* 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; 10+ 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] 10+ messages in thread
* RE: systemd @ in filenames not supported by thing-at-point
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
0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2016-07-30 5:42 UTC (permalink / raw)
To: Emanuel Berg, emacs-devel
Please don't cross-post to emacs-devel and help-gnu-emacs.
Pick one. (In this case, the latter might be better.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: systemd @ in filenames not supported by thing-at-point
2016-07-30 5:42 ` Drew Adams
@ 2016-07-30 6:02 ` Emanuel Berg
2016-07-30 6:47 ` Drew Adams
0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2016-07-30 6:02 UTC (permalink / raw)
To: emacs-devel
Drew Adams wrote:
> Please don't cross-post to emacs-devel and
> help-gnu-emacs. Pick one. (In this case, the
> latter might be better.)
Phew! Because when you said "pick one", for
a moment I thought *I* was supposed to make
the pick!
And why isn't this a devel issue?
/usr/share/emacs/24.4/lisp/thingatpt.el.gz
(line 6)
;; Maintainer: emacs-devel@gnu.org
with `thing-at-point' and 'filename not
getting, for example
$ cd /lib/systemd/system
$ ls | grep @
autovt@.service
container-getty@.service
getty@.service
ifup@.service
saned@.service
serial-getty@.service
ssh@.service
systemd-backlight@.service
systemd-fsck@.service
systemd-nspawn@.service
systemd-rfkill@.service
usb_modeswitch@.service
user@.service
?
--
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] 10+ messages in thread
* RE: systemd @ in filenames not supported by thing-at-point
2016-07-30 6:02 ` Emanuel Berg
@ 2016-07-30 6:47 ` Drew Adams
2016-07-30 7:22 ` Emanuel Berg
0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2016-07-30 6:47 UTC (permalink / raw)
To: Emanuel Berg, emacs-devel
> > Please don't cross-post to emacs-devel and
> > help-gnu-emacs. Pick one. (In this case, the
> > latter might be better.)
>
> Phew! Because when you said "pick one", for
> a moment I thought *I* was supposed to make
> the pick!
You are. You judge which list you think is more
appropriate - for you and for others. Which list would
help you more? Which would help other users or Emacs
developers more?
> And why isn't this a devel issue?
Maybe it is. If you think it is, then post to emacs-devel.
From my understanding of your question, I thought (think)
it is better suited for help-gnu-emacs. But it is up to you
which you choose. My only request was not to cross-post the
question.
Is it a how-do-I-do-this question or a question about Emacs
development?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: systemd @ in filenames not supported by thing-at-point
2016-07-30 6:47 ` Drew Adams
@ 2016-07-30 7:22 ` Emanuel Berg
2016-07-30 14:45 ` Drew Adams
0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2016-07-30 7:22 UTC (permalink / raw)
To: emacs-devel
Drew Adams wrote:
> Is it a how-do-I-do-this question or
> a question about Emacs development?
Is it life in general, or computers, that
are binary?
--
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] 10+ messages in thread
* RE: systemd @ in filenames not supported by thing-at-point
2016-07-30 7:22 ` Emanuel Berg
@ 2016-07-30 14:45 ` Drew Adams
2016-07-30 15:33 ` Emanuel Berg
0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2016-07-30 14:45 UTC (permalink / raw)
To: Emanuel Berg, emacs-devel
> > Is it a how-do-I-do-this question or
> > a question about Emacs development?
>
> Is it life in general, or computers, that are binary?
If you are not strictly just-black-or-white-with-no-gray you
will understand that summary question, especially following
the more detailed explanation, as really asking:
"Is it MORE a how-do-I-do-this question or MORE a question
about Emacs development?"
It's a judgment call, and yes, it's your call - you choose.
You might sometimes have difficulty deciding - things are
not always only black-or-white, but please make a choice,
as opposed to cross-posting.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: systemd @ in filenames not supported by thing-at-point
2016-07-30 14:45 ` Drew Adams
@ 2016-07-30 15:33 ` Emanuel Berg
2016-07-30 16:19 ` Clément Pit--Claudel
0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2016-07-30 15:33 UTC (permalink / raw)
To: emacs-devel
Drew Adams wrote:
> If you are not strictly
> just-black-or-white-with-no-gray you will
> understand that summary question, especially
> following the more detailed explanation, as
> really asking:
>
> "Is it MORE a how-do-I-do-this question or
> MORE a question about Emacs development?"
>
> It's a judgment call, and yes, it's your call
> - you choose. You might sometimes have
> difficulty deciding - things are not always
> only black-or-white, but please make
> a choice, as opposed to cross-posting.
Yes:
https://www.youtube.com/watch?v=UrDV6VksSRU
--
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] 10+ messages in thread
* Re: systemd @ in filenames not supported by thing-at-point
2016-07-30 15:33 ` Emanuel Berg
@ 2016-07-30 16:19 ` Clément Pit--Claudel
2016-07-31 0:23 ` Emanuel Berg
0 siblings, 1 reply; 10+ messages in thread
From: Clément Pit--Claudel @ 2016-07-30 16:19 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 426 bytes --]
On 2016-07-30 11:33, Emanuel Berg wrote:
> https://www.youtube.com/watch?v=UrDV6VksSRU
I have no idea what this is about, or what it has to do with Emacs. In any case, the original issue sounds like a bug to me, and you seem to have a reasonable-looking fix for it. Can you prepare a patch and send it with M-x report-emacs-bug? That would be very useful; we could probably discuss that fix there.
Cheers,
Clément.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: systemd @ in filenames not supported by thing-at-point
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
0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2016-07-31 0:23 UTC (permalink / raw)
To: emacs-devel
Clément Pit--Claudel wrote:
> I have no idea what this is about, or what it
> has to do with Emacs. In any case, the
> original issue sounds like a bug to me, and
> you seem to have a reasonable-looking fix for
> it. Can you prepare a patch and send it with
> M-x report-emacs-bug? That would be very
> useful; we could probably discuss that
> fix there.
By "preparing a patch", do you mean there is
some formal way of doing that? If so, I am not
familiar with that. (I know of
`report-emacs-bug', of course.)
But the patch would amount to adding an @ to
(defvar thing-at-point-file-name-chars "-~/[:alnum:]_.${}#%,:"
"Characters allowable in filenames.")
which is at line 242,
/usr/share/emacs/24.4/lisp/thingatpt.el.gz
However, in my initial post I added the @
*first* which I have since learned on
gnu.emacs.help turns the original, initial dash
into an interval (when it doesn't appear first
anymore), i.e., all of [@, ~] in math notation
are included which wasn't the intention,
for sure!
So better put the @ after the initial dash so
the dash will stay a char an nothing else, with
@ and only @ included as well.
--
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] 10+ messages in thread
* Re: systemd @ in filenames not supported by thing-at-point
2016-07-31 0:23 ` Emanuel Berg
@ 2016-07-31 1:00 ` Clément Pit--Claudel
0 siblings, 0 replies; 10+ messages in thread
From: Clément Pit--Claudel @ 2016-07-31 1:00 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 1982 bytes --]
On 2016-07-30 20:23, Emanuel Berg wrote:
> Clément Pit--Claudel wrote:
>
>> I have no idea what this is about, or what it
>> has to do with Emacs. In any case, the
>> original issue sounds like a bug to me, and
>> you seem to have a reasonable-looking fix for
>> it. Can you prepare a patch and send it with
>> M-x report-emacs-bug? That would be very
>> useful; we could probably discuss that
>> fix there.
>
> By "preparing a patch", do you mean there is
> some formal way of doing that? If so, I am not
> familiar with that. (I know of
> `report-emacs-bug', of course.)
:) It's very easy. You checkout the Emacs source tree with git, then make your change, commit it with a message in Changelog format), test it, and finally use `git-format-patch HEAD~1` to save it as a .patch file. Then you can post it as an attachment to a report-emacs-bug email summarizing the issue and the proposed fix.
As a small bonus, this process ensures that you're credited for finding and fixing the issue in the Emacs history, which is nice :); also, it makes it easy for people to test the proposed fix (although, arguably, it's already easy in this case).
In general, you need to sign a contributor agreement to send patches to Emacs; this particular fix however counts as a "trivial" fix, and thus is exempted from this. But if you haven't yet done so, signing the CLA is very easy, and will make it smoother to contribute more significant patches in the future :)
> However, in my initial post I added the @
> *first* which I have since learned on
> gnu.emacs.help turns the original, initial dash
> into an interval (when it doesn't appear first
> anymore), i.e., all of [@, ~] in math notation
> are included which wasn't the intention,
> for sure!
That's right; nice catch. I'd suggest sending the patch to bug-gnu-emacs, and seeing if people have other similar insight.
Cheers and thanks for catching this issue and proposing a fix!
Clément.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-07-31 1:00 UTC | newest]
Thread overview: 10+ 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
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).