Received: (at submit) by debbugs.gnu.org; 2 Sep 2023 18:40:46 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 02 14:40:46 2023 Received: from localhost ([127.0.0.1]:38639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qcVY6-0001iU-36 for submit <at> debbugs.gnu.org; Sat, 02 Sep 2023 14:40:46 -0400 Received: from lists.gnu.org ([2001:470:142::17]:50966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1qcVY3-0001iC-Oa for submit <at> debbugs.gnu.org; Sat, 02 Sep 2023 14:40:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1qcVXo-000493-A4 for bug-gnu-emacs@HIDDEN; Sat, 02 Sep 2023 14:40:28 -0400 Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1qcVXl-0006Ej-Qe for bug-gnu-emacs@HIDDEN; Sat, 02 Sep 2023 14:40:28 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1qcVXh-0007yx-Ec for bug-gnu-emacs@HIDDEN; Sat, 02 Sep 2023 20:40:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@HIDDEN From: Howard Melman <hmelman@HIDDEN> Subject: Re: bug#63911: Dired Open With Date: Sat, 02 Sep 2023 14:40:13 -0400 Message-ID: <lypm30e7w2.fsf@HIDDEN> References: <86bkhuney2.fsf@HIDDEN> <868rca9map.fsf@HIDDEN> <CADwFkmnJdG9KP6JmDpMWNH1286k9-EA_zfgCHm8O7tArrvrW+Q@HIDDEN> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:ARHEW/Nw+BkIZ3asn/XtG90lj9c= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@HIDDEN; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Stefan Kangas writes: > Juri Linkov writes: > >> After using this for a while I noticed that most of the time >> mailcap suggestions are useless - they don't contain the same >> items as in the context menus of a File Ma [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 FORGED_GMAIL_RCVD 'From' gmail.com does not match 'Received' headers 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (hmelman[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.5 (/) Stefan Kangas <stefankangas@HIDDEN> writes: > Juri Linkov <juri@HIDDEN> writes: > >> After using this for a while I noticed that most of the time >> mailcap suggestions are useless - they don't contain the same >> items as in the context menus of a File Manager. For example, >> clicking the right mouse button on a ScreamTracker .stm file >> opens a menu with Rhythmbox, and clicking on a ScreamTracker3 >> .s3m file opens a menu where the first item is Celluloid >> and the second is Rhythmbox. >> >> So I implemented support for xdg commands that now displays exactly >> the same menus in Emacs as in the File Manager, and with the same order. > > Agreed, it's better to use the xdg commands for this. Will this work (or at least not break) on mac or windows or other non-xgd systems? -- Howard
bug-gnu-emacs@HIDDEN
:bug#63911
; Package emacs
.
Full text available.Received: (at 63911) by debbugs.gnu.org; 1 Sep 2023 22:34:00 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 01 18:34:00 2023 Received: from localhost ([127.0.0.1]:34398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qcCiG-00057X-2c for submit <at> debbugs.gnu.org; Fri, 01 Sep 2023 18:34:00 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:54501) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1qcCiE-00057I-Hq for 63911 <at> debbugs.gnu.org; Fri, 01 Sep 2023 18:33:59 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5009d4a4897so4511057e87.0 for <63911 <at> debbugs.gnu.org>; Fri, 01 Sep 2023 15:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693607621; x=1694212421; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yXhrO6e3aYNVazk6IfqG5+XXIcn1SXylCvzR2rhBmrc=; b=aMQyQUZp3AMyY/qY5otlOhPsKBlNCBwmuqIrMSSqYO3gm5bXy7k+rqhfkkhU3LHTia +RtqhdqHlad+MdKvbZ1aZh4oOZFqA6Q6cLMsngJ2PORKlZwQ23RuM9WOA0+xpuywWkq0 FmcvN4V95ietdpF9lq+rmsxI+leLkigZ2ku9vXOtf2exa4qpxbgEN++TdULrHGj730Rs iYFg6GxdVZA2HCoyVdTBw1hYQJ3D/GJs2SodUPyGu0Et7JQPf+TNxYaqltism7QB2mhl 2PQxKJHlHYjddHEzLkNhi0qZDwYhgkXeBUQ8LvvYhSks5ZgVvryZk1TubFYDU7Nh5p10 OH9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693607621; x=1694212421; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yXhrO6e3aYNVazk6IfqG5+XXIcn1SXylCvzR2rhBmrc=; b=kBqeL4s14tIiIsE6dOZmc4Sdo72gwtu2/lfgRXygKJgP55B55uL6385FweSEEDZDPD 8sNu4NHH00EONDoQ2HeGIyySVRUjGfP47rK+OgThGIS62XeIg6zv6uPuF64nnDmyN/2p ZCFJNfVjNLsTdLFac+dqf54/FeuHK9qIwGKmDPgjXccwWU5X9ZrgaR5D2YUmz1VYaKVc 9qXdmkdDnt8XX/Ms83KS/9yVmnd24TdaPvdq9xbJKgJrBP47X9IKg9Wr/0Q/cIVUfKam CqTHCteUgiXjNcWyOJ5RoKjkcERoQ3P8zxIMHH7jKVeEu4CdxpHEhnb2Xtib01mN9v6B +ASA== X-Gm-Message-State: AOJu0YylF0JjH61rcEhUPi03apF8Z0H+Enp+WpMA8sF+YtBLhRkrSY82 GlRxPw8NeEDcxnRDhpkKRF2SM/EaGx72quqdf/DdFhMLEHyq8g== X-Google-Smtp-Source: AGHT+IEZZDbNOXHbQx93gqacqRua+u1CvyvUbYnUWMmxFMpO1oODE/9o2YAjp/pz+5kkYYMEemBb2N+OY6OG9vwLGVc= X-Received: by 2002:a05:6512:3085:b0:4f8:ff52:93b7 with SMTP id z5-20020a056512308500b004f8ff5293b7mr3078229lfd.30.1693607620796; Fri, 01 Sep 2023 15:33:40 -0700 (PDT) MIME-Version: 1.0 References: <86bkhuney2.fsf@HIDDEN> <868rca9map.fsf@HIDDEN> In-Reply-To: <868rca9map.fsf@HIDDEN> From: Stefan Kangas <stefankangas@HIDDEN> Date: Sat, 2 Sep 2023 00:33:29 +0200 Message-ID: <CADwFkmnJdG9KP6JmDpMWNH1286k9-EA_zfgCHm8O7tArrvrW+Q@HIDDEN> Subject: Re: bug#63911: Dired Open With To: Juri Linkov <juri@HIDDEN> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 63911 Cc: 63911 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Juri Linkov <juri@HIDDEN> writes: > After using this for a while I noticed that most of the time > mailcap suggestions are useless - they don't contain the same > items as in the context menus of a File Manager. For example, > clicking the right mouse button on a ScreamTracker .stm file > opens a menu with Rhythmbox, and clicking on a ScreamTracker3 > .s3m file opens a menu where the first item is Celluloid > and the second is Rhythmbox. > > So I implemented support for xdg commands that now displays exactly > the same menus in Emacs as in the File Manager, and with the same order. Agreed, it's better to use the xdg commands for this. > This is not the final patch, maybe more customization needed > before pushing to master. I guess a NEWS item is in order, too.
bug-gnu-emacs@HIDDEN
:bug#63911
; Package emacs
.
Full text available.Received: (at 63911) by debbugs.gnu.org; 23 Jun 2023 16:59:42 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 23 12:59:41 2023 Received: from localhost ([127.0.0.1]:39487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qCk8L-0004KH-Gc for submit <at> debbugs.gnu.org; Fri, 23 Jun 2023 12:59:41 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:55573) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1qCk8J-0004Jz-K8 for 63911 <at> debbugs.gnu.org; Fri, 23 Jun 2023 12:59:40 -0400 X-GND-Sasl: juri@HIDDEN Received: by mail.gandi.net (Postfix) with ESMTPSA id E311C1C0008 for <63911 <at> debbugs.gnu.org>; Fri, 23 Jun 2023 16:59:32 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: 63911 <at> debbugs.gnu.org Subject: Re: bug#63911: Dired Open With In-Reply-To: <86bkhuney2.fsf@HIDDEN> (Juri Linkov's message of "Mon, 05 Jun 2023 19:07:49 +0300") Organization: LINKOV.NET References: <86bkhuney2.fsf@HIDDEN> Date: Fri, 23 Jun 2023 19:27:10 +0300 Message-ID: <868rca9map.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 63911 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain > As requested in bug#63875, here is a new context submenu "Open With" in Dired: > > + (require 'mailcap nil t) > + (let* ((filename (save-excursion > + (mouse-set-point click) > + (dired-get-filename nil t))) > + (commands (mailcap-file-default-commands (list filename))) After using this for a while I noticed that most of the time mailcap suggestions are useless - they don't contain the same items as in the context menus of a File Manager. For example, clicking the right mouse button on a ScreamTracker .stm file opens a menu with Rhythmbox, and clicking on a ScreamTracker3 .s3m file opens a menu where the first item is Celluloid and the second is Rhythmbox. So I implemented support for xdg commands that now displays exactly the same menus in Emacs as in the File Manager, and with the same order. This is not the final patch, maybe more customization needed before pushing to master. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=dired-context-menu-desktop-commands.patch diff --git a/lisp/dired.el b/lisp/dired.el index 914d0a0e783..7d5691df352 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2504,17 +2504,58 @@ dired-mode-operate-menu ["Delete Image Tag..." image-dired-delete-tag :help "Delete image tag from current or marked files"])) +(declare-function mailcap-file-default-commands "mailcap" (files)) +(declare-function xdg-mime-apps "xdg" (mime)) +(declare-function xdg-desktop-read-file "xdg" (filename &optional group)) + (defun dired-context-menu (menu click) "Populate MENU with Dired mode commands at CLICK." (when (mouse-posn-property (event-start click) 'dired-filename) (define-key menu [dired-separator] menu-bar-separator) - (let ((easy-menu (make-sparse-keymap "Immediate"))) + (require 'mailcap) + (require 'xdg) + (let* ((filename (save-excursion + (mouse-set-point click) + (dired-get-filename nil t))) + (mailcap-commands (mailcap-file-default-commands (list filename))) + (xdg-mime (when (executable-find "xdg-mime") + (string-trim-right + (shell-command-to-string + (concat "xdg-mime query filetype " filename))))) + (xdg-mime-apps (unless (string-empty-p xdg-mime) + (xdg-mime-apps xdg-mime))) + (desktop-commands + (mapcar (lambda (desktop) + (setq desktop (xdg-desktop-read-file desktop)) + (cons (gethash "Name" desktop) + (replace-regexp-in-string + " .*" "" (gethash "Exec" desktop)))) + xdg-mime-apps)) + (easy-menu (make-sparse-keymap "Immediate"))) (easy-menu-define nil easy-menu nil - '("Immediate" + `("Immediate" ["Find This File" dired-mouse-find-file :help "Edit file at mouse click"] ["Find in Other Window" dired-mouse-find-file-other-window - :help "Edit file at mouse click in other window"])) + :help "Edit file at mouse click in other window"] + ,@(when (or desktop-commands mailcap-commands) + (list (cons "Open With" + (append + (mapcar (lambda (desktop-command) + `[,(car desktop-command) + (lambda () + (interactive) + (dired-do-async-shell-command + ,(cdr desktop-command) nil + (list ,filename)))]) + desktop-commands) + (mapcar (lambda (mailcap-command) + `[,mailcap-command + (lambda () + (interactive) + (dired-do-async-shell-command + ,mailcap-command nil (list ,filename)))]) + mailcap-commands))))))) (dolist (item (reverse (lookup-key easy-menu [menu-bar immediate]))) (when (consp item) (define-key menu (vector (car item)) (cdr item)))))) --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#63911
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 5 Jun 2023 16:40:00 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 05 12:40:00 2023 Received: from localhost ([127.0.0.1]:50258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1q6DFQ-0004oV-GQ for submit <at> debbugs.gnu.org; Mon, 05 Jun 2023 12:40:00 -0400 Received: from lists.gnu.org ([209.51.188.17]:39816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1q6DFP-0004oM-2z for submit <at> debbugs.gnu.org; Mon, 05 Jun 2023 12:39:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1q6DFO-0004Tb-Sy for bug-gnu-emacs@HIDDEN; Mon, 05 Jun 2023 12:39:58 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1q6DFN-00043H-4P for bug-gnu-emacs@HIDDEN; Mon, 05 Jun 2023 12:39:58 -0400 X-GND-Sasl: juri@HIDDEN Received: by mail.gandi.net (Postfix) with ESMTPSA id ABE0E1BF207 for <bug-gnu-emacs@HIDDEN>; Mon, 5 Jun 2023 16:39:52 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: Dired Open With Organization: LINKOV.NET Date: Mon, 05 Jun 2023 19:07:49 +0300 Message-ID: <86bkhuney2.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.183.201; envelope-from=juri@HIDDEN; helo=relay8-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Tags: patch As requested in bug#63875, here is a new context submenu "Open With" in Dired: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=dired-open-with.patch diff --git a/lisp/dired.el b/lisp/dired.el index e70467ca53b..a295ece128d 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2504,17 +2504,33 @@ dired-mode-operate-menu ["Delete Image Tag..." image-dired-delete-tag :help "Delete image tag from current or marked files"])) +(declare-function mailcap-file-default-commands "mailcap" (files)) + (defun dired-context-menu (menu click) "Populate MENU with Dired mode commands at CLICK." (when (mouse-posn-property (event-start click) 'dired-filename) (define-key menu [dired-separator] menu-bar-separator) - (let ((easy-menu (make-sparse-keymap "Immediate"))) + (require 'mailcap nil t) + (let* ((filename (save-excursion + (mouse-set-point click) + (dired-get-filename nil t))) + (commands (mailcap-file-default-commands (list filename))) + (easy-menu (make-sparse-keymap "Immediate"))) (easy-menu-define nil easy-menu nil - '("Immediate" + `("Immediate" ["Find This File" dired-mouse-find-file :help "Edit file at mouse click"] ["Find in Other Window" dired-mouse-find-file-other-window - :help "Edit file at mouse click in other window"])) + :help "Edit file at mouse click in other window"] + ,@(when commands + (list (cons "Open With" + (mapcar (lambda (command) + `[,command + (lambda () + (interactive) + (dired-do-async-shell-command + ,command nil (list ,filename)))]) + commands)))))) (dolist (item (reverse (lookup-key easy-menu [menu-bar immediate]))) (when (consp item) (define-key menu (vector (car item)) (cdr item)))))) --=-=-=--
Juri Linkov <juri@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#63911
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.