emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-29 additional key binding suggestions


From: Robert Pluim
Subject: Re: emacs-29 additional key binding suggestions
Date: Tue, 25 Apr 2023 17:19:47 +0200

>>>>> On Mon, 24 Apr 2023 18:57:28 +0530, Visuwesh <visuweshm@gmail.com> said:

    Visuwesh> AFAIK, C-u to mean to use the secondary browser is a fairly common
    Visuwesh> pattern.  See browse-url-button-open and 
browse-url-button-open-url as
    Visuwesh> well.

This works for me.

commit 43f96d990a4
Author:     Robert Pluim <rpluim@gmail.com>
AuthorDate: Tue Apr 25 12:28:47 2023 +0200
Commit:     Robert Pluim <rpluim@gmail.com>
CommitDate: Tue Apr 25 17:17:36 2023 +0200

    Allow dired to invoke secondary browser
    
    'browse-url-of-dired-file' always invokes the primary browser, but
    sometimes it's handy to call a different browser, which is why
    'browse-url-secondary-browser-function' exists.
    
    * lisp/net/browse-url.el (browse-url-of-dired-file): Call
    'browse-url-secondary-browser-function' when invoked with a prefix
    argument.
    * etc/NEWS: Announce the change.

diff --git a/etc/NEWS b/etc/NEWS
index 80ff535dba6..bcca31edb0d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1669,6 +1669,13 @@ the following to your Init file:
 *** New command 'dired-do-eww'.
 This command visits the file on the current line with EWW.
 
+---
+*** 'browse-url-of-dired-file' can now call the secondary browser.
+When invoked with a non-nil prefix arg, this will now call
+'browse-url-secondary-browser-function' instead of the default
+browser.  'browse-url-of-dired-file' is bound to 'W' by default in
+dired mode.
+
 ---
 *** New user option 'dired-omit-lines'.
 This is used by 'dired-omit-mode', and now allows you to hide based on
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 0177d12f236..39513b8f602 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -825,10 +825,17 @@ browse-url-delete-temp-file
                  (&optional localp no-error-if-not-filep))
 
 ;;;###autoload
-(defun browse-url-of-dired-file ()
-  "In Dired, ask a WWW browser to display the file named on this line."
-  (interactive)
+(defun browse-url-of-dired-file (&optional secondary)
+  "In Dired, ask a WWW browser to display the file named on this line.
+With prefix arg, use the secondary browser instead (e.g. EWW if
+`browse-url-secondary-browser-function' is set to
+`eww-browse-url'."
+  (interactive "P")
   (let ((tem (dired-get-filename t t))
+        (browse-url-browser-function
+         (if secondary
+             browse-url-secondary-browser-function
+           browse-url-browser-function))
         ;; Some URL handlers open files in Emacs.  We want to always
         ;; open in a browser, so disable those.
         (browse-url-default-handlers nil))

Robert
-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]