@@ -828,15 +828,8 @@ This alist is formed at load time by appending together
828
828
; ;; user interface to the widget-y stuff
829
829
830
830
;;;### autoload
831
- (defun gnuplot-gui-mouse-set (event )
832
- " Use the mouse to begin setting options using a GUI interface.
833
- EVENT is a mouse event. Bound to \\ [gnuplot-gui-mouse-set]
834
- Note that \" plot\" , \" splot\" , \" fit\" , and \" cntrparam\" are not
835
- currently supported."
836
- (interactive " @e" )
837
- (save-excursion
838
- (mouse-set-point event)
839
- (gnuplot-gui-set-options-and-insert)))
831
+ (define-obsolete-function-alias 'gnuplot-gui-mouse-set
832
+ #'gnuplot-gui-set-options-and-insert " 2025" )
840
833
841
834
(defun gnuplot-gui-get-frame-param (param )
842
835
(cdr (assoc param gnuplot-gui-frame-parameters)))
@@ -845,86 +838,89 @@ currently supported."
845
838
(setcdr (assoc param gnuplot-gui-frame-parameters) value))
846
839
847
840
;;;### autoload
848
- (defun gnuplot-gui-set-options-and-insert ()
841
+ (defun gnuplot-gui-set-options-and-insert (&optional event )
849
842
" Insert arguments using a GUI interface.
850
843
Determine contents of current line and set up the appropriate GUI
851
844
frame. Bound to \\ [gnuplot-gui-set-options-and-insert]
852
845
Note that \" cntrparam\" is not currently supported."
853
846
(interactive )
854
- (let ((begin (gnuplot-point-at-beginning-of-command))
855
- (end (save-excursion (end-of-line ) (point-marker )))
856
- (termin (concat " \\ (,\\ s-*" (regexp-quote " \\ " ) " \\ |;\\ )" ))
857
- (set nil ) (term nil ))
858
- (save-excursion
859
- ; ; there can be more then one command per line
860
- (if (re-search-forward termin end " to_limit" )
861
- (progn (backward-char (length (match-string 1 )))
862
- (setq end (point-marker ))))
863
- (goto-char begin)
864
- (skip-syntax-forward " -" end)
865
- ; ; various constructions are recognized here. at the end of this
866
- ; ; cond, point should be just after the word whose arguments are
867
- ; ; to be set
868
- (cond ((looking-at " set\\ s-+" )
869
- (setq set t )
870
- (goto-char (match-end 0 ))
871
- (if (looking-at " \\ sw+" ) (goto-char (match-end 0 )))
872
- (when (string-match " ^ter" (gnuplot-this-word)) ; terminal?
873
- (setq term t )
847
+ (interactive (list last-nonmenu-event))
848
+ (save-excursion
849
+ (if event (mouse-set-point event))
850
+ (let ((begin (gnuplot-point-at-beginning-of-command))
851
+ (end (save-excursion (end-of-line ) (point-marker )))
852
+ (termin (concat " \\ (,\\ s-*" (regexp-quote " \\ " ) " \\ |;\\ )" ))
853
+ (set nil ) (term nil ))
854
+ (save-excursion
855
+ ; ; there can be more then one command per line
856
+ (if (re-search-forward termin end " to_limit" )
857
+ (progn (backward-char (length (match-string 1 )))
858
+ (setq end (point-marker ))))
859
+ (goto-char begin)
860
+ (skip-syntax-forward " -" end)
861
+ ; ; various constructions are recognized here. at the end of this
862
+ ; ; cond, point should be just after the word whose arguments are
863
+ ; ; to be set
864
+ (cond ((looking-at " set\\ s-+" )
865
+ (setq set t )
866
+ (goto-char (match-end 0 ))
867
+ (if (looking-at " \\ sw+" ) (goto-char (match-end 0 )))
868
+ (when (string-match " ^ter" (gnuplot-this-word)) ; terminal?
869
+ (setq term t )
870
+ (forward-word 1 ))
871
+ (when (string-match " ^\\ (da\\ |fu\\ )" (gnuplot-this-word))
872
+ (unless (looking-at " \\ s-+st" )
873
+ (insert " style" ) (forward-word 1 ))
874
+ (forward-word 1 )))
875
+ ((looking-at (concat " \\ (cd\\ |ca\\ |lo\\ |pa\\ |pr\\ |sa\\ |u\\ )"
876
+ " \\ w*"
877
+ " [\\ s-\\ ']" ))
874
878
(forward-word 1 ))
875
- (when (string-match " ^\\ (da\\ |fu\\ )" (gnuplot-this-word))
876
- (unless (looking-at " \\ s-+st" )
877
- (insert " style" ) (forward-word 1 ))
878
- (forward-word 1 )))
879
- ((looking-at (concat " \\ (cd\\ |ca\\ |lo\\ |pa\\ |pr\\ |sa\\ |u\\ )"
880
- " \\ w*"
881
- " [\\ s-\\ ']" ))
882
- (forward-word 1 ))
883
- ; ;(goto-char (match-end 0)))
884
- (t
885
- (forward-word 1 )))
886
- (if (> (point ) end) (goto-char end))
887
- (let* ((w (gnuplot-this-word))
888
- (wd (try-completion w gnuplot-gui-all-types))
889
- (word " " ) wrd list )
890
- (cond ((equal wd t ) (setq word w))
891
- ((equal wd nil ) (setq word w))
892
- ((assoc wd gnuplot-gui-all-types) (setq word wd))
893
- (t (setq wd nil )))
894
- (cond ((equal (string-match " ^\\ s-*$" w) 0 )
895
- (message " Blank line " ))
896
- ((and wd (stringp word))
897
- (gnuplot-gui-correct-command word set term begin)
898
- (setq gnuplot-gui-alist nil
899
- gnuplot-gui-current-string
900
- (buffer-substring-no-properties (point ) end))
901
- (gnuplot-gui-set-alist word gnuplot-gui-current-string)
902
- (let* ((old-height (gnuplot-gui-get-frame-param 'height ))
903
- (old-top (gnuplot-gui-get-frame-param 'top )))
904
- (when (or
905
- (and (equal gnuplot-gui-plot-splot-fit-style 'complete )
906
- (cl-member word '(" plot" " splot" " fit" )
907
- :test 'string= ))
908
- (equal word " test" ))
909
- (gnuplot-gui-set-frame-param 'height 32 )
910
- (gnuplot-gui-set-frame-param 'top 50 ))
911
- (gnuplot-gui-prompt-for-frame word)
912
- (when (or
913
- (and (equal gnuplot-gui-plot-splot-fit-style 'complete )
914
- (cl-member word '(" plot" " splot" " fit" )
915
- :test 'string= ))
916
- (equal word " test" ))
917
- (gnuplot-gui-set-frame-param 'height old-height)
918
- (gnuplot-gui-set-frame-param 'top old-top)) ))
919
- ((setq wrd (car (all-completions w '((" cntrparam" )))))
920
- (message
921
- " Setting arguments for %S is currently unsuported in gnuplot-mode"
922
- wrd))
923
- ((setq list (all-completions w gnuplot-gui-all-types))
924
- (message " %S could be one of %S " w list ))
879
+ ; ;(goto-char (match-end 0)))
925
880
(t
926
- (message
927
- " %S is not a gnuplot command which takes options" w)))) )))
881
+ (forward-word 1 )))
882
+ (if (> (point ) end) (goto-char end))
883
+ (let* ((w (gnuplot-this-word))
884
+ (wd (try-completion w gnuplot-gui-all-types))
885
+ (word " " ) wrd list )
886
+ (cond ((equal wd t ) (setq word w))
887
+ ((equal wd nil ) (setq word w))
888
+ ((assoc wd gnuplot-gui-all-types) (setq word wd))
889
+ (t (setq wd nil )))
890
+ (cond ((equal (string-match " ^\\ s-*$" w) 0 )
891
+ (message " Blank line " ))
892
+ ((and wd (stringp word))
893
+ (gnuplot-gui-correct-command word set term begin)
894
+ (setq gnuplot-gui-alist nil
895
+ gnuplot-gui-current-string
896
+ (buffer-substring-no-properties (point ) end))
897
+ (gnuplot-gui-set-alist word gnuplot-gui-current-string)
898
+ (let* ((old-height (gnuplot-gui-get-frame-param 'height ))
899
+ (old-top (gnuplot-gui-get-frame-param 'top )))
900
+ (when (or
901
+ (and (equal gnuplot-gui-plot-splot-fit-style 'complete )
902
+ (cl-member word '(" plot" " splot" " fit" )
903
+ :test 'string= ))
904
+ (equal word " test" ))
905
+ (gnuplot-gui-set-frame-param 'height 32 )
906
+ (gnuplot-gui-set-frame-param 'top 50 ))
907
+ (gnuplot-gui-prompt-for-frame word)
908
+ (when (or
909
+ (and (equal gnuplot-gui-plot-splot-fit-style 'complete )
910
+ (cl-member word '(" plot" " splot" " fit" )
911
+ :test 'string= ))
912
+ (equal word " test" ))
913
+ (gnuplot-gui-set-frame-param 'height old-height)
914
+ (gnuplot-gui-set-frame-param 'top old-top)) ))
915
+ ((setq wrd (car (all-completions w '((" cntrparam" )))))
916
+ (message
917
+ " Setting arguments for %S is currently unsuported in gnuplot-mode"
918
+ wrd))
919
+ ((setq list (all-completions w gnuplot-gui-all-types))
920
+ (message " %S could be one of %S " w list ))
921
+ (t
922
+ (message
923
+ " %S is not a gnuplot command which takes options" w)))) ))))
928
924
929
925
;;;### autoload
930
926
(defun gnuplot-gui-toggle-popup ()
0 commit comments