diff options
| author | Visuwesh | 2023-12-12 21:14:12 +0530 |
|---|---|---|
| committer | Eli Zaretskii | 2023-12-23 11:27:36 +0200 |
| commit | cbbb19ced674dc8c42c95238577abb9849a75b87 (patch) | |
| tree | 79a9493fb225979e7ebea2ec89065960db237798 | |
| parent | e54e25129ec631969e1febdcf44d2f99a1791063 (diff) | |
| download | emacs-cbbb19ced674dc8c42c95238577abb9849a75b87.tar.gz emacs-cbbb19ced674dc8c42c95238577abb9849a75b87.zip | |
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.
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ffap.el | 14 |
2 files changed, 16 insertions, 3 deletions
| @@ -278,6 +278,11 @@ elaborate and error-prone escaping (to protect them from the shell). | |||
| 278 | When answering the prompt with "diff" or "=", it now shows the diffs | 278 | When answering the prompt with "diff" or "=", it now shows the diffs |
| 279 | between the auto save file and the current file. | 279 | between the auto save file and the current file. |
| 280 | 280 | ||
| 281 | --- | ||
| 282 | ** 'ffap-lax-url' now defaults to nil. | ||
| 283 | Previously, it was set to 'ffap-lax-url' to t but this broke remote file | ||
| 284 | name detection. | ||
| 285 | |||
| 281 | 286 | ||
| 282 | * Editing Changes in Emacs 30.1 | 287 | * Editing Changes in Emacs 30.1 |
| 283 | 288 | ||
diff --git a/lisp/ffap.el b/lisp/ffap.el index 530e3da182e..9cea11cf540 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el | |||
| @@ -152,15 +152,15 @@ schemes (e.g. \"ftp\"); in that case, only convert those URLs." | |||
| 152 | :group 'ffap | 152 | :group 'ffap |
| 153 | :version "24.3") | 153 | :version "24.3") |
| 154 | 154 | ||
| 155 | (defcustom ffap-lax-url t | 155 | (defcustom ffap-lax-url nil |
| 156 | "If non-nil, allow lax URL matching. | 156 | "If non-nil, allow lax URL matching. |
| 157 | The default non-nil value might produce false URLs in C++ code | 157 | The default non-nil value might produce false URLs in C++ code |
| 158 | with symbols like \"std::find\". On the other hand, setting | 158 | with symbols like \"std::find\". On the other hand, setting |
| 159 | this to nil will disable recognition of URLs that are not | 159 | this to nil will disable recognition of URLs that are not |
| 160 | well-formed, such as \"user@host\" or \"<user@host>\"." | 160 | well-formed." |
| 161 | :type 'boolean | 161 | :type 'boolean |
| 162 | :group 'ffap | 162 | :group 'ffap |
| 163 | :version "25.2") ; nil -> t | 163 | :version "30.1") |
| 164 | 164 | ||
| 165 | (defcustom ffap-ftp-default-user "anonymous" | 165 | (defcustom ffap-ftp-default-user "anonymous" |
| 166 | "User name in FTP file names generated by `ffap-host-to-filename'. | 166 | "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\"." | |||
| 609 | ((and ffap-url-unwrap-remote (ffap-url-unwrap-remote url))) | 609 | ((and ffap-url-unwrap-remote (ffap-url-unwrap-remote url))) |
| 610 | (url))) | 610 | (url))) |
| 611 | 611 | ||
| 612 | (defun ffap-fixup-email (email) | ||
| 613 | "Clean up EMAIL and return it as a mailto: URL." | ||
| 614 | (when (stringp email) | ||
| 615 | (if (string-prefix-p "mailto:" email) | ||
| 616 | |||
| 617 | (concat "mailto:" email)))) | ||
| 618 | |||
| 612 | 619 | ||
| 613 | ;;; File Name Handling: | 620 | ;;; File Name Handling: |
| 614 | 621 | ||
| @@ -1571,6 +1578,7 @@ Uses the face `ffap' if it is defined, or else `highlight'." | |||
| 1571 | (ffap-fixup-url (or (ffap-url-at-point) | 1578 | (ffap-fixup-url (or (ffap-url-at-point) |
| 1572 | (ffap-gopher-at-point)))) | 1579 | (ffap-gopher-at-point)))) |
| 1573 | (ffap-file-at-point) ; may yield url! | 1580 | (ffap-file-at-point) ; may yield url! |
| 1581 | (ffap-fixup-email (thing-at-point 'email)) | ||
| 1574 | (ffap-fixup-machine (ffap-machine-at-point)))) | 1582 | (ffap-fixup-machine (ffap-machine-at-point)))) |
| 1575 | 1583 | ||
| 1576 | (defun ffap-prompter (&optional guess suffix) | 1584 | (defun ffap-prompter (&optional guess suffix) |