Make ffap correctly guess remote file names at point
* lisp/ffap.el (ffap-lax-url): Set it to nil so that remote file names may be matched. (ffap-fixup-email): New function. (ffap-guesser): Specially handle email addresses now that 'ffap-lax-url' is nil, as user@host fails to be matched as an email address with that setting. (Bug#67688) * etc/NEWS: Announce the new value of the defcustom.
This commit is contained in:
parent
e54e25129e
commit
cbbb19ced6
2 changed files with 16 additions and 3 deletions
5
etc/NEWS
5
etc/NEWS
|
@ -278,6 +278,11 @@ elaborate and error-prone escaping (to protect them from the shell).
|
|||
When answering the prompt with "diff" or "=", it now shows the diffs
|
||||
between the auto save file and the current file.
|
||||
|
||||
---
|
||||
** 'ffap-lax-url' now defaults to nil.
|
||||
Previously, it was set to 'ffap-lax-url' to t but this broke remote file
|
||||
name detection.
|
||||
|
||||
|
||||
* Editing Changes in Emacs 30.1
|
||||
|
||||
|
|
14
lisp/ffap.el
14
lisp/ffap.el
|
@ -152,15 +152,15 @@ schemes (e.g. \"ftp\"); in that case, only convert those URLs."
|
|||
:group 'ffap
|
||||
:version "24.3")
|
||||
|
||||
(defcustom ffap-lax-url t
|
||||
(defcustom ffap-lax-url nil
|
||||
"If non-nil, allow lax URL matching.
|
||||
The default non-nil value might produce false URLs in C++ code
|
||||
with symbols like \"std::find\". On the other hand, setting
|
||||
this to nil will disable recognition of URLs that are not
|
||||
well-formed, such as \"user@host\" or \"<user@host>\"."
|
||||
well-formed."
|
||||
:type 'boolean
|
||||
:group 'ffap
|
||||
:version "25.2") ; nil -> t
|
||||
:version "30.1")
|
||||
|
||||
(defcustom ffap-ftp-default-user "anonymous"
|
||||
"User name in FTP file names generated by `ffap-host-to-filename'.
|
||||
|
@ -609,6 +609,13 @@ Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"."
|
|||
((and ffap-url-unwrap-remote (ffap-url-unwrap-remote url)))
|
||||
(url)))
|
||||
|
||||
(defun ffap-fixup-email (email)
|
||||
"Clean up EMAIL and return it as a mailto: URL."
|
||||
(when (stringp email)
|
||||
(if (string-prefix-p "mailto:" email)
|
||||
email
|
||||
(concat "mailto:" email))))
|
||||
|
||||
|
||||
;;; File Name Handling:
|
||||
|
||||
|
@ -1571,6 +1578,7 @@ Uses the face `ffap' if it is defined, or else `highlight'."
|
|||
(ffap-fixup-url (or (ffap-url-at-point)
|
||||
(ffap-gopher-at-point))))
|
||||
(ffap-file-at-point) ; may yield url!
|
||||
(ffap-fixup-email (thing-at-point 'email))
|
||||
(ffap-fixup-machine (ffap-machine-at-point))))
|
||||
|
||||
(defun ffap-prompter (&optional guess suffix)
|
||||
|
|
Loading…
Add table
Reference in a new issue