Further lisp-current-defun-name tweaks

* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Further
tweaks to finding the symbol being defined (defalias).
This commit is contained in:
Lars Ingebrigtsen 2022-08-08 15:52:53 +02:00
parent ffc81ebc4b
commit 909931cb9a

View file

@ -776,8 +776,12 @@ decided heuristically.)"
(when (and (not name)
(string-match-p "\\`def" (symbol-name symbol)))
(when-let ((candidate (ignore-errors (read (current-buffer)))))
(when (symbolp candidate)
(setq name candidate))))
(cond
((symbolp candidate)
(setq name candidate))
((and (consp candidate)
(symbolp (car (delete 'quote candidate))))
(setq name (car (delete 'quote candidate)))))))
(when-let ((result (or name symbol)))
(symbol-name result)))))))