branch: elpa/gnuplot commit 0b246cf3062ad02121bc8ee390585ee18cac0891 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Formatting --- gnuplot-context.el | 23 +++++++++-------------- gnuplot-debug-context.el | 16 ++++++++-------- gnuplot-gui.el | 32 ++++++++++---------------------- gnuplot-test-context.el | 1 - gnuplot-tests.el | 12 ++++++------ gnuplot.el | 30 ++++-------------------------- 6 files changed, 37 insertions(+), 77 deletions(-) diff --git a/gnuplot-context.el b/gnuplot-context.el index 47d995a37d..712ac9e88d 100644 --- a/gnuplot-context.el +++ b/gnuplot-context.el @@ -253,9 +253,9 @@ (let ((str (match-string-no-properties 0))) (forward-char (length str)) (gnuplot-context--token-make :id str - :type ',token-type - :start (match-beginning 0) - :end (match-end 0)))))) + :type ',token-type + :start (match-beginning 0) + :end (match-end 0)))))) rules)))) (defun gnuplot-context--tokenize (&optional completing-p) @@ -320,7 +320,6 @@ name; otherwise continues tokenizing up to the token at point. FIXME." (nreverse tokens))) - ;;;; The pattern and grammar compiler ;; @@ -410,7 +409,6 @@ name; otherwise continues tokenizing up to the token at point. FIXME." ;; for debugging purposes. ;; - (eval-and-compile ;; Compile a single pattern into a list of instructions. Leaves ;; calls to other rules as symbolic instructions (call SYMBOL) and @@ -503,7 +501,6 @@ name; otherwise continues tokenizing up to the token at point. FIXME." (gnuplot-context--compile-pattern `(sequence ,@pat1 (many ,@pat1))))) - ;; Optional (?) ((maybe) (let* ((pat1 (cons 'sequence (cdr pat))) @@ -1651,7 +1648,6 @@ name; otherwise continues tokenizing up to the token at point. FIXME." "zzeroaxis") (maybe linestyle-spec)]) - ;;; Other commands (cd-command ["cd" string]) @@ -1715,7 +1711,6 @@ name; otherwise continues tokenizing up to the token at point. FIXME." (defmacro gnuplot-context--trace (&rest _) "No-op." '(progn nil)) (defmacro gnuplot-context--debug (&rest _) "No-op." '(progn nil)))) - ;;;; Variables to be set via pattern matching (defvar gnuplot-context--completions nil @@ -1754,7 +1749,7 @@ These have to be compiled from the Gnuplot source tree using ;;;; The pattern matching machine (defun gnuplot-context--match-pattern (instructions tokens completing-p - &optional start-symbol) + &optional start-symbol) "Parse TOKENS, setting completions, info and ElDoc information. This function parses TOKENS by simulating a stack machine with @@ -1794,11 +1789,11 @@ there." gnuplot-context--captures nil) (cl-flet ((advance - () - (pop tokens) - (if (and (null tokens) (not completing-p)) - (gnuplot-context--scan-stack stack tokens))) - (fail () (setq fail t))) + () + (pop tokens) + (if (and (null tokens) (not completing-p)) + (gnuplot-context--scan-stack stack tokens))) + (fail () (setq fail t))) ;; Main loop (while t diff --git a/gnuplot-debug-context.el b/gnuplot-debug-context.el index 3c7815fa8d..f5a0f44c66 100644 --- a/gnuplot-debug-context.el +++ b/gnuplot-debug-context.el @@ -98,14 +98,14 @@ (gnuplot-context--with-trace-buffer (insert "\n-- * capture groups: * --\n") (cl-loop for c on gnuplot-context--captures - do - (let ((name (caar c)) - (gnuplot-context--captures c)) - (insert (format "%s\t%s\n" - name - (mapconcat 'gnuplot-context--token-id - (gnuplot-context--capture-group name) - " "))))) + do + (let ((name (caar c)) + (gnuplot-context--captures c)) + (insert (format "%s\t%s\n" + name + (mapconcat 'gnuplot-context--token-id + (gnuplot-context--capture-group name) + " "))))) (insert "-- end capture groups --\n\n")))) (provide 'gnuplot-debug-context) diff --git a/gnuplot-gui.el b/gnuplot-gui.el index 0ce6f9df05..c4a607fc9b 100644 --- a/gnuplot-gui.el +++ b/gnuplot-gui.el @@ -131,7 +131,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 @@ -594,7 +593,6 @@ 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 @@ -605,7 +603,6 @@ parsing values already in the script buffer." :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 +705,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" @@ -820,8 +816,6 @@ 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 @@ -921,7 +915,6 @@ Note that \"cntrparam\" is not currently supported." "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) @@ -955,7 +948,6 @@ BEGIN is the beginning of the command." (insert "set ")))))) (message nil)) - ;;; handle the actual arguments @@ -1022,12 +1014,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)))) (setq this-cons (cons tag (car match-cons)) arg-list (cl-remove (car temp-list) arg-list - :test 'string= :count 1) + :test 'string= :count 1) temp-list nil) (setq temp-list (cdr temp-list))))) ;; ---------------------------- tag (first number in list) @@ -1048,16 +1040,16 @@ arguments." (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 'string= :count 1) arg-list (cl-remove (cadr temp-list) arg-list - :test 'string= :count 1) + :test 'string= :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 'string= :count 1) temp-list nil)) (t (setq temp-list (cdr temp-list))))) @@ -1083,7 +1075,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 'string= :count 1) temp-list nil) (setq temp-list (cdr temp-list)) )) ;; ---------------------------- labels @@ -1105,7 +1097,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 'string= :count 1) temp-list nil)) (setq temp-list (cdr temp-list))) ) ;; ---------------------------- string, file, format @@ -1116,7 +1108,7 @@ 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 'string= :count 1) temp-list nil) (setq temp-list (cdr temp-list)) )) ;; ---------------------------- string* @@ -1124,9 +1116,9 @@ arguments." (if (string= 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 'string= :count 1) arg-list (cl-remove (cadr temp-list) arg-list - :test 'string= :count 1) + :test 'string= :count 1) temp-list nil) (setq temp-list (cdr temp-list)) ) ) ;; ---------------------------- other or unknown @@ -1136,7 +1128,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 @@ -1192,7 +1183,6 @@ 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) ) - (defface gnuplot-gui-error-face '((((class color) (background light)) (:foreground "grey30")) (((class color) (background dark)) @@ -1525,7 +1515,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." @@ -1634,7 +1623,6 @@ 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 diff --git a/gnuplot-test-context.el b/gnuplot-test-context.el index 7b3f55a8a6..210cb59e39 100644 --- a/gnuplot-test-context.el +++ b/gnuplot-test-context.el @@ -327,7 +327,6 @@ ("cntrparam levels 10") ("cntrparam levels incremental 100,50"))) - ;; ;; test by parsing all the demos from the Gnuplot source tree diff --git a/gnuplot-tests.el b/gnuplot-tests.el index 5e9ec08ef7..6fd7c57a3c 100644 --- a/gnuplot-tests.el +++ b/gnuplot-tests.el @@ -66,8 +66,8 @@ string-literal in multiple different contexts, as determined by `(ert-deftest ,name () ,string ,@(cl-loop for context in gnuplot-string-test-contexts - collect - `(should (gnuplot-test-string-in-context ,string ,context))))) + collect + `(should (gnuplot-test-string-in-context ,string ,context))))) ;;;; Tests for double-quoted strings @@ -201,11 +201,11 @@ comment (syntax-propertize (point-max)) (goto-char (1+ start)) (cl-flet ((in-comment-p (position) - (nth 4 (syntax-ppss position)))) + (nth 4 (syntax-ppss position)))) (and (not (in-comment-p start)) (cl-loop for position from (1+ start) upto end - always (in-comment-p position)) + always (in-comment-p position)) (or (= end (point-max)) (not (in-comment-p (1+ end)))))))))) @@ -219,8 +219,8 @@ string-literal in multiple different contexts, as determined by `(ert-deftest ,name () ,comment ,@(cl-loop for context in gnuplot-comment-test-contexts - collect - `(should (gnuplot-test-comment-in-context ,comment ,context))))) + collect + `(should (gnuplot-test-comment-in-context ,comment ,context))))) (gnuplot-test-comment gnuplot-comment-simple "# a simple one-line comment") diff --git a/gnuplot.el b/gnuplot.el index c7e6e61168..1a4308e494 100644 --- a/gnuplot.el +++ b/gnuplot.el @@ -43,7 +43,6 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Acknowledgements: ;; David Batty <DB> (numerous corrections) @@ -370,10 +369,10 @@ non-nil." (defvar gnuplot-display-options-menu (cl-flet ((make-image-setter (type) - `[,(concat (upcase type) " images") - (lambda () (interactive) (gnuplot-set-image-format ,type)) - :style toggle - :selected (eq gnuplot-image-format ,type)])) + `[,(concat (upcase type) " images") + (lambda () (interactive) (gnuplot-set-image-format ,type)) + :style toggle + :selected (eq gnuplot-image-format ,type)])) `("Display plot output" ["Externally" gnuplot-external-display-mode :style toggle @@ -424,7 +423,6 @@ non-nil." ["Kill gnuplot" gnuplot-kill-gnuplot-buffer t]) "Menu for `gnuplot-mode'.") - ;;; --- insertions variables and menus @@ -514,8 +512,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - - (defcustom gnuplot-insertions-plot-options '("plot options" ["autoscale" (gnuplot-insert "set autoscale ") t] @@ -542,7 +538,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - (defcustom gnuplot-insertions-terminal '("terminal" ["eepic" (gnuplot-insert "set terminal eepic") t] @@ -573,7 +568,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - (defcustom gnuplot-insertions-x-axis '("x-axis" ["xdata" (gnuplot-insert "set xdata ") t] @@ -596,7 +590,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - (defcustom gnuplot-insertions-x2-axis '("x2-axis" ["x2data" (gnuplot-insert "set xdata ") t] @@ -619,7 +612,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - (defcustom gnuplot-insertions-y-axis '("y-axis" ["ydata" (gnuplot-insert "set ydata ") t] @@ -664,8 +656,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - - (defcustom gnuplot-insertions-z-axis '("z-axis" ["zdata" (gnuplot-insert "set zdata ") t] @@ -687,7 +677,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - (defcustom gnuplot-insertions-parametric-plots '("parametric plots" ["parametric" (gnuplot-insert "set parametric") t] @@ -708,7 +697,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - (defcustom gnuplot-insertions-polar-plots '("polar plots" ["polar" (gnuplot-insert "set polar") t] @@ -726,7 +714,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - (defcustom gnuplot-insertions-surface-plots '("surface plots" ["clabel" (gnuplot-insert "set clabel ") t] @@ -749,7 +736,6 @@ create a `gnuplot-mode' buffer." (function :tag "Callback") (boolean :tag "Enabled" t))))) - (defvar gnuplot-insertions-bottom '("---" ["Display of info with insertion" gnuplot-toggle-info-display @@ -924,7 +910,6 @@ These are highlighted using `font-lock-constant-face'.") (0 'font-lock-constant-face)) ("!.*$" (0 'font-lock-constant-face)))) - (defvar gnuplot-font-lock-defaults '(gnuplot-font-lock-keywords nil ; Use syntactic fontification @@ -1319,7 +1304,6 @@ buffer." ;; Set up completion, using completion-at-point (add-hook 'completion-at-point-functions #'gnuplot-completion-at-point nil t) - ;; Set up menu (see below) (easy-menu-define gnuplot-comint-mode-menu gnuplot-comint-mode-map "Menu used in gnuplot-comint-mode" @@ -1406,7 +1390,6 @@ This is very similar to `comint-delchar-or-maybe-eof'." (setq gnuplot-process nil gnuplot-buffer nil)) - (defun gnuplot-show-gnuplot-buffer () "Switch to the buffer containing the gnuplot process. When `gnuplot-display-process' is nil this will switch to @@ -1545,7 +1528,6 @@ then removes itself from `comint-preoutput-filter-functions'." #'gnuplot--discard-output t)))) "") - ;;; --- miscellaneous functions: insert file name, indentation, negation @@ -1560,7 +1542,6 @@ Bound to \\[gnuplot-insert-filename]" default-directory) gnuplot-quote-character)) - ;; Adjust indentation for the line containing point (defun gnuplot-indent-line () "Set indentation in gnuplot buffer. @@ -1750,17 +1731,14 @@ Negatable options are defined in `gnuplot-keywords-negatable-options'." (message "There is not a negatable set option on this line"))) (message "There is not a set option on this line"))))) - (defun gnuplot-customize () "Customize `gnuplot-mode'." (interactive) (customize-group "gnuplot")) - ;;; --- help from the info file, keyword list + completion, insert function - ;; set up stuff for info-look (as suggested by <SE>) ;; modified with suggestion from <MS> (defun gnuplot--setup-info-look ()