From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <55231C6A.50101@yandex.ru> <55231E12.5050303@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bacc4bad6a48a051319245b X-Trace: ger.gmane.org 1428373641 17116 80.91.229.3 (7 Apr 2015 02:27:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Apr 2015 02:27:21 +0000 (UTC) To: Dmitry Gutov , 19839@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 07 04:27:12 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YfJEM-0001jz-Th for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Apr 2015 04:27:11 +0200 Original-Received: from localhost ([::1]:42718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfJEM-0002dL-9L for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 Apr 2015 22:27:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfJEH-0002d8-W6 for bug-gnu-emacs@gnu.org; Mon, 06 Apr 2015 22:27:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YfJEE-0006Tn-PA for bug-gnu-emacs@gnu.org; Mon, 06 Apr 2015 22:27:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfJEE-0006Tf-MQ for bug-gnu-emacs@gnu.org; Mon, 06 Apr 2015 22:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YfJEE-0000He-A3 for bug-gnu-emacs@gnu.org; Mon, 06 Apr 2015 22:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Apr 2015 02:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19839 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19839-submit@debbugs.gnu.org id=B19839.14283736051065 (code B ref 19839); Tue, 07 Apr 2015 02:27:02 +0000 Original-Received: (at 19839) by debbugs.gnu.org; 7 Apr 2015 02:26:45 +0000 Original-Received: from localhost ([127.0.0.1]:46725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YfJDw-0000H6-LT for submit@debbugs.gnu.org; Mon, 06 Apr 2015 22:26:45 -0400 Original-Received: from mail-ig0-f179.google.com ([209.85.213.179]:38715) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YfJDu-0000Gt-8e for 19839@debbugs.gnu.org; Mon, 06 Apr 2015 22:26:43 -0400 Original-Received: by igbqf9 with SMTP id qf9so966257igb.1 for <19839@debbugs.gnu.org>; Mon, 06 Apr 2015 19:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-type; bh=fh0DrtSPt4CYRDTyfwTIK1P+LuUbYj26Wc69UEJNos8=; b=D8oNb4Psv7gqQsmPtwAfpwmCdQoWoPmnwvNk+oRbcW6TEhJVbE0qaBiD5EAp/JlqaC 9gA4zz5dg+VG7mo13lC/mJ09r8hT80W4Qpilkv1eTeBUxZO7faXsMAhfcjenD77U7G4c YaDYYrK+jbWZioBCJDNbeLHTUu0ta9sX2gl1A2NOKc5ksxoZswv+X3eNRvh5owhO9n11 YHbZUO57qdLa+dAZHgKHQDqwuRPMNpd4lfdkq3rRQ9x708hKUA1szheClw3EZHow400l WQvjwkzXnWz4KkTEiI34Xn7t6Weo3Me9SAZf3EmU9noEQ5a+v0zwfYOt0bUmxWG81jzT Xlug== X-Received: by 10.42.238.140 with SMTP id ks12mr15450035icb.12.1428373596706; Mon, 06 Apr 2015 19:26:36 -0700 (PDT) In-Reply-To: <55231E12.5050303@yandex.ru> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:101241 Archived-At: --047d7bacc4bad6a48a051319245b Content-Type: text/plain; charset=KOI8-R 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 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). > --047d7bacc4bad6a48a051319245b Content-Type: text/html; charset=KOI8-R Content-Transfer-Encoding: quoted-printable
I was able to recreate this consistently in master branch.=

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

<= /div>
Also I noticed that no error is thrown any more (it probably chan= ged 24.4 onwards) but ffap still does not work over paths with curly braces= . My fix fixes that.


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

;; STEP 1: Enable ido ffap

<= div>(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 d= oes 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 co= nfig file for the sake of this example

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

ido-find-file > ido-f= ile-internal > ffap-guesser > ffap-file-at-point > ffap-string-at-= point

;; STEP 3:=9A
;; Patch `ffap-strin= g-at-point-mode-alist' to support file paths with curly braces:
(requ= ire 'ffap)
;; Delete from `ffap-string-at-point-mo= de-alist' all elements whose `car' is `file'
(setq ff= ap-string-at-point-mode-alist
=9A =9A =9A (assq-delete-all 'f= ile 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
=9A =9A =9A =9A =9A =9A =9A'= (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 $HO= ME)


Let me know if you also can rep= eat these steps. =9A


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:

=9A> I don't see any errors doing `M-x ffap' or `C-x C-f', i= t just doesn't
> find anything.

...in Emacs built from the master branch (forgot to mention that).
--047d7bacc4bad6a48a051319245b--