bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#26190: 25.1; ffap problem with curly braces


From: Lars Ingebrigtsen
Subject: bug#26190: 25.1; ffap problem with curly braces
Date: Fri, 26 Jul 2019 13:26:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

wyousef@fcih.net writes:

> In scratch buffer with cursor on {/etc} do M-: (ffap-guesser) RET
>
> With emacs-25 => nil
> With emacs-24.5 => "/etc"

The regression occurred with this commit:

commit ba6c32b6decaa2a72a3d5f854efd513e8e82c118
Author: Dmitry Gutov <dgutov@yandex.ru>
Date:   Wed Apr 8 03:18:38 2015 +0300

    ffap: Support environment variable expansion in file names
    
    Fixes: debbugs:19839
    
    * lisp/ffap.el (ffap-string-at-point-mode-alist): Support
    environment variable expansion in file names.

diff --git a/lisp/ffap.el b/lisp/ffap.el
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1007,1 +1007,1 @@
-    (file "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
+    (file "--:\\\\$\\{\\}+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")

Which is slightly confusing since \\{ and \\} are number repetition
things while {} are literal braces, but I guess Emacs will interpret
them the same way here when they can't be repetition arguments in this
form.

So this means that the braces are now part of the file name, and since
"{/etc}" doesn't exist, you get nil.

This was intended to make ffap work better with files that have curly
braces in the file names.  I guess "{/etc}" could be a valid file name?
But it's an odd one, and I'd guess that it would more commonly refer to
/etc.  So I think the right thing here is to revert this patch and just
accept that we can't guess right on file names with weird characters in
them.

Opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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