GNU bug report logs - #7229
23.1; ido guess and ffap bug

Previous Next

Package: emacs;

Reported by: "Thibault Kruse" <thibault.kruse <at> gmx.de>

Date: Sat, 16 Oct 2010 20:52:02 UTC

Severity: minor

Tags: fixed, patch

Merged with 8990, 24057

Found in versions 23.1, 23.3, 25.1.50

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7229 in the body.
You can then email your comments to 7229 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Sat, 16 Oct 2010 20:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Thibault Kruse" <thibault.kruse <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 16 Oct 2010 20:52:02 GMT) Full text and rfc822 format available.

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

From: "Thibault Kruse" <thibault.kruse <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; ido guess and ffap bug
Date: Sat, 16 Oct 2010 22:08:28 +0200
Hi, the ffap function of ido mode in emacs makes bad guesses after javadoc-style comments:
/**
and xml node ends
<test />

to reproduce:
emacs -q --no-site-file
M-x ido-mode
M-x customize-option ido-use-filename-at-point
Choose guess, set for current session
open *scratch* buffer

enter /**
cursor at the end of that line
M-x ido-find-file (or C-x f): ido suggests /**, instead of pwd
enter <test />
cursor at the end of that line
M-x ido-find-file (or C-x f): ido suggests /, instead of pwd

same for M-x ffap



In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
 of 2010-03-29 on rothera, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x <up> <up> M-x c u s <tab> - o <tab> <return> <up> 
i d o <tab> <backspace> <backspace> <backspace> <backspace> 
u <tab> <tab> <backspace> <tab> <tab> <tab> <backspace> 
<backspace> <backspace> <backspace> C-g M-x <up> <return> 
i d o - u s <tab> <tab> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> C-g M-x i d o <tab> 
m o <tab> <return> M-x <up> <up> <return> i d o <tab> 
u <tab> s <tab> f i <tab> <return> C-x b s c r <return> 
/ * * C-x C-f C-g M-x i d <tab> o <tab> m o <tab> <return> 
x M-x <up> <return> M-x <up> <up> <return> <up> <return> 
<help-echo> <down-mouse-1> <help-echo> <help-echo> 
<down-mouse-1> C-x b <return> <backspace> C-x C-f C-g 
M-x i d o - o <tab> <backspace> <backspace> f i <tab> 
f i <tab> <return> C-g M-x f f a <tab> <return> C-g 
M-x <up> <up> <up> <return> <up> <return> <down-mouse-1> 
<help-echo> <help-echo> <down-mouse-1> <help-echo> 
C-x b <return> C-x C-f C-g <return> < t e s t SPC / 
> M-x f f a <tab> <return> C-g <down-mouse-1> <mouse-movement> 
<mouse-1> M-x r e p o <tab> <tab> e <backspace> <return> 
r t <tab> <return>

Recent messages:
Creating customization setup...done
To install your edits, invoke [State] and choose the Set operation
Quit [3 times]
Creating customization items...
Creating customization items ...done
Resetting customization items...done
Creating customization setup...done
To install your edits, invoke [State] and choose the Set operation
Quit [2 times]
Making completion list... [2 times]
-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Sun, 24 Oct 2010 19:03:02 GMT) Full text and rfc822 format available.

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

From: "Thibault Kruse" <thibault.kruse <at> gmx.de>
To: 7229 <at> debbugs.gnu.org
Subject: patch
Date: Sun, 24 Oct 2010 21:06:50 +0200
HI,

i dont know where the ffap sources are in emacs 23.1, therefore I could not write a patch myself, but as a workaround, I created this advice. Maybe it can help.

(require 'advice)
(defadvice ffap-file-at-point (around bugfix-ffap  activate)
  "returns nil when point is somewhere we do not want to guess filenames"
  (require 'thingatpt)
;;; prevent in javadoc style comments
  (narrow-to-region (line-beginning-position) (line-end-position))
  (unless (or
           (thing-at-point-looking-at "[\\*]+")
           ;; for xml modes, not sure about other modes
           (and (member major-mode '(sgml-mode nxml-mode))
                ;; ignore about <somenode/> and </somenode>
                (or (thing-at-point-looking-at "</?[a-zA-Z_][a-zA-Z0-9:_.-]+")
                    (thing-at-point-looking-at "/>"))))
    ad-do-it))

-- 
GMX DSL Doppel-Flat ab 19,99 &euro;/mtl.! Jetzt auch mit 
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Sun, 24 Oct 2010 19:06:01 GMT) Full text and rfc822 format available.

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

From: "Thibault Kruse" <thibault.kruse <at> gmx.de>
To: 7229 <at> debbugs.gnu.org
Subject: patch
Date: Sun, 24 Oct 2010 21:09:43 +0200
sorry, wrong path, narrow-to-region is applied wrongly in my last comment:

(require 'advice)
(defadvice ffap-file-at-point (around bugfix-ffap  activate)
  "returns nil when point is somewhere we do not want to guess filenames"
  (require 'thingatpt)
;;; prevent in javadoc style comments
  (unless (or
           (thing-at-point-looking-at "[\\*]+")
           ;; for xml modes
           (and (member major-mode '(sgml-mode nxml-mode))
                ;; don't care about <somenode/> and </somenode>
                (or (thing-at-point-looking-at "</?[a-zA-Z_][a-zA-Z0-9:_.-]+")
                    (thing-at-point-looking-at "/>"))))
    ad-do-it))
-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Fri, 11 Mar 2011 17:03:01 GMT) Full text and rfc822 format available.

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

From: "Thibault Kruse" <thibault.kruse <at> gmx.de>
To: 7229 <at> debbugs.gnu.org
Subject: further patch
Date: Fri, 11 Mar 2011 18:02:00 +0100
More things that annoy me, patched, and missed closing ">" in xml mode:


;; ignore shebang lines like #!/bin/bash
(thing-at-point-looking-at "#!/[a-zA-Z0-9:_.-/]+")

(and (member major-mode '(sgml-mode nxml-mode))
                ;; don't care about <somenode/> and </somenode>
                (or (thing-at-point-looking-at "</?[a-zA-Z_][a-zA-Z0-9:_.-]*>?")
                    (thing-at-point-looking-at "/>"))))
-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren: http://www.gmx.net/de/go/freephone




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Thu, 11 Jul 2013 16:24:02 GMT) Full text and rfc822 format available.

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

From: Leo Liu <sdl.web <at> gmail.com>
To: "Thibault Kruse" <thibault.kruse <at> gmx.de>
Cc: 7229 <at> debbugs.gnu.org
Subject: Re: bug#7229: 23.1; ido guess and ffap bug
Date: Fri, 12 Jul 2013 00:23:33 +0800
On 2010-10-17 04:08 +0800, Thibault Kruse wrote:
> enter /**
> cursor at the end of that line
> M-x ido-find-file (or C-x f): ido suggests /**, instead of pwd
> enter <test />
> cursor at the end of that line
> M-x ido-find-file (or C-x f): ido suggests /, instead of pwd
>
> same for M-x ffap

I don't see any bugs here. ido and ffap seem working consistently per
your request (/** and / are valid file names).

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Fri, 12 Jul 2013 01:21:01 GMT) Full text and rfc822 format available.

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

From: Leo Liu <sdl.web <at> gmail.com>
To: 7229 <at> debbugs.gnu.org
Subject: Re: bug#7229: 23.1; ido guess and ffap bug
Date: Fri, 12 Jul 2013 09:20:33 +0800
[Message part 1 (message/rfc822, inline)]
From: "Thibault Kruse" <thibault.kruse <at> gmx.de>
To: "Leo Liu" <sdl.web <at> gmail.com>
Subject: Aw: Re: bug#7229: 23.1; ido guess and ffap bug
Date: Fri, 12 Jul 2013 01:50:57 +0200 (CEST)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Fri, 12 Jul 2013 01:44:02 GMT) Full text and rfc822 format available.

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

From: Leo Liu <sdl.web <at> gmail.com>
To: "Thibault Kruse" <thibault.kruse <at> gmx.de>
Cc: 7229 <at> debbugs.gnu.org
Subject: Re: bug#7229: 23.1; ido guess and ffap bug
Date: Fri, 12 Jul 2013 09:43:33 +0800
On 2013-07-12 09:20 +0800, Leo Liu wrote:
> Then maybe call it sub-optimal default behavior instead of a bug.

From my experience I agree.

I enabled ido-use-url-at-point and ido-use-filename-at-point for a while
and was constantly annoyed by false positives and negatives. I have set
both to nil in the last few years.

Maybe the feature can be changed this way:

 1. remove both ido-use-url-at-point and ido-use-filename-at-point
 2. when ido-find-file is invoked with prefix, use ffap.

You can experiment this with the following:

(setq ido-use-filename-at-point nil
      ido-use-url-at-point nil)
(defadvice ido-file-internal (around ffap activate)
  "When called with a prefix, use `ffap' instead."
  (if current-prefix-arg
      (ffap)
    ad-do-it))

Let me know if this is a good idea and should be part of ido.el. Thanks.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Fri, 12 Jul 2013 07:49:01 GMT) Full text and rfc822 format available.

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

From: Leo Liu <sdl.web <at> gmail.com>
To: "Thibault Kruse" <thibault.kruse <at> gmx.de>
Cc: 7229 <at> debbugs.gnu.org
Subject: Re: Aw: Re: bug#7229: 23.1; ido guess and ffap bug
Date: Fri, 12 Jul 2013 15:48:29 +0800
Please CC the bug address.

On 2013-07-12 15:36 +0800, Thibault Kruse wrote:
> It seems that for me, doing so always yields a curent-prefix-arg that
> is nil, not sure why.

Do you have ffap settings that interfere? Do you try with emacs -q?

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Fri, 12 Jul 2013 23:04:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: Thibault Kruse <thibault.kruse <at> gmx.de>, 7229 <at> debbugs.gnu.org
Subject: Re: bug#7229: 23.1; ido guess and ffap bug
Date: Sat, 13 Jul 2013 03:03:28 +0400
Leo Liu <sdl.web <at> gmail.com> writes:

> On 2010-10-17 04:08 +0800, Thibault Kruse wrote:
>> enter /**
>> cursor at the end of that line
>> M-x ido-find-file (or C-x f): ido suggests /**, instead of pwd
>> enter <test />
>> cursor at the end of that line
>> M-x ido-find-file (or C-x f): ido suggests /, instead of pwd
>>
>> same for M-x ffap
>
> I don't see any bugs here. ido and ffap seem working consistently per
> your request (/** and / are valid file names).

Maybe we should be able to restrict `ffap-file-at-point' to local files
(which it checks for existence).

After all, the variable that enables this behavior is called
`ido-use-filename-at-point', and the description does not tell you that
the thing at point could be interpreted as a remote URL.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Sat, 13 Jul 2013 01:22:02 GMT) Full text and rfc822 format available.

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

From: Leo Liu <sdl.web <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Thibault Kruse <thibault.kruse <at> gmx.de>, 7229 <at> debbugs.gnu.org
Subject: Re: bug#7229: 23.1; ido guess and ffap bug
Date: Sat, 13 Jul 2013 09:20:54 +0800
On 2013-07-13 07:03 +0800, Dmitry Gutov wrote:
> Maybe we should be able to restrict `ffap-file-at-point' to local files
> (which it checks for existence).
>
> After all, the variable that enables this behavior is called
> `ido-use-filename-at-point', and the description does not tell you that
> the thing at point could be interpreted as a remote URL.

Is ffap-url-regexp enough?

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Sat, 13 Jul 2013 01:26:01 GMT) Full text and rfc822 format available.

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

From: Leo Liu <sdl.web <at> gmail.com>
To: "Thibault Kruse" <thibault.kruse <at> gmx.de>
Cc: 7229 <at> debbugs.gnu.org
Subject: Re: Aw: Re:  Re: bug#7229: 23.1; ido guess and ffap bug
Date: Sat, 13 Jul 2013 09:25:12 +0800
On 2013-07-12 15:52 +0800, Thibault Kruse wrote:
> I tried: 
> emacs -q --no-site-file
> M-x ido-mode
> M-x ielm
> pasted the lines you gave
> switch to scratch buffer
> typed "~/local" which exists
> press C-x C-f

Instead of C-x C-f, Try C-u C-x C-f.

> no prefix is used, ido just shows ~
> debugger also indicates the prefix var is nil

Please please write to the bug address 7229 <at> debbugs.gnu.org instead of
my email.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Sat, 13 Jul 2013 01:29:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: Thibault Kruse <thibault.kruse <at> gmx.de>, 7229 <at> debbugs.gnu.org
Subject: Re: bug#7229: 23.1; ido guess and ffap bug
Date: Sat, 13 Jul 2013 05:28:04 +0400
On 13.07.2013 5:20, Leo Liu wrote:
> On 2013-07-13 07:03 +0800, Dmitry Gutov wrote:
>> Maybe we should be able to restrict `ffap-file-at-point' to local files
>> (which it checks for existence).
>>
>> After all, the variable that enables this behavior is called
>> `ido-use-filename-at-point', and the description does not tell you that
>> the thing at point could be interpreted as a remote URL.
>
> Is ffap-url-regexp enough?

Not 100% sure what you mean, but probably not:

1) It doesn't match "/**", a value which apparently (ffap-guesser) can 
return even if there's no existing file with that name.

2) Likewise, it doesn't match "http:/". And I'm sure we can find other 
examples.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Sat, 13 Jul 2013 08:02:02 GMT) Full text and rfc822 format available.

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

From: "Thibault Kruse" <thibault.kruse <at> gmx.de>
To: 7229 <at> debbugs.gnu.org
Subject: Aw: Re:  Re:  Re: bug#7229: 23.1; ido guess and ffap bug
Date: Sat, 13 Jul 2013 10:01:33 +0200 (CEST)
[Message part 1 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Sat, 13 Jul 2013 17:32:01 GMT) Full text and rfc822 format available.

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

From: Leo Liu <sdl.web <at> gmail.com>
To: "Thibault Kruse" <thibault.kruse <at> gmx.de>
Cc: 7229 <at> debbugs.gnu.org
Subject: Re: bug#7229: Aw: Re:  Re:  Re: bug#7229: 23.1; ido guess and ffap bug
Date: Sun, 14 Jul 2013 01:31:02 +0800
On 2013-07-13 16:01 +0800, Thibault Kruse wrote:
> Again, it is a design decision, not a bug. I believe emacs users will
> be happier if C-x C-f with ido-ffap uses heuristics to avoid common
> false positives, rather than having to learn another shortcut.

I consider this not a bug/flaw in ido but ffap. Special-case particular
file names doesn't look like a good solution.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7229; Package emacs. (Sat, 13 Jul 2013 18:39:03 GMT) Full text and rfc822 format available.

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

From: "Thibault Kruse" <thibault.kruse <at> gmx.de>
To: 7229 <at> debbugs.gnu.org
Subject: Aw: Re: bug#7229:  Re:  Re:  Re: bug#7229: 23.1; ido guess and ffap
 bug
Date: Sat, 13 Jul 2013 20:38:25 +0200 (CEST)
[Message part 1 (text/html, inline)]

Severity set to 'normal' from 'minor' Request was from Kaushal Modi <kaushal.modi <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 23 Jul 2016 12:02:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Kaushal Modi <kaushal.modi <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 23 Jul 2016 12:14:01 GMT) Full text and rfc822 format available.

Merged 7229 8990 24057. Request was from Kaushal Modi <kaushal.modi <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 23 Jul 2016 12:14:01 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 18 Mar 2017 15:40:02 GMT) Full text and rfc822 format available.

Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Thu, 23 Mar 2017 13:00:04 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 24057 <at> debbugs.gnu.org and Kaushal Modi <kaushal.modi <at> gmail.com> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Thu, 23 Mar 2017 13:00:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 21 Apr 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 65 days ago.

Previous Next


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