[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
(find-fun
(if other-window #'find-file-other-window #'find-file)) )
(if (and possible-filename (file-exists-p possible-filename))
(apply find-fun (list possible-filename))
(progn
(forward-char 1)
(find-file-at-line) ))))
As you see, it relies on `thing-at-point' and
"filename".
However, with the lambasted systemd, files are
sometimes include an "@", as in
/lib/systemd/system/getty@.service
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 .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 64 Blogomatic articles -
- systemd @ in filenames not supported by thing-at-point,
Emanuel Berg <=