all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kaushal <kaushal.modi@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>, 19839@debbugs.gnu.org
Subject: bug#19839: 24.4; ffap does not detect file paths with curly braced shell variables
Date: Tue, 07 Apr 2015 02:26:35 +0000	[thread overview]
Message-ID: <CAFyQvY2if4Y4XJ6rK16Ehhr36g+qcbgHHd6aGUOpT33wmyap4w@mail.gmail.com> (raw)
In-Reply-To: <55231E12.5050303@yandex.ru>

[-- Attachment #1: Type: text/plain, Size: 1952 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3018 bytes --]

  reply	other threads:[~2015-04-07  2:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11 19:23 bug#19839: 24.4; ffap does not detect file paths with curly braced shell variables Kaushal
2015-04-06 19:13 ` Kaushal
2015-04-06 23:53 ` Dmitry Gutov
2015-04-07  0:00   ` Dmitry Gutov
2015-04-07  2:26     ` Kaushal [this message]
2015-04-08  0:22       ` Dmitry Gutov

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

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

  git send-email \
    --in-reply-to=CAFyQvY2if4Y4XJ6rK16Ehhr36g+qcbgHHd6aGUOpT33wmyap4w@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=19839@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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 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.