]> git.eshelyaron.com Git - emacs.git/commitdiff
`ffap-gopher-at-point' interminable without newlines
authordickmao <none>
Mon, 19 Oct 2020 09:56:36 +0000 (11:56 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 19 Oct 2020 09:56:49 +0000 (11:56 +0200)
* 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
test/lisp/ffap-tests.el

index ccba29114451110f7f733964d2b40b2c0aa9d8f1..2c1d3d5bd9d01909f5a6861e88b7a9dc9130fd88 100644 (file)
@@ -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")))
index e8c12669c1a98de263b00c2a9dfd9f339c274e00..ca8c10831fdc934ede342cd773aafd89d3222a43 100644 (file)
@@ -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