diff options
author | Basil L. Contovounesios <contovob@tcd.ie> | 2020-12-27 14:21:50 +0000 |
---|---|---|
committer | Basil L. Contovounesios <contovob@tcd.ie> | 2021-01-10 13:37:38 +0000 |
commit | 25dadca0d175aa7f9f1654314f90af64cdcb68fd (patch) | |
tree | d8b5831f5d903520731ac130889440c859b3f3a7 /test/lisp/help-mode-tests.el | |
parent | 4c55eeee39c05aa56df5ffdca6ff5b233607727c (diff) | |
download | emacs-25dadca0d175aa7f9f1654314f90af64cdcb68fd.tar.gz emacs-25dadca0d175aa7f9f1654314f90af64cdcb68fd.tar.bz2 emacs-25dadca0d175aa7f9f1654314f90af64cdcb68fd.zip |
Hyperlink symbol names without word syntax in Help
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2)
(lisp-cl-font-lock-keywords-2): Allow single-character symbol names.
* lisp/help-mode.el (help-xref-symbol-regexp): Also match symbol
names starting with symbol syntax (bug#6601, bug#24309).
* test/lisp/help-mode-tests.el (help-mode-tests-xref-button): Test
hyperlink creation for function names without symbol syntax.
Diffstat (limited to 'test/lisp/help-mode-tests.el')
-rw-r--r-- | test/lisp/help-mode-tests.el | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/test/lisp/help-mode-tests.el b/test/lisp/help-mode-tests.el index e0e82c9cc1a..43db59d4b1b 100644 --- a/test/lisp/help-mode-tests.el +++ b/test/lisp/help-mode-tests.el @@ -72,14 +72,19 @@ Lisp concepts such as car, cdr, cons cell and list.") #'info))))) (ert-deftest help-mode-tests-xref-button () - (with-temp-buffer - (insert "See also the function ‘interactive’.") - (string-match help-xref-symbol-regexp (buffer-string)) - (help-xref-button 8 'help-function) - (should-not (button-at 22)) - (should-not (button-at 35)) - (let ((button (button-at 30))) - (should (eq (button-type button) 'help-function))))) + (let* ((fmt "See also the function ‘%s’.") + ;; 1+ translates string index to buffer position. + (beg (1+ (string-search "%" fmt)))) + (with-temp-buffer + (dolist (fn '(interactive \` = + - * / %)) + (erase-buffer) + (insert (format fmt fn)) + (goto-char (point-min)) + (re-search-forward help-xref-symbol-regexp) + (help-xref-button 8 'help-function) + (should-not (button-at (1- beg))) + (should-not (button-at (+ beg (length (symbol-name fn))))) + (should (eq (button-type (button-at beg)) 'help-function)))))) (ert-deftest help-mode-tests-insert-xref-button () (with-temp-buffer |