emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8cdbd84: `ffap-gopher-at-point' interminable without newlines


From: Lars Ingebrigtsen
Subject: master 8cdbd84: `ffap-gopher-at-point' interminable without newlines
Date: Mon, 19 Oct 2020 05:56:56 -0400 (EDT)

branch: master
commit 8cdbd84ebe72091ed02984ce85e9a3c4fbad7c54
Author: dickmao <none>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    `ffap-gopher-at-point' interminable without newlines
    
    * lisp/ffap.el (ffap-gopher-at-point): Stop when we get to the end
    of the buffer.
    * test/lisp/ffap-tests.el (ffap-test-no-newlines): Ensure
    termination for corner case (bug#44048).
---
 lisp/ffap.el            | 3 ++-
 test/lisp/ffap-tests.el | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/ffap.el b/lisp/ffap.el
index ccba291..2c1d3d5 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1383,7 +1383,8 @@ Sets the variable `ffap-string-at-point-region' to the 
bounds of URL, if any."
                          (point)))
              (bookmark (cl-loop for keyval = (ffap--gopher-var-on-line)
                                 while keyval collect keyval
-                                do (forward-line 1))))
+                                do (forward-line 1)
+                                until (eobp))))
         (when bookmark
           (setq ffap-string-at-point-region (list beg (point)))
           (let-alist (nconc bookmark '((type . "1") (port . "70")))
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el
index e8c1266..ca8c108 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -117,6 +117,12 @@ left alone when opening a URL in an external browser."
      t "C:\\temp\\program.log on Windows or /var/log/program.log on Unix.")
     "\\temp\\program.log")))
 
+(ert-deftest ffap-test-no-newlines ()
+  (should-not
+   (with-temp-buffer
+     (save-excursion (insert "type="))
+     (ffap-guess-file-name-at-point))))
+
 (provide 'ffap-tests)
 
 ;;; ffap-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]