GNU bug report logs - #19839
24.4; ffap does not detect file paths with curly braced shell variables

Previous Next

Package: emacs;

Reported by: Kaushal <kaushal.modi <at> gmail.com>

Date: Wed, 11 Feb 2015 19:25:01 UTC

Severity: minor

Found in version 24.4

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 19839 <at> debbugs.gnu.org (full text, mbox):

From: Kaushal <kaushal.modi <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>, 19839 <at> debbugs.gnu.org
Subject: Re: bug#19839: 24.4; ffap does not detect file paths with curly
 braced shell variables
Date: Tue, 07 Apr 2015 02:26:35 +0000
[Message part 1 (text/plain, inline)]
I was able to recreate this consistently in master branch.

You need to enable the ido ffap feature for this to work.

Also I noticed that no error is thrown any more (it probably changed 24.4
onwards) but ffap still does not work over paths with curly braces. My fix
fixes that.


* Copy the below content to *scratch* buffer on an emacs -Q session and
follow the steps. *

;; STEP 1: Enable ido ffap

(require 'ido)
(setq ido-use-filename-at-point 'guess)
(ido-mode 1)

;; STEP 2: Test that when you put the point over the below link and do `M-x
ido-find-file', it does not try to open that particular file
;; ${HOME}/.emacs.d/init.el
;; Change the above link to ${HOME}/.emacs or the where you save your emacs
config file for the sake of this example

It did not work because the following call order returns nil by default
(before the below fix in STEP 3)

ido-find-file > ido-file-internal > ffap-guesser > ffap-file-at-point >
ffap-string-at-point

;; STEP 3:
;; Patch `ffap-string-at-point-mode-alist' to support file paths with curly
braces:
(require 'ffap)
;; Delete from `ffap-string-at-point-mode-alist' all elements whose `car'
is `file'
(setq ffap-string-at-point-mode-alist
      (assq-delete-all 'file ffap-string-at-point-mode-alist))
;; and then add a new list `(file ..)' that supports the curly braces.
(add-to-list 'ffap-string-at-point-mode-alist
             '(file "--:\\\\$\\{\\}+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:"))

;; STEP 4: Repeat STEP 2. Now when you do `M-x ido-find-file` over that
path, emacs will try to open the file in that path (it auto expands the
environment variable $HOME)


Let me know if you also can repeat these steps.


On Mon, Apr 6, 2015 at 8:00 PM Dmitry Gutov <dgutov <at> yandex.ru> wrote:

> On 04/07/2015 02:53 AM, Dmitry Gutov wrote:
>
>  > I don't see any errors doing `M-x ffap' or `C-x C-f', it just doesn't
> > find anything.
>
> ...in Emacs built from the master branch (forgot to mention that).
>
[Message part 2 (text/html, inline)]

This bug report was last modified 10 years and 46 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.