Skip to content

Commit 437108f

Browse files
committed
gnuplot-gui/gnuplot-context: Make more symbols private/respect namespaces
1 parent 2625bf7 commit 437108f

File tree

3 files changed

+57
-57
lines changed

3 files changed

+57
-57
lines changed

gnuplot-context.el

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ name; otherwise continues tokenizing up to the token at point. FIXME."
790790
plot-body])
791791

792792
(splot-command
793-
[ ;; This capturing group lets `gnuplot-find-using-eldoc' know
793+
[ ;; This capturing group lets `gnuplot-context--find-using-eldoc' know
794794
;; that this is an splot command
795795
(capture :splot-command (kw ("spl" . "ot")))
796796

@@ -1007,7 +1007,7 @@ name; otherwise continues tokenizing up to the token at point. FIXME."
10071007
[(kw "thru") expression])
10081008

10091009
(using-modifier
1010-
[(:eldoc gnuplot-find-using-eldoc)
1010+
[(:eldoc gnuplot-context--find-using-eldoc)
10111011
(kw ("u" . "sing"))
10121012
(either
10131013
string
@@ -1720,9 +1720,9 @@ name; otherwise continues tokenizing up to the token at point. FIXME."
17201720
;; them. For normal use, they compile to no-ops.
17211721
(eval-when-compile
17221722
(when (not (featurep 'gnuplot-debug-context))
1723-
(defmacro with-gnuplot-trace-buffer (&rest _) "No-op." '(progn nil))
1724-
(defmacro gnuplot-trace (&rest _) "No-op." '(progn nil))
1725-
(defmacro gnuplot-debug (&rest _) "No-op." '(progn nil))))
1723+
(defmacro gnuplot-context--with-trace-buffer (&rest _) "No-op." '(progn nil))
1724+
(defmacro gnuplot-context--trace (&rest _) "No-op." '(progn nil))
1725+
(defmacro gnuplot-context--debug (&rest _) "No-op." '(progn nil))))
17261726

17271727

17281728

@@ -1740,11 +1740,6 @@ Set by `gnuplot-context--match-pattern' using information from
17401740
and info strings onto the stack as it runs, and scans the stack
17411741
for the topmost entry when it reaches the token at point.")
17421742

1743-
(defvar gnuplot-eldoc nil
1744-
"ElDoc documentation string for the Gnuplot construction at point.
1745-
1746-
Set by `gnuplot-context--match-pattern'. See also `gnuplot-info-at-point'.")
1747-
17481743
(defvar gnuplot-context--captures nil
17491744
"Alist of named capture groups for `gnuplot-mode' completion code.
17501745
@@ -1754,6 +1749,11 @@ name specified in the (capture NAME PATTERN) form in the
17541749
list beginning the capture group, and END is the tail of the
17551750
token list just after the end of the capture group.")
17561751

1752+
(defvar gnuplot-eldoc nil
1753+
"ElDoc documentation string for the Gnuplot construction at point.
1754+
1755+
Set by `gnuplot-context--match-pattern'. See also `gnuplot-info-at-point'.")
1756+
17571757
(defvar gnuplot-eldoc-hash nil
17581758
"ElDoc strings for `gnuplot-mode'.
17591759
@@ -1789,7 +1789,7 @@ there."
17891789
;; of conses (pc . tokens)
17901790
(progress '()))
17911791

1792-
(with-gnuplot-trace-buffer (erase-buffer))
1792+
(gnuplot-context--with-trace-buffer (erase-buffer))
17931793

17941794
(when start-symbol ; HACK FIXME
17951795
(let ((look-for `(label ,start-symbol)))
@@ -1815,7 +1815,7 @@ there."
18151815
(opcode (car inst))
18161816
(token (car tokens))
18171817
(end-of-tokens (null tokens)))
1818-
(gnuplot-trace "%s\t%s\t%s\n" pc inst (and token (gnuplot-token-id token)))
1818+
(gnuplot-context--trace "%s\t%s\t%s\n" pc inst (and token (gnuplot-token-id token)))
18191819

18201820
(cl-case opcode
18211821
;; (literal LITERAL NO-COMPLETE)
@@ -1824,7 +1824,7 @@ there."
18241824
(no-complete (cl-caddr inst)))
18251825
(cond (end-of-tokens
18261826
(unless no-complete
1827-
(gnuplot-trace "\tpushing \"%s\" to completions\n" expect)
1827+
(gnuplot-context--trace "\tpushing \"%s\" to completions\n" expect)
18281828
(push expect gnuplot-context--completions))
18291829
(fail))
18301830

@@ -1848,7 +1848,7 @@ there."
18481848
(let ((regexp (cadr inst))
18491849
(name (cl-caddr inst)))
18501850
(cond (end-of-tokens
1851-
(gnuplot-trace "\tpushing \"%s\" to completions\n" name)
1851+
(gnuplot-context--trace "\tpushing \"%s\" to completions\n" name)
18521852
(push name gnuplot-context--completions)
18531853
(fail))
18541854

@@ -1948,7 +1948,7 @@ there."
19481948
(if (not record)
19491949
(error "Gnuplot-match-tokens: no open capture group named %s" name)
19501950
(setf (cl-caddr record) tokens)
1951-
(gnuplot-debug (gnuplot-dump-captures)))))
1951+
(gnuplot-context--debug (gnuplot-dump-captures)))))
19521952

19531953
;; (check-progress): make sure not stuck in an infinite loop
19541954
((check-progress)
@@ -1968,8 +1968,8 @@ there."
19681968
(when fail
19691969
(if (not backtrack) ; Out of backtracking stack: failed match
19701970
(throw 'return nil)
1971-
(gnuplot-trace "\t*fail*\t%s\n" (length backtrack))
1972-
(gnuplot-debug (gnuplot-dump-backtrack backtrack))
1971+
(gnuplot-context--trace "\t*fail*\t%s\n" (length backtrack))
1972+
(gnuplot-context--debug (gnuplot-dump-backtrack backtrack))
19731973
;; If we got as far as token-at-point before failing,
19741974
;; scan the stack for eldoc and info strings
19751975
(when (and end-of-tokens (not completing-p))
@@ -1984,13 +1984,13 @@ there."
19841984
gnuplot-context--captures bt-captures
19851985
progress bt-progress
19861986
fail nil)
1987-
(gnuplot-debug (gnuplot-dump-progress progress)))))))))))
1987+
(gnuplot-context--debug (gnuplot-dump-progress progress)))))))))))
19881988

19891989
(defun gnuplot-context--scan-stack (stack tokens)
19901990
"Scan STACK for the most recently pushed eldoc and info strings."
1991-
(gnuplot-trace "\t* scanning stack *\n")
1992-
(gnuplot-debug (gnuplot-backtrace stack))
1993-
(gnuplot-debug (gnuplot-dump-captures))
1991+
(gnuplot-context--trace "\t* scanning stack *\n")
1992+
(gnuplot-context--debug (gnuplot-backtrace stack))
1993+
(gnuplot-context--debug (gnuplot-dump-captures))
19941994

19951995
(catch 'no-scan
19961996
(while (and stack
@@ -2014,20 +2014,20 @@ there."
20142014
((functionp info) (funcall info))
20152015
(t info)))
20162016
(when gnuplot-info-at-point
2017-
(gnuplot-trace "\tset info to \"%s\"\n" gnuplot-info-at-point)
2017+
(gnuplot-context--trace "\tset info to \"%s\"\n" gnuplot-info-at-point)
20182018
(when (and (not gnuplot-eldoc) gnuplot-eldoc-hash)
20192019
(let ((eldoc
20202020
(car (gethash gnuplot-info-at-point gnuplot-eldoc-hash))))
20212021
(when eldoc
20222022
(setq gnuplot-eldoc eldoc)
2023-
(gnuplot-trace "\tand set eldoc to \"%s\"\n" eldoc))))))))
2023+
(gnuplot-context--trace "\tand set eldoc to \"%s\"\n" eldoc))))))))
20242024

20252025
((eldoc)
20262026
(when (not gnuplot-eldoc)
20272027
(let ((eldoc (cadr item)))
20282028
(setq gnuplot-eldoc
20292029
(if (functionp eldoc) (funcall eldoc) eldoc))
2030-
(gnuplot-trace "\tset eldoc to \"%s\"\n" gnuplot-eldoc)))))))
2030+
(gnuplot-context--trace "\tset eldoc to \"%s\"\n" gnuplot-eldoc)))))))
20312031
(pop stack))))
20322032

20332033
(defun gnuplot-context--capture-group (name)
@@ -2087,9 +2087,9 @@ there."
20872087
(info-lookup-interactive-arguments 'symbol)))
20882088
(setq gnuplot-info-at-point (car info))))
20892089
(when gnuplot-info-at-point
2090-
(gnuplot--find-info-node gnuplot-info-at-point)))
2090+
(gnuplot-context--find-info-node gnuplot-info-at-point)))
20912091

2092-
(defun gnuplot--find-info-node (node)
2092+
(defun gnuplot-context--find-info-node (node)
20932093
(save-window-excursion
20942094
(info (format "(gnuplot)%s" node)))
20952095
(gnuplot--adjust-info-display))
@@ -2100,7 +2100,7 @@ there."
21002100
;; ElDoc strings for "using" specs, which depend on other information
21012101
;; from the parsed command
21022102

2103-
(defvar gnuplot-using-eldoc
2103+
(defvar gnuplot-context--using-eldoc
21042104
'(("boxerrorbars" . "x:y:ydelta{:xdelta} | x:y:ylow:yhigh{:xdelta}")
21052105
("boxes" . "x:y{:x_width}")
21062106
("boxxyerrorbars" . "x:y:xdelta:ydelta | x:y:xlow:xhigh:ylow:yhigh")
@@ -2128,7 +2128,7 @@ there."
21282128
("xyerrorlines" . "x:y:xdelta:ydelta | x:y:xlow:xhigh:ylow:yhigh"))
21292129
"Alist of ElDoc strings for Gnuplot \"using\" clauses in \"plot\" commands.")
21302130

2131-
(defvar gnuplot-using-3d-eldoc
2131+
(defvar gnuplot-context--using-3d-eldoc
21322132
(append
21332133
'(("fsteps" . "z | x:y:z")
21342134
("histeps" . "z | x:y:z")
@@ -2140,10 +2140,10 @@ there."
21402140
("lines" . "z | x:y:z")
21412141
("steps" . "z | x:y:z")
21422142
("vectors" . "x:y:z:xdelta:ydelta:zdelta"))
2143-
gnuplot-using-eldoc)
2143+
gnuplot-context--using-eldoc)
21442144
"Alist of ElDoc strings for Gnuplot \"using\" clauses in \"splot\" commands.")
21452145

2146-
(defun gnuplot-find-using-eldoc ()
2146+
(defun gnuplot-context--find-using-eldoc ()
21472147
"Return ElDoc string for a Gnuplot \"using\" clause, based on plotting style.
21482148
21492149
This will fail if the \"using\" clause comes before the \"with\"
@@ -2155,8 +2155,8 @@ clause."
21552155
(let ((with-style-string (gnuplot-token-id (car with-style))))
21562156
(setq column-description
21572157
(or (and 3d-p
2158-
(cdr (assoc with-style-string gnuplot-using-3d-eldoc)))
2159-
(cdr (assoc with-style-string gnuplot-using-eldoc))
2158+
(cdr (assoc with-style-string gnuplot-context--using-3d-eldoc)))
2159+
(cdr (assoc with-style-string gnuplot-context--using-eldoc))
21602160
"<columns>"))))
21612161
(format "using %s {'format'}" column-description)))
21622162

gnuplot-debug-context.el

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@
4444
(load-library "gnuplot-debug-context"))
4545
(gnuplot-recompile))
4646

47-
(defmacro with-gnuplot-trace-buffer (&rest body)
48-
`(with-current-buffer (get-buffer-create "gnuplot-trace")
47+
(defmacro gnuplot-context--with-trace-buffer (&rest body)
48+
`(with-current-buffer (get-buffer-create "gnuplot-context-trace")
4949
,@body))
5050

51-
(defmacro gnuplot-debug (&rest args)
51+
(defmacro gnuplot-context--debug (&rest args)
5252
`(progn ,@args))
5353

54-
(defmacro gnuplot-trace (&rest args)
55-
`(with-gnuplot-trace-buffer (insert (format ,@args))))
54+
(defmacro gnuplot-context--trace (&rest args)
55+
`(gnuplot-context--with-trace-buffer (insert (format ,@args))))
5656

5757
(defun gnuplot-backtrace (stack)
5858
(if stack
59-
(with-gnuplot-trace-buffer
59+
(gnuplot-context--with-trace-buffer
6060
(insert "\n-- * backtrace: * --\n")
6161
(dolist (x stack)
6262
(insert (format "%s\n"
@@ -68,15 +68,15 @@
6868

6969
(defun gnuplot-dump-backtrack (backtrack)
7070
(if backtrack
71-
(with-gnuplot-trace-buffer
71+
(gnuplot-context--with-trace-buffer
7272
(insert "\n-- * backtrack records: * --\n")
7373
(dolist (x backtrack)
7474
(insert (format "%s\t%s\n" (cl-caddr x) (gnuplot-simplify-tokens (cadr x)))))
7575
(insert "-- end backtrack records --\n\n"))))
7676

7777
(defun gnuplot-dump-progress (progress)
7878
(if progress
79-
(with-gnuplot-trace-buffer
79+
(gnuplot-context--with-trace-buffer
8080
(insert "\n-- * progress records: * --\n")
8181
(dolist (x progress)
8282
(insert (format "%s\t%s\n" (car x) (gnuplot-simplify-tokens (cdr x)))))
@@ -85,7 +85,7 @@
8585
(defun gnuplot-dump-code (&optional inst)
8686
(interactive)
8787
(let ((inst (or inst gnuplot-context--compiled-grammar)))
88-
(with-gnuplot-trace-buffer
88+
(gnuplot-context--with-trace-buffer
8989
(insert "\n-- * compiled code: * --\n")
9090
(dotimes (i (length inst))
9191
(insert (format "%s\t%s\n" i (aref inst i))))
@@ -95,7 +95,7 @@
9595
(defun gnuplot-dump-captures ()
9696
(interactive)
9797
(if gnuplot-context--captures
98-
(with-gnuplot-trace-buffer
98+
(gnuplot-context--with-trace-buffer
9999
(insert "\n-- * capture groups: * --\n")
100100
(cl-loop for c on gnuplot-context--captures
101101
do

gnuplot-gui.el

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ the first entry in the list be a blank string."
103103
:type '(repeat (string :tag "Font name:")))
104104

105105
;; some global variables
106-
(defvar gnuplot-current-frame nil)
107-
(defvar gnuplot-current-buffer nil)
108-
(defvar gnuplot-current-buffer-point nil)
106+
(defvar gnuplot-gui-current-frame nil)
107+
(defvar gnuplot-gui-current-buffer nil)
108+
(defvar gnuplot-gui-current-buffer-point nil)
109109
(defvar gnuplot-gui-alist nil)
110110
(defvar gnuplot-gui-current-string nil)
111111

@@ -120,7 +120,7 @@ the first entry in the list be a blank string."
120120
(defsubst gnuplot-gui-type-fourth (obj) (elt obj 4))
121121
(defsubst gnuplot-gui-type-list (obj) (cddr obj))
122122

123-
(defun gnuplot-this-word ()
123+
(defun gnuplot-gui-this-word ()
124124
"Return the word under point."
125125
(let ((begin (save-excursion (beginning-of-line) (point-marker)))
126126
(end (save-excursion (end-of-line) (point-marker))))
@@ -860,10 +860,10 @@ Note that \"cntrparam\" is not currently supported."
860860
(setq set t)
861861
(goto-char (match-end 0))
862862
(if (looking-at "\\sw+") (goto-char (match-end 0)))
863-
(when (string-match "^ter" (gnuplot-this-word)) ; terminal?
863+
(when (string-match "^ter" (gnuplot-gui-this-word)) ; terminal?
864864
(setq term t)
865865
(forward-word 1))
866-
(when (string-match "^\\(da\\|fu\\)" (gnuplot-this-word))
866+
(when (string-match "^\\(da\\|fu\\)" (gnuplot-gui-this-word))
867867
(unless (looking-at "\\s-+st")
868868
(insert " style") (forward-word 1))
869869
(forward-word 1)))
@@ -875,7 +875,7 @@ Note that \"cntrparam\" is not currently supported."
875875
(t
876876
(forward-word 1)))
877877
(if (> (point) end) (goto-char end))
878-
(let* ((w (gnuplot-this-word))
878+
(let* ((w (gnuplot-gui-this-word))
879879
(wd (try-completion w gnuplot-gui-all-types))
880880
(word "") wrd list)
881881
(cond ((equal wd t) (setq word w))
@@ -1217,9 +1217,9 @@ ITEM is the object for which arguments are being set. ALIST is
12171217
the alist of arguments for ITEM taken from `gnuplot-gui-all-types'.
12181218
SAVE-FRAME is non-nil when the widgets are being reset."
12191219
(unless save-frame
1220-
(setq gnuplot-current-frame (selected-frame)
1221-
gnuplot-current-buffer (current-buffer)
1222-
gnuplot-current-buffer-point (point-marker))
1220+
(setq gnuplot-gui-current-frame (selected-frame)
1221+
gnuplot-gui-current-buffer (current-buffer)
1222+
gnuplot-gui-current-buffer-point (point-marker))
12231223
(unless (and gnuplot-gui-frame (frame-live-p gnuplot-gui-frame))
12241224
(setq gnuplot-gui-frame (make-frame gnuplot-gui-frame-parameters)))
12251225
(select-frame gnuplot-gui-frame)
@@ -1309,16 +1309,16 @@ SAVE-FRAME is non-nil when the widgets are being reset."
13091309
(lambda (widget &rest _ignore)
13101310
(kill-buffer (get-buffer-create "*Gnuplot GUI*"))
13111311
(delete-frame)
1312-
(select-frame gnuplot-current-frame)
1313-
(switch-to-buffer gnuplot-current-buffer)
1314-
(goto-char gnuplot-current-buffer-point)
1312+
(select-frame gnuplot-gui-current-frame)
1313+
(switch-to-buffer gnuplot-gui-current-buffer)
1314+
(goto-char gnuplot-gui-current-buffer-point)
13151315
(gnuplot-gui-post-process-alist
13161316
(widget-get widget :doc))
13171317
(let ((alist gnuplot-gui-alist) marker
13181318
(eol (save-excursion (end-of-line) (point-marker) )) )
13191319
(if (re-search-forward ";" eol "to_limit")
13201320
(backward-char 1))
1321-
(delete-region gnuplot-current-buffer-point (point-marker))
1321+
(delete-region gnuplot-gui-current-buffer-point (point-marker))
13221322
(delete-horizontal-space)
13231323
(setq marker (point-marker))
13241324
(while alist
@@ -1374,7 +1374,7 @@ SAVE-FRAME is non-nil when the widgets are being reset."
13741374
(setq gnuplot-gui-alist nil
13751375
gnuplot-gui-current-string nil)
13761376
(delete-frame)
1377-
(select-frame gnuplot-current-frame)))
1377+
(select-frame gnuplot-gui-current-frame)))
13781378
(goto-char (point-min))
13791379
(use-local-map widget-keymap)
13801380
(widget-setup))

0 commit comments

Comments
 (0)