* bug#7229: 23.1; ido guess and ffap bug
@ 2010-10-16 20:08 Thibault Kruse
2010-10-24 19:06 ` bug#7229: patch Thibault Kruse
` (4 more replies)
0 siblings, 5 replies; 15+ messages in thread
From: Thibault Kruse @ 2010-10-16 20:08 UTC (permalink / raw)
To: 7229
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#7229: patch
2010-10-16 20:08 bug#7229: 23.1; ido guess and ffap bug Thibault Kruse
@ 2010-10-24 19:06 ` Thibault Kruse
2010-10-24 19:09 ` Thibault Kruse
` (3 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: Thibault Kruse @ 2010-10-24 19:06 UTC (permalink / raw)
To: 7229
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 €/mtl.! Jetzt auch mit
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#7229: patch
2010-10-16 20:08 bug#7229: 23.1; ido guess and ffap bug Thibault Kruse
2010-10-24 19:06 ` bug#7229: patch Thibault Kruse
@ 2010-10-24 19:09 ` Thibault Kruse
2011-03-11 17:02 ` bug#7229: further patch Thibault Kruse
` (2 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: Thibault Kruse @ 2010-10-24 19:09 UTC (permalink / raw)
To: 7229
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#7229: further patch
2010-10-16 20:08 bug#7229: 23.1; ido guess and ffap bug Thibault Kruse
2010-10-24 19:06 ` bug#7229: patch Thibault Kruse
2010-10-24 19:09 ` Thibault Kruse
@ 2011-03-11 17:02 ` Thibault Kruse
2013-07-11 16:23 ` bug#7229: 23.1; ido guess and ffap bug Leo Liu
2013-07-12 1:20 ` Leo Liu
4 siblings, 0 replies; 15+ messages in thread
From: Thibault Kruse @ 2011-03-11 17:02 UTC (permalink / raw)
To: 7229
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#7229: 23.1; ido guess and ffap bug
2010-10-16 20:08 bug#7229: 23.1; ido guess and ffap bug Thibault Kruse
` (2 preceding siblings ...)
2011-03-11 17:02 ` bug#7229: further patch Thibault Kruse
@ 2013-07-11 16:23 ` Leo Liu
2013-07-12 23:03 ` Dmitry Gutov
2013-07-12 1:20 ` Leo Liu
4 siblings, 1 reply; 15+ messages in thread
From: Leo Liu @ 2013-07-11 16:23 UTC (permalink / raw)
To: Thibault Kruse; +Cc: 7229
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#7229: 23.1; ido guess and ffap bug
2013-07-11 16:23 ` bug#7229: 23.1; ido guess and ffap bug Leo Liu
@ 2013-07-12 23:03 ` Dmitry Gutov
2013-07-13 1:20 ` Leo Liu
0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Gutov @ 2013-07-12 23:03 UTC (permalink / raw)
To: Leo Liu; +Cc: Thibault Kruse, 7229
Leo Liu <sdl.web@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#7229: 23.1; ido guess and ffap bug
2013-07-12 23:03 ` Dmitry Gutov
@ 2013-07-13 1:20 ` Leo Liu
2013-07-13 1:28 ` Dmitry Gutov
0 siblings, 1 reply; 15+ messages in thread
From: Leo Liu @ 2013-07-13 1:20 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: Thibault Kruse, 7229
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#7229: 23.1; ido guess and ffap bug
2013-07-13 1:20 ` Leo Liu
@ 2013-07-13 1:28 ` Dmitry Gutov
0 siblings, 0 replies; 15+ messages in thread
From: Dmitry Gutov @ 2013-07-13 1:28 UTC (permalink / raw)
To: Leo Liu; +Cc: Thibault Kruse, 7229
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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#7229: 23.1; ido guess and ffap bug
2010-10-16 20:08 bug#7229: 23.1; ido guess and ffap bug Thibault Kruse
` (3 preceding siblings ...)
2013-07-11 16:23 ` bug#7229: 23.1; ido guess and ffap bug Leo Liu
@ 2013-07-12 1:20 ` Leo Liu
2013-07-12 1:43 ` Leo Liu
4 siblings, 1 reply; 15+ messages in thread
From: Leo Liu @ 2013-07-12 1:20 UTC (permalink / raw)
To: 7229
[-- Attachment #0: Type: message/rfc822, Size: 4030 bytes --]
[-- Attachment #1: Type: text/html, Size: 2053 bytes --]
From: "Thibault Kruse" <thibault.kruse@gmx.de>
To: "Leo Liu" <sdl.web@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-ID: <trinity-fba17496-0150-43f3-b09d-37da878e8e87-1373586656940@3capp-gmx-bs54>
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#7229: 23.1; ido guess and ffap bug
2013-07-12 1:20 ` Leo Liu
@ 2013-07-12 1:43 ` Leo Liu
[not found] ` <trinity-a533030b-3b06-4782-a22a-e375aeeb1416-1373614579651@3capp-gmx-bs03>
0 siblings, 1 reply; 15+ messages in thread
From: Leo Liu @ 2013-07-12 1:43 UTC (permalink / raw)
To: Thibault Kruse; +Cc: 7229
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
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2013-07-13 18:38 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-16 20:08 bug#7229: 23.1; ido guess and ffap bug Thibault Kruse
2010-10-24 19:06 ` bug#7229: patch Thibault Kruse
2010-10-24 19:09 ` Thibault Kruse
2011-03-11 17:02 ` bug#7229: further patch Thibault Kruse
2013-07-11 16:23 ` bug#7229: 23.1; ido guess and ffap bug Leo Liu
2013-07-12 23:03 ` Dmitry Gutov
2013-07-13 1:20 ` Leo Liu
2013-07-13 1:28 ` Dmitry Gutov
2013-07-12 1:20 ` Leo Liu
2013-07-12 1:43 ` Leo Liu
[not found] ` <trinity-a533030b-3b06-4782-a22a-e375aeeb1416-1373614579651@3capp-gmx-bs03>
2013-07-12 7:48 ` bug#7229: Aw: " Leo Liu
[not found] ` <trinity-a290f8a8-f7aa-4dce-8eee-958dff7573c7-1373615567287@3capp-gmx-bs03>
2013-07-13 1:25 ` bug#7229: Aw: " Leo Liu
2013-07-13 8:01 ` bug#7229: Aw: " Thibault Kruse
2013-07-13 17:31 ` Leo Liu
2013-07-13 18:38 ` bug#7229: Aw: Re: bug#7229: " Thibault Kruse
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).