unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: emacs-devel@gnu.org
Subject: systemd @ in filenames not supported by thing-at-point
Date: Sat, 30 Jul 2016 03:35:10 +0200	[thread overview]
Message-ID: <867fc3zz5d.fsf@student.uu.se> (raw)

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 -                   




             reply	other threads:[~2016-07-30  1:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-30  1:35 Emanuel Berg [this message]
2016-07-30  5:42 ` systemd @ in filenames not supported by thing-at-point 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=867fc3zz5d.fsf@student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

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