[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/eldoc-async 20c4662: Use new Eldoc capabilities in Elisp mode
From: |
João Távora |
Subject: |
scratch/eldoc-async 20c4662: Use new Eldoc capabilities in Elisp mode |
Date: |
Sat, 6 Jun 2020 09:05:55 -0400 (EDT) |
branch: scratch/eldoc-async
commit 20c4662991115c8dc8b8a3aa5a13b537f9d53aab
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Use new Eldoc capabilities in Elisp mode
* lisp/progmodes/elisp-mode.el (elisp-eldoc-funcall): Delete.
* lisp/progmodes/elisp-mode.el (elisp-eldoc-funcall)
(elisp-eldoc-var-docstring): New functions.
(emacs-lisp-mode): Put two elements in
eldoc-documentation-functions.
---
lisp/progmodes/elisp-mode.el | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 5e32b25..a003f0f 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -280,7 +280,9 @@ Blank lines separate paragraphs. Semicolons start comments.
electric-pair-text-pairs))
(add-hook 'electric-pair-mode-hook #'emacs-lisp-set-electric-text-pairs))
(add-hook 'eldoc-documentation-functions
- #'elisp-eldoc-documentation-function nil t)
+ #'elisp-eldoc-var-docstring nil t)
+ (add-hook 'eldoc-documentation-functions
+ #'elisp-eldoc-funcall nil t)
(add-hook 'xref-backend-functions #'elisp--xref-backend nil t)
(setq-local project-vc-external-roots-function #'elisp-load-path-roots)
(add-hook 'completion-at-point-functions
@@ -1403,20 +1405,18 @@ which see."
or argument string for functions.
2 - `function' if function args, `variable' if variable documentation.")
-(defun elisp-eldoc-documentation-function (_ignored &rest _also-ignored)
- "Contextual documentation function for Emacs Lisp.
-Intended to be placed in `eldoc-documentation-functions' (which
-see)."
- (let ((current-symbol (elisp--current-symbol))
- (current-fnsym (elisp--fnsym-in-current-sexp)))
- (cond ((null current-fnsym)
- nil)
- ((eq current-symbol (car current-fnsym))
- (or (apply #'elisp-get-fnsym-args-string current-fnsym)
- (elisp-get-var-docstring current-symbol)))
- (t
- (or (elisp-get-var-docstring current-symbol)
- (apply #'elisp-get-fnsym-args-string current-fnsym))))))
+(defun elisp-eldoc-funcall (&rest _ignored)
+ "Document function call at point.
+Intended for `eldoc-documentation-functions' (which see)."
+ (let ((fn-sym (elisp--fnsym-in-current-sexp)))
+ (when fn-sym
+ (apply #'elisp-get-fnsym-args-string fn-sym))))
+
+(defun elisp-eldoc-var-docstring (&rest _ignored)
+ "Document variable at point.
+Intended for `eldoc-documentation-functions' (which see)."
+ (let ((sym (elisp--current-symbol)))
+ (when sym (elisp-get-var-docstring sym))))
(defun elisp-get-fnsym-args-string (sym &optional index prefix)
"Return a string containing the parameter list of the function SYM.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- scratch/eldoc-async 20c4662: Use new Eldoc capabilities in Elisp mode,
João Távora <=