diff options
| author | Noam Postavsky | 2017-01-08 18:19:32 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2017-01-15 13:04:54 -0500 |
| commit | fd6b829d91da73a945643b5916ee6d79c992e030 (patch) | |
| tree | 5759b3099ad52bdf3fb80948a12973d349981b2f /test | |
| parent | af3db69ee640d9a1e9027c04ba3b5bec7c2681ab (diff) | |
| download | emacs-fd6b829d91da73a945643b5916ee6d79c992e030.tar.gz emacs-fd6b829d91da73a945643b5916ee6d79c992e030.zip | |
Improve ffap-gopher-at-point handling of long lines
* lisp/ffap.el (ffap-gopher-regexp): Only match the KEY part. Note
setting to nil is now supported.
(ffap--gopher-var-on-line): New function.
(ffap-gopher-at-point): Use it instead of the old ffap-gopher-regexp
which could overflow the regexp stack on long lines (Bug#25391). Use
`let-alist' instead of calling `set' on local variables.
* test/lisp/ffap-tests.el (ffap-gopher-at-point): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/ffap-tests.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el index 1ba5f86a887..a3fe3502461 100644 --- a/test/lisp/ffap-tests.el +++ b/test/lisp/ffap-tests.el | |||
| @@ -49,6 +49,23 @@ index 3d7cebadcf..ad4b70d737 100644 | |||
| 49 | (should (equal '(1 1) ffap-string-at-point-region))))) | 49 | (should (equal '(1 1) ffap-string-at-point-region))))) |
| 50 | (and (file-exists-p file) (delete-file file))))) | 50 | (and (file-exists-p file) (delete-file file))))) |
| 51 | 51 | ||
| 52 | (ert-deftest ffap-gopher-at-point () | ||
| 53 | (with-temp-buffer | ||
| 54 | (insert "\ | ||
| 55 | Type = 1 | ||
| 56 | Name = foo | ||
| 57 | Path = /the/path | ||
| 58 | Port = 7070 | ||
| 59 | Host = example.com\n") | ||
| 60 | (should-not (ffap-gopher-at-point)) | ||
| 61 | (goto-char (point-min)) | ||
| 62 | (should (equal (ffap-gopher-at-point) | ||
| 63 | "gopher://example.com:7070/1/the/path")) | ||
| 64 | (should (equal ffap-string-at-point-region | ||
| 65 | (list (point-min) (point-max)))) | ||
| 66 | (let ((ffap-gopher-regexp nil)) | ||
| 67 | (should-not (ffap-gopher-at-point))))) | ||
| 68 | |||
| 52 | (provide 'ffap-tests) | 69 | (provide 'ffap-tests) |
| 53 | 70 | ||
| 54 | ;;; ffap-tests.el ends here | 71 | ;;; ffap-tests.el ends here |