GNU bug report logs - #17723
24.3.91; Improvements for ffap

Previous Next

Package: emacs;

Reported by: Ivan Andrus <darthandrus <at> gmail.com>

Date: Sat, 7 Jun 2014 07:52:01 UTC

Severity: wishlist

Tags: patch

Found in version 24.3.91

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 17723 in the body.
You can then email your comments to 17723 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 bug-gnu-emacs <at> gnu.org:
bug#17723; Package emacs. (Sat, 07 Jun 2014 07:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ivan Andrus <darthandrus <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 07 Jun 2014 07:52:02 GMT) Full text and rfc822 format available.

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

From: Ivan Andrus <darthandrus <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.91; Improvements for ffap
Date: Sat, 7 Jun 2014 01:51:02 -0600
Find file at point has two annoyances for me (I've rebound C-x C-f to ffap).

The first is that closing xml tags take me to the root directory since
they start with "/".  I fixed by simply disallowing "/" as a valid match
in this case.

The second is that when editing C++ code, namespaced functions (like
std::find) get picked up as URLs.  I changed this by adding an option.
I personally haven't found a reason for it to be non-nil (use lax
matching), but I presume there must have been one so I defaulted to no
behavior change.

Here's a proposed ChangeLog entry (please let me know if the format is wrong):

2014-06-07  Ivan Andrus  <darthandrus <at> gmail.com>

	* ffap.el (ffap-url-at-point): Added `ffap-lax-url' to disallow
	lax URL matching.
	(ffap-file-at-point): Disallow "/" so closing xml tags don't
	interfere.


Thanks,
Ivan


diff --git a/lisp/ffap.el b/lisp/ffap.el
index 119e0ad..e36e613 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -163,6 +163,12 @@ schemes (e.g. \"ftp\"); in that case, only convert those URLs."
   :group 'ffap
   :version "24.3")

+(defcustom ffap-lax-url t
+  "If non-nil, allow lax URL matching."
+  :type 'boolean
+  :group 'ffap
+  :version "24.4")
+
(defcustom ffap-ftp-default-user "anonymous"
   "User name in FTP file names generated by `ffap-host-to-path'.
Note this name may be omitted if it equals the default
@@ -1096,7 +1102,7 @@ Assumes the buffer has not changed."
	     (w3-view-this-url t))
	(let ((thing-at-point-beginning-of-url-regexp ffap-url-regexp)
	      (thing-at-point-default-mail-uri-scheme ffap-foo-at-bar-prefix))
-	  (thing-at-point-url-at-point t
+	  (thing-at-point-url-at-point ffap-lax-url
				       (if (use-region-p)
					   (cons (region-beginning)
						 (region-end))))))))
@@ -1253,7 +1259,8 @@ which may actually result in an URL rather than a filename."
                         (not (ffap-file-exists-string dir))
                         (not (equal dir (setq dir (file-name-directory
                                                    (directory-file-name dir)))))))
-            (ffap-file-exists-string dir)))
+            (and (not (string= dir "/"))
+		 (ffap-file-exists-string dir))))
	 )
       (set-match-data data))))





Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Thu, 12 Jun 2014 02:32:02 GMT) Full text and rfc822 format available.

Notification sent to Ivan Andrus <darthandrus <at> gmail.com>:
bug acknowledged by developer. (Thu, 12 Jun 2014 02:32:03 GMT) Full text and rfc822 format available.

Message #10 received at 17723-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ivan Andrus <darthandrus <at> gmail.com>
Cc: 17723-done <at> debbugs.gnu.org
Subject: Re: bug#17723: 24.3.91; Improvements for ffap
Date: Wed, 11 Jun 2014 22:31:53 -0400
> The second is that when editing C++ code, namespaced functions (like
> std::find) get picked up as URLs.  I changed this by adding an option.
> I personally haven't found a reason for it to be non-nil (use lax
> matching), but I presume there must have been one so I defaulted to no
> behavior change.

Thanks, installed into `trunk', and changed the default.
The patch was mangled, tho, please try and make sure you use a MUA that
doesn't try to be too clever.


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 10 Jul 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 40 days ago.

Previous Next


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