Skip to content

Commit 432fe8f

Browse files
committed
Load gnuplot-gui lazily if needed
1 parent e74ca19 commit 432fe8f

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

gnuplot-gui.el

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ This alist is formed at load time by appending together
805805
gnuplot-gui-test-type))
806806

807807

808+
;;;###autoload
808809
(defun gnuplot-gui-swap-simple-complete ()
809810
(interactive)
810811
(setq gnuplot-gui-plot-splot-fit-style
@@ -826,6 +827,7 @@ This alist is formed at load time by appending together
826827

827828
;;; user interface to the widget-y stuff
828829

830+
;;;###autoload
829831
(defun gnuplot-gui-mouse-set (event)
830832
"Use the mouse to begin setting options using a GUI interface.
831833
EVENT is a mouse event. Bound to \\[gnuplot-gui-mouse-set]
@@ -842,6 +844,7 @@ currently supported."
842844
(defun gnuplot-gui-set-frame-param (param value)
843845
(setcdr (assoc param gnuplot-gui-frame-parameters) value))
844846

847+
;;;###autoload
845848
(defun gnuplot-gui-set-options-and-insert ()
846849
"Insert arguments using a GUI interface.
847850
Determine contents of current line and set up the appropriate GUI
@@ -923,6 +926,7 @@ Note that \"cntrparam\" is not currently supported."
923926
(message
924927
"%S is not a gnuplot command which takes options" w)))) )))
925928

929+
;;;###autoload
926930
(defun gnuplot-gui-toggle-popup ()
927931
(interactive)
928932
(setq gnuplot-gui-popup-flag (not gnuplot-gui-popup-flag))

gnuplot.el

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -837,18 +837,16 @@ create a `gnuplot-mode' buffer."
837837
(boolean :tag "Enabled" t)))))
838838

839839

840-
(defvar gnuplot-gui-popup-flag)
841-
(defvar gnuplot-insertions-bottom ()
840+
(defvar gnuplot-insertions-bottom
841+
'("---"
842+
["Display of info with insertion" gnuplot-toggle-info-display
843+
:style toggle :selected gnuplot-insertions-show-help-flag]
844+
["Display GUI popup with insertion" gnuplot-gui-toggle-popup
845+
:active t
846+
:style toggle :selected gnuplot-gui-popup-flag])
842847
"Bottom part of the insertions menu.
843848
This part contains the toggle buttons for displaying info or
844849
opening an argument-setting popup.")
845-
(setq gnuplot-insertions-bottom
846-
'("---"
847-
["Display of info with insertion" gnuplot-toggle-info-display
848-
:style toggle :selected gnuplot-insertions-show-help-flag]
849-
["Display GUI popup with insertion" gnuplot-gui-toggle-popup
850-
:active t
851-
:style toggle :selected gnuplot-gui-popup-flag]))
852850

853851
(defun gnuplot-setup-menubar ()
854852
"Initial setup of gnuplot and insertions menus."
@@ -2130,7 +2128,8 @@ shown."
21302128
(setq topic (downcase (match-string 2 string))
21312129
term (match-string 4 string))
21322130
(if (string= topic "terminal") (setq topic (downcase term)))))
2133-
(cond (gnuplot-gui-popup-flag
2131+
(cond ((and (bound-and-true-p gnuplot-gui-popup-flag)
2132+
(fboundp 'gnuplot-gui-set-options-and-insert))
21342133
(gnuplot-gui-set-options-and-insert))
21352134
(gnuplot-insertions-show-help-flag
21362135
(if gnuplot-keywords-pending ; <HW>
@@ -2232,7 +2231,6 @@ a list:
22322231
(setq-local font-lock-multiline t)
22332232
(setq-local parse-sexp-lookup-properties t)
22342233

2235-
(require 'gnuplot-gui)
22362234
(setq gnuplot-first-call nil ; a few more details ...
22372235
gnuplot-comint-recent-buffer (current-buffer))
22382236
(setq-local comint-process-echoes gnuplot-echo-command-line-flag)

0 commit comments

Comments
 (0)