4141 :group 'tool
4242 :link '(url-link :tag " Repository" " https://github.com/emacs-eask/eldoc-eask" ))
4343
44+ ; ;
45+ ; ; (@* "Util" )
46+ ; ;
47+
48+ (defun eldoc-eask--s-replace (old new s )
49+ " Replace OLD with NEW in S each time it occurs."
50+ (if (fboundp #'string-replace )
51+ (string-replace old new s)
52+ (replace-regexp-in-string (regexp-quote old) new s t t )))
53+
4454; ;
4555; ; (@* "Core" )
4656; ;
4757
58+ (defun eldoc-eask--fnsym-in-current-sexp ()
59+ " Mainly copy it from `elisp--fnsym-in-current-sexp' function"
60+ (save-excursion
61+ (unless (nth 8 (syntax-ppss ))
62+ (let ((argument-index (1- (elisp--beginning-of-sexp ))))
63+ ; ; If we are at the beginning of function name, this will be -1.
64+ (when (< argument-index 0 )
65+ (setq argument-index 0 ))
66+ (list (or (elisp--current-symbol )
67+ (thing-at-point 'symbol ))
68+ argument-index)))))
69+
4870(defun eldoc-eask--funcall (callback &rest _ignored )
4971 " Document function call at point.
5072
51- Mainly copy it from `elisp-eldoc-funcall' function"
52- (when-let* ((sym-info (elisp --fnsym-in-current-sexp ))
73+ Mainly copy it from `elisp-eldoc-funcall' function. "
74+ (when-let* ((sym-info (eldoc-eask --fnsym-in-current-sexp))
5375 (fn-sym (car sym-info))
5476 ((member (eask-2str fn-sym) eask-file-keywords)))
5577 (setf (car sym-info) (intern (format " eask-f-%s " fn-sym)))
78+ (setq fn-sym (car sym-info))
5679 (funcall callback (apply #'elisp-get-fnsym-args-string sym-info)
5780 :thing fn-sym
58- :face (if (functionp fn-sym)
59- 'font-lock-function-name-face
60- 'font-lock-keyword-face ))))
81+ :face 'font-lock-keyword-face )))
6182
6283(defun eldoc-eask--function ()
6384 " Main eldoc entry.
@@ -68,9 +89,11 @@ Mainly copy it from `elisp-eldoc-documentation-function' function."
6889 (when doc
6990 (setq str
7091 (format " %s : %s "
71- (propertize (prin1-to-string
72- (plist-get plist :thing ))
73- 'face (plist-get plist :face ))
92+ (eldoc-eask--s-replace
93+ " eask-f-" " "
94+ (propertize (prin1-to-string
95+ (plist-get plist :thing ))
96+ 'face (plist-get plist :face )))
7497 doc))))))
7598 (or (progn (eldoc-eask--funcall callback) str))))
7699
0 commit comments