unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Visuwesh <visuweshm@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
Subject: Re: emacs-29 additional key binding suggestions
Date: Tue, 25 Apr 2023 17:19:47 +0200	[thread overview]
Message-ID: <87v8hk7zvw.fsf@gmail.com> (raw)
In-Reply-To: <878rehmmv3.fsf@gmail.com> (Visuwesh's message of "Mon, 24 Apr 2023 18:57:28 +0530")

>>>>> 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	other threads:[~2023-04-25 15:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 14:15 emacs-29 additional key binding suggestions Robert Pluim
2023-04-18 15:20 ` [External] : " Drew Adams
2023-04-20  8:21 ` Eli Zaretskii
2023-04-20  9:41   ` Robert Pluim
2023-04-20 11:34     ` Eli Zaretskii
2023-05-29 12:47       ` Robert Pluim
2023-04-20 16:06   ` Visuwesh
2023-04-20 17:55     ` Robert Pluim
2023-04-21  4:18       ` Visuwesh
2023-04-24  7:26         ` Robert Pluim
2023-04-24 11:07           ` Eli Zaretskii
2023-04-24 11:23             ` Robert Pluim
2023-04-24 12:06               ` Eli Zaretskii
2023-04-24 12:43                 ` Robert Pluim
2023-04-24 13:06                   ` Eli Zaretskii
2023-04-24 13:27                 ` Visuwesh
2023-04-25 15:19                   ` Robert Pluim [this message]
2023-04-25 15:23                     ` Eli Zaretskii
2023-04-25 15:27                       ` Robert Pluim
2023-05-29 12:54                         ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8hk7zvw.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=visuweshm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).