]> git.eshelyaron.com Git - emacs.git/commitdiff
elisp-mode.el: Improve Eldoc support
authorEshel Yaron <me@eshelyaron.com>
Tue, 25 Feb 2025 15:47:52 +0000 (16:47 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 25 Feb 2025 15:47:52 +0000 (16:47 +0100)
lisp/progmodes/elisp-mode.el

index d48ab93f570997babe61e46d96195f25a3878703..befcc338cabf5448b5e7cbec55dfe7880314abf2 100644 (file)
@@ -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.