@@ -625,6 +625,8 @@ These are set by `gnuplot--set-keywords-list' from the values in
625
625
; ;; --- key bindings and menus
626
626
627
627
(defvar-keymap gnuplot-mode-map
628
+ :doc " Keymap used by `gnuplot-mode' ."
629
+ :parent prog-mode-map
628
630
" C-c C-b" #'gnuplot-send-buffer-to-gnuplot
629
631
" C-c C-o" #'gnuplot-gui-set-options-and-insert
630
632
" C-c C-e" #'gnuplot-show-comint-buffer
@@ -643,8 +645,6 @@ These are set by `gnuplot--set-keywords-list' from the values in
643
645
" M-TAB" #'completion-at-point
644
646
" S-<mouse-2>" #'gnuplot-gui-set-options-and-insert )
645
647
646
- (defvar gnuplot-mode-menu nil )
647
-
648
648
(defvar gnuplot--display-options-menu
649
649
(cl-flet ((make-image-setter (type)
650
650
`[,(concat (upcase type) " images" )
@@ -666,7 +666,8 @@ These are set by `gnuplot--set-keywords-list' from the values in
666
666
,@(mapcar #'make-image-setter (list " png" " jpeg" " svg" ))
667
667
[" Other image type..." gnuplot-set-image-format])))
668
668
669
- (defvar gnuplot--menu
669
+ (easy-menu-define gnuplot-mode-menu gnuplot-mode-map
670
+ " Menu used in `gnuplot-mode' ."
670
671
`(" Gnuplot"
671
672
[" Send line to gnuplot" gnuplot-send-line-to-gnuplot t]
672
673
[" Send line & move forward" gnuplot-send-line-and-forward (not (eobp ))]
@@ -698,8 +699,7 @@ These are set by `gnuplot--set-keywords-list' from the values in
698
699
" ---"
699
700
[" Customize gnuplot" gnuplot-customize t]
700
701
" ---"
701
- [" Kill gnuplot" gnuplot-kill-comint-buffer t])
702
- " Menu for `gnuplot-mode' ." )
702
+ [" Kill gnuplot" gnuplot-kill-comint-buffer t]))
703
703
704
704
705
705
; ;; --- syntax colorization, syntax table
@@ -1156,8 +1156,22 @@ this function is attached to `gnuplot-after-plot-hook'"
1156
1156
1157
1157
; ;; --- functions controlling the gnuplot process
1158
1158
1159
- ; ; Menu for the comint-mode buffer
1160
- (defvar gnuplot--comint-menu
1159
+ (defvar-keymap gnuplot-comint-mode-map
1160
+ :doc " Keymap used by `gnuplot-comint-mode' ."
1161
+ :parent comint-mode-map
1162
+ " C-M-p" #'gnuplot-plot-from-comint
1163
+ " C-M-f" #'gnuplot-save-and-plot-from-comint
1164
+ " C-d" #'gnuplot-delchar-or-maybe-eof
1165
+ " M-TAB" #'completion-at-point
1166
+ " C-c C-d" #'gnuplot-info-lookup-symbol
1167
+ " C-c C-i" #'gnuplot-insert-filename
1168
+ " C-c C-n" #'gnuplot-negate-option
1169
+ " C-c C-z" #'gnuplot-customize
1170
+ " C-c C-e" #'gnuplot-pop-to-recent-buffer )
1171
+
1172
+ (easy-menu-define
1173
+ gnuplot-comint-mode-menu gnuplot-comint-mode-map
1174
+ " Menu used in `gnuplot-comint-mode' ."
1161
1175
`(" Gnuplot"
1162
1176
[" Plot most recent gnuplot buffer" gnuplot-plot-from-comint
1163
1177
(buffer-live-p gnuplot--comint-recent-buffer)]
@@ -1209,27 +1223,7 @@ buffer."
1209
1223
(add-hook 'comint-output-filter-functions
1210
1224
#'gnuplot--protect-prompt-fn
1211
1225
nil t )
1212
- (add-hook 'completion-at-point-functions #'gnuplot-completion-at-point-info-look nil t )
1213
-
1214
- ; ; Set up menu (see below)
1215
- (easy-menu-define
1216
- gnuplot-comint-mode-menu gnuplot-comint-mode-map " Menu used in gnuplot-comint-mode"
1217
- gnuplot--comint-menu))
1218
-
1219
- ; ; Key bindings for gnuplot-comint-mode
1220
- (define-key gnuplot-comint-mode-map " \M -\C -p" #'gnuplot-plot-from-comint )
1221
- (define-key gnuplot-comint-mode-map " \M -\C -f" #'gnuplot-save-and-plot-from-comint )
1222
- (define-key gnuplot-comint-mode-map " \C -d" #'gnuplot-delchar-or-maybe-eof )
1223
- (define-key gnuplot-comint-mode-map " \M -\t " #'completion-at-point )
1224
- (define-key gnuplot-comint-mode-map " \C -c\C -d" #'gnuplot-info-lookup-symbol )
1225
- (define-key gnuplot-comint-mode-map " \C -c\C -i" #'gnuplot-insert-filename )
1226
- (define-key gnuplot-comint-mode-map " \C -c\C -n" #'gnuplot-negate-option )
1227
- (define-key gnuplot-comint-mode-map " \C -c\C -z" #'gnuplot-customize )
1228
- (define-key gnuplot-comint-mode-map " \C -c\C -e" #'gnuplot-pop-to-recent-buffer )
1229
-
1230
- ; ; Menu for gnuplot-comint-mode
1231
- (defvar gnuplot-comint-mode-menu nil
1232
- " Menu for `gnuplot-comint-mode' ." )
1226
+ (add-hook 'completion-at-point-functions #'gnuplot-completion-at-point-info-look nil t ))
1233
1227
1234
1228
(defun gnuplot--make-comint-buffer ()
1235
1229
" Switch to the gnuplot program buffer or create one if none exists."
@@ -1779,29 +1773,25 @@ shown."
1779
1773
" Help will be displayed after insertions."
1780
1774
" Help no longer displayed after insertions." )))
1781
1775
1782
- (defun gnuplot--setup-menubar ()
1783
- " Initial setup of gnuplot and insertions menus."
1784
- (unless gnuplot-mode-menu
1785
- (when gnuplot-insertions-menu-flag
1786
- (easy-menu-define gnuplot--insertions-menu gnuplot-mode-map
1787
- " Insertions menu used in Gnuplot-mode"
1788
- `(" Insertions"
1789
- ,@gnuplot-insertions-top
1790
- , gnuplot-insertions-adornments
1791
- , gnuplot-insertions-plot-options
1792
- , gnuplot-insertions-terminal
1793
- , gnuplot-insertions-x-axis
1794
- , gnuplot-insertions-y-axis
1795
- , gnuplot-insertions-z-axis
1796
- , gnuplot-insertions-x2-axis
1797
- , gnuplot-insertions-y2-axis
1798
- , gnuplot-insertions-parametric-plots
1799
- , gnuplot-insertions-polar-plots
1800
- , gnuplot-insertions-surface-plots
1801
- ,@gnuplot-insertions-bottom )))
1802
- (easy-menu-define ; set up gnuplot menu
1803
- gnuplot-mode-menu gnuplot-mode-map " Menu used in gnuplot-mode"
1804
- gnuplot--menu)))
1776
+ (defun gnuplot--setup-insertions-menu ()
1777
+ " Initial setup of insertions menu."
1778
+ (when (and gnuplot-insertions-menu-flag (not gnuplot--insertions-menu))
1779
+ (easy-menu-define gnuplot--insertions-menu gnuplot-mode-map
1780
+ " Insertions menu used in Gnuplot-mode"
1781
+ `(" Insertions"
1782
+ ,@gnuplot-insertions-top
1783
+ , gnuplot-insertions-adornments
1784
+ , gnuplot-insertions-plot-options
1785
+ , gnuplot-insertions-terminal
1786
+ , gnuplot-insertions-x-axis
1787
+ , gnuplot-insertions-y-axis
1788
+ , gnuplot-insertions-z-axis
1789
+ , gnuplot-insertions-x2-axis
1790
+ , gnuplot-insertions-y2-axis
1791
+ , gnuplot-insertions-parametric-plots
1792
+ , gnuplot-insertions-polar-plots
1793
+ , gnuplot-insertions-surface-plots
1794
+ ,@gnuplot-insertions-bottom ))))
1805
1795
1806
1796
(defun gnuplot--mark-active ()
1807
1797
" Return non-nil if the mark is active and it is not equal to point."
@@ -1866,7 +1856,7 @@ a list:
1866
1856
(add-hook 'syntax-propertize-extend-region-functions
1867
1857
#'gnuplot--syntax-propertize-extend-region nil t )
1868
1858
(setq gnuplot--comint-recent-buffer (current-buffer ))
1869
- (gnuplot--setup-menubar ))
1859
+ (gnuplot--setup-insertions-menu ))
1870
1860
1871
1861
;;;### autoload
1872
1862
(defun gnuplot-make-buffer ()
0 commit comments