emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 3/3] lisp/mpc.el (mpc--proc-connect): use file-name-absolute-


From: Mark Oteiza
Subject: Re: [PATCH 3/3] lisp/mpc.el (mpc--proc-connect): use file-name-absolute-p
Date: Mon, 7 Sep 2015 21:57:48 -0400
User-agent: Mutt/1.5.24+9 (2dac9fa02842) (2015-08-30)

On 07/09/15 at 09:16pm, Stefan Monnier wrote:
> > -    (when (string-prefix-p "/" host)    ;FIXME: Use file-name-absolute-p?
> > +    (when (file-name-absolute-p host)
> > +      ;; Expand file name because `file-name-absolute-p'
> > +      ;; considers paths beginning with "~" as absolute
> > +      (setq host (expand-file-name host))
> 
> So do you think using file-name-absolute-p is better?
> I left it as a FIXME, because I simply didn't know the answer.

The only reasons I imagine it's better is because of readability and
file_name_absolute_p has platform specifics. The latter reason is likely
a silly one, regarding w32.

> If you set $MPD_HOST to "~/.mpdsocket" do other MPD clients handle
> it correctly?

No, which is why I initially just did string-prefix-p. However, normally
when one sets MPD_HOST in, for instance, a shell config e.g.

  export MPD_HOST=~/.mpdsocket

the shell does the expansion of the ~ for us.  No mpd client I know of
(I've only tried mpc(1) and ncmpcpp) does tilde expansion.  What the
change is good for is letting someone set the defcustom mpc-host to the
string "~/.mpdsocket" and it working, because Emacs is doing the tilde
expansion.

I think that file-name-absolute-p treating paths beginning with ~ as
absolute is a little weird because it isn't really an absolute path, at
least not until the tilde (or ~user/) is expanded into the path it
represents.  I figured I'd work with it, though.

> What about under w32?

I don't even know what the analog to UNIX domain sockets is on windows,
if there is one.



reply via email to

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