unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* find-grep-dired vs. browse-url-of-dired-file
@ 2004-12-09 21:07 Dan Jacobson
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Jacobson @ 2004-12-09 21:07 UTC (permalink / raw)


browse-url-of-dired-file doesn't work in find-grep-dired result buffers.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: find-grep-dired vs. browse-url-of-dired-file
       [not found] <mailman.4836.1102632722.27204.bug-gnu-emacs@gnu.org>
@ 2004-12-10 17:43 ` Kevin Rodgers
       [not found] ` <mailman.5025.1102701222.27204.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2004-12-10 17:43 UTC (permalink / raw)


Dan Jacobson wrote:
 > browse-url-of-dired-file doesn't work in find-grep-dired result buffers.

Could you possibly be more vague?

The only problem I see is when the find-grep-dired result buffer lists
matches relative to my home directory.  Then dired-get-filename returns
a string like "~/MB3STAGE/com/ihs/metabase/XHTML.html", which
browse-url-of-dired-file passes to browse-url-of-file; which in turn
calls browse-url-file-url to map the file name to a URL before calling
browse-url.  browse-url-file-url depends on browse-url-filename-alist to
prepend "file:" to an absolute file name, but in this case the file name
doesn't begin with a slash.  All that's needed to fix that is for
browse-url-of-file to call expand-file-name first:

*** emacs-21.3/lisp/net/browse-url.el~	Wed Dec  4 05:38:27 2002
--- emacs-21.3/lisp/net/browse-url.el	Fri Dec 10 10:38:04 2004
***************
*** 535,541 ****
   `browse-url-file-url'.  Pass the URL to a browser using the
   `browse-url' function then run `browse-url-of-file-hook'."
     (interactive)
!   (or file
         (setq file (buffer-file-name))
         (error "Current buffer has no file"))
     (let ((buf (get-file-buffer file)))
--- 535,542 ----
   `browse-url-file-url'.  Pass the URL to a browser using the
   `browse-url' function then run `browse-url-of-file-hook'."
     (interactive)
!   (or (and file
!            (setq file (expand-file-name file)))
         (setq file (buffer-file-name))
         (error "Current buffer has no file"))
     (let ((buf (get-file-buffer file)))

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: find-grep-dired vs. browse-url-of-dired-file
       [not found] ` <mailman.5025.1102701222.27204.bug-gnu-emacs@gnu.org>
@ 2004-12-10 17:59   ` Kevin Rodgers
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2004-12-10 17:59 UTC (permalink / raw)


Kevin Rodgers wrote:
 > doesn't begin with a slash.  All that's needed to fix that is for
 > browse-url-of-file to call expand-file-name first:
 >
 > *** emacs-21.3/lisp/net/browse-url.el~    Wed Dec  4 05:38:27 2002
 > --- emacs-21.3/lisp/net/browse-url.el    Fri Dec 10 10:38:04 2004
 > ***************
 > *** 535,541 ****
 >   `browse-url-file-url'.  Pass the URL to a browser using the
 >   `browse-url' function then run `browse-url-of-file-hook'."
 >     (interactive)
 > !   (or file
 >         (setq file (buffer-file-name))
 >         (error "Current buffer has no file"))
 >     (let ((buf (get-file-buffer file)))
 > --- 535,542 ----
 >   `browse-url-file-url'.  Pass the URL to a browser using the
 >   `browse-url' function then run `browse-url-of-file-hook'."
 >     (interactive)
 > !   (or (and file
 > !            (setq file (expand-file-name file)))
 >         (setq file (buffer-file-name))
 >         (error "Current buffer has no file"))
 >     (let ((buf (get-file-buffer file)))

Actually, I think it'd be clearer to write that conditional as:

   (cond (file (setq file (expand-file-name file)))
         ((setq file (buffer-file-name)))
         (t (error "Current buffer has no file")))

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-10 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-09 21:07 find-grep-dired vs. browse-url-of-dired-file Dan Jacobson
     [not found] <mailman.4836.1102632722.27204.bug-gnu-emacs@gnu.org>
2004-12-10 17:43 ` Kevin Rodgers
     [not found] ` <mailman.5025.1102701222.27204.bug-gnu-emacs@gnu.org>
2004-12-10 17:59   ` Kevin Rodgers

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).