Skip to content

Commit 50bdce6

Browse files
committed
Do not enable or disable eldoc-mode
Eldoc is enabled by default these days.
1 parent 00d0398 commit 50bdce6

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

gnuplot-context.el

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ there."
20612061
(gnuplot-context--completions)))
20622062

20632063
;; Eldoc help
2064-
(defun gnuplot-eldoc-function ()
2064+
(defun gnuplot-eldoc-function (&rest _)
20652065
"Return the ElDoc string for the Gnuplot construction at point."
20662066
(gnuplot-context--parse-at-point nil)
20672067
gnuplot-eldoc)
@@ -2225,31 +2225,20 @@ distribution. See gnuplot-context.el for details."
22252225
(setq gnuplot-completion-at-point-function #'gnuplot-context-completion-at-point)
22262226

22272227
;; Setup Eldoc
2228-
(setq-local eldoc-documentation-function #'gnuplot-eldoc-function)
2228+
(add-hook 'eldoc-documentation-functions #'gnuplot-eldoc-function nil 'local)
22292229
(eldoc-add-command 'completion-at-point) ; Check for eldoc after completion
22302230

22312231
;; Try to load Eldoc strings
2232-
(when gnuplot-eldoc-mode
2233-
(unless gnuplot-eldoc-hash
2234-
(condition-case nil
2235-
(load-library "gnuplot-eldoc")
2236-
(error
2237-
(message "gnuplot-eldoc.el not found. Install it from the Gnuplot distribution.")
2238-
(setq gnuplot-eldoc-hash nil
2239-
gnuplot-eldoc-mode nil))))
2240-
2241-
(if gnuplot-eldoc-hash
2242-
(eldoc-mode 1)
2243-
(eldoc-mode 0)))
2232+
(when (and gnuplot-eldoc-mode (not gnuplot-eldoc-hash))
2233+
(load "gnuplot-eldoc" nil t))
22442234

22452235
;; Set up tab-to-complete
22462236
(when gnuplot-tab-completion
22472237
(setq-local tab-always-indent 'complete)))
22482238

22492239
;; Turn off
22502240
(setq gnuplot-completion-at-point-function #'gnuplot-completion-at-point-info-look)
2251-
(setq eldoc-documentation-function nil)
2252-
(eldoc-mode 0)))
2241+
(remove-hook 'eldoc-documentation-functions #'gnuplot-eldoc-function 'local)))
22532242

22542243
(provide 'gnuplot-context)
22552244
;; Local Variables:

0 commit comments

Comments
 (0)