unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [Stephen.Berman@gmx.net: ffap-string-at-point-mode-alist error?]
@ 2007-04-05 23:12 Richard Stallman
  2007-04-06  8:36 ` Glenn Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-04-05 23:12 UTC (permalink / raw)
  To: emacs-devel

Would someone please try to fix this problem in ffap?

------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
To: emacs-pretest-bug@gnu.org
From: Stephen Berman <Stephen.Berman@gmx.net>
Date: Wed, 04 Apr 2007 23:58:32 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Subject: ffap-string-at-point-mode-alist error?

In a newsgroup posting I read (with Gnus) the following:

    In c-end-of-defun:
    cc-cmds.el:1626:4:Warning: value returned from form is not used.

I put the cursor within "cc-cmds.el" and typed `M-x ffap'.  This
produced the following minibuffer text:

    Find file or URL: /cc-cmds.el:1626:4:Warning

(I can reproduce this with emacs -Q.)  I believe the reason is that
"cc-cmds.el:1626:4:Warning" matches the regexp for URLs in
ffap-string-at-point-mode-alist.


In GNU Emacs 22.0.96.7 (i686-pc-linux-gnu, GTK+ Version 2.10.6)
 of 2007-04-03 on escher
Windowing system distributor `The X.Org Foundation', version 11.0.70199902
configured using `configure  '--with-x-toolkit=gtk''

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.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  eldoc-mode: t
  senator-minor-mode: t
  semantic-idle-summary-mode: t
  semantic-idle-scheduler-mode: t
  tabbar-mwheel-mode: t
  tabbar-mode: t
  recentf-mode: t
  display-time-mode: t
  show-paren-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
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: identity

Recent input:
j e <tab> <return> C-M-x <down> <down> <down> <C-right> 
<C-right> <down> <left> <C-left> <C-left> C-c , j <return> 
<down> C-u C-M-x C-c j <return> M-x <up> <return> SPC 
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC 
SPC SPC SPC SPC SPC e n a m e <return> C-] C-c j <return> 
<up> <up> <up> <up> <up> <up> <up> <C-right> <C-right> 
C-c , j <return> <down> <down> <down> <down> <down> 
C-u C-M-x C-c j <return> M-x <up> <return> SPC SPC 
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC 
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC 
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC 
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC 
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC 
SPC f SPC <return> C-x o <f1> C-c j e <tab> <return> 
<down-mouse-1> <mouse-1> C-h v <return> <select-window> 
<down-mouse-1> <mouse-1> <help-echo> <select-window> 
<help-echo> <help-echo> <help-echo> <select-window> 
<select-window> <help-echo> <help-echo> <help-echo> 
C-x b <return> <down-mouse-1> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <help-echo> <select-window> <select-window> 
<help-echo> <help-echo> <help-echo> <help-echo> <f1> 
C-c j m a <tab> <return> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> M-x f f a <tab> <return> <f1> C-] C-c j e <tab> 
<return> C-M-x C-c j <return> M-x f f a <tab> <return> 
C-] C-c j <return> C-M-x C-c j <return> M-x f f a <tab> 
<return> C-g <down-mouse-1> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <down-mouse-1> <mouse-1> M-x <up> <return> 
C-g <help-echo> <help-echo> <help-echo> C-c j <return> 
C-x C-x C-c , j <return> <down> <down> <down> <down> 
<down> <down> <down-mouse-4> <mouse-4> M-x r e p o 
<tab> r <tab> b <tab> <return>

Recent messages:
Auto-saving...done
Quit
ffap-string-at-point
Quit
ffap-file-at-point
Quit [2 times]
Auto-saving...
Mark set
Making completion list...
Loading emacsbug...done


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Stephen.Berman@gmx.net: ffap-string-at-point-mode-alist error?]
  2007-04-05 23:12 [Stephen.Berman@gmx.net: ffap-string-at-point-mode-alist error?] Richard Stallman
@ 2007-04-06  8:36 ` Glenn Morris
  2007-04-06 15:12   ` Chong Yidong
  2007-04-06 19:47   ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Glenn Morris @ 2007-04-06  8:36 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:

> Would someone please try to fix this problem in ffap?
>
> From: Stephen Berman <Stephen.Berman@gmx.net>
> Subject: ffap-string-at-point-mode-alist error?
> To: emacs-pretest-bug@gnu.org
> Date: Wed, 04 Apr 2007 23:58:32 +0200

>     cc-cmds.el:1626:4:Warning: value returned from form is not used.
[ffap]
>     Find file or URL: /cc-cmds.el:1626:4:Warning

It's because "cc-cmds.el:1626:4:Warning:" matches
ffap-ftp-sans-slash-regexp in ffap-file-at-point. One can customize
ffap-ftp-regexp to nil to prevent such matches being checked for.
Maybe this is the best solution.

Other possible solutions:

1. Before the ftp regexp is checked, ffap-file-at-point checks for
   existence of a file in default-directory. It could look elsewhere
   as well. Ie:

*** ffap.el 10 Jan 2007 15:48:04 -0800 1.61
--- ffap.el 06 Apr 2007 01:29:39 -0700 
***************
*** 1157,1163 ****
           ((and (not abs) (ffap-file-exists-string name)))
           ;; Try stripping off line numbers; good for
           compilation/grep output.
           ((and (not abs) (string-match ":[0-9]" name)
!                (ffap-file-exists-string (substring name 0 (match-beginning 0)))))
           ;; Try stripping off prominent (non-root - #) shell prompts
            ;; if the ffap-shell-prompt-regexp is non-nil.
           ((and ffap-shell-prompt-regexp
--- 1157,1165 ----
           ((and (not abs) (ffap-file-exists-string name)))
           ;; Try stripping off line numbers; good for
           compilation/grep output.
           ((and (not abs) (string-match ":[0-9]" name)
!                (let ((sub (substring name 0 (match-beginning 0))))
!                  (or (ffap-file-exists-string sub)
!                      (ffap-locate-file sub)))))
           ;; Try stripping off prominent (non-root - #) shell prompts
            ;; if the ffap-shell-prompt-regexp is non-nil.
           ((and ffap-shell-prompt-regexp


2. Can a URL ever contain something like ":1626:4:"? If not, could
  prevent such things from matching the ftp test:

***************
*** 1170,1175 ****
--- 1172,1178 ----
        (and
             ffap-ftp-sans-slash-regexp
                  (string-match ffap-ftp-sans-slash-regexp name)
+              (not (string-match ":[0-9]+:[0-9]+:" name))
                    (ffap-file-remote-p (concat "/" name)))))
                     ;; Ok, not remote, try the existence test even if it is absolute:
       ((and abs (ffap-file-exists-string name)))

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Stephen.Berman@gmx.net: ffap-string-at-point-mode-alist error?]
  2007-04-06  8:36 ` Glenn Morris
@ 2007-04-06 15:12   ` Chong Yidong
  2007-04-06 19:47   ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2007-04-06 15:12 UTC (permalink / raw)
  To: Glenn Morris; +Cc: rms, emacs-devel

Glenn Morris <rgm@gnu.org> writes:

>>     cc-cmds.el:1626:4:Warning: value returned from form is not used.
> [ffap]
>>     Find file or URL: /cc-cmds.el:1626:4:Warning
>
> It's because "cc-cmds.el:1626:4:Warning:" matches
> ffap-ftp-sans-slash-regexp in ffap-file-at-point. One can customize
> ffap-ftp-regexp to nil to prevent such matches being checked for.
> Maybe this is the best solution.

I also think this is the best solution.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Stephen.Berman@gmx.net: ffap-string-at-point-mode-alist error?]
  2007-04-06  8:36 ` Glenn Morris
  2007-04-06 15:12   ` Chong Yidong
@ 2007-04-06 19:47   ` Richard Stallman
  2007-04-07  3:01     ` Glenn Morris
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-04-06 19:47 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

    It's because "cc-cmds.el:1626:4:Warning:" matches
    ffap-ftp-sans-slash-regexp in ffap-file-at-point. One can customize
    ffap-ftp-regexp to nil to prevent such matches being checked for.
    Maybe this is the best solution.

Trying to use ffap on a file name in a GNU standard error message
is not an unusual usage pattern.  It is something that people using ffap
will systematically be led to do.

So I think we should make it handle this case right by default,
not make it depend on the user for customization.

As for HOW to do it, I have no opinion, since I don't use ffap.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Stephen.Berman@gmx.net: ffap-string-at-point-mode-alist error?]
  2007-04-06 19:47   ` Richard Stallman
@ 2007-04-07  3:01     ` Glenn Morris
  2007-04-07 17:31       ` Richard Stallman
  2007-04-08 17:11       ` Stephen Berman
  0 siblings, 2 replies; 7+ messages in thread
From: Glenn Morris @ 2007-04-07  3:01 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:

> Trying to use ffap on a file name in a GNU standard error message
> is not an unusual usage pattern.  It is something that people using ffap
> will systematically be led to do.
>
> So I think we should make it handle this case right by default,
> not make it depend on the user for customization.
>
> As for HOW to do it, I have no opinion, since I don't use ffap.

I don't use it either. And the problem with these things that try to
guess what you mean is that sometimes there is no right solution.

But, I agree with your first point. I checked in a fix that lowers the
priority of the part that made ffap match this case as a remote file.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Stephen.Berman@gmx.net: ffap-string-at-point-mode-alist error?]
  2007-04-07  3:01     ` Glenn Morris
@ 2007-04-07 17:31       ` Richard Stallman
  2007-04-08 17:11       ` Stephen Berman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2007-04-07 17:31 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

Thanks for fixing this.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Stephen.Berman@gmx.net: ffap-string-at-point-mode-alist error?]
  2007-04-07  3:01     ` Glenn Morris
  2007-04-07 17:31       ` Richard Stallman
@ 2007-04-08 17:11       ` Stephen Berman
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Berman @ 2007-04-08 17:11 UTC (permalink / raw)
  To: emacs-devel

On Fri, 06 Apr 2007 23:01:16 -0400 Glenn Morris <rgm@gnu.org> wrote:

> Richard Stallman wrote:
>
>> Trying to use ffap on a file name in a GNU standard error message
>> is not an unusual usage pattern.  It is something that people using ffap
>> will systematically be led to do.
>>
>> So I think we should make it handle this case right by default,
>> not make it depend on the user for customization.
>>
>> As for HOW to do it, I have no opinion, since I don't use ffap.
>
> I don't use it either. And the problem with these things that try to
> guess what you mean is that sometimes there is no right solution.
>
> But, I agree with your first point. I checked in a fix that lowers the
> priority of the part that made ffap match this case as a remote file.

I confirm it fixes the problem; thanks!

Steve Berman

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-04-08 17:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-05 23:12 [Stephen.Berman@gmx.net: ffap-string-at-point-mode-alist error?] Richard Stallman
2007-04-06  8:36 ` Glenn Morris
2007-04-06 15:12   ` Chong Yidong
2007-04-06 19:47   ` Richard Stallman
2007-04-07  3:01     ` Glenn Morris
2007-04-07 17:31       ` Richard Stallman
2007-04-08 17:11       ` Stephen Berman

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