diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-08-08 14:31:54 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-08-08 14:32:33 +0200 |
commit | 55cc8b040b0e3c5f97fd1386d1e9c5a120be6340 (patch) | |
tree | e34e21804caeb4977d269fedd347fafeaf5fd21e /test | |
parent | 3d7d8ddc5ac73ebeb4aff9e672e649c8352beeb2 (diff) | |
download | emacs-55cc8b040b0e3c5f97fd1386d1e9c5a120be6340.tar.gz emacs-55cc8b040b0e3c5f97fd1386d1e9c5a120be6340.tar.bz2 emacs-55cc8b040b0e3c5f97fd1386d1e9c5a120be6340.zip |
Make which-func-mode output less junk
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Use
edebug specs to find the name (if they exist), and default to
returning the top-level symbol if there isn't a define-like form
(bug#49592).
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/emacs-lisp/lisp-mode-tests.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index fd1af75ba3f..d3e78aa1d7e 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -330,5 +330,28 @@ Expected initialization file: `%s'\" (faceup-clean-buffer) (should (faceup-test-font-lock-buffer 'emacs-lisp-mode faceup))))) +(ert-deftest test-lisp-current-defun-name () + (require 'edebug) + (with-temp-buffer + (emacs-lisp-mode) + (insert "(defun foo ()\n'bar)\n") + (goto-char 5) + (should (equal (lisp-current-defun-name) "foo"))) + (with-temp-buffer + (emacs-lisp-mode) + (insert "(define-flabbergast-test zot ()\n'bar)\n") + (goto-char 5) + (should (equal (lisp-current-defun-name) "zot"))) + (with-temp-buffer + (emacs-lisp-mode) + (insert "(progn\n ;; comment\n ;; about that\n (define-key ...)\n )") + (goto-char 5) + (should (equal (lisp-current-defun-name) "progn"))) + (with-temp-buffer + (emacs-lisp-mode) + (insert "(defblarg \"a\" 'b)") + (goto-char 5) + (should (equal (lisp-current-defun-name) "defblarg")))) + (provide 'lisp-mode-tests) ;;; lisp-mode-tests.el ends here |