From: Eshel Yaron Date: Tue, 25 Feb 2025 15:47:52 +0000 (+0100) Subject: elisp-mode.el: Improve Eldoc support X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=080debb8e997274fe7c24cb882e7b901762c651a;p=emacs.git elisp-mode.el: Improve Eldoc support --- diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index d48ab93f570..befcc338cab 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -347,6 +347,10 @@ happens in interactive invocations." "Face for highlighting face names in Emacs Lisp code." :group 'lisp) +(defface elisp-function-call '((t :inherit font-lock-function-call-face)) + "Face for highlighting function calls in Emacs Lisp code." + :group 'lisp) + (defface elisp-macro-call '((t :inherit font-lock-keyword-face)) "Face for highlighting macro calls in Emacs Lisp code." :group 'lisp) @@ -485,7 +489,7 @@ happens in interactive invocations." (cl-case type (variable 'elisp-free-variable) (face 'elisp-face) - (function 'font-lock-function-call-face) + (function 'elisp-function-call) (macro 'elisp-macro-call) (special-form 'elisp-special-form) (throw-tag 'elisp-throw-tag) @@ -2112,11 +2116,18 @@ ARGS is the argument list of function SYM." (defun elisp--fnsym-in-current-sexp () (save-excursion (unless (nth 8 (syntax-ppss)) - (let ((argument-index (1- (elisp--beginning-of-sexp)))) - ;; If we are at the beginning of function name, this will be -1. - (when (< argument-index 0) - (setq argument-index 0)) - (list (elisp--current-symbol) argument-index))))) + (catch 'ball nil + (while t + (let ((argument-index (1- (elisp--beginning-of-sexp)))) + ;; If we are at the beginning of function name, this will be -1. + (when (< argument-index 0) + (setq argument-index 0)) + (if (memq (get-text-property (point) 'face) + '(elisp-special-form elisp-macro-call elisp-function-call)) + (throw 'ball (list (elisp--current-symbol) argument-index)) + (condition-case nil + (backward-up-list) + (scan-error (throw 'ball nil)))))))))) ;; Move to the beginning of current sexp. Return the number of nested ;; sexp the point was over or after.