* bug#17723: 24.3.91; Improvements for ffap
@ 2014-06-07 7:51 Ivan Andrus
2014-06-12 2:31 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Ivan Andrus @ 2014-06-07 7:51 UTC (permalink / raw
To: 17723
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@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))))
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#17723: 24.3.91; Improvements for ffap
2014-06-07 7:51 bug#17723: 24.3.91; Improvements for ffap Ivan Andrus
@ 2014-06-12 2:31 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2014-06-12 2:31 UTC (permalink / raw
To: Ivan Andrus; +Cc: 17723-done
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-12 2:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-07 7:51 bug#17723: 24.3.91; Improvements for ffap Ivan Andrus
2014-06-12 2:31 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.