1 ;;;; gnuplot.el -- drive gnuplot from within emacs
3 ;; Copyright (C) 1998 Phil Type and Bruce Ravel, 1999-2002 Bruce Ravel
5 ;; Author: Bruce Ravel <ravel@phys.washington.edu> and Phil Type
6 ;; Maintainer: Bruce Ravel <ravel@phys.washington.edu>
7 ;; Created: June 28 1998
8 ;; Updated: December 13, 2002
10 ;; Keywords: gnuplot, plotting
12 ;; This file is not part of GNU Emacs.
14 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15 ;; This program is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
20 ;; This lisp script is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 ;; Permission is granted to distribute copies of this lisp script
25 ;; provided the copyright notice and this permission are preserved in
28 ;; You should have received a copy of the GNU General Public License
29 ;; along with this program; if not, you can either send email to this
30 ;; program's maintainer or write to: The Free Software Foundation,
31 ;; Inc.; 675 Massachusetts Avenue; Cambridge, MA 02139, USA.
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33 ;; send bug reports to the author (ravel@phys.washington.edu)
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37 ;; This is a major mode for composing gnuplot scripts and displaying
38 ;; their results using gnuplot. It is optimized for use with gnuplot
39 ;; 3.7 or one of the later patchlevels of "version 3.6". It should
40 ;; also work very handily with version 3.5. This mode offers several
41 ;; tools to help you compose your scripts, including syntax
42 ;; colorization using either font-lock or hilit19, a syntax table
43 ;; appropriate to gnuplot, key bindings, pull-down menus, indentation,
44 ;; keyword completions and variable customization using the Custom
45 ;; package. Once the script is composed, there are several function
46 ;; for sending some or all of the script to gnuplot. The interaction
47 ;; with the gnuplot process is within a comint buffer.
49 ;; C-c C-l send current line to gnuplot
50 ;; C-c C-v send current line to gnuplot and move forward 1 line
51 ;; C-c C-r send current region to gnuplot
52 ;; C-c C-b send entire buffer to gnuplot
53 ;; C-c C-f send a file to gnuplot
54 ;; C-c C-i insert filename at point
55 ;; C-c C-n negate set option on current line
56 ;; C-c C-c comment region
57 ;; C-c C-o set arguments for command at point
58 ;; S-mouse-2 set arguments for command under mouse cursor
59 ;; C-c C-h read the gnuplot info file
60 ;; C-c C-e show-gnuplot-buffer
61 ;; C-c C-k kill gnuplot process
62 ;; C-c C-u submit a bug report about gnuplot-mode
63 ;; M-tab or M-ret complete keyword before point
64 ;; ret newline and indent
65 ;; tab indent current line
67 ;; Gnuplot-mode adds two key bindings to the comint buffer:
68 ;; M-C-p plot the current script buffer line-by-line
69 ;; M-C-f save the current script buffer and load that file
71 ;; These two functions are useful for starting up gnuplot-mode.
74 ;; start gnuplot-mode in the current buffer
76 ;; M-x gnuplot-make-buffer
77 ;; open a new buffer (which is not visiting a file) and start
78 ;; gnuplot-mode in that buffer
80 ;; ---------------------------------------------------------------------
82 ;; Other lisp files used by gnuplot.el
84 ;; info-look.el (comes with GNU Emacs 20):
85 ;; This provides the interface to the gnuplot-info file and provides
86 ;; on-line help and keyword completion functionality. The version
87 ;; of info-look.el that comes with version 20.2 of Emacs contains a
88 ;; bug that will impede its interaction with the gnuplot info file.
89 ;; You should use the version from the gnuplot-mode homepage
90 ;; instead. info-look is not distributed with XEmacs and so should
91 ;; be installed along with gnuplot-mode when using XEmacs.
93 ;; gnuplot-gui.el (written by Bruce):
94 ;; Defines the GUI interface for setting setting arguments to
95 ;; gnuplot options. This uses the widget package extensively.
97 ;; ---------------------------------------------------------------------
99 ;; This mode was inspired by the original gnu-plot-mode by Gershon
100 ;; Elber, which is distributed with gnuplot itself and which dates
101 ;; back to the early 90's. Although this mode encompasses the
102 ;; functionality of the original, the two share no code and the
103 ;; current implementation takes advantage of many features of modern
104 ;; versions of emacs and adheres (or so I intend) to the major mode
105 ;; conventions described in the emacs-lisp reference for version 19
108 ;; ---------------------------------------------------------------------
113 ;; A recent version of this file can be found at
114 ;; http://feff.phys.washington.edu/~ravel/software/gnuplot-mode/
116 ;; To autoload gnuplot-mode on any file with gp extension, put this in
118 ;; (autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t)
119 ;; (autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot-mode" t)
122 ;; (setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode))
124 ;; is useful for having files ending in .gp start up in gnuplot-mode.
127 ;; (global-set-key [(f9)] 'gnuplot-make-buffer)
128 ;; may be useful. This binds f9 to the function that opens a scratch
129 ;; buffer (i.e. one that is not visiting a file) in gnuplot-mode.
130 ;; This is handy for your quick 'n' dirty plotting chores.
132 ;; To use the `gnuplot-info-lookup-symbol' function, the file
133 ;; gnuplot.info MUST be installed somewhere that info can find it.
134 ;; This means you must either:
135 ;; 1. Copy gnuplot.info to the normal info directory or
136 ;; 2. Make sure info can find gnuplot.info by putting this in your
138 ;; (setenv "INFOPATH"
139 ;; (concat (getenv "INFOPATH") ":"
140 ;; (expand-file-name "/path/to/file")))
141 ;; where "/path/to/file" is the location of gnuplot.info
143 ;; This had been tested extensively with Emacs 19.34 and 20.2 and
144 ;; XEmacs 20.3 and in a limited manner with Emacs 19.30 and XEmacs
147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
150 ;; 0.1 Jun 25 1998 Finished with initial release.
151 ;; 0.2 Sep 4 1998 Added filename insertion, indentation, and
152 ;; colorization/completion in comint buffer. <BR>
153 ;; 0.2a Sep 11 1998 made `indent-line-function' buffer-local (whoops!)
154 ;; and fixed some stuff in the installation script <BR>
155 ;; 0.3 Sep 12 1998 include insertions menu <BR>
156 ;; 0.3a Sep 14 1998 fixed bug finding info file if missing, fixed bug
157 ;; starting font-lock, fixed bug re overwriting files in
158 ;; installation script <BR>
159 ;; 0.3b Sep 15 1998 Added (require 'info) to `(eval-and-compile'
160 ;; clause, Added (kill-all-local-variables) to `gnuplot-mode',
161 ;; altered order of:-
162 ;; (provide 'gnuplot)
163 ;; (run-hooks 'gnuplot-load-hook)
164 ;; at the end of the file in case something in the load hook
165 ;; requires gnuplot (oh not that old one again...), added
166 ;; `gnuplot-comint-setup-hook', corrected `gnuplot-mark-active'
167 ;; which caused an error to be raised by (mark) when the mark
168 ;; was inactive <DB> Some changes to font-lock rules <LB>&<BR>
169 ;; 0.4 Nov 14 1998 <BR> Use info-look for info interface. No
170 ;; change to gnuplot-mode user interface, but cleaner code.
171 ;; With info-look, the help funcion works regardless of the
172 ;; version number of gnuplot. Also, `gnuplot-keywords' (used
173 ;; for help, keyword-completion, and hilit19 highlighting) is
174 ;; now generated automatically.
175 ;; 0.4a Nov 18 1998 <BR> info-look leaves a couple of really useless
176 ;; buffers lying around so I cleaned them up. Also fixed
177 ;; font-lock rules so that things in quotes get highlighted
178 ;; correctly and the surrounding text is unhighlighted. Fixed
179 ;; up font-lock rules for plot and splot. Added
180 ;; `gnuplot-send-line-and-forward' as suggested by <MD>.
181 ;; 0.4b Nov 21 1998 <BR> added toolbar for xemacs -- see file
182 ;; gnuplot-toolbar.el. fixed error message in plot line
183 ;; function when line is empty. option added to display the
184 ;; comint buffer showing the gnuplot process in a separate
186 ;; 0.4c Minor stuff: Nov 30 1998 <BR> fixed highlighting in comint
187 ;; buffer. fixed frame behavior. added "[:]" to range
188 ;; insertions. added :link to defgroup. Dec 1 1998 <BR> fixed
189 ;; some mismatched defcustoms. added a few lines to suppress
190 ;; some compile-time warnings. Dec 3 1998 <BR> Fixed behavior
191 ;; of filename insertion function. Added more :links to
193 ;; 0.4d Dec 6 1998 <BR> Added function gnuplot-setup-info-look and
194 ;; variable gnuplot-info-hook to handle various versions of the
195 ;; gnuplot info file.
196 ;; 0.4e Dec 12 1998 <BR> Split up gnuplot-insertions-menu for ease of
197 ;; custimization, put menubar initialization in a function.
198 ;; 0.4f Dec 14 1998 <BR> defcustom the insertions submenus, add
199 ;; gnuplot-insertion-menu-flag, intelligent Makefile knows
200 ;; which info-look to compile
201 ;; 0.5 Dec 27 1998 <BR> wrote initial draft of gnuplot-gui.el,
202 ;; included it in insertions menu and in `gnuplot-insert'.
203 ;; Negate option function, bound to C-c C-n. Dec 29 1998 <BR>
204 ;; C-c C-h with no response goes to Commands menu. Transparent
205 ;; toolbar icons. Replace kw-compl with a simple completion
206 ;; function. Put gnuplot-toolbar code in gnuplot.el.
207 ;; 0.5a Jan 23 1999 <BR> send file uses the load command. add
208 ;; gnuplot-plot-from-comint and
209 ;; gnuplot-save-and-plot-from-comint and keybindings in the
210 ;; comint buffer. do (process-kill-without-query
211 ;; gnuplot-process nil). `gnuplot-negate-option' checks if set
212 ;; option has a negated form.
213 ;; 0.5b `gnuplot-kill-gnuplot-buffer' made more robust. fixed a bug
214 ;; in `gnuplot-plot-from-comint'. fixed description of
215 ;; gnuplot-faces group.
216 ;; 0.5c update copyright information, update gpelcard
217 ;; 0.5d Mar 20 1999 <BR> adopt installation materials from <LH>. Add
218 ;; some support for hidden3d. Use constants in types alists in
219 ;; gui. Various other minor improvements to the types alists.
220 ;; 0.5e Apr 6 1999 <BR> at the suggestion of <SE> I did away with the
221 ;; gnuplot-which-highlight variable and revamped how
222 ;; colorization gets turned on. This is a bit tricky since I
223 ;; want it to work with font-lock under emacs and xemacs and
224 ;; with hilit19. Apr 11 1999 <BR> insert space at end of
225 ;; unique completion. add a few GUI types, rewrite some stuff
226 ;; in the GUI interface. primitive support for plot, splot,
227 ;; and fit. Fixed completion in file widget.
228 ;; 0.5f May 15 1999 <BR> Add pgnuplot.c and Win9x install instructions
229 ;; to the distribution. Fixed a defface bug. Added
230 ;; `gnuplot-keywords-when' allowing deferral of parsing the
232 ;; 0.5g May 27 1999 <BR> Fixed font-locking of strings and
233 ;; comments. Figure out gnuplot-version number from startup
234 ;; message and set `gnuplot-echo-command-line-flag'
235 ;; accordingly. Added `gnuplot-program-version' variable.
236 ;; Check that font-lock is actually a feature, as suggested by
238 ;; 0.5h Aug 15 1999 <BR> Added `gnuplot-determine-gnuplot-version' so
239 ;; that the gnuplot version number and `comint-process-echos'
240 ;; actually get set correctly. Actually, the first time
241 ;; something is plotted, the echoing might not work, but the
242 ;; second time it will.
243 ;; 0.5i Sep 2 1999 <BR> Once again changed how
244 ;; `comint-process-echos' gets set. Maybe I got it right this
245 ;; time? Also fixed certain situations where the info file
246 ;; did notget properly loaded (insertion with info toggle on
247 ;; and info button in GUI).
248 ;; 0.5j Sep 9 1999 <BR> Do a more robust check for the gnuplot
249 ;; process before killing the gnuplot buffer, as suggested by
251 ;; 0.5k Sep 22 1999 <BR> make `gnuplot-send-line-and-forward' skip
252 ;; over blank and comment lines as suggested by <SE>. Jan 10
253 ;; 2000 Bound C-c C-j to `gnuplot-forward-script-line'.
254 ;; 0.5l Nov 16 2000 <BR> support for pm3d in gnuplot-gui and in plot
255 ;; options insertions menu. mentioned pm3d in gpelcard. gui
256 ;; support for x11 pm3d and vgagl terms.
257 ;; `gnuplot-negate-option' works with new syntax.
258 ;; 0.5m Nov 17 2000 <BR> add colorization and gui support for new
259 ;; commands in 3.8. gui support for emf term. gui support for
260 ;; new "set style" syntax. much better scheme for determining
261 ;; gnuplot version number + make better use of it.
262 ;; 0.5n Jan 4 2001 <BR> corrected a serious problem interacting with
265 ;; 0.5p Mar 14 2001 <BR> fixed problem with toolbar creation and
267 ;; 0.5q May 30 2001 <BR> added font-lock bindings for words associated
269 ;; 0.5r Oct 17 2001 <BR> Incorporate two suggestions by <RF>, bind
270 ;; C-c C-c to comment-region and C-c C-o to the GUI, also make
271 ;; C-c C-l respect continuation lines
272 ;; April 12, 2002 <BR> added feature to trim length of gnuplot
274 ;; 0.5s Jun 7 2002 <BR> Yet again changed how `comint-process-echos'
275 ;; gets set. It really needs to be nil on NTEmacs 21.1 or
276 ;; comint gets stuck in an infinate loop.
277 ;; 0.5t Sep 16 2002 <BR> Fixed a problem with C-c C-v jumping
278 ;; forward 2 lines at a time
279 ;; 0.6.0 Dec 13 2002 <BR> Changed numbering scheme to accommodate
280 ;; gnuplot packaging requirements
281 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
282 ;;; Acknowledgements:
283 ;; David Batty <DB> (numerous corrections)
284 ;; Laurent Bonnaud <LB> (suggestions regarding font-lock rules)
285 ;; Markus Dickebohm <MD> (suggested `gnuplot-send-line-and-forward')
286 ;; Stephen Eglan <SE> (suggested the use of info-look,
287 ;; contributed a bug fix regarding shutting
288 ;; down the gnuplot process, improvement to
289 ;; `gnuplot-send-line-and-forward')
290 ;; Robert Fenk <RF> (suggested respecting continuation lines)
291 ;; Michael Karbach <MK> (suggested trimming the gnuplot process buffer)
292 ;; Alex Chan Libchen <AL> (suggested font-lock for plotting words)
293 ;; Kuang-Yu Liu <KL> (pointed out buggy dependence on font-lock)
294 ;; Hrvoje Niksic <HN> (help with defcustom arguments for insertions)
295 ;; Andreas Rechtsteiner <AR> (pointed out problem with C-c C-v)
296 ;; Michael Sanders <MS> (help with the info-look interface)
297 ;; Jinwei Shen <JS> (suggested functionality in comint buffer)
298 ;; Michael M. Tung <MT> (prompted me to add pm3d support)
299 ;; Holger Wenzel <HW> (suggested using `gnuplot-keywords-when')
300 ;; Wolfgang Zocher <WZ> (pointed out problem with gnuplot-mode + speedbar)
301 ;; and especially to Lars Hecking <LH> for including gnuplot-mode
302 ;; with the gnuplot 3.7-beta distribution and for providing me with
303 ;; installation materials
304 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
307 ;; 1. Since `gnuplot-display-process' can be nil, it would be
308 ;; handy to have a function to put on
309 ;; `gnuplot-after-plot-buffer-hook' to check and see if the script
310 ;; executed properly. Alas I am not sure how gnuplot signals its
312 ;; 2. improve plot, splot, fit in GUI
313 ;; 3. interface to setting bind command using `read-key-sequence'.
314 ;; this is a pain because the nomenclature is really different in
315 ;; gnuplot than in `read-key-sequence'
319 ;; -- indentation is not quite right (but close)
321 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
328 ;;; --- variable definitions + eval-and-compile clauses
335 (if (and (featurep 'custom
) (fboundp 'custom-declare-variable
))
336 nil
;; We've got what we needed
337 ;; We have the old custom-library, hack around it!
338 (if (fboundp 'defgroup
)
340 (defmacro defgroup
(&rest args
)
342 (if (fboundp 'defface
)
344 (defmacro defface
(var values doc
&rest args
)
346 (defvar (, var
) (quote (, var
)))
347 ;; To make colors for your faces you need to set your .Xdefaults
348 ;; or set them up ahead of time in your .emacs file.
351 (if (fboundp 'defcustom
)
353 (defmacro defcustom
(var value doc
&rest args
)
354 (` (defvar (, var
) (, value
) (, doc
)))))))
357 ;; (condition-case ()
358 ;; (require 'kw-compl)
360 (eval-and-compile ;; <DB>
366 ;; this just gets rid of an annoying compile time error message
367 ;; (eval-when-compile
368 ;; (defun gnuplot-dummy ())
369 ;; (defalias 'hilit-set-mode-patterns 'gnuplot-dummy))
372 (defconst gnuplot-xemacs-p
(string-match "XEmacs" (emacs-version)))
373 (defconst gnuplot-ntemacs-p
(string-match "msvc" (emacs-version)))
374 (defvar gnuplot-three-eight-p
"")
376 (defconst gnuplot-maintainer
"Bruce Ravel")
377 (defconst gnuplot-maintainer-email
"ravel@phys.washington.edu")
378 (defconst gnuplot-maintainer-url
379 "http://feff.phys.washington.edu/~ravel/software/gnuplot-mode/")
380 (defconst gnuplot-version
"0.6.0")
382 (defgroup gnuplot nil
383 "Gnuplot-mode for Emacs."
388 :link
'(emacs-library-link :tag
"Lisp File" "gnuplot.el")
389 :link
'(url-link :tag
"Homepage"
390 "http://feff.phys.washington.edu/~ravel/software/gnuplot-mode/")
391 :link
'(custom-manual "(gnuplot)Top")
392 :link
'(emacs-commentary-link :tag
"Commentary" "gnuplot.el") )
393 (defgroup gnuplot-insertions nil
394 "Insert commands into gnuplot-scripts from a pull-down menu."
395 :prefix
"gnuplot-insertions-"
397 (defgroup gnuplot-hooks nil
398 "Hook variables used by `gnuplot-mode'."
402 (defcustom gnuplot-mode-hook nil
403 "*Hook run when `gnuplot-mode' is entered."
404 :group
'gnuplot-hooks
406 (defcustom gnuplot-load-hook nil
407 "*Hook run when gnuplot.el is first loaded."
408 :group
'gnuplot-hooks
410 (defcustom gnuplot-after-plot-hook nil
411 "*Hook run after gnuplot plots something.
412 This is the last thing done by the functions for plotting a line, a
413 region, a buffer, or a file."
414 :group
'gnuplot-hooks
416 (defcustom gnuplot-info-hook nil
417 "*Hook run before setting up the info-look interface.
418 This hook is necessary to handle inconsistencies in versions of and
419 sources of the gnuplot info file. If Gnuplot-mode can find the info
420 file generated from the 3.6beta patchlevel 347 (or later) release of
421 Gnuplot, then this hook probably is not necessary. Some versions of
422 the info file may have a General Index session, which can be used by
423 info-look. In that case the following (or something similar with the
424 value of `info-lookup-symbol-alist' altered appropriately) should be
425 placed in the .emacs file.
427 Emacs version 20.2 ships with a different version of info-look that
428 does 20.3. If you use any version of Emacs 19, you must use the
429 version from 20.2. Any version of XEmacs 20 or 21 should use the
430 version from 20.3 but can use either. XEmacs 19 should use the
433 For the newer version of info-look, do this:
435 (add-hook \'gnuplot-info-hook
437 (let ((elem (assoc \'gnuplot-mode info-lookup-alist)))
438 (delete elem info-lookup-alist)
439 (info-lookup-maybe-add-help
440 :mode 'gnuplot-mode :topic 'symbol
441 :regexp \"[a-zA-Z][_a-zA-Z0-9]*\"
442 :doc-spec '((\"(gnuplot)General Index\" nil
443 \"[_a-zA-Z0-9]+\"))))))
445 For the older version of info-look, do this:
447 (add-hook \'gnuplot-info-hook
449 (let ((elem (assoc \'gnuplot-mode info-lookup-alist)))
450 (delete elem info-lookup-alist)
451 (setq info-lookup-alist
452 (append info-lookup-alist
454 \"[a-zA-Z][_a-zA-Z0-9]*\" nil
455 ((\"(gnuplot)General Index\" nil
456 \"[_a-zA-Z0-9]+\" )))))))))"
457 :group
'gnuplot-hooks
459 ;; comint hook suggested by <DB>
460 (defcustom gnuplot-comint-setup-hook nil
461 "*Hook run after setting up the gnuplot buffer in comint mode.
462 So the configuration can be customised by the user."
463 :group
'gnuplot-hooks
465 (defvar gnuplot-recently-sent nil
466 "This is a record of the most recent kind of text sent to gnuplot.
467 It takes as its value nil, 'line, 'region, 'buffer, or 'file. It is
468 useful for functions included in `gnuplot-after-plot-hook'.")
469 (make-variable-buffer-local 'gnuplot-recently-sent
)
471 (defcustom gnuplot-program
"gnuplot"
472 "*The name of the gnuplot executable."
475 (defvar gnuplot-program-version nil
476 "Version number of gnuplot.
477 This is found using `gnuplot-determine-gnuplot-version")
478 (defcustom gnuplot-process-name
"gnuplot"
479 "Name given to the gnuplot buffer and process."
482 (defvar gnuplot-buffer nil
483 "*The name of the buffer displaying the gnuplot process.")
484 (defvar gnuplot-process nil
485 "Variable holding the process handle.")
486 (defvar gnuplot-process-frame nil
487 "The frame for displaying the gnuplot process.
488 This is used when `gnuplot-display-process' is equal to 'frame.")
489 (defvar gnuplot-comint-recent-buffer nil
490 "The most recently plotted gnuplot script buffer.
491 This is used by the function that plot from the comint buffer. It is
492 reset every time something is plotted from a script buffer.")
494 (defcustom gnuplot-gnuplot-buffer
"plot.gp"
495 "*The name of the gnuplot scratch buffer opened by 'gnuplot-make-buffer'."
499 (defcustom gnuplot-display-process
'window
500 "This controls how the gnuplot process buffer is displayed.
502 'frame display gnuplot process in a separate frame
503 'window display gnuplot process in this frame but in another window
504 nil `gnuplot-process' is in the current frame but not displayed"
506 :type
'(radio (const :tag
"Separate frame" frame
)
507 (const :tag
"Separate window" window
)
508 (const :tag
"Not displayed" nil
)))
509 (defcustom gnuplot-info-display
'window
510 "*Determines how `gnuplot-info-lookup-symbol' displays the info file.
512 'frame display info file in a separate frame
513 'window display info file in another window
514 nil display info file in the current window"
516 :type
'(radio (const :tag
"Separate frame" frame
)
517 (const :tag
"Separate window" window
)
518 (const :tag
"This window" nil
)))
520 (defcustom gnuplot-echo-command-line-flag
(not gnuplot-ntemacs-p
)
521 "*This sets the fall-back value of `comint-process-echos'.
522 If `gnuplot-mode' cannot figure out what version number of gnuplot
523 this is, then the value of this variable will be used for
524 `comint-process-echos'. It seems that gnuplot 3.5 wants this to be
525 nil and 3.7 wants it to be t. If lines that you send to gnuplot from
526 the `gnuplot-mode' buffer are not appearing at the gnuplot prompt in
527 the process buffer, try toggling it. Also see the document string for
528 `comint-process-echos'. If you change this, kill the gnuplot process
532 (defcustom gnuplot-insertions-show-help-flag nil
533 "*Non-nil means to display certain help messages automatically.
534 These messages are shown after menu insertion of gnuplot commands."
535 :group
'gnuplot-insertions
538 (defcustom gnuplot-delay
0.01
539 "*Amount of time to delay before sending a new line to gnuplot.
540 This is needed so that the the line is not written in the gnuplot
541 buffer in advance of its prompt. Increase this number if the
542 prompts and lines are displayed out of order."
545 (defcustom gnuplot-buffer-max-size
1000
546 "*The maximum size in lines of the gnuplot process buffer.
547 Each time text is written in the gnuplot process buffer, lines are
548 trimmed from the beginning of the buffer so that the buffer is this
549 many lines long. The lines are deleted after the most recent lines
550 were interpretted by gnuplot. Setting to 0 turns off this feature
551 (i.e. no lines get trimmed)."
554 (defcustom gnuplot-quote-character
"\'"
555 "*Quotation character used for inserting quoted strings.
556 Gnuplot can use single or double quotes. If you prefer to have the
557 filename insertion function never insert quotes for you, set this
558 to the empty string."
560 :type
'(radio (const :tag
"double quote" "\"")
561 (const :tag
"single quote" "\'")
562 (const :tag
"none" "" )))
563 ;; (defcustom gnuplot-gnuplot-version nil
564 ;; "*Force gnuplot-mode to behave for this version of gnuplot."
566 ;; :type '(radio (const :tag "unspecified" nil)
567 ;; (const :tag "3.8 or newer" "3.8")
568 ;; (const :tag "3.7 or older" "3.7")))
570 (defvar gnuplot-info-frame nil
)
571 (defvar gnuplot-info-nodes
'())
573 (defvar gnuplot-first-call t
)
575 ;; with info-look, there is no need to carry this list around -- it
576 ;; can be generated on the fly appropriate to the currently installed
577 ;; version of gnuplot.info
578 (defvar gnuplot-keywords nil
579 "A list of keywords used in GNUPLOT.
580 These are set by `gnuplot-set-keywords-list' from the values in
581 `info-lookup-cache'.")
582 (defvar gnuplot-keywords-pending t
;; <HW>
583 "A boolean which gets toggled when the info file is probed.")
584 (defcustom gnuplot-keywords-when
'deferred
;; 'immediately
585 "This variable controls when the info file is parsed.
586 The choices are immediately upon starting gnuplot-mode or the first
587 time that data is needed. If you use hilit19, then the info file is
588 parsed immediately regardless of the value of this variable. But
589 you're not using that musty old thing, are you..."
592 '(radio (const :tag
"Parse info file when gnuplot-mode starts" immediately
)
593 (const :tag
"Parse info file the first time it is needed" deferred
)))
595 (defgroup gnuplot-faces nil
596 "Text faces used by gnuplot-mode."
600 (cond ((and (featurep 'custom
) (fboundp 'custom-declare-variable
))
601 (defface gnuplot-prompt-face
'((((class color
))
602 (:foreground
"firebrick"))
604 (:bold t
:underline t
)))
605 "Face used for the prompt in the gnuplot process buffer."
606 :group
'gnuplot-faces
))
608 (make-face 'gnuplot-prompt-face
)
609 (set-face-foreground 'gnuplot-prompt-face
"firebrick")))
612 ;;; --- key bindings and menus
614 (defvar gnuplot-mode-map nil
)
617 (setq gnuplot-mode-map
(make-sparse-keymap))
618 (define-key gnuplot-mode-map
"\C-c\C-b" 'gnuplot-send-buffer-to-gnuplot
)
619 (define-key gnuplot-mode-map
"\C-c\C-c" 'comment-region
) ; <RF>
620 (define-key gnuplot-mode-map
"\C-c\C-o" 'gnuplot-gui-set-options-and-insert
)
621 (define-key gnuplot-mode-map
"\C-c\C-d" 'gnuplot-show-version
)
622 (define-key gnuplot-mode-map
"\C-c\C-e" 'gnuplot-show-gnuplot-buffer
)
623 (define-key gnuplot-mode-map
"\C-c\C-f" 'gnuplot-send-file-to-gnuplot
)
624 (define-key gnuplot-mode-map
"\C-c\C-h" 'gnuplot-info-lookup-symbol
)
625 (define-key gnuplot-mode-map
"\C-c\C-i" 'gnuplot-insert-filename
)
626 (define-key gnuplot-mode-map
"\C-c\C-j" 'gnuplot-forward-script-line
)
627 (define-key gnuplot-mode-map
"\C-c\C-k" 'gnuplot-kill-gnuplot-buffer
)
628 (define-key gnuplot-mode-map
"\C-c\C-l" 'gnuplot-send-line-to-gnuplot
)
629 (define-key gnuplot-mode-map
"\C-c\C-n" 'gnuplot-negate-option
)
630 (define-key gnuplot-mode-map
"\C-c\C-p" 'gnuplot-show-gnuplot-version
)
631 (define-key gnuplot-mode-map
"\C-c\C-r" 'gnuplot-send-region-to-gnuplot
)
632 ;;(define-key gnuplot-mode-map "\C-c\C-t" 'gnuplot-gui-swap-simple-complete)
633 (define-key gnuplot-mode-map
"\C-c\C-u" 'gnuplot-bug-report
)
634 (define-key gnuplot-mode-map
"\C-c\C-v" 'gnuplot-send-line-and-forward
)
635 (define-key gnuplot-mode-map
"\C-c\C-z" 'gnuplot-customize
)
636 (define-key gnuplot-mode-map
"\M-\r" 'gnuplot-complete-keyword
)
637 (define-key gnuplot-mode-map
"\M-\t" 'gnuplot-complete-keyword
)
638 (define-key gnuplot-mode-map
"\C-i" 'indent-for-tab-command
)
639 (define-key gnuplot-mode-map
"\C-m" 'newline-and-indent
)
640 ;;(define-key gnuplot-mode-map "\C-m" 'reindent-then-newline-and-indent)
641 ;;(if (featurep 'kw-compl)
642 ;; (define-key gnuplot-mode-map "\M-\r" 'kw-compl-abbrev)))
643 (cond (gnuplot-xemacs-p
644 (define-key gnuplot-mode-map
'(shift button2
)
645 'gnuplot-gui-mouse-set
))
647 (define-key gnuplot-mode-map
[S-mouse-2
]
648 'gnuplot-gui-mouse-set
))) )
650 (defvar gnuplot-mode-menu nil
)
651 (defvar gnuplot-menu nil
652 "Menu for `gnuplot-mode'.")
655 ["Send line to gnuplot" gnuplot-send-line-to-gnuplot t
]
656 ["Send line & move forward" gnuplot-send-line-and-forward
(not (eobp))]
657 ["Send region to gnuplot" gnuplot-send-region-to-gnuplot
658 (gnuplot-mark-active)]
659 ["Send buffer to gnuplot" gnuplot-send-buffer-to-gnuplot t
]
660 ["Send file to gnuplot" gnuplot-send-file-to-gnuplot t
]
662 ["Insert filename at point" gnuplot-insert-filename t
]
663 ["Negate set option" gnuplot-negate-option t
]
664 ;;["Set key binding" gnuplot-set-binding gnuplot-three-eight-p]
665 ["Keyword help" gnuplot-info-lookup-symbol
666 (or gnuplot-keywords gnuplot-keywords-pending
)]
667 ["Show gnuplot process buffer" gnuplot-show-gnuplot-buffer t
]
668 ["Set arguments at point" gnuplot-gui-set-options-and-insert
669 (fboundp 'gnuplot-gui-set-options-and-insert
)]
670 ["Swap plot/splot/fit lists in GUI" gnuplot-gui-swap-simple-complete
671 (fboundp 'gnuplot-gui-swap-simple-complete
)]
673 ["Customize gnuplot" gnuplot-customize t
]
674 ["Submit bug report" gnuplot-bug-report t
]
675 ["Show gnuplot-mode version" gnuplot-show-version t
]
676 ["Show gnuplot version" gnuplot-show-gnuplot-version t
]
678 ["Kill gnuplot" gnuplot-kill-gnuplot-buffer t
]
682 ;;; --- insertions variables and menus
684 ;;(load-library "gnuplot-insertions")
685 (defvar gnuplot-mode-insertions-menu nil
)
686 (defvar gnuplot-insertions-menu nil
687 "Menu for insertions in `gnuplot-mode'.
689 The insertions menu is composed of several sub-menus. The variables
690 describing the sub-menus are:
691 `gnuplot-insertions-adornments'
692 `gnuplot-insertions-plot-options'
693 `gnuplot-insertions-terminal'
694 `gnuplot-insertions-x-axis'
695 `gnuplot-insertions-y-axis'
696 `gnuplot-insertions-z-axis'
697 `gnuplot-insertions-x2-axis'
698 `gnuplot-insertions-y2-axis'
699 `gnuplot-insertions-parametric-plots'
700 `gnuplot-insertions-polar-plots'
701 `gnuplot-insertions-surface-plots'
702 These variables can be customized by the user. For example, there are
703 many terminal types which are not in the terminal submenu but which
704 may be compiled into a user's copy of gnuplot.
706 Each of these variables is a list whose first element is a string and
707 all the rest are vectors as described in the document string for
708 `easy-menu-define'. The callback used throughout these menus is
709 `gnuplot-insert' which inserts the appropriate set expression and,
710 optionally, looks up that item in the gnuplot info file.
712 The easiest way to customize the submenus is to use the custom
713 package. Just type \\[gnuplot-customize] and follow your nose.
715 You can also add new items to any of these sub-menus by adding to the
716 `gnuplot-load-hook' in your .emacs file. Here is an example of adding
717 the \"regis\" terminal type to the terminal sub-menu:
722 (setq gnuplot-insertions-terminal
723 (append gnuplot-insertions-terminal
726 (gnuplot-insert \"set terminal regis\")
729 (defvar gnuplot-insertions-top
()
730 "Top part of insertions menu.
731 See the document string for `gnuplot-insertions-menu'")
733 (defcustom gnuplot-insertions-menu-flag t
734 "*Non-nil means to place the insertion menu in the menubar.
735 Changing this will not effect a change in any currently existing
736 `gnuplot-mode' buffer. You will see the change the next time you
737 create a `gnuplot-mode' buffer."
738 :group
'gnuplot-insertions
741 (defcustom gnuplot-insertions-adornments
; this is icky...
742 (if gnuplot-three-eight-p
744 ["arrow" (gnuplot-insert "set arrow ") t
]
745 ["bar" (gnuplot-insert "set bar") t
]
746 ["border" (gnuplot-insert "set border") t
]
747 ["boxwidth" (gnuplot-insert "set boxwidth ") t
]
748 ["format" (gnuplot-insert "set format ") t
]
749 ["grid" (gnuplot-insert "set grid") t
]
750 ["key" (gnuplot-insert "set key ") t
]
751 ["label" (gnuplot-insert "set label ") t
]
752 ["pointsize" (gnuplot-insert "set pointsize ") t
]
753 ["samples" (gnuplot-insert "set samples ") t
]
754 ["size" (gnuplot-insert "set size ") t
]
755 ["style" (gnuplot-insert "set style ") t
]
756 ["tics" (gnuplot-insert "set tics ") t
]
757 ["timefmt" (gnuplot-insert "set timefmt ") t
]
758 ["timestamp" (gnuplot-insert "set timestamp ") t
]
759 ["title" (gnuplot-insert "set title ") t
]
760 ["zeroaxis" (gnuplot-insert "set zeroaxis") t
] )
762 ["data style" (gnuplot-insert "set data style ") t
]
763 ["function style" (gnuplot-insert "set function style ") t
]
764 ["arrow" (gnuplot-insert "set arrow ") t
]
765 ["bar" (gnuplot-insert "set bar") t
]
766 ["border" (gnuplot-insert "set border") t
]
767 ["boxwidth" (gnuplot-insert "set boxwidth ") t
]
768 ["format" (gnuplot-insert "set format ") t
]
769 ["grid" (gnuplot-insert "set grid") t
]
770 ["key" (gnuplot-insert "set key ") t
]
771 ["label" (gnuplot-insert "set label ") t
]
772 ["pointsize" (gnuplot-insert "set pointsize ") t
]
773 ["samples" (gnuplot-insert "set samples ") t
]
774 ["size" (gnuplot-insert "set size ") t
]
775 ["tics" (gnuplot-insert "set tics ") t
]
776 ["timefmt" (gnuplot-insert "set timefmt ") t
]
777 ["timestamp" (gnuplot-insert "set timestamp ") t
]
778 ["title" (gnuplot-insert "set title ") t
]
779 ["zeroaxis" (gnuplot-insert "set zeroaxis") t
] ))
780 "Adornments submenu in the insertions menu.
781 See the document string for `gnuplot-insertions-menu'
782 Changing this will not effect a change in any currently existing
783 `gnuplot-mode' buffer. You will see the change the next time you
784 create a `gnuplot-mode' buffer."
785 :group
'gnuplot-insertions
786 :type
'(list (string :tag
"Title")
788 (vector (string :tag
"Name")
789 (function :tag
"Callback")
790 (boolean :tag
"Enabled" t
)))))
794 (defcustom gnuplot-insertions-plot-options
796 ["autoscale" (gnuplot-insert "set autoscale ") t
]
797 ["clip" (gnuplot-insert "set clip ") t
]
798 ["encoding" (gnuplot-insert "set encoding ") t
]
799 ["locale" (gnuplot-insert "set locale ") t
]
800 ["logscale" (gnuplot-insert "set logscale ") t
]
801 ["multiplot" (gnuplot-insert "set multiplot") t
]
802 ["missing" (gnuplot-insert "set missing \"\"") t
]
803 ["palette" (gnuplot-insert "set palette ") t
] ; <MT>
804 ["pm3d" (gnuplot-insert "set pm3d ") t
]
805 ["offsets" (gnuplot-insert "set offsets ") t
]
806 ["output" (gnuplot-insert "set output ") t
]
807 ["zero" (gnuplot-insert "set zero ") t
] )
808 "Plot options submenu in the insertions menu.
809 See the document string for `gnuplot-insertions-menu'
810 Changing this will not effect a change in any currently existing
811 `gnuplot-mode' buffer. You will see the change the next time you
812 create a `gnuplot-mode' buffer."
813 :group
'gnuplot-insertions
814 :type
'(list (string :tag
"Title")
816 (vector (string :tag
"Name")
817 (function :tag
"Callback")
818 (boolean :tag
"Enabled" t
)))))
821 (defcustom gnuplot-insertions-terminal
823 ["eepic" (gnuplot-insert "set terminal eepic") t
]
824 ["fig" (gnuplot-insert "set terminal fig") t
]
825 ["gpic" (gnuplot-insert "set terminal gpic") t
]
826 ["latex" (gnuplot-insert "set terminal latex") t
]
827 ["linux" (gnuplot-insert "set terminal linux") t
]
828 ["pbm" (gnuplot-insert "set terminal pbm") t
]
829 ["png" (gnuplot-insert "set terminal png") t
]
830 ["postscript" (gnuplot-insert "set terminal postscript") t
]
831 ["pslatex" (gnuplot-insert "set terminal pslatex") t
]
832 ["table" (gnuplot-insert "set terminal table") t
]
833 ["tek40xx" (gnuplot-insert "set terminal tek40xx") t
]
834 ["tkcanvas" (gnuplot-insert "set terminal tkcanvas") t
]
835 ["tpic" (gnuplot-insert "set terminal tpic") t
]
836 ["vgagl" (gnuplot-insert "set terminal vgagl") t
] ; for pm3d patch
837 ["vttek" (gnuplot-insert "set terminal vttek") t
]
838 ["x11" (gnuplot-insert "set terminal x11") t
] )
839 "Terminal submenu in the insertions menu.
840 See the document string for `gnuplot-insertions-menu'
841 Changing this will not effect a change in any currently existing
842 `gnuplot-mode' buffer. You will see the change the next time you
843 create a `gnuplot-mode' buffer."
844 :group
'gnuplot-insertions
845 :type
'(list (string :tag
"Title")
847 (vector (string :tag
"Name")
848 (function :tag
"Callback")
849 (boolean :tag
"Enabled" t
)))))
852 (defcustom gnuplot-insertions-x-axis
854 ["xdata" (gnuplot-insert "set xdata ") t
]
855 ["xlabel" (gnuplot-insert "set xlabel ") t
]
856 ["xrange" (gnuplot-insert "set xrange [:]") t
]
857 ["xtics" (gnuplot-insert "set xtics ") t
]
858 ["mxtics" (gnuplot-insert "set mxtics ") t
]
859 ["xzeroaxis" (gnuplot-insert "set xzeroaxis ") t
]
860 ["xdtics" (gnuplot-insert "set xdtics ") t
]
861 ["xmtics" (gnuplot-insert "set xmtics ") t
])
862 "X-axis submenu in the insertions menu.
863 See the document string for `gnuplot-insertions-menu'
864 Changing this will not effect a change in any currently existing
865 `gnuplot-mode' buffer. You will see the change the next time you
866 create a `gnuplot-mode' buffer."
867 :group
'gnuplot-insertions
868 :type
'(list (string :tag
"Title")
870 (vector (string :tag
"Name")
871 (function :tag
"Callback")
872 (boolean :tag
"Enabled" t
)))))
875 (defcustom gnuplot-insertions-x2-axis
877 ["x2data" (gnuplot-insert "set xdata ") t
]
878 ["x2label" (gnuplot-insert "set xlabel ") t
]
879 ["x2range" (gnuplot-insert "set xrange [:]") t
]
880 ["x2tics" (gnuplot-insert "set xtics ") t
]
881 ["mx2tics" (gnuplot-insert "set mxtics ") t
]
882 ["x2zeroaxis" (gnuplot-insert "set xzeroaxis ") t
]
883 ["x2dtics" (gnuplot-insert "set xdtics ") t
]
884 ["x2mtics" (gnuplot-insert "set xmtics ") t
])
885 "X2-axis submenu in the insertions menu.
886 See the document string for `gnuplot-insertions-menu'
887 Changing this will not effect a change in any currently existing
888 `gnuplot-mode' buffer. You will see the change the next time you
889 create a `gnuplot-mode' buffer."
890 :group
'gnuplot-insertions
891 :type
'(list (string :tag
"Title")
893 (vector (string :tag
"Name")
894 (function :tag
"Callback")
895 (boolean :tag
"Enabled" t
)))))
898 (defcustom gnuplot-insertions-y-axis
900 ["ydata" (gnuplot-insert "set ydata ") t
]
901 ["ylabel" (gnuplot-insert "set ylabel ") t
]
902 ["ymtics" (gnuplot-insert "set ymtics ") t
]
903 ["yrange" (gnuplot-insert "set yrange [:]") t
]
904 ["ytics" (gnuplot-insert "set ytics ") t
]
905 ["yzeroaxis" (gnuplot-insert "set yzeroaxis ") t
]
906 ["ydtics" (gnuplot-insert "set ydtics ") t
]
907 ["mytics" (gnuplot-insert "set mytics ") t
])
908 "Y-axis submenu in the insertions menu.
909 See the document string for `gnuplot-insertions-menu'
910 Changing this will not effect a change in any currently existing
911 `gnuplot-mode' buffer. You will see the change the next time you
912 create a `gnuplot-mode' buffer."
913 :group
'gnuplot-insertions
914 :type
'(list (string :tag
"Title")
916 (vector (string :tag
"Name")
917 (function :tag
"Callback")
918 (boolean :tag
"Enabled" t
)))))
920 (defcustom gnuplot-insertions-y2-axis
922 ["y2data" (gnuplot-insert "set ydata ") t
]
923 ["y2label" (gnuplot-insert "set ylabel ") t
]
924 ["y2range" (gnuplot-insert "set yrange [:]") t
]
925 ["y2tics" (gnuplot-insert "set ytics ") t
]
926 ["my2tics" (gnuplot-insert "set mytics ") t
]
927 ["y2zeroaxis" (gnuplot-insert "set yzeroaxis ") t
]
928 ["y2mtics" (gnuplot-insert "set ymtics ") t
]
929 ["y2dtics" (gnuplot-insert "set ydtics ") t
])
930 "Y2-axis submenu in the insertions menu.
931 See the document string for `gnuplot-insertions-menu'
932 Changing this will not effect a change in any currently existing
933 `gnuplot-mode' buffer. You will see the change the next time you
934 create a `gnuplot-mode' buffer."
935 :group
'gnuplot-insertions
936 :type
'(list (string :tag
"Title")
938 (vector (string :tag
"Name")
939 (function :tag
"Callback")
940 (boolean :tag
"Enabled" t
)))))
944 (defcustom gnuplot-insertions-z-axis
946 ["zdata" (gnuplot-insert "set zdata ") t
]
947 ["zlabel" (gnuplot-insert "set zlabel ") t
]
948 ["zrange" (gnuplot-insert "set zrange [:]") t
]
949 ["ztics" (gnuplot-insert "set ztics ") t
]
950 ["mztics" (gnuplot-insert "set mztics ") t
]
951 ["zdtics" (gnuplot-insert "set zdtics ") t
]
952 ["zmtics" (gnuplot-insert "set zmtics ") t
] )
953 "Z-axis submenu in the insertions menu.
954 See the document string for `gnuplot-insertions-menu'
955 Changing this will not effect a change in any currently existing
956 `gnuplot-mode' buffer. You will see the change the next time you
957 create a `gnuplot-mode' buffer."
958 :group
'gnuplot-insertions
959 :type
'(list (string :tag
"Title")
961 (vector (string :tag
"Name")
962 (function :tag
"Callback")
963 (boolean :tag
"Enabled" t
)))))
966 (defcustom gnuplot-insertions-parametric-plots
968 ["parametric" (gnuplot-insert "set parametric") t
]
969 ["isosamples" (gnuplot-insert "set isosamples ") t
]
970 ["dummy" (gnuplot-insert "set dummy ") t
]
971 ["trange" (gnuplot-insert "set trange [:]") t
]
972 ["urange" (gnuplot-insert "set urange [:]") t
]
973 ["vrange" (gnuplot-insert "set vrange [:]") t
] )
974 "Parametric plots submenu in the insertions menu.
975 See the document string for `gnuplot-insertions-menu'
976 Changing this will not effect a change in any currently existing
977 `gnuplot-mode' buffer. You will see the change the next time you
978 create a `gnuplot-mode' buffer."
979 :group
'gnuplot-insertions
980 :type
'(list (string :tag
"Title")
982 (vector (string :tag
"Name")
983 (function :tag
"Callback")
984 (boolean :tag
"Enabled" t
)))))
987 (defcustom gnuplot-insertions-polar-plots
989 ["polar" (gnuplot-insert "set polar") t
]
990 ["angles" (gnuplot-insert "set angles ") t
]
991 ["rrange" (gnuplot-insert "set rrange [:]") t
] )
992 "Polar plots submenu in the insertions menu.
993 See the document string for `gnuplot-insertions-menu'
994 Changing this will not effect a change in any currently existing
995 `gnuplot-mode' buffer. You will see the change the next time you
996 create a `gnuplot-mode' buffer."
997 :group
'gnuplot-insertions
998 :type
'(list (string :tag
"Title")
1000 (vector (string :tag
"Name")
1001 (function :tag
"Callback")
1002 (boolean :tag
"Enabled" t
)))))
1005 (defcustom gnuplot-insertions-surface-plots
1007 ["clabel" (gnuplot-insert "set clabel ") t
]
1008 ["cntrparam" (gnuplot-insert "set cntrparam ") t
]
1009 ["contour" (gnuplot-insert "set contour") t
]
1010 ["dgrid3d" (gnuplot-insert "set dgrid3d ") t
]
1011 ["hidden3d" (gnuplot-insert "set hidden3d ") t
]
1012 ["mapping" (gnuplot-insert "set mapping ") t
]
1013 ["surface" (gnuplot-insert "set surface ") t
]
1014 ["view" (gnuplot-insert "set view ") t
] )
1015 "Surface plots submenu in the insertions menu.
1016 See the document string for `gnuplot-insertions-menu'
1017 Changing this will not effect a change in any currently existing
1018 `gnuplot-mode' buffer. You will see the change the next time you
1019 create a `gnuplot-mode' buffer."
1020 :group
'gnuplot-insertions
1021 :type
'(list (string :tag
"Title")
1023 (vector (string :tag
"Name")
1024 (function :tag
"Callback")
1025 (boolean :tag
"Enabled" t
)))))
1029 (defvar gnuplot-insertions-bottom
()
1030 "Bottom part of the insertions menu.
1031 This part contains the toggle buttons for displaying info or
1032 opening an argument-setting popup.")
1033 (setq gnuplot-insertions-bottom
1035 ["Display of info with insertion" gnuplot-toggle-info-display
1036 :style toggle
:selected gnuplot-insertions-show-help-flag
]
1037 ["Display GUI popup with insertion" gnuplot-gui-toggle-popup
1038 :active
(fboundp 'gnuplot-gui-toggle-popup
)
1039 :style toggle
:selected
(and (fboundp 'gnuplot-gui-toggle-popup
)
1040 gnuplot-gui-popup-flag
)] ))
1043 ;; Regarding a comment by <DB>:
1045 ;; This is from the header in easymenu.el distributed with XEmacs:
1047 ;; ;; - Function: easy-menu-add MENU [ MAP ]
1048 ;; ;; Add MENU to the current menubar in MAP.
1050 ;; ;; - Function: easy-menu-remove MENU
1051 ;; ;; Remove MENU from the current menubar.
1053 ;; ;; Emacs 19 never uses `easy-menu-add' or `easy-menu-remove', menus
1054 ;; ;; automatically appear and disappear when the keymaps specified by
1055 ;; ;; the MAPS argument to `easy-menu-define' are activated.
1057 ;; ;; XEmacs will bind the map to button3 in each MAPS, but you must
1058 ;; ;; explicitly call `easy-menu-add' and `easy-menu-remove' to add and
1059 ;; ;; remove menus from the menu bar.
1061 ;; in Emacs, easy-menu-add is defined like this:
1062 ;; (defun easy-menu-add (menu &optional map))
1064 (defun gnuplot-setup-menubar ()
1065 "Initial setup of gnuplot and insertions menus."
1066 (if gnuplot-insertions-menu-flag
; set up insertions menu
1068 (if gnuplot-xemacs-p
1069 (setq gnuplot-insertions-top
1070 '("insert set expression" "--:doubleLine"))
1071 (setq gnuplot-insertions-top
1072 '("insert set expression" "---")))
1073 (setq gnuplot-insertions-menu
1074 (append (list "Insertions")
1075 gnuplot-insertions-top
1076 (list gnuplot-insertions-adornments
)
1077 (list gnuplot-insertions-plot-options
)
1078 (list gnuplot-insertions-terminal
)
1079 (list gnuplot-insertions-x-axis
)
1080 (list gnuplot-insertions-y-axis
)
1081 (list gnuplot-insertions-z-axis
)
1082 (list gnuplot-insertions-x2-axis
)
1083 (list gnuplot-insertions-y2-axis
)
1084 (list gnuplot-insertions-parametric-plots
)
1085 (list gnuplot-insertions-polar-plots
)
1086 (list gnuplot-insertions-surface-plots
)
1087 gnuplot-insertions-bottom
))
1088 (easy-menu-define gnuplot-mode-insertions-menu gnuplot-mode-map
1089 "Insertions menu used in Gnuplot-mode"
1090 gnuplot-insertions-menu
)
1091 (easy-menu-add gnuplot-mode-insertions-menu gnuplot-mode-map
)))
1092 (easy-menu-define ; set up gnuplot menu
1093 gnuplot-mode-menu gnuplot-mode-map
"Menu used in gnuplot-mode"
1095 (easy-menu-add gnuplot-mode-menu gnuplot-mode-map
) )
1097 ;; There is no `mark-active' variable in XEmacs. Hassle! This is not
1098 ;; only replicates mark-active, but it only returns true if the region
1099 ;; is of non-zero width.
1100 ;; Error checking suggested by <DB>
1101 (defun gnuplot-mark-active ()
1102 "Return non-nil if the mark is active and it is not equal to point."
1104 (and (mark) (/= (mark) (point)))
1108 ;;; --- XEmacs toolbar
1110 (defgroup gnuplot-toolbar nil
1111 "Toolbar used by XEmacs."
1112 :prefix
"gnuplot-toolbar-"
1115 (defcustom gnuplot-toolbar-display-flag gnuplot-xemacs-p
1116 "*Non-nil means to display display a toolbar in XEmacs."
1117 :group
'gnuplot-toolbar
1120 (defcustom gnuplot-toolbar-use-toolbar
(if (featurep 'toolbar
) 'left-toolbar nil
)
1121 "*If nil, do not use a toolbar.
1122 If it is non-nil, it must be a toolbar. The five legal values are
1123 `default-toolbar', `top-toolbar', `bottom-toolbar', `right-toolbar',
1124 and `left-toolbar', although choosing `default-toolbar' or
1125 `top-toolbar' may be a bad idea since either will make the GNUPLOT
1126 toolbar replace the standard toolbar. Changing this will not change
1127 the toolbar in a currently existing buffer, but it will take effect
1128 the next time you use `gnuplot-mode' and emacs.
1130 This is only used if a toolbar can be displayed, thus this is used in
1131 XEmacs and ignored in FSF Emacs."
1132 :type
'(choice (const default-toolbar
)
1134 (const bottom-toolbar
)
1135 (const left-toolbar
)
1136 (const right-toolbar
)
1137 (const :tag
"No toolbar" nil
))
1138 :group
'gnuplot-toolbar
)
1140 (defvar gnuplot-toolbar-location
"")
1142 (defun gnuplot-toolbar-setup-toolbar (toolbar)
1143 "Setup function for the `gnuplot-mode' toolbar.
1144 TOOLBAR contains the toolbar specification.
1145 This is basically swiped from VM."
1146 (let ((width 46) (height 46)
1147 (buffer (current-buffer))
1148 (frame (selected-frame))
1151 ((eq (symbol-value gnuplot-toolbar-use-toolbar
) right-toolbar
)
1152 (setq gnuplot-toolbar-location
"right")
1153 (set-specifier right-toolbar toolbar buffer
)
1154 (set-specifier right-toolbar-width width frame tag-set
))
1155 ((eq (symbol-value gnuplot-toolbar-use-toolbar
) left-toolbar
)
1156 (setq gnuplot-toolbar-location
"left")
1157 (set-specifier left-toolbar toolbar buffer
)
1158 (set-specifier left-toolbar-width width frame tag-set
))
1159 ((eq (symbol-value gnuplot-toolbar-use-toolbar
) bottom-toolbar
)
1160 (setq gnuplot-toolbar-location
"bottom")
1161 (set-specifier bottom-toolbar toolbar buffer
)
1162 (set-specifier bottom-toolbar-height height frame tag-set
))
1163 ((eq (symbol-value gnuplot-toolbar-use-toolbar
) top-toolbar
)
1164 (setq gnuplot-toolbar-location
"top")
1165 (set-specifier top-toolbar toolbar buffer
)
1166 (set-specifier top-toolbar-height height frame tag-set
))) ))
1168 (defvar gnuplot-line-xpm
1170 (toolbar-make-button-list
1172 static char *line[] = {
1173 /* width height num_colors chars_per_pixel */
1177 \"a c #bebebe s backgroundToolBarColor\",
1182 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1183 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1184 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1185 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1186 \"aaaaaaaaaaaaa..a..aaaaaaaaaaaaaaaaaaaaaa\",
1187 \"aaaaaaaaaaaaa..aaaaaaaaaaaaaaaaaaaaaaaaa\",
1188 \"aaaaaaaaaaaa..a..a....aaa...aaaaaaaaaaaa\",
1189 \"aaaaaaaaaaaa..a..a..a..a..a..aaaaaaaaaaa\",
1190 \"aaaaaaaaaaaa..a..a.aa..a.....aaaaaaaaaaa\",
1191 \"aaaaaaaaaaa..a..a..a..a..aaaaaaaaaaaaaaa\",
1192 \"aaaaaaaaaaa..a..a..a..a..a..aaaaaaaaaaaa\",
1193 \"aaaaaaaaaaa..a..a..a..aa...aaaaaaaaaaaaa\",
1194 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1195 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1196 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1197 \"aaaaaaa..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1198 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1199 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaadaaaaaaaa\",
1200 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaadaaaaaaaaa\",
1201 \"aaaaaaa..aaaaaaaaaaaaaaaaaaaadaaaaaaaaaa\",
1202 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaadaaaaaaaaaaa\",
1203 \"aaaaaaaa.aaaaaaaaaacaaaadaadaaaaaaaaaaaa\",
1204 \"aaaaaaaa.caaadaaaccaccadaddaaaaaccaaaaaa\",
1205 \"aaaaaaa..accdaddcaaaaaccaaaaaaccaaaaaaaa\",
1206 \"aaaaaaaa.aadcaccdaaaadaaccaaccaaaaaaaaaa\",
1207 \"aaaaaaaa.adaacaaaddadaaaaaccaaaaaaaaaaaa\",
1208 \"aaaaaaaa.daaaaaaaaadaaaaaaaaaaaaaaaaaaaa\",
1209 \"aaaaaaa..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1210 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1211 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1212 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1213 \"aaaaaa............................aaaaaa\",
1214 \"aaaaaaaa.aaaa.aaaa.aaaa.aaaa.aaaaaaaaaaa\",
1215 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1216 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1217 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1218 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1219 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1220 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1221 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"};")
1222 "XPM format image used for the \"plot line\" button"))
1224 (defvar gnuplot-region-xpm
1226 (toolbar-make-button-list
1228 static char *region[] = {
1229 /* width height num_colors chars_per_pixel */
1233 \"a c #bebebe s backgroundToolBarColor\",
1238 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1239 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1240 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1241 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1242 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1243 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1244 \"aaaaaaaaaaaaaaaaaaaaaaa..aaaaaaaaaaaaaaa\",
1245 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1246 \"aaaaaa.a..a...aaa....a..aa...aa....aaaaa\",
1247 \"aaaaaa...a..a..a..a..a..a..a..a..a..aaaa\",
1248 \"aaaaaa..aa.....a.aa..a....aa..a.aa..aaaa\",
1249 \"aaaaa..a...aaaa..aa.a..a..aa....a..aaaaa\",
1250 \"aaaaa..a...a..a..a..a..a..a..a..a..aaaaa\",
1251 \"aaaa..aaaa...aaa....a..aa...aa..a..aaaaa\",
1252 \"aaaaaaaaaaaaaaaaa..aaaaaaaaaaaaaaaaaaaaa\",
1253 \"aaaaaaaaaaaaaaa...aaaaaaaaaaaaaaaaaaaaaa\",
1254 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1255 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaadaaaaaaaa\",
1256 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaadaaaaaaaaa\",
1257 \"aaaaaaa..aaaaaaaaaaaaaaaaaaaadaaaaaaaaaa\",
1258 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaadaaaaaaaaaaa\",
1259 \"aaaaaaaa.aaaaaaaaaacaaaadaadaaaaaaaaaaaa\",
1260 \"aaaaaaaa.caaadaaaccaccadaddaaaaaccaaaaaa\",
1261 \"aaaaaaa..accdaddcaaaaaccaaaaaaccaaaaaaaa\",
1262 \"aaaaaaaa.aadcaccdaaaadaaccaaccaaaaaaaaaa\",
1263 \"aaaaaaaa.adaacaaaddadaaaaaccaaaaaaaaaaaa\",
1264 \"aaaaaaaa.daaaaaaaaadaaaaaaaaaaaaaaaaaaaa\",
1265 \"aaaaaaa..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1266 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1267 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1268 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1269 \"aaaaaa............................aaaaaa\",
1270 \"aaaaaaaa.aaaa.aaaa.aaaa.aaaa.aaaaaaaaaaa\",
1271 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1272 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1273 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1274 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1275 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1276 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1277 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"};")
1278 "XPM format image used for the \"plot region\" button"))
1280 (defvar gnuplot-buffer-xpm
1282 (toolbar-make-button-list
1284 static char *buffer[] = {
1285 /* width height num_colors chars_per_pixel */
1289 \"a c #bebebe s backgroundToolBarColor\",
1294 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1295 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1296 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1297 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1298 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1299 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1300 \"aaaaaaaa..aaaaaaaaaa......aaaaaaaaaaaaaa\",
1301 \"aaaaaaaa..aaaaaaaaa..a..aaaaaaaaaaaaaaaa\",
1302 \"aaaaaaa....aa..a.........a...aa.a.aaaaaa\",
1303 \"aaaaaaa..a..a..a..a..a..a..a..a...aaaaaa\",
1304 \"aaaaaaa.aa....aa..a..a..a.....a..aaaaaaa\",
1305 \"aaaaaa...a.a..a..a..a..a..aaaa..aaaaaaaa\",
1306 \"aaaaaa.....a..a..a..a..a..a..a..aaaaaaaa\",
1307 \"aaaaaa....aaa..a.a..a..aa...aa..aaaaaaaa\",
1308 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1309 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1310 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1311 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaadaaaaaaaa\",
1312 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaadaaaaaaaaa\",
1313 \"aaaaaaa..aaaaaaaaaaaaaaaaaaaadaaaaaaaaaa\",
1314 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaadaaaaaaaaaaa\",
1315 \"aaaaaaaa.aaaaaaaaaacaaaadaadaaaaaaaaaaaa\",
1316 \"aaaaaaaa.caaadaaaccaccadaddaaaaaccaaaaaa\",
1317 \"aaaaaaa..accdaddcaaaaaccaaaaaaccaaaaaaaa\",
1318 \"aaaaaaaa.aadcaccdaaaadaaccaaccaaaaaaaaaa\",
1319 \"aaaaaaaa.adaacaaaddadaaaaaccaaaaaaaaaaaa\",
1320 \"aaaaaaaa.daaaaaaaaadaaaaaaaaaaaaaaaaaaaa\",
1321 \"aaaaaaa..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1322 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1323 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1324 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1325 \"aaaaaa............................aaaaaa\",
1326 \"aaaaaaaa.aaaa.aaaa.aaaa.aaaa.aaaaaaaaaaa\",
1327 \"aaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1328 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1329 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1330 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1331 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1332 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1333 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"};")
1334 "XPM format image used for the \"plot buffer\" button"))
1336 (defvar gnuplot-doc-xpm
1338 (toolbar-make-button-list
1340 static char *book_index[] = {
1341 /* width height num_colors chars_per_pixel */
1345 \"a c #bebebe s backgroundToolBarColor\",
1351 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1352 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1353 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1354 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1355 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1356 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1357 \"aaaaaa.........bbeaaaebb..........aaaaaa\",
1358 \"aaaaaa.ddddddddaaebebeaaddddddddd.aaaaaa\",
1359 \"aaaa...dab.bddeebadbdaeebedeeeeed...aaaa\",
1360 \"aaaa.c.dbaddddebeedbdeebeedebebed.c.aaaa\",
1361 \"aaaa.c.d.de.edeebeabdbbeeddebbbed.c.aaaa\",
1362 \"aaaa.c.dbad.ddebeadbdeeebeddeeeed.c.aaaa\",
1363 \"aaaa.c.dab..ddeeeedbdebeeedebebed.c.aaaa\",
1364 \"aaaa.c.dddddddeebeabdebebedeebedd.c.aaaa\",
1365 \"aaaa.c.debebedebeedbdbebeedbeeeeb.c.aaaa\",
1366 \"aaaa.c.debeeedeeeaabdaaddddebedbb.c.aaaa\",
1367 \"aaaa.c.deebeddbebedbdbaa.adeeedeb.c.aaaa\",
1368 \"aaaa.c.ddeebedeeebaba.dd.dddeeedd.c.aaaa\",
1369 \"aaaa.c.debeebdbeeedbd....ddeebeed.c.aaaa\",
1370 \"aaaa.c.deebeedeebadbd.dd.ddeeeedd.c.aaaa\",
1371 \"aaaa.c.dbbebddeeeeabd.aa.adebebbd.c.aaaa\",
1372 \"aaaa.c.deeeeedeebeabaedddddeeeedd.c.aaaa\",
1373 \"aaaa.c.dbebbbdebeadbdaeeeedebeeed.c.aaaa\",
1374 \"aaaa.c.deeebddeeebdbdeebeedeebeed.c.aaaa\",
1375 \"aaaa.c.debeeedebeeabdebebedebeebd.c.aaaa\",
1376 \"aaaa.c.deebbedeeeedbdeeeeddeeeeed.c.aaaa\",
1377 \"aaaa.c.dddddddddaadbdaddddddddddd.c.aaaa\",
1378 \"aaaa.c..........beabaeb...........c.aaaa\",
1379 \"aaaa.c.bbbbbbbbbb.bbbbbbbbbbbbbbb.c.aaaa\",
1380 \"aaaa.c.bbbbbbbbbb..e.bbbbbbbbbbbb.c.aaaa\",
1381 \"aaaa.c.bbbbbbbbbb.b.bbbbbbbbbbbbb.c.aaaa\",
1382 \"aaaa.c............e.e.............c.aaaa\",
1383 \"aaaa.cccccccccccc.a.a.ccccccccccccc.aaaa\",
1384 \"aaaa................................aaaa\",
1385 \"aaaaaaaaaaaaaaaaaa...aaaaaaaaaaaaaaaaaaa\",
1386 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1387 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1388 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1389 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1390 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"};")
1391 "XPM format image used for the \"document\" button"))
1393 (defvar gnuplot-help-xpm
1395 (toolbar-make-button-list
1397 static char *help_btn[] = {
1398 /* width height num_colors chars_per_pixel */
1401 \"a c #bebebe s backgroundToolBarColor\",
1405 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1406 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1407 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1408 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1409 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1410 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1411 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1412 \"aaaaaaaaaaaaaaaabbbbbbbbaaaaaaaaaaaaaaaa\",
1413 \"aaaaaaaaaaaaabbbccccccccbbbaaaaaaaaaaaaa\",
1414 \"aaaaaaaaaaabbccccccccccccccbbaaaaaaaaaaa\",
1415 \"aaaaaaaaaabccccccccccccccccccbaaaaaaaaaa\",
1416 \"aaaaaaaaabccccccccccccccccccccbaaaaaaaaa\",
1417 \"aaaaaaaabcccccccbbbbbbbbcccccccbaaaaaaaa\",
1418 \"aaaaaaaabccccbbbaaaaaaaabbbccccbaaaaaaaa\",
1419 \"aaaaaaabccccbaaaaaaaaaaaaaabccccbaaaaaaa\",
1420 \"aaaaaaabcccbaaaaaaaaaaaaaaaabcccbaaaaaaa\",
1421 \"aaaaaaabcccbaaaaaaaaaaaaaaaabcccbaaaaaaa\",
1422 \"aaaaaaabcccbaaaaaaaaaaaaaaaabcccbaaaaaaa\",
1423 \"aaaaaaabbbbbaaaaaaaaaaaaaaabccccbaaaaaaa\",
1424 \"aaaaaaaaaaaaaaaaaaaaaaaabbbccccbaaaaaaaa\",
1425 \"aaaaaaaaaaaaaaaabbbbbbbbcccccccbaaaaaaaa\",
1426 \"aaaaaaaaaaaaaaaabcccccccccccccbaaaaaaaaa\",
1427 \"aaaaaaaaaaaaaaaabccccccccccccbaaaaaaaaaa\",
1428 \"aaaaaaaaaaaaaaaabccccccccccbbaaaaaaaaaaa\",
1429 \"aaaaaaaaaaaaaaaabccccbbbbbbaaaaaaaaaaaaa\",
1430 \"aaaaaaaaaaaaaaaabccccbaaaaaaaaaaaaaaaaaa\",
1431 \"aaaaaaaaaaaaaaaabccccbaaaaaaaaaaaaaaaaaa\",
1432 \"aaaaaaaaaaaaaaaabbbbbbaaaaaaaaaaaaaaaaaa\",
1433 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1434 \"aaaaaaaaaaaaaaaabbbbbbaaaaaaaaaaaaaaaaaa\",
1435 \"aaaaaaaaaaaaaaaabccccbaaaaaaaaaaaaaaaaaa\",
1436 \"aaaaaaaaaaaaaaaabccccbaaaaaaaaaaaaaaaaaa\",
1437 \"aaaaaaaaaaaaaaaabccccbaaaaaaaaaaaaaaaaaa\",
1438 \"aaaaaaaaaaaaaaaabbbbbbaaaaaaaaaaaaaaaaaa\",
1439 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1440 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1441 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1442 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1443 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",
1444 \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"};")
1445 "XPM format image used for the \"help\" button"))
1447 (defvar gnuplot-toolbar
1449 gnuplot-line-fn t
"Plot the line under point"]
1451 gnuplot-region-fn t
"Plot the selected region"]
1453 gnuplot-buffer-fn t
"Plot the entire buffer"]
1456 gnuplot-help-fn t
"Look at the gnuplot process buffer"]
1458 gnuplot-doc-fn t
"Look at the gnuplot document"])
1459 "The gnuplot toolbar.")
1461 (fset 'gnuplot-line-fn
'gnuplot-send-line-and-forward
)
1462 (fset 'gnuplot-region-fn
'gnuplot-send-region-to-gnuplot
)
1463 (fset 'gnuplot-buffer-fn
'gnuplot-send-buffer-to-gnuplot
)
1464 (fset 'gnuplot-help-fn
'gnuplot-show-gnuplot-buffer
)
1465 (fset 'gnuplot-doc-fn
'gnuplot-info-lookup-symbol
)
1467 (defvar gnuplot-all-buttons-defined
1468 (and (listp gnuplot-line-xpm
) (listp gnuplot-region-xpm
)
1469 (listp gnuplot-buffer-xpm
) (listp gnuplot-doc-xpm
)
1470 (listp gnuplot-help-xpm
)))
1473 (defun gnuplot-make-toolbar-function ()
1474 (if (and gnuplot-xemacs-p gnuplot-all-buttons-defined
)
1476 ;;(remove-specifier gnuplot-toolbar-use-toolbar (current-buffer))
1477 (gnuplot-toolbar-setup-toolbar gnuplot-toolbar
)
1478 (add-spec-to-specifier (symbol-value gnuplot-toolbar-use-toolbar
)
1480 (current-buffer) ))))
1482 ;;(defalias 'gnuplot-make-toolbar 'gnuplot-make-toolbar-function)
1486 ;;; --- syntax colorization, syntax table
1488 (defvar gnuplot-mode-syntax-table nil
1489 "Syntax table in use in `gnuplot-mode' buffers.
1490 This is the same as the standard syntax table except that ' is a
1491 string quote character, ` and _ are word characters, and math
1492 operators are punctuation characters.")
1493 (if gnuplot-mode-syntax-table
1495 (setq gnuplot-mode-syntax-table
(make-syntax-table))
1496 (modify-syntax-entry ?
* "." gnuplot-mode-syntax-table
)
1497 (modify-syntax-entry ?
+ "." gnuplot-mode-syntax-table
)
1498 (modify-syntax-entry ?-
"." gnuplot-mode-syntax-table
)
1499 (modify-syntax-entry ?
/ "." gnuplot-mode-syntax-table
)
1500 (modify-syntax-entry ?%
"." gnuplot-mode-syntax-table
)
1501 ;;(modify-syntax-entry ?& "." gnuplot-mode-syntax-table) ; rarely used
1502 ;;(modify-syntax-entry ?^ "." gnuplot-mode-syntax-table) ; operators
1503 ;;(modify-syntax-entry ?| "." gnuplot-mode-syntax-table) ; in gnuplot,
1504 ;;(modify-syntax-entry ?& "." gnuplot-mode-syntax-table) ; (by me,
1505 ;;(modify-syntax-entry ?? "." gnuplot-mode-syntax-table) ; anyway...)
1506 ;;(modify-syntax-entry ?~ "." gnuplot-mode-syntax-table) ;
1507 (modify-syntax-entry ?
' "\"" gnuplot-mode-syntax-table
)
1508 (modify-syntax-entry ?
` "w" gnuplot-mode-syntax-table
)
1509 (modify-syntax-entry ?_
"w" gnuplot-mode-syntax-table
))
1512 (defvar gnuplot-font-lock-keywords nil
)
1513 (defvar gnuplot-font-lock-keywords-1 nil
)
1514 (defvar gnuplot-font-lock-keywords-2 nil
)
1516 ;; used make-regexp to generate the regular expression strings
1517 ;; this is all pattern based
1518 ;; (insert (format "%s"
1521 ;; '("abs" "acos" "acosh" "arg" "asin" "asinh" "atan"
1522 ;; "atan2" "atanh" "besj0" "besj1" "besy0" "besy1"
1523 ;; "ceil" "cos" "cosh" "erf" "erfc" "exp" "floor"
1524 ;; "gamma" "ibeta" "inverf" "igamma" "imag" "invnorm"
1525 ;; "int" "lgamma" "log" "log10" "norm" "rand" "real"
1526 ;; "sgn" "sin" "sinh" "sqrt" "tan" "tanh" "column"
1527 ;; "tm_hour" "tm_mday" "tm_min" "tm_mon" "tm_sec"
1528 ;; "tm_wday" "tm_yday" "tm_year" "valid")))))
1530 ;; Set up colorization for gnuplot.
1531 ;; This handles font-lock for emacs and xemacs.
1532 ;; hilit19 is handled in `gnuplot-mode'.
1533 ;; These regular expressions treat the gnuplot vocabulary as complete
1534 ;; words. Although gnuplot will recognise unique abbreviations, these
1535 ;; regular expressions will not."
1536 (if (featurep 'font-lock
) ; <KL>
1537 (setq gnuplot-font-lock-keywords
1540 '("#.*$" . font-lock-comment-face
)
1542 ;'("['\"]\\([^'\"\n]*\\)['\"]"
1543 ; 1 font-lock-string-face)
1544 '("'[^'\n]*'?" . font-lock-string-face
)
1545 ; stuff in brackets, sugg. by <LB>
1546 '("\\[\\([^]]+\\)\\]"
1547 1 font-lock-reference-face
)
1548 ; variable/function definitions
1549 '("\\(\\<[a-z]+[a-z_0-9()]*\\)[ \t]*="
1550 1 font-lock-variable-name-face
)
1551 ; built-in function names
1554 "a\\(bs\\|cosh\?\\|rg\\|sinh\?\\|"
1555 "tan\\(\\|\[2h\]\\)\\)\\|"
1556 "bes\\(j\[01\]\\|y\[01\]\\)\\|"
1557 "c\\(eil\\|o\\(lumn\\|sh\?\\)\\)\\|"
1558 "e\\(rfc\?\\|xp\\)\\|floor\\|gamma\\|"
1559 "i\\(beta\\|gamma\\|mag\\|"
1560 "n\\(t\\|v\\(erf\\|norm\\)\\)\\)\\|"
1561 "l\\(gamma\\|og\\(\\|10\\)\\)\\|"
1562 "norm\\|r\\(and\\|eal\\)\\|"
1563 "s\\(gn\\|inh\?\\|qrt\\)\\|"
1564 "t\\(anh\?\\|m_\\(hour\\|m\\(day\\|in\\|on\\)\\|"
1565 "sec\\|wday\\|y\\(day\\|ear\\)\\)\\)\\|"
1568 font-lock-function-name-face
)
1569 ; reserved words associated with
1571 '("\\<\\(axes\\|every\\|index\\|l\\(\[stw\]\\|ine\\(style\\|type\\|width\\)\\)\\|notitle\\|p\\(\[st\]\\|oint\\(size\\|type\\)\\)\\|smooth\\|t\\(hru\\|itle\\)\\|using\\|with\\)\\>" . font-lock-type-face
)
1572 '("\\<\\(box\\(e\\(rrorbars\\|s\\)\\|xyerrorbars\\)\\|candlesticks\\|dots\\|errorbars\\|f\\(inancebars\\|steps\\)\\|histeps\\|impulses\\|lines\\(\\|points\\)\\|points\\|steps\\|vector\\|x\\(errorbars\\|yerrorbars\\)\\|yerrorbars\\)\\>" . font-lock-function-name-face
)
1573 ; (s)plot -- also thing (s)plotted
1574 '("\\<s?plot\\>" . font-lock-keyword-face
)
1575 '("\\<s?plot\\s-+\\([^'\" ]+\\)[) \n,\\\\]"
1576 1 font-lock-variable-name-face
)
1577 ; other common commands
1578 ; miscellaneous commands
1579 (cons (concat "\\<\\("
1581 "c\\(d\\|lear\\)\\|exit\\|fit\\|h\\(elp\\|istory\\)\\|load\\|"
1582 "p\\(ause\\|rint\\|wd\\)\\|quit\\|replot\\|"
1583 "s\\(ave\\|et\\|how\\)\\|unset"
1585 font-lock-reference-face
))
1586 gnuplot-font-lock-keywords-1 gnuplot-font-lock-keywords
1587 gnuplot-font-lock-keywords-2 gnuplot-font-lock-keywords
) )
1589 (if (and gnuplot-xemacs-p
(featurep 'font-lock
))
1590 (put 'gnuplot-mode
'font-lock-defaults
1591 '((gnuplot-font-lock-keywords
1592 gnuplot-font-lock-keywords-1
1593 gnuplot-font-lock-keywords-2
)
1594 t t
((?_ .
"w")) )))
1596 ;; these two lines get rid of an annoying compile time error
1597 ;; message. that function gets non-trivially defalias-ed in
1598 ;; gnuplot-toolbar.el
1599 ;; (defun gnuplot-make-toolbar-dummy ())
1600 ;; (defalias 'gnuplot-make-toolbar 'gnuplot-make-toolbar-dummy)
1603 ;;; --- functions for sending commands to gnuplot
1605 (defun gnuplot-split-string (string)
1606 "Break STRING at each carriage return, returning a list of lines."
1607 (let ((list ()) (line "") (index 0))
1608 (while (< index
(length string
))
1609 (if (char-equal (elt string index
) ?
\n)
1610 (setq list
(append list
(list line
))
1612 (setq line
(concat line
(char-to-string (elt string index
)))))
1613 (setq index
(1+ index
)) )
1616 ;; -- the calls to `sleep-for' are to allow enough time for gnuplot
1617 ;; to write to the buffer before the next line is inserted
1618 ;; -- note that the input string is split into lines and each line is
1619 ;; sent to gnuplot individually. this is a bit slow, but it puts
1620 ;; each line on the comint history.
1621 (defun gnuplot-send-string-to-gnuplot (string text
)
1622 "Sends STRING to the gnuplot program.
1623 If no gnuplot process exists, a new one is created. TEXT indicates
1624 the type of text being sent to gnuplot and is typically one of
1625 nil, 'line, 'region, 'buffer, or 'file. TEXT may be useful for
1626 functions in `gnuplot-after-plot-hook'. `gnuplot-after-plot-hook' is
1627 called by this function after all of STRING is sent to gnuplot."
1628 (gnuplot-make-gnuplot-buffer) ; make sure a gnuplot buffer exists
1629 (or gnuplot-program-version
1631 (message "Determining gnuplot version number (sitting for 2 seconds)")
1632 (gnuplot-fetch-version-number)
1634 (setq gnuplot-comint-recent-buffer
(current-buffer))
1635 (if (equal gnuplot-display-process
'frame
)
1636 (or (and gnuplot-process-frame
1637 (frame-live-p gnuplot-process-frame
))
1638 (let ((frame (selected-frame)))
1639 (setq gnuplot-process-frame
(make-frame))
1640 (select-frame gnuplot-process-frame
)
1641 (switch-to-buffer gnuplot-buffer
)
1642 (delete-other-windows)
1643 (select-frame frame
))) )
1644 (let ((buffer (current-buffer))
1645 (gbuffer (get-buffer gnuplot-buffer
))
1646 (list (gnuplot-split-string string
)))
1647 (set-buffer gbuffer
)
1648 (goto-char (point-max))
1649 ;; bruce asks: what is this next line for?
1650 (set-marker (process-mark gnuplot-process
) (point-marker))
1651 (sleep-for (* 20 gnuplot-delay
))
1655 (sleep-for gnuplot-delay
)
1656 (setq list
(cdr list
))
1657 (goto-char (point-max)))
1659 (cond ((equal gnuplot-display-process
'window
)
1660 (select-window (display-buffer gbuffer
))
1661 (goto-char (point-max))
1662 (or (pos-visible-in-window-p (point) (selected-window))
1665 ((equal gnuplot-display-process
'frame
)
1666 ;;(raise-frame gnuplot-process-frame)
1667 (select-frame gnuplot-process-frame
)
1668 (display-buffer gbuffer
)
1669 (goto-char (point-max))
1670 (or (pos-visible-in-window-p (point) (selected-window))
1672 ;;(process-send-string gnuplot-program string)
1673 (setq gnuplot-recently-sent text
)
1674 (run-hooks 'gnuplot-after-plot-hook
)))
1676 (defun gnuplot-send-region-to-gnuplot (&optional begin end text
)
1677 "Sends a selected region to the gnuplot program.
1678 If BEGIN and END are not specified, point and mark are used. TEXT
1679 indicates the type of text being sent to gnuplot. This will be
1680 'region unless explicitly set by a function calling this one. Other
1681 typical values are of nil, 'line, 'buffer, or 'file. TEXT may be
1682 useful for function in `gnuplot-after-plot-hook'."
1684 (let (string (txt (or text
'region
)))
1685 (cond ((equal major-mode
'gnuplot-mode
)
1686 (setq string
(buffer-substring-no-properties begin end
))
1687 (if (string= (substring string -
1) "\n") ()
1688 (setq string
(concat string
"\n")))
1689 (gnuplot-send-string-to-gnuplot string txt
))
1691 (message (concat "You can only send regions from "
1692 "gnuplot-mode buffers to gnuplot."))))))
1694 (defun gnuplot-send-line-to-gnuplot ()
1695 "Sends the current line to the gnuplot program.
1696 Respects continuation lines.
1697 This sets `gnuplot-recently-sent' to 'line."
1699 (cond ((equal major-mode
'gnuplot-mode
)
1700 (let ((start (save-excursion (beginning-of-line) (point-marker)))
1702 ;(end (save-excursion (beginning-of-line 2) (point-marker)))
1708 (while (looking-at "\\\\") ; go to end of last continuation line
1711 (beginning-of-line 2)
1712 (setq end
(point-marker)))
1713 (if (not (string-match "\\`\\s-*\\'"
1714 (buffer-substring-no-properties start end
)))
1715 (gnuplot-send-region-to-gnuplot start end
'line
))
1718 (message "You can only send lines in gnuplot-mode buffers to gnuplot.")
1721 ;; I chose a very easy to type but slightly non-mnemonic key-binding
1722 ;; for this (C-c C-v). It seems like the kind of thing one would want
1723 ;; to do repeatedly without incurring RSI. 8^)
1724 (defun gnuplot-send-line-and-forward (&optional num
)
1725 "Call `gnuplot-send-line-to-gnuplot' and move forward 1 line.
1726 You can use a numeric prefix to send more than one line. Blank lines and
1727 lines with only comments are skipped when moving forward."
1731 (setq end
(gnuplot-send-line-to-gnuplot))
1733 (backward-char 1) ; <AR>
1734 (gnuplot-forward-script-line 1)
1735 (setq num
(1- num
)))))
1738 (defun gnuplot-forward-script-line (&optional num
) ; <SE>
1739 "Move forward my NUM script lines.
1740 Blank lines and commented lines are not included in the NUM count."
1743 (and (not (eobp)) (forward-line 1))
1744 (while (and (not (eobp))
1745 (or (looking-at "^\\s-*$")
1746 (looking-at "^\\s-*#")))
1748 (setq num
(1- num
))) )
1750 (defun gnuplot-send-buffer-to-gnuplot ()
1751 "Sends the entire buffer to the gnuplot program.
1752 This sets `gnuplot-recently-sent' to 'buffer."
1754 (if (equal major-mode
'gnuplot-mode
)
1755 (gnuplot-send-region-to-gnuplot (point-min) (point-max) 'buffer
)
1756 (message "You can only send gnuplot-mode buffers to gnuplot.")))
1758 (defun gnuplot-send-file-to-gnuplot ()
1759 "Sends a selected file to the gnuplot program using the \"load\" command.
1760 This sets `gnuplot-recently-sent' to 'file."
1762 (let ((string (read-file-name "Name of file to send to gnuplot > " nil nil t
)))
1763 (setq string
(concat "load '" (expand-file-name string
) "'\n"))
1764 (message "%S" string
)
1765 (gnuplot-make-gnuplot-buffer) ; make sure a gnuplot buffer exists
1766 (gnuplot-send-string-to-gnuplot string
'file
)))
1768 ;; suggested by <JS>
1769 (defun gnuplot-plot-from-comint ()
1770 "Send the contents of a script to gnuplot from the process buffer.
1771 This inserts the contents of the most recently used gnuplot script
1772 into the process buffer and sends those lines to gnuplot. It does
1773 this by copying the script line by line."
1775 (if (equal major-mode
'comint-mode
)
1776 (let (string list
(buffer (current-buffer)))
1777 (set-buffer gnuplot-comint-recent-buffer
)
1778 (setq string
(buffer-substring-no-properties (point-min) (point-max))
1779 string
(concat string
"\n")
1780 list
(gnuplot-split-string string
))
1785 (sleep-for gnuplot-delay
)
1786 (setq list
(cdr list
)))
1787 (comint-send-input))
1789 "`gnuplot-plot-from-comint' only works in the gnuplot process buffer")))
1791 (defun gnuplot-save-and-plot-from-comint ()
1792 "Send a current script to gnuplot from the process buffer.
1793 This sends the most recently used gnuplot script to gnuplot using the
1794 \"load\" command. This function first saves the script buffer to a
1795 file, prompting for a filename if one is not associated with the script
1796 buffer. Then it sends a load command to gnuplot using the name of the
1797 file visited by the script buffer."
1799 (if (equal major-mode
'comint-mode
)
1800 (let (fname (buffer (current-buffer)))
1801 (set-buffer gnuplot-comint-recent-buffer
)
1803 (setq fname
(buffer-file-name))
1805 (goto-char (point-max))
1806 (insert (format "load '%s'" fname
))
1807 (comint-send-input))
1808 (message (concat "`gnuplot-save-and-plot-from-comint' only works "
1809 "in the gnuplot process buffer"))))
1812 (defun gnuplot-trim-gnuplot-buffer ()
1813 "Trim lines form the beginning of the *gnuplot* buffer.
1814 This keeps that buffer from growing excessively in size. Normally,
1815 this function is attached to `gnuplot-after-plot-hook'"
1816 (if (> gnuplot-buffer-max-size
0)
1818 (set-buffer gnuplot-buffer
)
1819 (let ((nlines (count-lines (point-min) (point-max)))
1820 (kill-whole-line t
))
1821 (while (> nlines gnuplot-buffer-max-size
)
1822 (goto-char (point-min))
1824 (setq nlines
(1- nlines
)))
1825 (goto-char (point-max)) ))))
1826 (add-hook 'gnuplot-after-plot-hook
'gnuplot-trim-gnuplot-buffer nil nil
)
1829 ;;; --- functions controlling the gnuplot process
1831 ;; use of comint-setup-hook suggested by <DB>
1832 (defun gnuplot-comint-start-function ()
1833 "Function run when comint/gnuplot started.
1834 This sets font-lock and keyword completion in the comint/gnuplot
1835 buffer. Further customization is possible via
1836 `gnuplot-comint-setup-hook'."
1837 ;;(if (not (fboundp 'hilit-set-mode-patterns))
1838 (if (featurep 'font-lock
)
1840 (make-variable-buffer-local 'font-lock-defaults
)
1841 (setq font-lock-defaults
'(gnuplot-font-lock-keywords t t
))
1842 (if gnuplot-xemacs-p
(turn-on-font-lock))))
1843 ;;(if (featurep 'kw-compl)
1845 ;; (setq kw-compl-list gnuplot-keywords
1846 ;; kw-compl-upper-case nil)
1847 ;; (define-key comint-mode-map "\M-\r" 'kw-compl-abbrev)))
1848 (define-key comint-mode-map
"\M-\C-p" 'gnuplot-plot-from-comint
)
1849 (define-key comint-mode-map
"\M-\C-f" 'gnuplot-save-and-plot-from-comint
)
1850 (define-key comint-mode-map
"\C-d" 'gnuplot-delchar-or-maybe-eof
)
1851 (define-key comint-mode-map
"\M-\r" 'gnuplot-complete-keyword
)
1852 (define-key comint-mode-map
"\M-\t" 'gnuplot-complete-keyword
)
1853 (run-hooks 'gnuplot-comint-setup-hook
))
1855 (defun gnuplot-make-gnuplot-buffer ()
1856 "Switch to the gnuplot program buffer or create one if none exists."
1857 (or (and gnuplot-process
(get-process gnuplot-process
)
1858 gnuplot-buffer
(get-buffer gnuplot-buffer
))
1860 (message "Starting gnuplot plotting program...")
1861 (setq gnuplot-buffer
(make-comint gnuplot-process-name gnuplot-program
)
1862 gnuplot-process
(get-process gnuplot-process-name
))
1863 (process-kill-without-query gnuplot-process nil
)
1865 (set-buffer gnuplot-buffer
)
1866 (make-local-hook 'kill-buffer-hook
)
1867 (add-hook 'kill-buffer-hook
'gnuplot-close-down nil t
)
1868 (gnuplot-comint-start-function)
1869 (make-local-variable 'comint-output-filter-functions
)
1870 (setq comint-output-filter-functions
1871 (append comint-output-filter-functions
1872 '(comint-postoutput-scroll-to-bottom
1873 gnuplot-protect-prompt-fn
)))
1874 (message "Starting gnuplot plotting program...Done")))))
1877 (defun gnuplot-fetch-version-number ()
1879 (message "gnuplot-mode %s -- determining gnuplot version ......"
1881 (let* ((command (concat "echo \"show version\" | " gnuplot-program
))
1882 (process (start-process-shell-command "gnuplot-version"
1885 (set-process-sentinel process
'gnuplot-determine-version-number
)))
1887 (defun gnuplot-determine-version-number (process event
)
1890 (if (string-match "SPEEDBAR" (format "%S" (current-buffer))) ;; <WZ>
1891 (if (fboundp 'speedbar-switch-buffer-attached-frame
)
1892 (speedbar-switch-buffer-attached-frame "*gnuplot-version*")
1894 (speedbar-select-attached-frame)
1895 (switch-to-buffer "*gnuplot-version*")))
1896 (switch-to-buffer "*gnuplot-version*"))
1897 (goto-char (point-min))
1898 (re-search-forward "[Vv]ersion\\s-+" (point-max) t
)
1899 (if (looking-at "[0-9]\\.[0-9]+")
1900 (setq version
(match-string 0))
1901 (setq version
"3.7"))
1902 (kill-buffer (get-buffer "*gnuplot-version*"))
1903 ;;(and (interactive-p) (message "You are using gnuplot version %s" version))
1904 (setq gnuplot-program-version version
1905 gnuplot-three-eight-p
(>= (string-to-number gnuplot-program-version
) 3.8))
1906 (gnuplot-setup-menu-and-toolbar)
1909 (defun gnuplot-setup-menu-and-toolbar ()
1910 ;; set up the menubar (possibly dependent on version number)
1911 (gnuplot-setup-menubar)
1912 ;; set up the toolbar (possibly dependent on version number)
1913 (if (and gnuplot-xemacs-p gnuplot-toolbar-display-flag
)
1914 (condition-case () ; deal with the toolbar
1915 (and (require 'toolbar
)
1917 (gnuplot-make-toolbar-function))
1919 (message "gnuplot-mode %s (gnuplot %s) -- report bugs with %S"
1920 gnuplot-version gnuplot-program-version
1921 (substitute-command-keys "\\[gnuplot-bug-report]"))
1926 ;; (defun gnuplot-determine-gnuplot-version ()
1927 ;; "Figure out which version of gnuplot we are running."
1929 ;; (cond (gnuplot-gnuplot-version
1930 ;; (setq comint-process-echoes nil ;; t
1931 ;; gnuplot-program-version gnuplot-gnuplot-version))
1933 ;; (let ((counter 0))
1935 ;; (set-buffer gnuplot-buffer)
1936 ;; (goto-char (point-min))
1937 ;; ;; it may take a while for emacs to display the gnuplot start-up
1938 ;; ;; message. since we need this to determine the version number
1939 ;; ;; and hence the value of `comint-process-echoes', we must wait
1940 ;; ;; for this to happen.
1941 ;; (while (and (equal (point-max) (point-min)) (< 10 counter))
1944 ;; (if (re-search-forward "[Vv]ersion" (point-max) t)
1946 ;; (cond ((or (looking-at "\\s-*3.8") (looking-at "\\s-*4"))
1947 ;; (setq comint-process-echoes nil ;; t
1948 ;; gnuplot-program-version "3.8"))
1949 ;; ((looking-at "\\s-*3.7")
1950 ;; (setq comint-process-echoes nil ;; t
1951 ;; gnuplot-program-version "3.7"))
1953 ;; (setq comint-process-echoes nil
1954 ;; gnuplot-program-version "3.5") )))
1955 ;; (setq comint-process-echoes gnuplot-echo-command-line-flag)))))))
1957 (defun gnuplot-protect-prompt-fn (string)
1958 "Prevent the Gnuplot prompt from being deleted or overwritten.
1959 STRING is the text as originally inserted in the comint buffer."
1962 (goto-char (point-max))
1966 (if (re-search-forward "^gnuplot> " (point-max) t
)
1969 (put-text-property b e
'rear-nonsticky
'(read-only intangible face
))
1970 (put-text-property b e
'intangible t
)
1971 (put-text-property b e
'face
'gnuplot-prompt-face
)
1972 ;;(put-text-property b e 'read-only t)
1975 (defun gnuplot-close-down ()
1976 "Tidy up when deleting the gnuplot buffer."
1977 (if (eq (process-status gnuplot-process
) 'run
);; <SE>
1978 (kill-process gnuplot-process
))
1979 (setq gnuplot-process nil
1980 gnuplot-buffer nil
))
1982 (defun gnuplot-delchar-or-maybe-eof (arg)
1983 "Delete ARG characters forward, or (if at eob) send an EOF to subprocess.
1984 This is very similar to `comint-delchar-or-maybe-eof'."
1987 (gnuplot-kill-gnuplot-buffer)
1990 (defun gnuplot-kill-gnuplot-buffer ()
1991 "Kill the gnuplot process and its display buffers."
1993 (if (and gnuplot-process
1994 (eq (process-status gnuplot-process
) 'run
)) ;; <SE>
1995 (kill-process gnuplot-process
))
1996 (if (and gnuplot-buffer
(get-buffer gnuplot-buffer
))
1998 (if (one-window-p) ()
1999 (delete-window (get-buffer-window gnuplot-buffer
)))
2000 (kill-buffer gnuplot-buffer
)))
2001 (setq gnuplot-process nil
2002 gnuplot-buffer nil
))
2005 (defun gnuplot-show-gnuplot-buffer ()
2006 "Switch to the buffer containing the gnuplot process.
2007 When `gnuplot-display-process' is nil this will switch to
2008 the gnuplot process buffer. When that variable is non-nil, the
2009 gnuplot process buffer will be displayed in a window."
2011 (if (and gnuplot-buffer
(get-buffer gnuplot-buffer
))
2012 (cond ((equal gnuplot-display-process
'window
)
2013 (switch-to-buffer-other-window gnuplot-buffer
))
2014 ((equal gnuplot-display-process
'frame
)
2015 (or (and gnuplot-process-frame
2016 (frame-live-p gnuplot-process-frame
))
2017 (setq gnuplot-process-frame
(make-frame)))
2018 (raise-frame gnuplot-process-frame
)
2019 (select-frame gnuplot-process-frame
)
2020 (switch-to-buffer gnuplot-buffer
))
2022 (switch-to-buffer gnuplot-buffer
)))
2023 (message "There is not an active Gnuplot process.")))
2026 ;;; --- miscellaneous functions: insert file name, indentation, negation
2028 (defun gnuplot-insert-filename ()
2029 "Insert a filename at point, prompting for name in the minibuffer.
2030 This inserts a filename relative to the buffer's default directory.
2031 Uses completion and the value of `gnuplot-quote-character'.
2032 Bound to \\[gnuplot-insert-filename]"
2034 (insert gnuplot-quote-character
2035 (file-relative-name (read-file-name "Filename > " "")
2037 gnuplot-quote-character
) )
2039 ;; is this more complicated than it need be ...?
2040 ;; this doesn't quite do plot lists correctly:
2043 ;; set auto # not ok, should be under "p" (but does it matter?)
2045 (defun gnuplot-indent-line ()
2046 "Set indentation in gnuplot buffer.
2047 For most lines, set indentation to previous level of indentation.
2048 Attempt to add additional indentation for continued plot and splot
2056 (re-search-backward "^[ \t]*." (point-min) "to_limit")
2057 (back-to-indentation)
2058 (setq indent
(current-column))
2059 (if (looking-at "s?pl\\(o?\\|\\(ot\\)?\\)[ \t]+.?")
2060 (let ((plus (1- (length (match-string 0)))))
2063 (if (looking-at (regexp-quote "\\"))
2064 (setq indent
(+ plus indent
)))))))
2065 (if (= (current-indentation) indent
)
2068 (delete-horizontal-space)
2069 (insert (make-string indent ?
))))
2070 (if (looking-at "[ \t]+$")
2073 ;; FWIW, here are all the options which can be negated:
2074 ;; (insert (format "%s"
2077 ;; '("arrow" "autoscale" "border" "clabel" "clip"
2078 ;; "contour" "dgrid3d" "grid" "hidden3d" "key" "label"
2079 ;; "linestyle" "logscale" "multiplot" "mxtics"
2080 ;; "mytics" "mztics" "mx2tics" "my2tics"
2081 ;; "offsets" "polar" "surface" "timestamp" "title"
2082 ;; "xdtics" "ydtics" "zdtics" "x2dtics" "y2dtics"
2083 ;; "xmtics" "ymtics" "zmtics" "x2mtics" "y2mtics"
2084 ;; "xtics" "ytics" "ztics" "x2tics" "y2tics"
2085 ;; "xzeroaxis" "yzeroaxis" "zzeroaxis" "x2zeroaxis"
2086 ;; "y2zeroaxis")))))
2088 (defun gnuplot-negate-option ()
2089 "Append \"no\" to or remove \"no\" from the set option on the current line.
2090 This checks if the set option is one which has a negated form."
2092 (let ((begin (save-excursion (beginning-of-line) (point-marker)))
2093 (end (save-excursion (end-of-line) (point-marker)))
2094 (regex "a\\(rrow\\|utoscale\\)\\|border\\|c\\(l\\(abel\\|ip\\)\\|ontour\\)\\|dgrid3d\\|grid\\|hi\\(dden3d\\|storysize\\)\\|key\\|l\\(abel\\|inestyle\\|ogscale\\)\\|m\\(ouse\\|ultiplot\\|x\\(2tics\\|tics\\)\\|y\\(2tics\\|tics\\)\\|ztics\\)\\|offsets\\|polar\\|surface\\|ti\\(mestamp\\|tle\\)\\|x\\(2\\(dtics\\|mtics\\|tics\\|zeroaxis\\)\\|dtics\\|mtics\\|tics\\|zeroaxis\\)\\|y\\(2\\(dtics\\|mtics\\|tics\\|zeroaxis\\)\\|dtics\\|mtics\\|tics\\|zeroaxis\\)\\|z\\(dtics\\|mtics\\|tics\\|zeroaxis\\)"))
2096 (if (search-backward ";" begin t
)
2097 (progn (forward-char 1) (setq begin
(point-marker))))
2098 (if (search-forward ";" end t
)
2099 (progn (forward-char -
1) (setq end
(point-marker))))
2101 (skip-syntax-forward "-" end
)
2102 (if (looking-at "\\(un\\)?set\\s-+")
2103 (cond ((and gnuplot-program-version
2104 (> (string-to-number gnuplot-program-version
) 3.7))
2105 (cond ((looking-at "unset")
2107 ((looking-at (concat "set\\s-+\\(" regex
"\\)"))
2110 (message "There is not a negatable set option on this line"))))
2112 (goto-char (match-end 0))
2113 (if (> (point) end
) (goto-char end
))
2114 (cond ((looking-at "no")
2119 (message "There is not a negatable set option on this line")))))
2120 (message "There is not a set option on this line")) )))
2122 ;; (defun gnuplot-set-binding ()
2123 ;; "Interactively select a key sequence for binding to a plot function.
2124 ;; This is only useful in gnuplot 3.8 and for plot terminals which support
2125 ;; key bindings (i.e. those covered by pm3d)."
2127 ;; (let ((keyseq (read-key-sequence "Choose a key sequence now"))
2128 ;; (command (read-string "Bind to this command > ")))
2129 ;; (setq keyseq (format "%S" keyseq))
2130 ;; (string-match "keypress-event\\s-+" keyseq)
2131 ;; (setq keyseq (substring keyseq (match-end 0) -2))
2132 ;; ;; need to convert from emacs nomenclature to gnuplot. what a pain.
2133 ;; (let* ((alist '(("backspace" . "Backspace") ("tab" . "Tab") ("linefeed" . "Linefeed")
2134 ;; ("clear" . "Clear") ("return" . "Return") ("pause" . "Pause")
2135 ;; ("scroll-lock" . "Scroll_Lock") ("SysReq" . "sys-req")
2136 ;; ("escape" . "Escape") ("delete" . "Delete") ("home" . "Home")
2137 ;; ("left" . "Left") ("right" . "Right") ("up" . "Up") ("down" . "Down")
2138 ;; ("prior" . "PageUp") ("next" . "PageDown") ("end" . "End")
2139 ;; ("begin". "Begin")))
2140 ;; (match (assoc keyseq alist)))
2141 ;; (if match (setq keyseq (cdr match)))
2143 ;; (insert (format "bind \"%s\" \"%s\"" keyseq command)))))
2146 (defun gnuplot-customize ()
2147 "Customize `gnuplot-mode'."
2149 (if (fboundp 'customize-group
)
2150 (customize-group "gnuplot")
2151 (message "The Custom library is not installed.")))
2155 ;;; --- help from the info file, keyword list + completion, insert function
2158 ;; set up stuff for info-look (as suggested by <SE>)
2159 ;; modified with suggestion from <MS>
2160 (defun gnuplot-setup-info-look ()
2161 "Setup info-look in the gnuplot buffer.
2162 Also set the variable `gnuplot-keywords' and do something sensible if
2163 info-look was not available.
2164 See the comments in `gnuplot-info-hook'."
2166 (setq gnuplot-keywords-pending nil
)
2167 (if (featurep 'info-look
)
2169 (cond ((boundp 'info-lookup-symbol-alist
) ; older version
2170 (setq info-lookup-symbol-alist
2172 info-lookup-symbol-alist
2174 "[a-zA-Z][_a-zA-Z0-9]*" nil
2175 (("(gnuplot)Top" nil
"[_a-zA-Z0-9]+")
2176 ("(gnuplot)Commands" nil
"[_a-zA-Z0-9]+")
2177 ("(gnuplot)Functions" nil
"[_a-zA-Z0-9]+")
2178 ("(gnuplot)plot" nil
"[_a-zA-Z0-9]+")
2179 ("(gnuplot)set-show" nil
"[_a-zA-Z0-9]+")
2180 ("(gnuplot)data-file" nil
"[_a-zA-Z0-9]+")
2181 ("(gnuplot)smooth" nil
"[_a-zA-Z0-9]+")
2182 ("(gnuplot)style" nil
"[_a-zA-Z0-9]+")
2183 ("(gnuplot)terminal" nil
"[_a-zA-Z0-9]+")
2184 ;;("(gnuplot)General Index" nil "[_a-zA-Z0-9]+")
2185 ) "[_a-zA-Z0-9]+" ))) ))
2187 (info-lookup-maybe-add-help
2188 :mode
'gnuplot-mode
:topic
'symbol
2189 :regexp
"[a-zA-Z][_a-zA-Z0-9]*"
2190 :doc-spec
'(("(gnuplot)Top" nil
"[_a-zA-Z0-9]+")
2191 ("(gnuplot)Commands" nil
"[_a-zA-Z0-9]+")
2192 ("(gnuplot)Functions" nil
"[_a-zA-Z0-9]+")
2193 ("(gnuplot)plot" nil
"[_a-zA-Z0-9]+")
2194 ("(gnuplot)set-show" nil
"[_a-zA-Z0-9]+")
2195 ("(gnuplot)data-file" nil
"[_a-zA-Z0-9]+")
2196 ("(gnuplot)smooth" nil
"[_a-zA-Z0-9]+")
2197 ("(gnuplot)style" nil
"[_a-zA-Z0-9]+")
2198 ("(gnuplot)terminal" nil
"[_a-zA-Z0-9]+")
2200 ;; this hook is my best way of working with info-look and
2201 ;; allowing multiple versions of the gnuplot-info file.
2202 ;; yes, this is a hassle.
2203 (run-hooks 'gnuplot-info-hook
)
2204 (let ((there (bufferp (get-buffer "*info*"))))
2205 (info-lookup-setup-mode 'symbol
'gnuplot-mode
)
2206 (or there
(and (get-buffer "*info*") (kill-buffer "*info*")))
2207 ;; why are these buffers here? I think that the general
2208 ;; user will not want them lying around
2209 (and (get-buffer "info dir") (kill-buffer "info dir"))
2210 (and (get-buffer "info dir<2>") (kill-buffer "info dir<2>")))
2211 (setq gnuplot-keywords
(gnuplot-set-keywords-list))
2214 ;; or do something sensible if info-look is not installed
2215 (defun info-lookup-interactive-arguments (symbol)
2217 "Help is not available. The gnuplot info file could not be found.")
2221 (defun gnuplot-set-keywords-list ()
2222 "Set `gnuplot-keywords' from `info-lookup-cache'.
2223 Return a list of keywords."
2224 (let* ((list (cdr (assoc 'symbol info-lookup-cache
)))
2225 (list (cdr (cdr (assoc 'gnuplot-mode list
))))
2229 (setq item
(car (car list
))
2230 item
(format "%s" item
) ; keep this line for the sake of
2231 store
(append (list item
) store
) ; info-look.el w/o my patch
2233 (delete "nil" store
)
2237 (defun gnuplot-complete-keyword ()
2238 "Perform completion on keyword preceding point.
2239 This is a pretty simple minded completion function. It is loosely
2240 adapted from `lisp-complete-symbol'."
2242 (if gnuplot-keywords-pending
; <HW>
2243 (gnuplot-setup-info-look))
2244 (let* ((end (point))
2245 (beg (unwind-protect (save-excursion (backward-sexp 1) (point))))
2246 (patt (buffer-substring beg end
))
2247 (pattern (if (string-match "\\([^ \t]*\\)\\s-+$" patt
)
2248 (match-string 1 patt
) patt
))
2249 (alist (mapcar 'list gnuplot-keywords
))
2250 (completion (try-completion pattern alist
)))
2251 (cond ((eq completion t
))
2253 (message "No gnuplot keywords complete \"%s\"" pattern
))
2255 (when (not (string= pattern completion
))
2256 (delete-region beg end
)
2257 (insert completion
))
2258 (let* ((list (all-completions pattern alist
))
2259 (mess (format "%S could be one of %S" pattern list
))
2260 (orig (current-buffer))
2261 (buff (get-buffer-create " *gnuplot-completions*")))
2262 (if (= (length list
) 1) (insert " "))
2263 (if (< (length mess
) (frame-width))
2264 (if (> (length list
) 1) (message mess
))
2265 (switch-to-buffer-other-window buff
)
2267 (fill-region (point-min) (point-max))
2268 (goto-char (point-min))
2270 (+ 2 (- (count-lines (point-min) (point-max))
2272 (sit-for (max (length list
) 15))
2273 (switch-to-buffer orig
)
2275 (delete-other-windows) ))) )))
2277 (defun gnuplot-info-lookup-symbol (symbol &optional mode
)
2278 "Wrapper for `info-lookup-symbol'.
2279 Takes SYMBOL and MODE as arguments exactly as `info-lookup-symbol'.
2280 After doing the info lookup, this displays the info file in a window
2281 frame as specified by the value of `gnuplot-info-display'. If
2282 `gnuplot-info-display' is 'window, then the window will be shrunk to
2283 the size of the info entry if it is smaller than half the height of
2286 (cond (gnuplot-keywords
2287 (info-lookup-interactive-arguments 'symbol
))
2288 (gnuplot-keywords-pending ; <HW>
2289 (gnuplot-setup-info-look)
2290 (info-lookup-interactive-arguments 'symbol
))
2293 "Help is not available. The gnuplot info file could not be found.")))))
2294 (if (and (featurep 'info-look
) gnuplot-keywords
)
2295 (let ((buff (current-buffer))
2296 (info-lookup-other-window-flag
2297 (if gnuplot-info-display t nil
)))
2298 (if symbol
() (setq symbol
"Commands"))
2299 (info-lookup-symbol symbol mode
)
2300 (cond ((equal gnuplot-info-display
'window
)
2301 (let ((sw (selected-window))
2302 (window-min-height 2))
2305 (min (- (count-lines (point-min) (point-max)) (window-height))
2306 (- (/ (frame-height) 2) (window-height))))
2307 (select-window sw
)))
2308 ((equal gnuplot-info-display
'frame
)
2309 (switch-to-buffer buff
)
2310 (delete-other-windows)
2311 (or (and gnuplot-info-frame
2312 (frame-live-p gnuplot-info-frame
))
2313 (setq gnuplot-info-frame
(make-frame)))
2314 (select-frame gnuplot-info-frame
)
2315 (raise-frame gnuplot-info-frame
)
2316 (if gnuplot-xemacs-p
(setq toolbar-info-frame gnuplot-info-frame
))
2317 (switch-to-buffer "*info*") )) )))
2320 (defun gnuplot-insert (string)
2321 "Insert STRING at point and display help for for STRING.
2322 Help is not shown if `gnuplot-insertions-show-help-flag' is nil. The
2323 help shown is for STRING unless STRING begins with the word \"set\" or
2324 \"show\", in which case help is shown for the thing being set or
2327 (cond ((and (not gnuplot-three-eight-p
)
2328 (string-match "\\(emf\\|p\\(alette\\|m3d\\)\\|vgagl\\)" string
))
2329 (message "%S is an option introduced in gnuplot 3.8 (You are using %s)"
2330 string gnuplot-program-version
) )
2333 (let ((topic string
) term
)
2335 "\\(set\\|show\\)[ \t]+\\([^ \t]+\\)\\(\\s-+\\([^ \t]+\\)\\)?"
2338 (setq topic
(downcase (match-string 2 string
))
2339 term
(match-string 4 string
))
2340 (if (string= topic
"terminal") (setq topic
(downcase term
)))))
2341 (cond ((and (fboundp 'gnuplot-gui-set-options-and-insert
)
2342 gnuplot-gui-popup-flag
)
2343 (gnuplot-gui-set-options-and-insert))
2344 (gnuplot-insertions-show-help-flag
2345 (if gnuplot-keywords-pending
; <HW>
2346 (gnuplot-setup-info-look))
2347 (gnuplot-info-lookup-symbol topic
)) ) )) ) )
2349 (defun gnuplot-toggle-info-display ()
2351 (setq gnuplot-insertions-show-help-flag
(not gnuplot-insertions-show-help-flag
))
2352 (message (if gnuplot-insertions-show-help-flag
2353 "Help will be displayed after insertions."
2354 "Help no longer displayed after insertions.")))
2358 ;; grep '(defcustom' gnuplot.el gnuplot-gui.el | awk '{print $2}'
2359 (defun gnuplot-bug-report ()
2360 "Submit a bug report about `gnuplot-mode' by email.
2361 Please do not send any bug reports about gnuplot itself to the
2362 maintainer of `gnuplot-mode'."
2364 (let ((line (make-string 62 ?-
)))
2367 "Do you really want to submit an email report about gnuplot? ")
2369 (concat "Variable values will be written to the message. "
2370 "Don't erase them. OK? "))
2371 (reporter-submit-bug-report
2372 (format "%s <%s>" gnuplot-maintainer gnuplot-maintainer-email
)
2373 (format "gnuplot-mode (version %s)" gnuplot-version
)
2374 (append ; variables to display values of in mail
2377 gnuplot-after-plot-hook
2379 gnuplot-comint-setup-hook
2381 gnuplot-program-version
2382 gnuplot-process-name
2383 gnuplot-gnuplot-buffer
2384 gnuplot-display-process
2385 gnuplot-info-display
2386 gnuplot-echo-command-line-flag
2387 gnuplot-insertions-show-help-flag
2389 gnuplot-quote-character
2390 gnuplot-keywords-when
2391 ;;gnuplot-insertions-menu-flag
2392 ;;gnuplot-insertions-adornments
2393 ;;gnuplot-insertions-plot-options
2394 ;;gnuplot-insertions-terminal
2395 ;;gnuplot-insertions-x-axis
2396 ;;gnuplot-insertions-x2-axis
2397 ;;gnuplot-insertions-y-axis
2398 ;;gnuplot-insertions-y2-axis
2399 ;;gnuplot-insertions-z-axis
2400 ;;gnuplot-insertions-parametric-plots
2401 ;;gnuplot-insertions-polar-plots
2402 ;;gnuplot-insertions-surface-plots
2403 gnuplot-toolbar-display-flag
2404 gnuplot-toolbar-use-toolbar
2405 gnuplot-gui-popup-flag
2406 gnuplot-gui-frame-plist
2407 gnuplot-gui-frame-parameters
2408 gnuplot-gui-fontname-list
2409 gnuplot-gui-plot-splot-fit-style
2410 ;; plus a few more...
2411 gnuplot-comint-recent-buffer
2418 (concat line
; salutation
2419 "\nInsert your description of the gnuplot-mode bug here.\n"
2420 "Please be as specific as possible.\n\n"
2421 "There are several known shortcomings of gnuplot-mode.\n"
2422 "Many of these have to do with the complicated and inconsistent\n"
2423 "syntax of gnuplot itself. See the document string for the\n"
2424 "function `gnuplot-mode' (use `"
2425 (substitute-command-keys "\\[describe-function]")
2426 "') for details.\n\n"
2427 "Note that this bug report form should be used for problems\n"
2428 "with gnuplot-mode only. Problems with gnuplot itself should\n"
2429 "be addressed directly to the developers of gnuplot.\n"
2430 "The maintainer of gnuplot-mode will not field questions about\n"
2431 "gnuplot itself. Thank you.\n"
2437 ;;; --- autoloaded functions: gnuplot-mode and gnuplot-make-buffer
2440 (defun gnuplot-mode ()
2441 "Major mode for editing and executing GNUPLOT scripts.
2442 This was written with version 3.7 of gnuplot in mind but it should
2443 work fine with version 3.5 and the various 3.6 beta versions.
2445 Report bugs in `gnuplot-mode' using \\[gnuplot-bug-report].
2449 The help functions, keyword completion, and several other features
2450 depend upon having the info file properly installed. The info file
2451 can be made in the document directory of the gnuplot distribution or
2452 is available at the `gnuplot-mode' web page:
2453 http://feff.phys.washington.edu/~ravel/software/gnuplot-mode/
2455 If the help function does not work properly, you may have an older
2456 version of the gnuplot info file. Try the suggestion in the document
2457 string for the variable `gnuplot-info-hook'. See the `gnuplot-mode'
2458 web page for more details.
2462 There are several known shortcomings of `gnuplot-mode', version 0.5g
2463 and up. Many of the shortcomings involve the graphical interface
2464 (refered to as the GUI) to setting arguments to plot options. Here is
2467 1. Currently there is no way for `gnuplot-mode' to know if information
2468 sent to gnuplot was correctly plotted.
2469 2. Indentation is sometimes a bit flaky.
2470 3. \"plot\", \"splot\", and \"fit\" are handled in the GUI, but are
2471 a bit flaky. Their arguments may not be read correctly from
2472 existing text, and continuation lines (common for plot and splot)
2474 4. The GUI does not know how to read from continuation lines.
2475 5. Comma separated position arguments to plot options are
2476 unsupported in the GUI. Colon separated datafile modifiers (used
2477 for plot, splot, and fit) are not supported either. Arguments
2478 not yet supported by the GUI generate messages printed in grey
2480 6. The GUI handling of \"hidden3d\" is flaky and \"cntrparam\" is
2486 \\{gnuplot-mode-map}"
2488 (kill-all-local-variables)
2489 (use-local-map gnuplot-mode-map
)
2490 (setq major-mode
'gnuplot-mode
2491 mode-name
"Gnuplot")
2492 (set (make-local-variable 'comment-start
) "# ")
2493 (set (make-local-variable 'comment-end
) "")
2494 (set (make-local-variable 'comment-column
) 32)
2495 (set (make-local-variable 'comment-start-skip
) "#[ \t]*")
2496 (set (make-local-variable 'indent-line-function
) 'gnuplot-indent-line
)
2497 (set-syntax-table gnuplot-mode-syntax-table
)
2498 (if (or (fboundp 'hilit-set-mode-patterns
)
2499 (equal gnuplot-keywords-when
'immediately
)) ; <HW>
2500 (gnuplot-setup-info-look)) ;; <SE>
2501 (if (fboundp 'hilit-set-mode-patterns
) ; deal with hilit19 (ho hum!)
2502 (let ((keywords (concat "\\b\\(" (mapconcat 'identity
2503 gnuplot-keywords
"\\|")
2505 (hilit-set-mode-patterns
2507 `(("#.*$" nil comment
)
2508 ("\\([a-zA-Z0-9_-]+\\)\\(([^)]*)\\)?\\s *=" nil define
)
2509 ,(list keywords
'nil
'keyword
)
2510 (hilit-string-find ?
\\ string
)
2512 ;;(if (featurep 'kw-compl) ; old-style keyword completion
2513 ;; (setq kw-compl-list gnuplot-keywords
2514 ;; kw-compl-upper-case nil)) ; gnuplot keywords must be lower case
2515 (if gnuplot-xemacs-p
; deal with font-lock
2516 (if (fboundp 'turn-on-font-lock
) (turn-on-font-lock))
2518 (make-variable-buffer-local 'font-lock-defaults
)
2519 (setq font-lock-defaults
'(gnuplot-font-lock-keywords t t
))))
2520 ;; (if (and gnuplot-xemacs-p gnuplot-toolbar-display-flag)
2521 ;; (condition-case () ; deal with the toolbar
2522 ;; (and (require 'toolbar)
2524 ;; (gnuplot-make-toolbar-function))
2526 (if (fboundp 'widget-create
) ; gunplot-gui
2528 (require 'gnuplot-gui
)
2530 (setq gnuplot-first-call nil
; a few more details ...
2531 gnuplot-comint-recent-buffer
(current-buffer)
2532 comint-process-echoes gnuplot-echo-command-line-flag
)
2533 (run-hooks 'gnuplot-mode-hook
)
2534 ;; the first time we need to figure out which gnuplot we are running
2535 (if gnuplot-program-version
2536 (gnuplot-setup-menu-and-toolbar)
2537 (gnuplot-fetch-version-number)))
2540 (defun gnuplot-make-buffer ()
2541 "Open a new buffer in `gnuplot-mode'.
2542 When invoked, it switches to a new, empty buffer visiting no file
2543 and then starts `gnuplot-mode'.
2545 It is convenient to bind this function to a global key sequence. For
2546 example, to make the F10 key open a gnuplot script buffer, put the
2547 following in your .emacs file:
2548 (autoload 'gnuplot-make-buffer \"gnuplot\"
2549 \"open a buffer in gnuplot mode\" t)
2550 (global-set-key [(f10)] 'gnuplot-make-buffer)"
2552 (switch-to-buffer gnuplot-gnuplot-buffer
)
2555 (defun gnuplot-show-version ()
2556 "Show version number in echo area"
2558 (message "gnuplot-mode %s -- URL: %s" gnuplot-version gnuplot-maintainer-url
))
2560 (defun gnuplot-show-gnuplot-version ()
2561 "Show gnuplot program and version number in echo area"
2563 (message "You are calling gnuplot %s as %s" gnuplot-program-version gnuplot-program
))
2566 ;;; That's it! ----------------------------------------------------------------
2569 ;;; --- final chores: provide 'gnuplot and run load-hook
2570 ;; provide before run-hooks suggested by <DB>
2572 (run-hooks 'gnuplot-load-hook
)
2574 ;;;============================================================================
2576 ;;; gnuplot.el ends here