Subject: bug#17723: closed (Re: bug#17723: 24.3.91; Improvements for ffap)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 12 Jun 2014 02:32:03 +0000

Your bug report

#17723: 24.3.91; Improvements for ffap

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
17723: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17723
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#17723: 24.3.91; Improvements for ffap
From: Stefan Monnier <[email-masked]>
To: Ivan Andrus <[email-masked]>
Cc: [email-masked]
Date: Wed, 11 Jun 2014 22:31:53 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> 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

Subject: 24.3.91; Improvements for ffap
From: Ivan Andrus <[email-masked]>
To: [email-masked]
Date: Sat, 7 Jun 2014 01:51:02 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

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  <[email-masked]>

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