all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* systemd @ in filenames not supported by thing-at-point
@ 2016-07-30  1:35 Emanuel Berg
  2016-07-30  5:42 ` Drew Adams
  0 siblings, 1 reply; 18+ messages in thread
From: Emanuel Berg @ 2016-07-30  1:35 UTC (permalink / raw)
  To: emacs-devel

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 -                   




^ permalink raw reply	[flat|nested] 18+ messages in thread
* systemd @ in filenames not supported by thing-at-point
@ 2016-07-30  1:31 Emanuel Berg
  2016-07-30  5:41 ` Drew Adams
  2016-07-30  6:48 ` Yuri Khan
  0 siblings, 2 replies; 18+ messages in thread
From: Emanuel Berg @ 2016-07-30  1:31 UTC (permalink / raw)
  To: help-gnu-emacs

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 -                   


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

end of thread, other threads:[~2016-07-31  1:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-30  1:35 systemd @ in filenames not supported by thing-at-point Emanuel Berg
2016-07-30  5:42 ` Drew Adams
2016-07-30  6:02   ` Emanuel Berg
2016-07-30  6:47     ` Drew Adams
2016-07-30  7:22       ` Emanuel Berg
2016-07-30 14:45         ` Drew Adams
2016-07-30 15:33           ` Emanuel Berg
2016-07-30 16:19             ` Clément Pit--Claudel
2016-07-31  0:23               ` Emanuel Berg
2016-07-31  1:00                 ` Clément Pit--Claudel
  -- strict thread matches above, loose matches on Subject: below --
2016-07-30  1:31 Emanuel Berg
2016-07-30  5:41 ` Drew Adams
2016-07-30  6:07   ` Emanuel Berg
2016-07-30  6:43     ` Drew Adams
2016-07-30 17:29   ` Stefan Monnier
2016-07-30 18:01     ` Emanuel Berg
2016-07-30  6:48 ` Yuri Khan
2016-07-30  7:58   ` Emanuel Berg

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.