[Top][All Lists]

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

systemd @ in filenames not supported by thing-at-point

From: Emanuel Berg
Subject: systemd @ in filenames not supported by thing-at-point
Date: Sat, 30 Jul 2016 03:31:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

I have this function to get to a file which is
a path in a buffer:

(defun find-file-at-line (&optional other-window)
  (interactive "P")
  (let ((possible-filename (thing-at-point 'filename t)) ; NO-PROPERTIES
         (if other-window #'find-file-other-window #'find-file)) )
    (if (and possible-filename (file-exists-p possible-filename))
          (apply find-fun (list possible-filename))
        (forward-char 1)
        (find-file-at-line) ))))

As you see, it relies on `thing-at-point' and

However, with the lambasted systemd, files are
sometimes include an "@", as in


I just now noticed that my function, or rather
`thing-at-point', breaks on such paths because
of this setting:

    (defvar thing-at-point-file-name-chars "-~/[:alnum:]_.${}#%,:"
      "Characters allowable in filenames.")

(line 241 in /usr/share/emacs/24.4/lisp/thingatpt.el.gz )

Because "@" isn't included, it is considered
a file name delimiter and the path returned is
incorrectly /lib/systemd/system/getty - with this:

    (setq thing-at-point-file-name-chars "@-~/[:alnum:]_.${}#%,:")

it works as expected.

But I don't know if that will break something else?

underground experts united ....
Emacs Gnus Blogomatic .........
                   - so far: 64 Blogomatic articles -                   

reply via email to

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