Subject: Re: bug#39349: browse-url-of-dired-file should respect directory symlinks

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 19 Jul 2020 21:48:36 +0200

積丹尼 Dan Jacobson <[email-masked]> writes:

> browse-url-of-dired-file should respect directory symlinks.
> E.g.,
> $ emacs -q
> C-x d /cf/updates/
> SPC SPC SPC
> M-x browse-url-of-dired-file
> should call the browser on
> file:///cf/updates/52.html
> not the absolute path
> file:///mnt/usb/cf/updates/52.html

So /cf is a symlink in your setup?

The reason for this behaviour is a patch from 2011 which attempted to
make this command work on the "." and ".." directories:

  (let ((tem (dired-get-filename t t)))
    (if tem
	(browse-url-of-file (expand-file-name tem))

So we want to call with (browse-url-of-file "/") instead of
(browse-url-of-file "/tmp/.."), for instance, and use expand-file-name
to achieve that.  However, that function also resolves any symlinks...

This function just needs to do the ../. thing.  Does Emacs have a
function that just does the right thing the ".." and "/" and does
absolutely nothing else?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no