branch: elpa/gnuplot commit 437108f488bdb49f2babe45c9094e06b016863f8 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
gnuplot-gui/gnuplot-context: Make more symbols private/respect namespaces --- gnuplot-context.el | 64 ++++++++++++++++++++++++------------------------ gnuplot-debug-context.el | 20 +++++++-------- gnuplot-gui.el | 30 +++++++++++------------ 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/gnuplot-context.el b/gnuplot-context.el index a305c3c3df..c0c9d570b9 100644 --- a/gnuplot-context.el +++ b/gnuplot-context.el @@ -790,7 +790,7 @@ name; otherwise continues tokenizing up to the token at point. FIXME." plot-body]) (splot-command - [ ;; This capturing group lets `gnuplot-find-using-eldoc' know + [ ;; This capturing group lets `gnuplot-context--find-using-eldoc' know ;; that this is an splot command (capture :splot-command (kw ("spl" . "ot"))) @@ -1007,7 +1007,7 @@ name; otherwise continues tokenizing up to the token at point. FIXME." [(kw "thru") expression]) (using-modifier - [(:eldoc gnuplot-find-using-eldoc) + [(:eldoc gnuplot-context--find-using-eldoc) (kw ("u" . "sing")) (either string @@ -1720,9 +1720,9 @@ name; otherwise continues tokenizing up to the token at point. FIXME." ;; them. For normal use, they compile to no-ops. (eval-when-compile (when (not (featurep 'gnuplot-debug-context)) - (defmacro with-gnuplot-trace-buffer (&rest _) "No-op." '(progn nil)) - (defmacro gnuplot-trace (&rest _) "No-op." '(progn nil)) - (defmacro gnuplot-debug (&rest _) "No-op." '(progn nil)))) + (defmacro gnuplot-context--with-trace-buffer (&rest _) "No-op." '(progn nil)) + (defmacro gnuplot-context--trace (&rest _) "No-op." '(progn nil)) + (defmacro gnuplot-context--debug (&rest _) "No-op." '(progn nil)))) @@ -1740,11 +1740,6 @@ Set by `gnuplot-context--match-pattern' using information from and info strings onto the stack as it runs, and scans the stack for the topmost entry when it reaches the token at point.") -(defvar gnuplot-eldoc nil - "ElDoc documentation string for the Gnuplot construction at point. - -Set by `gnuplot-context--match-pattern'. See also `gnuplot-info-at-point'.") - (defvar gnuplot-context--captures nil "Alist of named capture groups for `gnuplot-mode' completion code. @@ -1754,6 +1749,11 @@ name specified in the (capture NAME PATTERN) form in the list beginning the capture group, and END is the tail of the token list just after the end of the capture group.") +(defvar gnuplot-eldoc nil + "ElDoc documentation string for the Gnuplot construction at point. + +Set by `gnuplot-context--match-pattern'. See also `gnuplot-info-at-point'.") + (defvar gnuplot-eldoc-hash nil "ElDoc strings for `gnuplot-mode'. @@ -1789,7 +1789,7 @@ there." ;; of conses (pc . tokens) (progress '())) - (with-gnuplot-trace-buffer (erase-buffer)) + (gnuplot-context--with-trace-buffer (erase-buffer)) (when start-symbol ; HACK FIXME (let ((look-for `(label ,start-symbol))) @@ -1815,7 +1815,7 @@ there." (opcode (car inst)) (token (car tokens)) (end-of-tokens (null tokens))) - (gnuplot-trace "%s\t%s\t%s\n" pc inst (and token (gnuplot-token-id token))) + (gnuplot-context--trace "%s\t%s\t%s\n" pc inst (and token (gnuplot-token-id token))) (cl-case opcode ;; (literal LITERAL NO-COMPLETE) @@ -1824,7 +1824,7 @@ there." (no-complete (cl-caddr inst))) (cond (end-of-tokens (unless no-complete - (gnuplot-trace "\tpushing \"%s\" to completions\n" expect) + (gnuplot-context--trace "\tpushing \"%s\" to completions\n" expect) (push expect gnuplot-context--completions)) (fail)) @@ -1848,7 +1848,7 @@ there." (let ((regexp (cadr inst)) (name (cl-caddr inst))) (cond (end-of-tokens - (gnuplot-trace "\tpushing \"%s\" to completions\n" name) + (gnuplot-context--trace "\tpushing \"%s\" to completions\n" name) (push name gnuplot-context--completions) (fail)) @@ -1948,7 +1948,7 @@ there." (if (not record) (error "Gnuplot-match-tokens: no open capture group named %s" name) (setf (cl-caddr record) tokens) - (gnuplot-debug (gnuplot-dump-captures))))) + (gnuplot-context--debug (gnuplot-dump-captures))))) ;; (check-progress): make sure not stuck in an infinite loop ((check-progress) @@ -1968,8 +1968,8 @@ there." (when fail (if (not backtrack) ; Out of backtracking stack: failed match (throw 'return nil) - (gnuplot-trace "\t*fail*\t%s\n" (length backtrack)) - (gnuplot-debug (gnuplot-dump-backtrack backtrack)) + (gnuplot-context--trace "\t*fail*\t%s\n" (length backtrack)) + (gnuplot-context--debug (gnuplot-dump-backtrack backtrack)) ;; If we got as far as token-at-point before failing, ;; scan the stack for eldoc and info strings (when (and end-of-tokens (not completing-p)) @@ -1984,13 +1984,13 @@ there." gnuplot-context--captures bt-captures progress bt-progress fail nil) - (gnuplot-debug (gnuplot-dump-progress progress))))))))))) + (gnuplot-context--debug (gnuplot-dump-progress progress))))))))))) (defun gnuplot-context--scan-stack (stack tokens) "Scan STACK for the most recently pushed eldoc and info strings." - (gnuplot-trace "\t* scanning stack *\n") - (gnuplot-debug (gnuplot-backtrace stack)) - (gnuplot-debug (gnuplot-dump-captures)) + (gnuplot-context--trace "\t* scanning stack *\n") + (gnuplot-context--debug (gnuplot-backtrace stack)) + (gnuplot-context--debug (gnuplot-dump-captures)) (catch 'no-scan (while (and stack @@ -2014,20 +2014,20 @@ there." ((functionp info) (funcall info)) (t info))) (when gnuplot-info-at-point - (gnuplot-trace "\tset info to \"%s\"\n" gnuplot-info-at-point) + (gnuplot-context--trace "\tset info to \"%s\"\n" gnuplot-info-at-point) (when (and (not gnuplot-eldoc) gnuplot-eldoc-hash) (let ((eldoc (car (gethash gnuplot-info-at-point gnuplot-eldoc-hash)))) (when eldoc (setq gnuplot-eldoc eldoc) - (gnuplot-trace "\tand set eldoc to \"%s\"\n" eldoc)))))))) + (gnuplot-context--trace "\tand set eldoc to \"%s\"\n" eldoc)))))))) ((eldoc) (when (not gnuplot-eldoc) (let ((eldoc (cadr item))) (setq gnuplot-eldoc (if (functionp eldoc) (funcall eldoc) eldoc)) - (gnuplot-trace "\tset eldoc to \"%s\"\n" gnuplot-eldoc))))))) + (gnuplot-context--trace "\tset eldoc to \"%s\"\n" gnuplot-eldoc))))))) (pop stack)))) (defun gnuplot-context--capture-group (name) @@ -2087,9 +2087,9 @@ there." (info-lookup-interactive-arguments 'symbol))) (setq gnuplot-info-at-point (car info)))) (when gnuplot-info-at-point - (gnuplot--find-info-node gnuplot-info-at-point))) + (gnuplot-context--find-info-node gnuplot-info-at-point))) -(defun gnuplot--find-info-node (node) +(defun gnuplot-context--find-info-node (node) (save-window-excursion (info (format "(gnuplot)%s" node))) (gnuplot--adjust-info-display)) @@ -2100,7 +2100,7 @@ there." ;; ElDoc strings for "using" specs, which depend on other information ;; from the parsed command -(defvar gnuplot-using-eldoc +(defvar gnuplot-context--using-eldoc '(("boxerrorbars" . "x:y:ydelta{:xdelta} | x:y:ylow:yhigh{:xdelta}") ("boxes" . "x:y{:x_width}") ("boxxyerrorbars" . "x:y:xdelta:ydelta | x:y:xlow:xhigh:ylow:yhigh") @@ -2128,7 +2128,7 @@ there." ("xyerrorlines" . "x:y:xdelta:ydelta | x:y:xlow:xhigh:ylow:yhigh")) "Alist of ElDoc strings for Gnuplot \"using\" clauses in \"plot\" commands.") -(defvar gnuplot-using-3d-eldoc +(defvar gnuplot-context--using-3d-eldoc (append '(("fsteps" . "z | x:y:z") ("histeps" . "z | x:y:z") @@ -2140,10 +2140,10 @@ there." ("lines" . "z | x:y:z") ("steps" . "z | x:y:z") ("vectors" . "x:y:z:xdelta:ydelta:zdelta")) - gnuplot-using-eldoc) + gnuplot-context--using-eldoc) "Alist of ElDoc strings for Gnuplot \"using\" clauses in \"splot\" commands.") -(defun gnuplot-find-using-eldoc () +(defun gnuplot-context--find-using-eldoc () "Return ElDoc string for a Gnuplot \"using\" clause, based on plotting style. This will fail if the \"using\" clause comes before the \"with\" @@ -2155,8 +2155,8 @@ clause." (let ((with-style-string (gnuplot-token-id (car with-style)))) (setq column-description (or (and 3d-p - (cdr (assoc with-style-string gnuplot-using-3d-eldoc))) - (cdr (assoc with-style-string gnuplot-using-eldoc)) + (cdr (assoc with-style-string gnuplot-context--using-3d-eldoc))) + (cdr (assoc with-style-string gnuplot-context--using-eldoc)) "<columns>")))) (format "using %s {'format'}" column-description))) diff --git a/gnuplot-debug-context.el b/gnuplot-debug-context.el index 3978c3be4e..ab20c54dce 100644 --- a/gnuplot-debug-context.el +++ b/gnuplot-debug-context.el @@ -44,19 +44,19 @@ (load-library "gnuplot-debug-context")) (gnuplot-recompile)) -(defmacro with-gnuplot-trace-buffer (&rest body) - `(with-current-buffer (get-buffer-create "gnuplot-trace") +(defmacro gnuplot-context--with-trace-buffer (&rest body) + `(with-current-buffer (get-buffer-create "gnuplot-context-trace") ,@body)) -(defmacro gnuplot-debug (&rest args) +(defmacro gnuplot-context--debug (&rest args) `(progn ,@args)) -(defmacro gnuplot-trace (&rest args) - `(with-gnuplot-trace-buffer (insert (format ,@args)))) +(defmacro gnuplot-context--trace (&rest args) + `(gnuplot-context--with-trace-buffer (insert (format ,@args)))) (defun gnuplot-backtrace (stack) (if stack - (with-gnuplot-trace-buffer + (gnuplot-context--with-trace-buffer (insert "\n-- * backtrace: * --\n") (dolist (x stack) (insert (format "%s\n" @@ -68,7 +68,7 @@ (defun gnuplot-dump-backtrack (backtrack) (if backtrack - (with-gnuplot-trace-buffer + (gnuplot-context--with-trace-buffer (insert "\n-- * backtrack records: * --\n") (dolist (x backtrack) (insert (format "%s\t%s\n" (cl-caddr x) (gnuplot-simplify-tokens (cadr x))))) @@ -76,7 +76,7 @@ (defun gnuplot-dump-progress (progress) (if progress - (with-gnuplot-trace-buffer + (gnuplot-context--with-trace-buffer (insert "\n-- * progress records: * --\n") (dolist (x progress) (insert (format "%s\t%s\n" (car x) (gnuplot-simplify-tokens (cdr x))))) @@ -85,7 +85,7 @@ (defun gnuplot-dump-code (&optional inst) (interactive) (let ((inst (or inst gnuplot-context--compiled-grammar))) - (with-gnuplot-trace-buffer + (gnuplot-context--with-trace-buffer (insert "\n-- * compiled code: * --\n") (dotimes (i (length inst)) (insert (format "%s\t%s\n" i (aref inst i)))) @@ -95,7 +95,7 @@ (defun gnuplot-dump-captures () (interactive) (if gnuplot-context--captures - (with-gnuplot-trace-buffer + (gnuplot-context--with-trace-buffer (insert "\n-- * capture groups: * --\n") (cl-loop for c on gnuplot-context--captures do diff --git a/gnuplot-gui.el b/gnuplot-gui.el index 4bb1523bf3..3fa79aa7aa 100644 --- a/gnuplot-gui.el +++ b/gnuplot-gui.el @@ -103,9 +103,9 @@ the first entry in the list be a blank string." :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 +120,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)))) @@ -860,10 +860,10 @@ Note that \"cntrparam\" is not currently supported." (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? + (when (string-match "^ter" (gnuplot-gui-this-word)) ; terminal? (setq term t) (forward-word 1)) - (when (string-match "^\\(da\\|fu\\)" (gnuplot-this-word)) + (when (string-match "^\\(da\\|fu\\)" (gnuplot-gui-this-word)) (unless (looking-at "\\s-+st") (insert " style") (forward-word 1)) (forward-word 1))) @@ -875,7 +875,7 @@ Note that \"cntrparam\" is not currently supported." (t (forward-word 1))) (if (> (point) end) (goto-char end)) - (let* ((w (gnuplot-this-word)) + (let* ((w (gnuplot-gui-this-word)) (wd (try-completion w gnuplot-gui-all-types)) (word "") wrd list) (cond ((equal wd t) (setq word w)) @@ -1217,9 +1217,9 @@ 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)) + (setq gnuplot-gui-current-frame (selected-frame) + gnuplot-gui-current-buffer (current-buffer) + gnuplot-gui-current-buffer-point (point-marker)) (unless (and gnuplot-gui-frame (frame-live-p gnuplot-gui-frame)) (setq gnuplot-gui-frame (make-frame gnuplot-gui-frame-parameters))) (select-frame gnuplot-gui-frame) @@ -1309,16 +1309,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 @@ -1374,7 +1374,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))