update packages
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
|
||||
;; Copyright (C) 1998-2000 Bruce Ravel
|
||||
|
||||
;; Author: Bruce Ravel <ravel@phys.washington.edu>
|
||||
;; URL: https://github.com/emacs-gnuplot/gnuplot
|
||||
;; Author: Bruce Ravel <ravel@phys.washington.edu>
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
@@ -21,21 +20,16 @@
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
|
||||
;; This file provides a graphical user interface to setting arguments
|
||||
;; to gnuplot commands. Positioning point near a command and invoking
|
||||
;; `gnuplot-gui-set-options-and-insert' (C-c C-c or shift-mouse-2)
|
||||
;; will pop open a frame with widgets for setting the various
|
||||
;; arguments appropriate the the item that was near point. The goal
|
||||
;; is to provide point-and-click functionality to gnuplot-mode.
|
||||
;;
|
||||
;; gnuplot-gui.el was developed using GNU Emacs 25 and should be
|
||||
;; compatible with GNU Emacs 24.3 and above.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
|
||||
;;; To do:
|
||||
;;
|
||||
|
||||
;; Widgets I need:
|
||||
;; -- 'position: two or three comma separated numbers used to denote a
|
||||
;; position or a tic start/end/increment (see arrow,
|
||||
@@ -53,14 +47,11 @@
|
||||
;; overall:
|
||||
;; -- continuation lines (ugh!)
|
||||
;; -- multiple frames end up displaying same window after setting options
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'gnuplot)
|
||||
(require 'widget)
|
||||
(require 'wid-edit)
|
||||
(require 'cl-lib)
|
||||
|
||||
|
||||
;;; customizable variables
|
||||
@@ -73,7 +64,6 @@
|
||||
(defcustom gnuplot-gui-popup-flag nil
|
||||
"Non-nil means to open arguments pop-ups automatically.
|
||||
This would be done after menu insertion of Gnuplot commands."
|
||||
:group 'gnuplot-gui
|
||||
:type 'boolean)
|
||||
|
||||
(defvar gnuplot-gui-frame nil
|
||||
@@ -89,7 +79,6 @@ This would be done after menu insertion of Gnuplot commands."
|
||||
(menu-bar-lines . 0)
|
||||
(unsplittable . t))
|
||||
"Frame parameters for the input run-time display frame in Emacs."
|
||||
:group 'gnuplot-gui
|
||||
:type '(repeat (sexp :tag "Parameter:")))
|
||||
|
||||
(defcustom gnuplot-gui-fontname-list
|
||||
@@ -99,13 +88,12 @@ These *must* be quoted, like so \"\\\"Helvetica\\\"\". This allows
|
||||
for fonts with names like \"\\\"Arial Bold Italic\\\"\" to be treated
|
||||
as single entries in the menu-buttons. And it is really important that
|
||||
the first entry in the list be a blank string."
|
||||
:group 'gnuplot-gui
|
||||
:type '(repeat (string :tag "Font name:")))
|
||||
|
||||
;; some global variables
|
||||
(defvar gnuplot-current-frame nil)
|
||||
(defvar gnuplot-current-buffer nil)
|
||||
(defvar gnuplot-current-buffer-point nil)
|
||||
(defvar gnuplot-gui-current-frame nil)
|
||||
(defvar gnuplot-gui-current-buffer nil)
|
||||
(defvar gnuplot-gui-current-buffer-point nil)
|
||||
(defvar gnuplot-gui-alist nil)
|
||||
(defvar gnuplot-gui-current-string nil)
|
||||
|
||||
@@ -120,7 +108,7 @@ the first entry in the list be a blank string."
|
||||
(defsubst gnuplot-gui-type-fourth (obj) (elt obj 4))
|
||||
(defsubst gnuplot-gui-type-list (obj) (cddr obj))
|
||||
|
||||
(defun gnuplot-this-word ()
|
||||
(defun gnuplot-gui-this-word ()
|
||||
"Return the word under point."
|
||||
(let ((begin (save-excursion (beginning-of-line) (point-marker)))
|
||||
(end (save-excursion (end-of-line) (point-marker))))
|
||||
@@ -131,7 +119,6 @@ the first entry in the list be a blank string."
|
||||
(if (> (point) end) (goto-char end))
|
||||
(buffer-substring-no-properties begin (point)))))
|
||||
|
||||
|
||||
|
||||
;;; data structures containing regarding options in Gnuplot 3.7
|
||||
|
||||
@@ -279,7 +266,7 @@ See the doc-string for `gnuplot-gui-all-types'.")
|
||||
'(("POINTSIZE" 'number " ")
|
||||
("LINEWIDTH" 'number " ")
|
||||
("INTERVAL " 'number " ")))
|
||||
(cons "vgagl" ; for pm3d patch (also persist, raise in x11) <MT>
|
||||
(cons "vgagl" ; for pm3d patch (also persist, raise in x11)
|
||||
'(("BACKGROUND" 'position " " "background" 3)
|
||||
("INTERPOLATION" 'list " " "uniform" "interpolate")
|
||||
("DUMP" 'file " ")
|
||||
@@ -443,7 +430,7 @@ See the doc-string for `gnuplot-gui-all-types'.")
|
||||
(cons "mx2tics" gnuplot-gui-mtics-list)
|
||||
(cons "my2tics" gnuplot-gui-mtics-list)
|
||||
|
||||
; pm3d additions <MT>
|
||||
; pm3d additions
|
||||
(cons "mouse"
|
||||
'(("DOUBLECLICK" 'number " " "doubleclick")
|
||||
("ZOOM" 'list " " "zoomcoordinates" "nozoomcoordinates")
|
||||
@@ -594,18 +581,15 @@ See the doc-string for `gnuplot-gui-all-types'.")
|
||||
'(("INITIAL FILE" 'file " " t)
|
||||
("UPDATED FILE" 'file " " t))) ))
|
||||
|
||||
|
||||
(defcustom gnuplot-gui-plot-splot-fit-style 'simple
|
||||
"Control the complexity of the GUI display for plot, splot, and fit.
|
||||
The values are \\='simple, which causes a limited set of plot, splot, or
|
||||
fit options to be displayed, and \\='complete, which attempts to display
|
||||
all options. The \\='complete setting is prone to making errors when
|
||||
parsing values already in the script buffer."
|
||||
:group 'gnuplot-gui
|
||||
:type '(radio (const :tag "Simple listing" simple)
|
||||
(const :tag "Complete listing" complete)))
|
||||
|
||||
|
||||
(defconst gnuplot-gui-plot-simple-list
|
||||
'(("X RANGE" 'range (" " . " ") ":")
|
||||
("Y RANGE" 'range (" " . " ") ":")
|
||||
@@ -708,7 +692,6 @@ See the doc-string for `gnuplot-gui-all-types'.")
|
||||
gnuplot-gui-fit-full-list
|
||||
gnuplot-gui-fit-simple-list))) )
|
||||
|
||||
|
||||
(defvar gnuplot-gui-test-type nil)
|
||||
(setq gnuplot-gui-test-type
|
||||
(list (cons "test"
|
||||
@@ -804,10 +787,8 @@ This alist is formed at load time by appending together
|
||||
gnuplot-gui-plot-splot-fit
|
||||
gnuplot-gui-test-type))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun gnuplot-gui-swap-simple-complete ()
|
||||
(interactive)
|
||||
(interactive nil gnuplot-mode)
|
||||
(setq gnuplot-gui-plot-splot-fit-style
|
||||
(if (equal gnuplot-gui-plot-splot-fit-style 'complete)
|
||||
'simple 'complete))
|
||||
@@ -822,124 +803,110 @@ This alist is formed at load time by appending together
|
||||
(message "Using %s lists for plot, splot, and fit."
|
||||
gnuplot-gui-plot-splot-fit-style) )
|
||||
|
||||
|
||||
|
||||
|
||||
;;; user interface to the widget-y stuff
|
||||
|
||||
;;;###autoload
|
||||
(defun gnuplot-gui-mouse-set (event)
|
||||
"Use the mouse to begin setting options using a GUI interface.
|
||||
EVENT is a mouse event. Bound to \\[gnuplot-gui-mouse-set]
|
||||
Note that \"plot\", \"splot\", \"fit\", and \"cntrparam\" are not
|
||||
currently supported."
|
||||
(interactive "@e")
|
||||
(save-excursion
|
||||
(mouse-set-point event)
|
||||
(gnuplot-gui-set-options-and-insert)))
|
||||
|
||||
(defun gnuplot-gui-get-frame-param (param)
|
||||
(cdr (assoc param gnuplot-gui-frame-parameters)))
|
||||
|
||||
(defun gnuplot-gui-set-frame-param (param value)
|
||||
(setcdr (assoc param gnuplot-gui-frame-parameters) value))
|
||||
|
||||
;;;###autoload
|
||||
(defun gnuplot-gui-set-options-and-insert ()
|
||||
(defun gnuplot-gui-set-options-and-insert (&optional event)
|
||||
"Insert arguments using a GUI interface.
|
||||
Determine contents of current line and set up the appropriate GUI
|
||||
frame. Bound to \\[gnuplot-gui-set-options-and-insert]
|
||||
Note that \"cntrparam\" is not currently supported."
|
||||
(interactive)
|
||||
(let ((begin (gnuplot-point-at-beginning-of-command))
|
||||
(end (save-excursion (end-of-line) (point-marker)))
|
||||
(termin (concat "\\(,\\s-*" (regexp-quote "\\") "\\|;\\)"))
|
||||
(set nil) (term nil))
|
||||
(save-excursion
|
||||
;; there can be more then one command per line
|
||||
(if (re-search-forward termin end "to_limit")
|
||||
(progn (backward-char (length (match-string 1)))
|
||||
(setq end (point-marker))))
|
||||
(goto-char begin)
|
||||
(skip-syntax-forward "-" end)
|
||||
;; various constructions are recognized here. at the end of this
|
||||
;; cond, point should be just after the word whose arguments are
|
||||
;; to be set
|
||||
(cond ((looking-at "set\\s-+")
|
||||
(setq set t)
|
||||
(goto-char (match-end 0))
|
||||
(if (looking-at "\\sw+") (goto-char (match-end 0)))
|
||||
(when (string-match "^ter" (gnuplot-this-word)) ; terminal?
|
||||
(setq term t)
|
||||
(interactive (list last-nonmenu-event) gnuplot-mode)
|
||||
(save-excursion
|
||||
(if event (mouse-set-point event))
|
||||
(let ((begin (gnuplot--point-at-beginning-of-command))
|
||||
(end (save-excursion (end-of-line) (point-marker)))
|
||||
(termin (concat "\\(,\\s-*" (regexp-quote "\\") "\\|;\\)"))
|
||||
(set nil) (term nil))
|
||||
(save-excursion
|
||||
;; there can be more then one command per line
|
||||
(when (re-search-forward termin end "to_limit")
|
||||
(backward-char (length (match-string 1)))
|
||||
(setq end (point-marker)))
|
||||
(goto-char begin)
|
||||
(skip-syntax-forward "-" end)
|
||||
;; various constructions are recognized here. at the end of this
|
||||
;; cond, point should be just after the word whose arguments are
|
||||
;; to be set
|
||||
(cond ((looking-at "set\\s-+")
|
||||
(setq set t)
|
||||
(goto-char (match-end 0))
|
||||
(if (looking-at "\\sw+") (goto-char (match-end 0)))
|
||||
(when (string-match "^ter" (gnuplot-gui-this-word)) ; terminal?
|
||||
(setq term t)
|
||||
(forward-word 1))
|
||||
(when (string-match "^\\(da\\|fu\\)" (gnuplot-gui-this-word))
|
||||
(unless (looking-at "\\s-+st")
|
||||
(insert " style") (forward-word 1))
|
||||
(forward-word 1)))
|
||||
((looking-at (concat "\\(cd\\|ca\\|lo\\|pa\\|pr\\|sa\\|u\\)"
|
||||
"\\w*"
|
||||
"[\\s-\\']"))
|
||||
(forward-word 1))
|
||||
(when (string-match "^\\(da\\|fu\\)" (gnuplot-this-word))
|
||||
(unless (looking-at "\\s-+st")
|
||||
(insert " style") (forward-word 1))
|
||||
(forward-word 1)))
|
||||
((looking-at (concat "\\(cd\\|ca\\|lo\\|pa\\|pr\\|sa\\|u\\)"
|
||||
"\\w*"
|
||||
"[\\s-\\']"))
|
||||
(forward-word 1))
|
||||
;;(goto-char (match-end 0)))
|
||||
(t
|
||||
(forward-word 1)))
|
||||
(if (> (point) end) (goto-char end))
|
||||
(let* ((w (gnuplot-this-word))
|
||||
(wd (try-completion w gnuplot-gui-all-types))
|
||||
(word "") wrd list)
|
||||
(cond ((equal wd t) (setq word w))
|
||||
((equal wd nil) (setq word w))
|
||||
((assoc wd gnuplot-gui-all-types) (setq word wd))
|
||||
(t (setq wd nil)))
|
||||
(cond ((equal (string-match "^\\s-*$" w) 0)
|
||||
(message "Blank line"))
|
||||
((and wd (stringp word))
|
||||
(gnuplot-gui-correct-command word set term begin)
|
||||
(setq gnuplot-gui-alist nil
|
||||
gnuplot-gui-current-string
|
||||
(buffer-substring-no-properties (point) end))
|
||||
(gnuplot-gui-set-alist word gnuplot-gui-current-string)
|
||||
(let* ((old-height (gnuplot-gui-get-frame-param 'height))
|
||||
(old-top (gnuplot-gui-get-frame-param 'top)))
|
||||
(when (or
|
||||
(and (equal gnuplot-gui-plot-splot-fit-style 'complete)
|
||||
(cl-member word '("plot" "splot" "fit")
|
||||
:test 'string=))
|
||||
(equal word "test"))
|
||||
(gnuplot-gui-set-frame-param 'height 32)
|
||||
(gnuplot-gui-set-frame-param 'top 50))
|
||||
(gnuplot-gui-prompt-for-frame word)
|
||||
(when (or
|
||||
(and (equal gnuplot-gui-plot-splot-fit-style 'complete)
|
||||
(cl-member word '("plot" "splot" "fit")
|
||||
:test 'string=))
|
||||
(equal word "test"))
|
||||
(gnuplot-gui-set-frame-param 'height old-height)
|
||||
(gnuplot-gui-set-frame-param 'top old-top)) ))
|
||||
((setq wrd (car (all-completions w '(("cntrparam")))))
|
||||
(message
|
||||
"Setting arguments for %S is currently unsuported in gnuplot-mode"
|
||||
wrd))
|
||||
((setq list (all-completions w gnuplot-gui-all-types))
|
||||
(message "%S could be one of %S" w list))
|
||||
;;(goto-char (match-end 0)))
|
||||
(t
|
||||
(message
|
||||
"%S is not a gnuplot command which takes options" w)))) )))
|
||||
(forward-word 1)))
|
||||
(if (> (point) end) (goto-char end))
|
||||
(let* ((w (gnuplot-gui-this-word))
|
||||
(wd (try-completion w gnuplot-gui-all-types))
|
||||
(word "") wrd list)
|
||||
(cond ((equal wd t) (setq word w))
|
||||
((equal wd nil) (setq word w))
|
||||
((assoc wd gnuplot-gui-all-types) (setq word wd))
|
||||
(t (setq wd nil)))
|
||||
(cond ((equal (string-match "^\\s-*$" w) 0)
|
||||
(message "Blank line"))
|
||||
((and wd (stringp word))
|
||||
(gnuplot-gui-correct-command word set term begin)
|
||||
(setq gnuplot-gui-alist nil
|
||||
gnuplot-gui-current-string
|
||||
(buffer-substring-no-properties (point) end))
|
||||
(gnuplot-gui-set-alist word gnuplot-gui-current-string)
|
||||
(let* ((old-height (gnuplot-gui-get-frame-param 'height))
|
||||
(old-top (gnuplot-gui-get-frame-param 'top)))
|
||||
(when (or
|
||||
(and (equal gnuplot-gui-plot-splot-fit-style 'complete)
|
||||
(cl-member word '("plot" "splot" "fit")
|
||||
:test 'equal))
|
||||
(equal word "test"))
|
||||
(gnuplot-gui-set-frame-param 'height 32)
|
||||
(gnuplot-gui-set-frame-param 'top 50))
|
||||
(gnuplot-gui-prompt-for-frame word)
|
||||
(when (or
|
||||
(and (equal gnuplot-gui-plot-splot-fit-style 'complete)
|
||||
(cl-member word '("plot" "splot" "fit")
|
||||
:test 'equal))
|
||||
(equal word "test"))
|
||||
(gnuplot-gui-set-frame-param 'height old-height)
|
||||
(gnuplot-gui-set-frame-param 'top old-top)) ))
|
||||
((setq wrd (car (all-completions w '(("cntrparam")))))
|
||||
(message
|
||||
"Setting arguments for %S is currently unsuported in gnuplot-mode"
|
||||
wrd))
|
||||
((setq list (all-completions w gnuplot-gui-all-types))
|
||||
(message "%S could be one of %S" w list))
|
||||
(t
|
||||
(message
|
||||
"%S is not a gnuplot command which takes options" w)))) ))))
|
||||
|
||||
;;;###autoload
|
||||
(defun gnuplot-gui-toggle-popup ()
|
||||
(interactive)
|
||||
(interactive nil gnuplot-mode)
|
||||
(setq gnuplot-gui-popup-flag (not gnuplot-gui-popup-flag))
|
||||
(message (if gnuplot-gui-popup-flag
|
||||
"Argument popup will appear after insertions."
|
||||
"Argument popup will no longer appear after insertions.")))
|
||||
|
||||
|
||||
(defalias 'gnuplot-gui-y-n 'y-or-n-p)
|
||||
|
||||
(defun gnuplot-gui-correct-command (word set term begin)
|
||||
"Check syntax of set command and terminal specifications.
|
||||
WORD is the item being set. SET and TERM are non-nil if the words
|
||||
WORD is the item being set. SET and TERM are non-nil if the words
|
||||
\"set\" and \"terminal\" were found preceding WORD in the buffer.
|
||||
BEGIN is the beginning of the command."
|
||||
(save-excursion
|
||||
@@ -968,7 +935,6 @@ BEGIN is the beginning of the command."
|
||||
(insert "set "))))))
|
||||
(message nil))
|
||||
|
||||
|
||||
|
||||
;;; handle the actual arguments
|
||||
|
||||
@@ -981,21 +947,21 @@ bounding single quotes with double quotes, since double quotes are
|
||||
used in `gnuplot-gui-all-types'."
|
||||
(let (fixed-list quote quoted) ; remove blanks
|
||||
(setq list (cl-remove "\\s-+" list :test 'string-match)
|
||||
list (cl-remove "" list :test 'string=))
|
||||
list (cl-remove "" list :test 'equal))
|
||||
(while list ; concatinate parts of quoted string
|
||||
(if (not (string-match "^\\([\]\[()'\"]\\)" (car list)))
|
||||
(setq fixed-list (append fixed-list (list (car list))))
|
||||
(setq quote (match-string 1 (car list))
|
||||
quoted (car list))
|
||||
(if (string= quote "[") (setq quote "]"))
|
||||
(if (string= quote "(") (setq quote ")"))
|
||||
(if (equal quote "[") (setq quote "]"))
|
||||
(if (equal quote "(") (setq quote ")"))
|
||||
(while (and list
|
||||
(or (equal (length quoted) 1)
|
||||
(not (string-match (concat (regexp-quote quote) "$")
|
||||
quoted))))
|
||||
(setq quoted (concat quoted " " (cadr list))
|
||||
list (cdr list)))
|
||||
(if (string= quote "'")
|
||||
(if (equal quote "'")
|
||||
(setq quoted (concat "\"" (substring quoted 1))
|
||||
quoted (concat (substring quoted 0 -1) "\"")))
|
||||
(setq fixed-list (append fixed-list (list quoted))))
|
||||
@@ -1035,12 +1001,12 @@ arguments."
|
||||
((cl-member symbol '(list list*) :test 'equal)
|
||||
(let* ((case-fold-search nil)
|
||||
(match-cons (cl-member (concat "^" (car temp-list))
|
||||
values :test 'string-match)))
|
||||
values :test 'string-match)))
|
||||
(if (and (car match-cons) ; " " may be first elem. of list
|
||||
(not (string= " " (car match-cons))))
|
||||
(not (equal " " (car match-cons))))
|
||||
(setq this-cons (cons tag (car match-cons))
|
||||
arg-list (cl-remove (car temp-list) arg-list
|
||||
:test 'string= :count 1)
|
||||
:test 'equal :count 1)
|
||||
temp-list nil)
|
||||
(setq temp-list (cdr temp-list)))))
|
||||
;; ---------------------------- tag (first number in list)
|
||||
@@ -1057,26 +1023,26 @@ arguments."
|
||||
(setq temp-list (cdr temp-list))) )
|
||||
;; ---------------------------- number with prefix
|
||||
((equal symbol 'number)
|
||||
(cond ((and (string= prefix (car temp-list))
|
||||
(cond ((and (equal prefix (car temp-list))
|
||||
(string-match "^[-0-9.]+$" (cadr temp-list)))
|
||||
(setq this-cons (cons tag (cadr temp-list))
|
||||
arg-list (cl-remove (car temp-list) arg-list
|
||||
:test 'string= :count 1)
|
||||
:test 'equal :count 1)
|
||||
arg-list (cl-remove (cadr temp-list) arg-list
|
||||
:test 'string= :count 1)
|
||||
:test 'equal :count 1)
|
||||
temp-list nil))
|
||||
;; --------------------- number without prefix
|
||||
((and (not prefix)
|
||||
(string-match "^[-0-9.]+$" (car temp-list)))
|
||||
(setq this-cons (cons tag (car temp-list))
|
||||
arg-list (cl-remove (car temp-list) arg-list
|
||||
:test 'string= :count 1)
|
||||
:test 'equal :count 1)
|
||||
temp-list nil))
|
||||
(t
|
||||
(setq temp-list (cdr temp-list)))))
|
||||
;; ---------------------------- pair with prefix
|
||||
((equal symbol 'pair)
|
||||
(if (and (string= prefix (car temp-list))
|
||||
(if (and (equal prefix (car temp-list))
|
||||
(string-match "^[-0-9.]+$" (cadr temp-list)))
|
||||
(let ((this-car (cadr temp-list))
|
||||
(this-cdr (if (string-match "^[-0-9.]+$" (cl-caddr temp-list))
|
||||
@@ -1096,7 +1062,7 @@ arguments."
|
||||
(cons tag (cons (match-string 1 (car temp-list))
|
||||
(match-string 2 (car temp-list))))
|
||||
arg-list (cl-remove (car temp-list) arg-list
|
||||
:test 'string= :count 1)
|
||||
:test 'equal :count 1)
|
||||
temp-list nil)
|
||||
(setq temp-list (cdr temp-list)) ))
|
||||
;; ---------------------------- labels
|
||||
@@ -1106,7 +1072,7 @@ arguments."
|
||||
")") ; closing paren
|
||||
(car temp-list))
|
||||
(let* ((list (split-string (car temp-list) "[ \t(),]+"))
|
||||
(list (cl-remove "" list :test 'string=))
|
||||
(list (cl-remove "" list :test 'equal))
|
||||
(return ()))
|
||||
(while list
|
||||
(if (string-match "['\"]\\([^'\"]*\\)['\"]" (car list))
|
||||
@@ -1118,7 +1084,7 @@ arguments."
|
||||
(setq list (cdr list)) )
|
||||
(setq this-cons (cons tag return)
|
||||
arg-list (cl-remove (car temp-list) arg-list
|
||||
:test 'string= :count 1)
|
||||
:test 'equal :count 1)
|
||||
temp-list nil))
|
||||
(setq temp-list (cdr temp-list))) )
|
||||
;; ---------------------------- string, file, format
|
||||
@@ -1129,17 +1095,17 @@ arguments."
|
||||
(car temp-list))
|
||||
(setq this-cons (cons tag (match-string 0 (car temp-list)))
|
||||
arg-list (cl-remove (car temp-list) arg-list
|
||||
:test 'string= :count 1)
|
||||
:test 'equal :count 1)
|
||||
temp-list nil)
|
||||
(setq temp-list (cdr temp-list)) ))
|
||||
;; ---------------------------- string*
|
||||
((equal symbol 'string*)
|
||||
(if (string= prefix (car temp-list))
|
||||
(if (equal prefix (car temp-list))
|
||||
(setq this-cons (cons tag (cadr temp-list))
|
||||
arg-list (cl-remove (car temp-list) arg-list
|
||||
:test 'string= :count 1)
|
||||
:test 'equal :count 1)
|
||||
arg-list (cl-remove (cadr temp-list) arg-list
|
||||
:test 'string= :count 1)
|
||||
:test 'equal :count 1)
|
||||
temp-list nil)
|
||||
(setq temp-list (cdr temp-list)) ) )
|
||||
;; ---------------------------- other or unknown
|
||||
@@ -1149,7 +1115,6 @@ arguments."
|
||||
(append gnuplot-gui-alist (list this-cons))))
|
||||
(setq alist (cdr alist))) ))
|
||||
|
||||
|
||||
(defun gnuplot-gui-post-process-alist (type)
|
||||
"A few types need some additional processing.
|
||||
\\='range, \\='pair, and \\='labels are cons or list valued and need to b made
|
||||
@@ -1205,20 +1170,22 @@ into the buffer. TYPE is the object whose arguments are being set."
|
||||
(gnuplot-gui-make-frame
|
||||
option (cdr (assoc option gnuplot-gui-all-types)) save-frame) )
|
||||
|
||||
(defgroup gnuplot-gui-faces nil
|
||||
"Text faces used by `gnuplot-gui'."
|
||||
:prefix "gnuplot-gui-"
|
||||
:group 'gnuplot-gui)
|
||||
|
||||
(defface gnuplot-gui-error-face '((((class color) (background light))
|
||||
(:foreground "grey30"))
|
||||
(((class color) (background dark))
|
||||
(:foreground "grey70")))
|
||||
"Face used to display message about unknown widget types."
|
||||
:group 'gnuplot-faces)
|
||||
"Face used to display message about unknown widget types.")
|
||||
|
||||
(defface gnuplot-gui-flat-text-face '((((class color) (background light))
|
||||
(:foreground "MediumBlue"))
|
||||
(((class color) (background dark))
|
||||
(:foreground "LightSteelBlue")))
|
||||
"Face used to display message about unknown widget types."
|
||||
:group 'gnuplot-faces)
|
||||
"Face used to display message about unknown widget types.")
|
||||
|
||||
(defun gnuplot-gui-make-frame (item alist &optional save-frame)
|
||||
"Open the frame and populate it with widgets.
|
||||
@@ -1226,10 +1193,10 @@ ITEM is the object for which arguments are being set. ALIST is
|
||||
the alist of arguments for ITEM taken from `gnuplot-gui-all-types'.
|
||||
SAVE-FRAME is non-nil when the widgets are being reset."
|
||||
(unless save-frame
|
||||
(setq gnuplot-current-frame (selected-frame)
|
||||
gnuplot-current-buffer (current-buffer)
|
||||
gnuplot-current-buffer-point (point-marker))
|
||||
(unless (and gnuplot-gui-frame (frame-live-p gnuplot-gui-frame))
|
||||
(setq gnuplot-gui-current-frame (selected-frame)
|
||||
gnuplot-gui-current-buffer (current-buffer)
|
||||
gnuplot-gui-current-buffer-point (point-marker))
|
||||
(unless (frame-live-p gnuplot-gui-frame)
|
||||
(setq gnuplot-gui-frame (make-frame gnuplot-gui-frame-parameters)))
|
||||
(select-frame gnuplot-gui-frame)
|
||||
;;(set-frame-position gnuplot-gui-frame 150 150) ;; so herky-jerky
|
||||
@@ -1318,16 +1285,16 @@ SAVE-FRAME is non-nil when the widgets are being reset."
|
||||
(lambda (widget &rest _ignore)
|
||||
(kill-buffer (get-buffer-create "*Gnuplot GUI*"))
|
||||
(delete-frame)
|
||||
(select-frame gnuplot-current-frame)
|
||||
(switch-to-buffer gnuplot-current-buffer)
|
||||
(goto-char gnuplot-current-buffer-point)
|
||||
(select-frame gnuplot-gui-current-frame)
|
||||
(switch-to-buffer gnuplot-gui-current-buffer)
|
||||
(goto-char gnuplot-gui-current-buffer-point)
|
||||
(gnuplot-gui-post-process-alist
|
||||
(widget-get widget :doc))
|
||||
(let ((alist gnuplot-gui-alist) marker
|
||||
(eol (save-excursion (end-of-line) (point-marker) )) )
|
||||
(if (re-search-forward ";" eol "to_limit")
|
||||
(backward-char 1))
|
||||
(delete-region gnuplot-current-buffer-point (point-marker))
|
||||
(delete-region gnuplot-gui-current-buffer-point (point-marker))
|
||||
(delete-horizontal-space)
|
||||
(setq marker (point-marker))
|
||||
(while alist
|
||||
@@ -1347,7 +1314,7 @@ SAVE-FRAME is non-nil when the widgets are being reset."
|
||||
(just-one-space))
|
||||
(forward-sexp)))
|
||||
(delete-horizontal-space)
|
||||
(if (string= "terminal" (widget-get widget :doc))
|
||||
(if (equal "terminal" (widget-get widget :doc))
|
||||
(gnuplot-gui-set-options-and-insert)) ))
|
||||
(widget-insert " ")
|
||||
(widget-create 'push-button :value "Reset"
|
||||
@@ -1383,7 +1350,7 @@ SAVE-FRAME is non-nil when the widgets are being reset."
|
||||
(setq gnuplot-gui-alist nil
|
||||
gnuplot-gui-current-string nil)
|
||||
(delete-frame)
|
||||
(select-frame gnuplot-current-frame)))
|
||||
(select-frame gnuplot-gui-current-frame)))
|
||||
(goto-char (point-min))
|
||||
(use-local-map widget-keymap)
|
||||
(widget-setup))
|
||||
@@ -1397,24 +1364,21 @@ SAVE-FRAME is non-nil when the widgets are being reset."
|
||||
(:bold t :foreground "seagreen"))
|
||||
(t
|
||||
(:italic t)))
|
||||
"Face used for menu-buttons."
|
||||
:group 'gnuplot-faces)
|
||||
"Face used for menu-buttons.")
|
||||
(defface gnuplot-gui-button-face '((((class color) (background light))
|
||||
(:bold t :foreground "sienna"))
|
||||
(((class color) (background dark))
|
||||
(:bold t :foreground "tan"))
|
||||
(t
|
||||
(:italic t)))
|
||||
"Face used for push-buttons."
|
||||
:group 'gnuplot-faces)
|
||||
"Face used for push-buttons.")
|
||||
(defface gnuplot-gui-labels-face '((((class color) (background light))
|
||||
(:bold t :foreground "darkslateblue"))
|
||||
(((class color) (background dark))
|
||||
(:bold t :foreground "lightslateblue"))
|
||||
(t
|
||||
(:italic t)))
|
||||
"Face used for insert and delete button in the labels widget."
|
||||
:group 'gnuplot-faces)
|
||||
"Face used for insert and delete button in the labels widget.")
|
||||
|
||||
(defun gnuplot-gui-menu-choice (item default list &optional starred)
|
||||
"Create a menu widget for the Gnuplot GUI.
|
||||
@@ -1433,7 +1397,7 @@ menu. STARRED is true if this a \\='list* widget."
|
||||
(concat (downcase (widget-get widget :tag)) " ")
|
||||
"" )))
|
||||
(setcdr (assoc (widget-get widget :tag) gnuplot-gui-alist)
|
||||
(if (string= (widget-value widget) " ") ""
|
||||
(if (equal (widget-value widget) " ") ""
|
||||
(format "%s%s" lab (widget-value widget))) )))
|
||||
(mapcar (lambda (x) (list 'item :value x))
|
||||
list))))
|
||||
@@ -1538,7 +1502,6 @@ prefix for the string."
|
||||
:value "format")
|
||||
(widget-insert "\n"))
|
||||
|
||||
|
||||
;; swiped from widget-color-complete
|
||||
(defun gnuplot-gui-file-completion (widget)
|
||||
"Complete the filename in WIDGET."
|
||||
@@ -1647,25 +1610,16 @@ is non-nil if this is a \\='range widget."
|
||||
(widget-insert " " (make-string (- 39 (current-column)) ?.)
|
||||
" (numeric values)\n"))
|
||||
|
||||
|
||||
;; suppress compiler warning
|
||||
;;(eval-when-compile (defun gnuplot-info-lookup-symbol (sym mode)))
|
||||
(define-widget 'gnuplot-gui-info-link 'info-link
|
||||
"A link to an info file for the Gnuplot GUI."
|
||||
:action '(lambda (widget &optional event)
|
||||
(let ((gnuplot-info-display 'frame))
|
||||
(if gnuplot-keywords-pending ; <HW>
|
||||
(gnuplot-setup-info-look))
|
||||
(when (eq gnuplot--info-keywords 'pending)
|
||||
(gnuplot--setup-info-look))
|
||||
(gnuplot-info-lookup-symbol (widget-value widget)
|
||||
'gnuplot-mode))))
|
||||
|
||||
|
||||
;;; just about done
|
||||
|
||||
(provide 'gnuplot-gui)
|
||||
|
||||
;; Local Variables:
|
||||
;; indent-tabs-mode: nil
|
||||
;; End:
|
||||
|
||||
;;; gnuplot-gui.el ends here
|
||||
|
||||
Reference in New Issue
Block a user