unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* xref symlink indigestion
@ 2017-01-02 20:48 James K. Lowden
  2017-01-02 21:20 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: James K. Lowden @ 2017-01-02 20:48 UTC (permalink / raw)
  To: help-gnu-emacs

With 25.1 installed, I'm happily using xref.  I noticed something
slightly odd, and wonder what might be done for it.  

On my system $HOME/projects is a symbolic link:

$ file ~/projects
/home/jklowden/projects: symbolic link to /usr/local/projects/

I rely exclusively on the symbolic link, and start emacs as a daemon
there.  At the moment I have two daemons running (under different
names) for two different projects.  When I use M-x pwd in the
*Messages* buffer, it reports the symlink path: 

	Directory /home/jklowden/projects/csv2bin/

When I use xref-find-definitions to load a file, though, it loads it via
the non-symbolic path.  If I open the file per usual (in the project
directory, via the symlink) and then use xref-find-definitions, I see a
message like 

	/usr/local/projects/csv2bin/mapcols.h and 
	/home/jklowden/projects/csv2bin/mapcols.h 
	are the same file

which indeed they are.  

Why is xref insisting on using the non-symbolic path?  The TAGS file
doesn't mention it.  The daemon's current working directory is on the
symbolic path.  Files opened with emacsclient on the symbolic path
behave normally (i.e., their names reflect the symbolic path).  

I suspect something somewhere is gratuitously calling realpath(3),
doubtless with good intentions.  I'd like to understand why, and see if
there's a better way.  

--jkl



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

* Re: xref symlink indigestion
  2017-01-02 20:48 xref symlink indigestion James K. Lowden
@ 2017-01-02 21:20 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2017-01-02 21:20 UTC (permalink / raw)
  To: help-gnu-emacs

> I suspect something somewhere is gratuitously calling realpath(3),
> doubtless with good intentions.  I'd like to understand why, and see if
> there's a better way.  

Emacs calls the equivalent of `realpath` (aka `file-truename`) very
frequently, indeed.

Maybe there's simply a bug in Emacs, but maybe you could try to set
directory-abbrev-alist so that canonicalization of file names uses the
symlink name rather than its target.  Something like:

    (setq directory-abbrev-alist
          (("/usr/local/projects/" . "/home/jklowden/projects")))

But it seems that maybe the bug is simply that *Messages* should not use
/home/jklowden/projects/csv2bin/ but /usr/local/projects/csv2bin/ (at
least unless/until you set directory-abbrev-alist as above).


        Stefan




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

end of thread, other threads:[~2017-01-02 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-02 20:48 xref symlink indigestion James K. Lowden
2017-01-02 21:20 ` Stefan Monnier

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