branch: elpa/gnuplot
commit a080f79b6f7a6ca94d11cda0d341acfc6e76d0c5
Merge: 4b267b8 8f2ddd0
Author: Naoya Yamashita <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #45 from conao3/fix-trivial
    
    Solve package-lint/byte-compile/check-doc warnings
---
 gnuplot-context.el | 271 +++++++++++++-------------
 gnuplot-gui.el     |  47 ++---
 gnuplot.el         | 557 +++++++++++++++++++++++++++--------------------------
 3 files changed, 436 insertions(+), 439 deletions(-)

diff --git a/gnuplot-context.el b/gnuplot-context.el
index 382cf94..7b067b7 100644
--- a/gnuplot-context.el
+++ b/gnuplot-context.el
@@ -3,11 +3,7 @@
 ;; Copyright (C) 2012-2013 Jon Oddie <[email protected]>
 
 ;; Author:     Jon Oddie <[email protected]>
-;; Maintainer: Jon Oddie <[email protected]>
-;; Created:    Wednesday, 08 February 2012
-;; Updated:    Friday, 07 February 2013
-;; Version:    0.7.0
-;; Keywords:   gnuplot, plotting
+;; URL:        https://github.com/emacsorphanage/gnuplot
 
 ;; This file is not part of GNU Emacs.
 
@@ -45,10 +41,10 @@
 ;;
 ;; Gnuplot's context sensitive mode is best controlled using Customize
 ;; (M-x customize-group gnuplot): simply enable the
-;; `gnuplot-context-sensitive-mode' setting. On recent Emacs (>= 23),
+;; `gnuplot-context-sensitive-mode' setting.  On recent Emacs (>= 23),
 ;; you may also want to turn on `gnuplot-tab-completion' so that the
 ;; TAB key does auto-completion on lines which are already
-;; indented. (This just sets the Emacs variable `tab-always-indent' to
+;; indented.  (This just sets the Emacs variable `tab-always-indent' to
 ;; `complete' in Gnuplot buffers).
 ;;
 ;; If you need to turn context sensitivity on or off from Lisp code
@@ -60,7 +56,7 @@
 ;; or not, you can always pop up a longer description of syntax using
 ;; `gnuplot-help-function' (C-c C-/ or C-c M-h).  ElDoc support also
 ;; requires an additional file of help strings, `gnuplot-eldoc.el',
-;; which should be included in recent Gnuplot releases. If it didn't
+;; which should be included in recent Gnuplot releases.  If it didn't
 ;; come with your Gnuplot installation, you'll need to grab a recent
 ;; source distribution of Gnuplot from http://gnuplot.info, and use
 ;; the `doc2texi.el' program in the docs/ directory to create it.  So
@@ -76,8 +72,8 @@
 ;;
 ;; Gnuplot's command language has a fair amount of syntactic
 ;; complexity, and the only way I could think of to support these
-;; features was to do a complete parse of the command line. So that's
-;; what this package does. Instead of building a parse tree, it
+;; features was to do a complete parse of the command line.  So that's
+;; what this package does.  Instead of building a parse tree, it
 ;; matches up until the token at point, and then either makes a list
 ;; of possible completions, or sets the variables `gnuplot-eldoc' and
 ;; `gnuplot-info-at-point' based on where it is in the grammar at that
@@ -95,7 +91,7 @@
 ;; work well enough, and it saves on the Emacs call stack.
 ;;
 ;; Compiling the grammar does require increasing `max-lisp-eval-depth'
-;; modestly. This shouldn't cause any problems on modern machines, and
+;; modestly.  This shouldn't cause any problems on modern machines, and
 ;; it only needs to be done once, at byte-compilation time.
 ;;
 ;; The parsing machine and compiler are partially based on the
@@ -110,30 +106,30 @@
 ;; notation as follows:
 ;;
 ;;    any
-;;     Match any token
+;;      Match any token
 ;;
 ;;    name, number, string, separator
-;;     Match a token of the given type. "Separator" is semicolon, the
-;;     statement separator.
+;;      Match a token of the given type.  "Separator" is semicolon, the
+;;      statement separator.
 ;;
 ;;    Any other symbol
-;;     Match another named rule in the grammar. May be recursive.
+;;      Match another named rule in the grammar.  May be recursive.
 ;;
 ;;    "STRING"
-;;     Match literally: a token with exactly the text "STRING".
+;;      Match literally: a token with exactly the text "STRING".
 ;;
 ;;   (kw KEYWORD ALIASES ...)
-;;     Match abbreviated Gnuplot keywords. KEYWORD can be a string or
-;;     a cons (PREFIX . SUFFIX). In the latter case, this pattern
-;;     will match PREFIX plus any number of characters from the
-;;     beginning of SUFFIX.  Any literal string from ALIASES will
-;;     also match. The token-id of the matching token is mutated to
-;;     the canonical value of KEYWORD.
-;;     Example:
-;;      (kw ("linew" ."idth") "lw") matches "linew", "linewi",
-;;     ... "linewidth" as well as "lw". Any of these tokens will
-;;     appear as "linewidth" in subsequent processing. (This is
-;;     important for the "info-keyword" form, see below).
+;;  Match abbreviated Gnuplot keywords.  KEYWORD can be a string or
+;;  a cons (PREFIX . SUFFIX).  In the latter case, this pattern
+;;  will match PREFIX plus any number of characters from the
+;;  beginning of SUFFIX.  Any literal string from ALIASES will
+;;  also match.  The token-id of the matching token is mutated to
+;;  the canonical value of KEYWORD.
+;;  Example:
+;;   (kw ("linew" ."idth") "lw") matches "linew", "linewi",
+;;  ... "linewidth" as well as "lw".  Any of these tokens will
+;;  appear as "linewidth" in subsequent processing.  (This is
+;;  important for the "info-keyword" form, see below).
 ;;
 ;; The other pattern forms combine simpler patterns, much like regular
 ;; expressions or PEGs (parsing expression grammars):
@@ -141,48 +137,48 @@
 ;;    (sequence { (:eldoc "eldoc string") }
 ;;              { (:info "info page") }
 ;;              { (:no-info) }
-;;          PATTERN PATTERN... )
-;;     Match all the PATTERNs in sequence or fail. Sequences can also
-;;     have optional ElDoc strings and info pages associated with
-;;     them; the innermost ElDoc or info page around point is the one
-;;     shown to the user. Alternatively, either property may be a
-;;     symbol, which should be a function to be called to get the
-;;     real value.  Finally, if no ElDoc string is specified but the
-;;     variable `gnuplot-eldoc-hash' contains a value for the name of
-;;     the info page at point, that value is used as the ElDoc string
-;;     instead.
+;;           PATTERN PATTERN... )
+;;      Match all the PATTERNs in sequence or fail.  Sequences can also
+;;      have optional ElDoc strings and info pages associated with
+;;      them; the innermost ElDoc or info page around point is the one
+;;      shown to the user.  Alternatively, either property may be a
+;;      symbol, which should be a function to be called to get the
+;;      real value.  Finally, if no ElDoc string is specified but the
+;;      variable `gnuplot-eldoc-hash' contains a value for the name of
+;;      the info page at point, that value is used as the ElDoc string
+;;      instead.
 ;;
-;;     For better readability, sequence forms can also be written as
-;;     a vector, omitting the `sequence': [PATTERN PATTERN ...]
+;;  For better readability, sequence forms can also be written as
+;;  a vector, omitting the `sequence': [PATTERN PATTERN ...]
 ;;
 ;;    (either PATTERN PATTERN...)
-;;     Match the first PATTERN to succeed, or fail if none
-;;     matches. Like regexp `|'.
+;;      Match the first PATTERN to succeed, or fail if none
+;;      matches.  Like regexp `|'.
 ;;
 ;;    (many PATTERN)
-;;     Match PATTERN zero or more times, greedily; like regexp
-;;     `*'. Unlike a regular expression matcher, the parsing machine
-;;     will not backtrack and try to match fewer times if a later
-;;     part of the pattern fails. This applies equally to the other
-;;     non-deterministic forms "either" and "maybe".
+;;  Match PATTERN zero or more times, greedily; like regexp
+;;  `*'.  Unlike a regular expression matcher, the parsing machine
+;;  will not backtrack and try to match fewer times if a later
+;;  part of the pattern fails.  This applies equally to the other
+;;  non-deterministic forms "either" and "maybe".
 ;;
 ;;    (maybe PATTERN)
-;;     Match PATTERN zero or one times, like regexp `?'.
+;;      Match PATTERN zero or one times, like regexp `?'.
 ;;
 ;;    (capture NAME PATTERN)
-;;     Match PATTERN, capturing the tokens in a capture group named
-;;     NAME. Capture groups are stored in `gnuplot-captures'
-;;     and can be retrieved using `gnuplot-capture-group'. This is
-;;     used to store the plotting style, which we need in order to
-;;     give the correct ElDoc string for "using" clauses, and for
-;;     info keywords (see below)
+;;      Match PATTERN, capturing the tokens in a capture group named
+;;      NAME.  Capture groups are stored in `gnuplot-captures'
+;;      and can be retrieved using `gnuplot-capture-group'.  This is
+;;      used to store the plotting style, which we need in order to
+;;      give the correct ElDoc string for "using" clauses, and for
+;;      info keywords (see below)
 ;;
 ;;    (info-keyword PATTERN)
-;;     Match PATTERN, and use whatever the value of the first token
-;;     it matches is to look up info pages for this pattern. Most
-;;     Gnuplot info pages have the same name as the keyword they
-;;     document, so by using this we only have to put :info
-;;     properties on the few that don't, such as "set".
+;;      Match PATTERN, and use whatever the value of the first token
+;;      it matches is to look up info pages for this pattern.  Most
+;;      Gnuplot info pages have the same name as the keyword they
+;;      document, so by using this we only have to put :info
+;;      properties on the few that don't, such as "set".
 ;;
 ;;    For convenience, "many", "maybe", "capture" and "info-keyword"
 ;;    wrap the rest of their arguments in an implicit "sequence" form,
@@ -190,14 +186,14 @@
 ;;    (maybe (sequence "," expression))
 ;;
 ;;    (delimited-list PATTERN SEPARATOR)
-;;     Match a list of PATTERNs separated by SEPARATOR. Sugar for:
-;;     (sequence PATTERN (many (sequence SEPARATOR PATTERN)))
+;;      Match a list of PATTERNs separated by SEPARATOR.  Sugar for:
+;;      (sequence PATTERN (many (sequence SEPARATOR PATTERN)))
 ;;
 ;;   (assert LISP-FORM)
-;;     Evaluate LISP-FORM and fail if it returns NIL. We need this in
-;;     the patterns for "plot" and "splot" to check whether the
-;;     command at point should be parsed in parametric mode or
-;;     not. See `gnuplot-guess-parametric-p'.
+;;  Evaluate LISP-FORM and fail if it returns NIL.  We need this in
+;;  the patterns for "plot" and "splot" to check whether the
+;;  command at point should be parsed in parametric mode or
+;;  not.  See `gnuplot-guess-parametric-p'.
 ;;
 ;;
 ;; Bugs, TODOs, etc.
@@ -214,22 +210,22 @@
 ;; many lines.
 ;;
 ;; In ElDoc mode, we parse the whole line every time the user stops
-;; typing. This is wasteful; should cache things in text properties
+;; typing.  This is wasteful; should cache things in text properties
 ;; instead.
 ;;
 ;; The pattern matching engine uses backtracking, which can take
-;; exponential time. So far it seems "fast enough" in actual use.
+;; exponential time.  So far it seems "fast enough" in actual use.
 ;;
 ;; The patterns don't really distinguish between "plot" and "splot"
 ;; for things like plot styles, binary arguments, etc.
 ;;
 ;; Some other the patterns are probably not quite right, especially for
 ;; things like abbreviated keywords, and features that I don't use
-;; myself like "fit". Hopefully anyone bothered by this will submit
+;; myself like "fit".  Hopefully anyone bothered by this will submit
 ;; patches ;-)
 ;;
 ;; It would be possible to provide more helpful ElDoc strings for
-;; sub-parts of complicated options like "cntrparam". This is a time
+;; sub-parts of complicated options like "cntrparam".  This is a time
 ;; and maintenance issue rather than a technical one.
 
 ;;; Code:
@@ -255,10 +251,10 @@
 ;;;; The tokenizer.
 
 (defstruct gnuplot-token
-  start            ; Buffer start position
-  end      ; Buffer end position
-  id       ; Text
-  type)            ; a symbol: name, number, string, operator, separator
+  start         ; Buffer start position
+  end       ; Buffer end position
+  id        ; Text
+  type)         ; a symbol: name, number, string, operator, separator
 
 (defvar gnuplot-operator-regexp
   (eval-when-compile
@@ -284,10 +280,11 @@
               rules))))
 
 (defun gnuplot-tokenize (&optional completing-p)
-  "Tokenize the Gnuplot command at point. Returns a list of `gnuplot-token' 
objects.
+  "Tokenize the Gnuplot command at point.
+Return a list of `gnuplot-token' objects.
 
 If COMPLETING-P is non-nil, omits the token at point if it is a
-name; otherwise continues tokenizing up to the token at point. FIXME"
+name; otherwise continues tokenizing up to the token at point.  FIXME."
   (let ((tokens '())
         (stop-point (min (point)
                          (gnuplot-point-at-end-of-command))))
@@ -326,7 +323,7 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
                      :start from :end to)))
 
                  (t (error
-                     "gnuplot-tokenize: bad token beginning %s"
+                     "Gnuplot-tokenize: bad token beginning %s"
                      (buffer-substring-no-properties (point) stop-point))))))
 
           (push token tokens))))
@@ -356,41 +353,41 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
 ;; instructions" are the following:
 ;;
 ;;    (any)
-;;     Match any token (fails only at end of command).
+;;      Match any token (fails only at end of command).
 ;;
 ;;    (literal LITERAL NO-COMPLETE)
-;;     Match token with `gnuplot-token-id' LITERAL or fail. If we
-;;     have reached the token before point, include LITERAL in the
-;;     completion list unless NO-COMPLETE is non-`nil'.
+;;      Match token with `gnuplot-token-id' LITERAL or fail. If we
+;;      have reached the token before point, include LITERAL in the
+;;      completion list unless NO-COMPLETE is non-`nil'.
 ;;
 ;;    (token-type TYPE)
-;;     Match a token with `gnuplot-token-type' TYPE, or fail.
+;;      Match a token with `gnuplot-token-type' TYPE, or fail.
 ;;
 ;;    (keyword REGEXP NAME)
-;;     Match any token whose `gnuplot-token-id' matches REGEXP. Use
-;;     NAME for the completion list.
+;;      Match any token whose `gnuplot-token-id' matches REGEXP. Use
+;;      NAME for the completion list.
 ;;
 ;;    (jump OFFSET FIXED)
-;;     Jump to (set PC to) OFFSET if FIXED is non-nil, otherwise to
-;;     PC + OFFSET
+;;      Jump to (set PC to) OFFSET if FIXED is non-nil, otherwise to
+;;      PC + OFFSET
 ;;
 ;;    (call OFFSET FIXED)
-;;     Like "jump", but push a return address onto the stack for
-;;     (return). (The compiler adds the name of the rule being called
-;;     as a fourth element on the end of the list, but this is just a
-;;     comment for debugging purposes).
+;;      Like "jump", but push a return address onto the stack for
+;;      (return). (The compiler adds the name of the rule being called
+;;      as a fourth element on the end of the list, but this is just a
+;;      comment for debugging purposes).
 ;;
 ;;    (return)
-;;     Return to the PC address on top of the stack, or finish
-;;     matching if stack is empty. (Usually this doesn't happen,
-;;     because the machine stops as soon as it gets to the token at
-;;     point).
+;;      Return to the PC address on top of the stack, or finish
+;;      matching if stack is empty. (Usually this doesn't happen,
+;;      because the machine stops as soon as it gets to the token at
+;;      point).
 ;;
 ;;    (choice OFFSET)
-;;     Push a backtracking entry for location PC + OFFSET onto the
-;;     backtracking stack. Backtracking entries save the contents of
-;;     the call stack, position in the token list, the values of
-;;     capture groups, and the record of loop progress (see below).
+;;      Push a backtracking entry for location PC + OFFSET onto the
+;;      backtracking stack. Backtracking entries save the contents of
+;;      the call stack, position in the token list, the values of
+;;      capture groups, and the record of loop progress (see below).
 ;;
 ;;    (check-progress)
 ;;      Break out of infinite loops, like (many (many ...)).  Checks
@@ -400,38 +397,38 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
 ;;      new entry onto the list.
 ;;
 ;;    (fail)
-;;     Pop the most recent backtracking entry and continue from
-;;     there, or fail the whole match if out of backtrack
-;;     points. Failing to match returns the remainder of the token
-;;     list, although we don't currently use this for anything.
+;;      Pop the most recent backtracking entry and continue from
+;;      there, or fail the whole match if out of backtrack
+;;      points. Failing to match returns the remainder of the token
+;;      list, although we don't currently use this for anything.
 ;;
 ;;    (commit OFFSET)
-;;     Discard one backtracking point and jump to PC + OFFSET. This
-;;     is used to make the (either) form non-deterministic.
+;;      Discard one backtracking point and jump to PC + OFFSET. This
+;;      is used to make the (either) form non-deterministic.
 ;;
 ;;    (push TYPE VALUE)
-;;     Push an entry for an eldoc or info string (specified by TYPE)
-;;     onto the stack.
+;;      Push an entry for an eldoc or info string (specified by TYPE)
+;;      onto the stack.
 ;;
 ;;    (pop TYPE)
-;;     Pop something off the stack; checks that it has the expected
-;;     TYPE, for safety.
+;;      Pop something off the stack; checks that it has the expected
+;;      TYPE, for safety.
 ;;
 ;;    (save-start NAME)
-;;     Open a capture group named NAME. Pushes an entry onto
-;;     `gnuplot-captures' with current position in token list as the
-;;     start of the group.
+;;      Open a capture group named NAME. Pushes an entry onto
+;;      `gnuplot-captures' with current position in token list as the
+;;      start of the group.
 ;;
 ;;    (save-end NAME)
-;;     Close the capture group named NAME. Finds the topmost entry in
-;;     `gnuplot-captures' with this name and sets its endpoint to the
-;;     current position in token list. Error if no group with that
-;;     name is found.
+;;      Close the capture group named NAME. Finds the topmost entry in
+;;      `gnuplot-captures' with this name and sets its endpoint to the
+;;      current position in token list. Error if no group with that
+;;      name is found.
 ;;
 ;;    (label NAME)
-;;     This should never be reached and will cause an error. The
-;;     compiler inserts it at the beginning of compiled rules only
-;;     for debugging purposes.
+;;      This should never be reached and will cause an error. The
+;;      compiler inserts it at the beginning of compiled rules only
+;;      for debugging purposes.
 ;;
 
 
@@ -493,13 +490,13 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
           ;; (either...): choose between patterns
           ((either)
            (cond
-            ((= (length pat) 2)                ; trivial case
+            ((= (length pat) 2)         ; trivial case
              (gnuplot-compile-pattern (cadr pat)))
 
-            ((> (length pat) 3)                ; could be more efficient...
+            ((> (length pat) 3)         ; could be more efficient...
              (gnuplot-compile-pattern (gnuplot-either-helper pat)))
 
-            (t                         ; two patterns
+            (t              ; two patterns
              (let* ((pat1 (cadr pat))
                     (pat2 (caddr pat))
                     (pat1-c (gnuplot-compile-pattern pat1))
@@ -517,7 +514,7 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
                   (pat1-c (gnuplot-compile-pattern pat1))
                   (pat1-l (length pat1-c)))
              `((choice ,(+ pat1-l 3))
-               (check-progress)                ; bail out of infinite loops
+               (check-progress)         ; bail out of infinite loops
                ,@pat1-c
                (commit ,(- (+ pat1-l 2))))))
 
@@ -572,7 +569,7 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
              `((assert ,form))))
 
           (t
-           (error "gnuplot-compile-pattern: bad pattern form %s" pat)))))))
+           (error "Gnuplot-compile-pattern: bad pattern form %s" pat)))))))
 
   ;; Helper function for destructuring (sequence ...) forms in patterns
   ;; Takes the cdr of the sequence form, returns a list (PATTERNS ELDOC
@@ -621,7 +618,7 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
   ;; each pattern individually, then "links" them into one vector,
   ;; converting symbolic (call ...) instructions into numeric offsets
   (defun gnuplot-compile-grammar (grammar start-symbol)
-    (let ((compiled-pats '())        ; Alist of (name . instructions)
+    (let ((compiled-pats '())         ; Alist of (name . instructions)
           ;; Reserve space for a jump to the start symbol
           (code-length 1))
 
@@ -679,7 +676,7 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
                      (setcdr inst `(,location))))
 
                   (t
-                   (error "gnuplot-compile-grammar: bad instruction %s" 
inst))))))))
+                   (error "Gnuplot-compile-grammar: bad instruction %s" 
inst))))))))
         object-code))))
 
 ;;; The grammar.
@@ -1239,7 +1236,7 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
 
          (set-dgrid3d-clause
           ["dgrid3d"
-           (maybe expression)          ; fixme
+           (maybe expression)       ; fixme
            (maybe "," expression)
            (either
             "splines"
@@ -1448,7 +1445,7 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
              "gray" "color"
              ["gamma" number]
              ["rgbformulae" number "," number "," number]
-             "defined"                 ; not complete
+             "defined"          ; not complete
              ["functions" expression "," expression "," expression]
              ["file" string (many datafile-modifier)]
              "RGB" "HSV" "CMY" "YIQ" "XYZ"
@@ -1550,7 +1547,7 @@ name; otherwise continues tokenizing up to the token at 
point. FIXME"
 
          (set-table-clause ["table" (maybe string)])
 
-         (set-terminal-clause          ; not sure how to do this...
+         (set-terminal-clause       ; not sure how to do this...
           ["terminal" (maybe (either "push" "pop"))])
 
          (set-termoption-clause
@@ -1751,14 +1748,14 @@ token before point.")
   "Relevant page of the Gnuplot info manual for the construction at point.
 
 Set by `gnuplot-match-pattern' using information from
-`gnuplot-compiled-grammar'. `gnuplot-match-pattern' pushes ElDoc
+`gnuplot-compiled-grammar'.  `gnuplot-match-pattern' pushes ElDoc
 and info strings onto the stack as it runs, and scans the stack
 for the topmost entry when it reaches the token at point.")
 
 (defvar gnuplot-eldoc nil
   "ElDoc documentation string for the Gnuplot construction at point.
 
-Set by `gnuplot-match-pattern'. See also `gnuplot-info-at-point'.")
+Set by `gnuplot-match-pattern'.  See also `gnuplot-info-at-point'.")
 
 (defvar gnuplot-captures nil
   "Alist of named capture groups for gnuplot-mode completion code.
@@ -1776,14 +1773,14 @@ token list just after the end of the capture group.")
   "Parse TOKENS, setting completions, info and ElDoc information.
 
 This function parses TOKENS by simulating a stack machine with
-unlimited backtracking. If COMPLETING-P is non-nil, it stops
+unlimited backtracking.  If COMPLETING-P is non-nil, it stops
 before the token at point and collects a list of the next tokens
-that it would accept in `gnuplot-completions'. If COMPLETING-P is
+that it would accept in `gnuplot-completions'.  If COMPLETING-P is
 nil, it parses up to the token at point and sets `gnuplot-eldoc'
 and `gnuplot-info-at-point' based on the contents of the stack
 there."
   (catch 'return
-    (let ((pc 0)                       ; Program counter
+    (let ((pc 0)            ; Program counter
           ;; Stack of return addresses (return PC), eldoc strings
           ;; (eldoc STRING) and info pages (info STRING)
           (stack '())
@@ -1800,7 +1797,7 @@ there."
 
       (with-gnuplot-trace-buffer (erase-buffer))
 
-      (when start-symbol               ; HACK FIXME
+      (when start-symbol        ; HACK FIXME
         (let ((look-for `(label ,start-symbol)))
           (while (not (equal (aref instructions pc) look-for))
             (incf pc))
@@ -1914,7 +1911,7 @@ there."
               ((commit)
                (let ((location (cadr inst)))
                  (if (not backtrack)
-                     (error "no more backtrack points in commit"))
+                     (error "No more backtrack points in commit"))
                  (pop backtrack)
                  (setq jump location)))
 
@@ -1955,7 +1952,7 @@ there."
                (let* ((name (cadr inst))
                       (record (assoc name gnuplot-captures)))
                  (if (not record)
-                     (error "gnuplot-match-tokens: no open capture group named 
%s" name)
+                     (error "Gnuplot-match-tokens: no open capture group named 
%s" name)
                    (setf (caddr record) tokens)
                    (gnuplot-debug (gnuplot-dump-captures)))))
 
@@ -1967,7 +1964,7 @@ there."
                    (push (cons pc tokens) progress))))
 
               (t
-               (error "bad instruction: %s" inst)))
+               (error "Bad instruction: %s" inst)))
 
             ;; Increment PC or jump
             (setq pc (or jump (1+ pc))
@@ -1975,7 +1972,7 @@ there."
 
             ;; Backtrack on failure
             (when fail
-              (if (not backtrack)      ; Out of backtracking stack: failed 
match
+              (if (not backtrack)   ; Out of backtracking stack: failed match
                   (throw 'return nil)
                 (gnuplot-trace "\t*fail*\t%s\n" (length backtrack))
                 (gnuplot-debug (gnuplot-dump-backtrack backtrack))
@@ -1996,7 +1993,7 @@ there."
                   (gnuplot-debug (gnuplot-dump-progress progress)))))))))))
 
 (defun gnuplot-scan-stack (stack tokens)
-  "Scan STACK for the most recently pushed eldoc and info strings"
+  "Scan STACK for the most recently pushed eldoc and info strings."
   (gnuplot-trace "\t* scanning stack *\n")
   (gnuplot-debug (gnuplot-backtrace))
   (gnuplot-debug (gnuplot-dump-captures))
diff --git a/gnuplot-gui.el b/gnuplot-gui.el
index a62996c..a3eb4e0 100644
--- a/gnuplot-gui.el
+++ b/gnuplot-gui.el
@@ -3,11 +3,7 @@
 ;; Copyright (C) 1998-2000 Bruce Ravel
 
 ;; Author:     Bruce Ravel <[email protected]>
-;; Maintainer: Bruce Ravel <[email protected]>
-;; Created:    19 December 1998
-;; Updated:    16 November 2000
-;; Version:    (same as gnuplot.el)
-;; Keywords:   gnuplot, plotting, interactive, GUI
+;; URL:        https://github.com/emacsorphanage/gnuplot
 
 ;; This file is not part of GNU Emacs.
 
@@ -77,7 +73,7 @@
         (require 'wid-edit))
     (error nil)))
 (require 'cl)
-(eval-when-compile                     ; suppress some compiler warnings
+(eval-when-compile          ; suppress some compiler warnings
   (defvar gnuplot-xemacs-p nil)
   (defvar gnuplot-quote-character nil)
   (defvar gnuplot-info-display nil)
@@ -86,7 +82,7 @@
 ;; (eval-when-compile
 ;;   (require 'wid-edit))
 
-(eval-and-compile                      ; I need this!
+(eval-and-compile           ; I need this!
   (if (fboundp 'split-string)
       ()
     (defun split-string (string &optional pattern)
@@ -112,7 +108,7 @@ If PATTERN is omitted, it defaults to \"[ 
\\f\\t\\n\\r\\v]+\"."
   :group 'gnuplot)
 
 (defcustom gnuplot-gui-popup-flag nil
-  "*Non-nil means to open arguments pop-ups automatically.
+  "Non-nil means to open arguments pop-ups automatically.
 This would be done after menu insertion of Gnuplot commands."
   :group 'gnuplot-gui
   :type 'boolean)
@@ -330,7 +326,7 @@ See the doc-string for `gnuplot-gui-all-types'.")
                   '(("POINTSIZE"        'number " ")
                     ("LINEWIDTH"        'number " ")
                     ("INTERVAL "        'number " ")))
-            (cons "vgagl"              ; for pm3d patch (also persist, raise 
in x11) <MT>
+            (cons "vgagl"       ; for pm3d patch (also persist, raise in x11) 
<MT>
                   '(("BACKGROUND"       'position  " " "background" 3)
                     ("INTERPOLATION"    'list " " "uniform" "interpolate")
                     ("DUMP"             'file " ")
@@ -377,8 +373,7 @@ See the doc-string for `gnuplot-gui-all-types'.")
                      "dots" "points" "linespoints")
                     ("LINESTYLE"   'number " " "ls")
                     ("LINETYPE"    'number " " "lt")
-                    ("LINEWIDTH"   'number " " "lw")
-                    ))
+                    ("LINEWIDTH"   'number " " "lw")))
             (cons "boxwidth"
                   '(("WIDTH" 'number " ")))
             (cons "clabel"
@@ -621,8 +616,7 @@ See the doc-string for `gnuplot-gui-all-types'.")
             (cons "x2zeroaxis" gnuplot-gui-zeroaxis-list)
 
             (cons "zero"
-                  '(("THRESHOLD" 'number " ")))
-            ))
+                  '(("THRESHOLD" 'number " ")))))
 
 (defvar gnuplot-gui-command-types nil
   "Associated list of command descriptions.
@@ -702,8 +696,7 @@ parsing values already in the script buffer."
     ("LINE TYPE  " 'number " " "lt")
     ("LINE WIDTH " 'number " " "lw")
     ("POINT TYPE " 'number " " "pt")
-    ("POINT STYLE" 'number " " "ps")
-    ))
+    ("POINT STYLE" 'number " " "ps")))
 (defconst gnuplot-gui-splot-simple-list
   '(("DATA FILE"   'file   " ")
     ("TITLE"       'string " ")
@@ -845,8 +838,8 @@ The value of REST depends upon TYPE:
 Here is an example entry for the png terminal type:
 
   (cons \"png\"
-       '((\"SIZE\"  'list \" \" \"small\" \"medium\" \"large\")
-         (\"COLOR\" 'list \" \" \"monochrome\" \"gray\" \"color\")))
+    '((\"SIZE\"  'list \" \" \"small\" \"medium\" \"large\")
+      (\"COLOR\" 'list \" \" \"monochrome\" \"gray\" \"color\")))
 
 This alist is formed at load time by appending together
 `gnuplot-gui-terminal-types', `gnuplot-gui-set-types' and
@@ -856,8 +849,7 @@ This alist is formed at load time by appending together
                                     gnuplot-gui-set-types
                                     gnuplot-gui-command-types
                                     gnuplot-gui-plot-splot-fit
-                                    gnuplot-gui-test-type
-                                    ))
+                                    gnuplot-gui-test-type))
 
 
 (defun gnuplot-gui-swap-simple-complete ()
@@ -1038,10 +1030,10 @@ from the list and concatenates the strings that are 
part of a quoted
 argument, for example an axis label or a font name.  It also replaces
 bounding single quotes with double quotes, since double quotes are
 used in `gnuplot-gui-all-types'."
-  (let (fixed-list quote quoted)       ; remove blanks
+  (let (fixed-list quote quoted)    ; remove blanks
     (setq list (remove* "\\s-+" list :test 'string-match)
           list (remove* ""      list :test 'string=))
-    (while list                                ; concatinate parts of quoted 
string
+    (while list             ; concatinate parts of quoted string
       (if (not (string-match "^\\([\]\[()'\"]\\)" (car list)))
           (setq fixed-list (append fixed-list (list (car list))))
         (setq quote (match-string 1 (car list))
@@ -1082,7 +1074,7 @@ arguments."
                                (cons tag (cons (car default) (cdr default))))
                               (t (cons tag default))))
              (temp-list arg-list) )
-        ;;(message "%S" temp-list)     ; want to lop values off arg-list
+        ;;(message "%S" temp-list)  ; want to lop values off arg-list
                                         ; as they are found
         (if (symbolp (cadr values))
             (setq values (symbol-value (cadr values))))
@@ -1146,9 +1138,9 @@ arguments."
            ;; ---------------------------- range
            ((equal symbol 'range)
             (if (string-match (concat "\\[\\s-*" ; opening bracket
-                                      "\\([^:, \t]*\\)"        ; first argument
+                                      "\\([^:, \t]*\\)" ; first argument
                                       "\\s-*[:,]\\s-*" ; separator
-                                      "\\([^\] \t]*\\)"        ; second 
argument
+                                      "\\([^\] \t]*\\)" ; second argument
                                       "\\s-*\\]") ; closing bracket
                               (car temp-list))
                 (setq this-cons
@@ -1203,8 +1195,7 @@ arguments."
               (setq temp-list (cdr temp-list)) ) )
            ;; ---------------------------- other or unknown
            (t
-            (setq temp-list nil))
-           ))
+            (setq temp-list nil))))
         (setq gnuplot-gui-alist
               (append gnuplot-gui-alist (list this-cons))))
       (setq alist (cdr alist))) ))
@@ -1337,7 +1328,7 @@ SAVE-FRAME is non-nil when the widgets are being reset."
            (list    (gnuplot-gui-type-list   this)))
       (if (symbolp (cadr list))
           (setq list (symbol-value (cadr list))))
-      (widget-insert "\t")             ; insert the appropriate widget
+      (widget-insert "\t")      ; insert the appropriate widget
       (cond
        ;;------------------------------ list, list* ------------
        ((member* (eval wtype) '(list list*) :test 'equal)
@@ -1725,7 +1716,7 @@ is non-nil if this is a 'range widget."
   "A link to an info file for the Gnuplot GUI."
   :action '(lambda (widget &optional event)
              (let ((gnuplot-info-display 'frame))
-               (if gnuplot-keywords-pending            ; <HW>
+               (if gnuplot-keywords-pending     ; <HW>
                    (gnuplot-setup-info-look))
                (gnuplot-info-lookup-symbol (widget-value widget)
                                            'gnuplot-mode))))
diff --git a/gnuplot.el b/gnuplot.el
index f94062e..382f0a2 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -1,4 +1,4 @@
-;;; gnuplot.el --- drive gnuplot from within emacs
+;;; gnuplot.el --- Major-mode and interactive frontend for gnuplot
 
 ;; Copyright (C) 1998, 2011 Phil Type and Bruce Ravel, 1999-2012 Bruce Ravel
 
@@ -7,9 +7,10 @@
 ;;         Phil Type
 ;; Maintainer: Bruce Ravel <[email protected]>
 ;; Created:    June 28 1998
-;; Updated:    November 1 2012
 ;; Version:    0.7.0
-;; Keywords:   gnuplot, plotting
+;; Keywords:   data gnuplot plotting
+;; URL:        https://github.com/emacsorphanage/gnuplot
+;; Package-Requires: ((emacs "24.1"))
 
 ;; This file is not part of GNU Emacs.
 
@@ -28,7 +29,6 @@
 
 ;;; Commentary:
 
-;;
 ;; This is a major mode for composing gnuplot scripts and displaying
 ;; their results using gnuplot.  It supports features of recent
 ;; Gnuplot versions (4.4 and up), but should also work fine with older
@@ -92,7 +92,7 @@
 ;;
 ;; ---------------------------------------------------------------------
 ;;
-;; Other lisp files used by gnuplot.el
+;; Other Lisp files used by gnuplot.el
 ;;
 ;; gnuplot-gui.el (written by Bruce):
 ;;   Defines the GUI interface for setting setting arguments to
@@ -100,7 +100,7 @@
 ;;
 ;; gnuplot-context.el (written by Jonathan, [email protected])
 ;;   Context-sensitive completion, help lookup and eldoc
-;;   strings for gnuplot buffers. Should be byte-compiled before
+;;   strings for gnuplot buffers.  Should be byte-compiled before
 ;;   using.
 ;;
 ;; ---------------------------------------------------------------------
@@ -110,7 +110,7 @@
 ;; back to the early 90's.  Although this mode encompasses the
 ;; functionality of the original, the two share no code and the
 ;; current implementation takes advantage of many features of modern
-;; versions of emacs and adheres (or so I intend) to the major mode
+;; versions of Emacs and adheres (or so I intend) to the major mode
 ;; conventions described in the emacs-lisp reference for version 19
 ;; and later.
 ;;
@@ -129,7 +129,7 @@
 ;;
 ;; Something like
 ;;   (setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode))
-;;                                auto-mode-alist))
+;;                                 auto-mode-alist))
 ;; is useful for having files ending in .gp start up in gnuplot-mode.
 ;;
 ;; Something like
@@ -145,7 +145,7 @@
 ;;   2.  Make sure info can find gnuplot.info by putting this in your
 ;;       .emacs file:
 ;;         (setenv "INFOPATH"
-;;           (concat (getenv "INFOPATH") ":"
+;;            (concat (getenv "INFOPATH") ":"
 ;;                    (expand-file-name "/path/to/file")))
 ;;       where "/path/to/file" is the location of gnuplot.info
 ;;
@@ -366,7 +366,7 @@ real work."
       (interactive)
       (let ((comint-dynamic-complete-functions
              '(gnuplot-comint-complete)))
-        (comint-dynamic-complete))))
+        (completion-at-point))))
 
 ;; Work around missing `window-full-height-p'
 (if (fboundp 'window-full-height-p)
@@ -416,7 +416,7 @@ real work."
   :link '(url-link :tag "Homepage"
                    "https://github.com/emacsorphanage/gnuplot/";)
   :link '(custom-manual "(gnuplot)Top")
-  :link '(emacs-commentary-link :tag "Commentary" "gnuplot.el") )
+  :link '(emacs-commentary-link :tag "Commentary" "gnuplot.el"))
 (defgroup gnuplot-insertions nil
   "Insert commands into gnuplot-scripts from a pull-down menu."
   :prefix "gnuplot-insertions-"
@@ -427,15 +427,15 @@ real work."
   :group 'gnuplot)
 
 (defcustom gnuplot-mode-hook nil
-  "*Hook run when `gnuplot-mode' is entered."
+  "Hook run when `gnuplot-mode' is entered."
   :group 'gnuplot-hooks
   :type 'hook)
 (defcustom gnuplot-load-hook nil
-  "*Hook run when gnuplot.el is first loaded."
+  "Hook run when gnuplot.el is first loaded."
   :group 'gnuplot-hooks
   :type 'hook)
 (defcustom gnuplot-after-plot-hook nil
-  "*Hook run after gnuplot plots something.
+  "Hook run after gnuplot plots something.
 This is the last thing done by the functions for plotting a line, a
 region, a buffer, or a file."
   :group 'gnuplot-hooks
@@ -443,7 +443,7 @@ region, a buffer, or a file."
 
 
 (defcustom gnuplot-info-hook nil
-  "*Hook run before setting up the info-look interface.
+  "Hook run before setting up the info-look interface.
 This hook is necessary to handle inconsistencies in versions of and
 sources of the gnuplot info file.  If Gnuplot-mode can find the info
 file generated from the 3.6beta patchlevel 347 (or later) release of
@@ -462,39 +462,39 @@ version 20.2.
 For the newer version of info-look, do this:
 
   (add-hook \'gnuplot-info-hook
-           \'(lambda ()
-              (let ((elem (assoc \'gnuplot-mode info-lookup-alist)))
-                (delete elem info-lookup-alist)
-                (info-lookup-maybe-add-help
-                 :mode 'gnuplot-mode :topic 'symbol
-                 :regexp \"[a-zA-Z][_a-zA-Z0-9]*\"
-                 :doc-spec '((\"(gnuplot)General Index\" nil
-                              \"[_a-zA-Z0-9]+\"))))))
+            \'(lambda ()
+               (let ((elem (assoc \'gnuplot-mode info-lookup-alist)))
+                 (delete elem info-lookup-alist)
+                 (info-lookup-maybe-add-help
+                  :mode 'gnuplot-mode :topic 'symbol
+                  :regexp \"[a-zA-Z][_a-zA-Z0-9]*\"
+                  :doc-spec '((\"(gnuplot)General Index\" nil
+                               \"[_a-zA-Z0-9]+\"))))))
 
 For the older version of info-look, do this:
 
   (add-hook \'gnuplot-info-hook
-           \'(lambda ()
-              (let ((elem (assoc \'gnuplot-mode info-lookup-alist)))
-                (delete elem info-lookup-alist)
-                (setq info-lookup-alist
-                      (append info-lookup-alist
-                              \'((gnuplot-mode
-                                 \"[a-zA-Z][_a-zA-Z0-9]*\" nil
-                                 ((\"(gnuplot)General Index\" nil
-                                   \"[_a-zA-Z0-9]+\" )))))))))"
+            \'(lambda ()
+               (let ((elem (assoc \'gnuplot-mode info-lookup-alist)))
+                 (delete elem info-lookup-alist)
+                 (setq info-lookup-alist
+                       (append info-lookup-alist
+                               \'((gnuplot-mode
+                                  \"[a-zA-Z][_a-zA-Z0-9]*\" nil
+                                  ((\"(gnuplot)General Index\" nil
+                                    \"[_a-zA-Z0-9]+\" )))))))))"
   :group 'gnuplot-hooks
   :type 'hook)
 
 ;; comint hook suggested by <DB>
 (defcustom gnuplot-comint-setup-hook nil
-  "*Hook run after setting up the gnuplot buffer in comint mode.
+  "Hook run after setting up the gnuplot buffer in comint mode.
 So the configuration can be customised by the user."
   :group 'gnuplot-hooks
   :type 'hook)
 
 (defcustom gnuplot-comint-mode-hook nil
-  "*Hook run after setting up the gnuplot buffer in gnuplot-comint-mode.
+  "Hook run after setting up the gnuplot buffer in gnuplot-comint-mode.
 By default this runs the hook named `gnuplot-comint-setup-hook',
 for backward compatibility."
   :group 'gnuplot-hooks
@@ -507,7 +507,7 @@ useful for functions included in 
`gnuplot-after-plot-hook'.")
 (make-variable-buffer-local 'gnuplot-recently-sent)
 
 (defcustom gnuplot-program "gnuplot"
-  "*The name of the gnuplot executable."
+  "The name of the gnuplot executable."
   :group 'gnuplot
   :type 'string)
 (defvar gnuplot-program-version nil
@@ -525,7 +525,7 @@ This is found using `gnuplot-fetch-version-number'.")
   :group 'gnuplot
   :type 'string)
 (defvar gnuplot-buffer nil
-  "*The name of the buffer displaying the gnuplot process.")
+  "The name of the buffer displaying the gnuplot process.")
 (defvar gnuplot-process nil
   "Variable holding the process handle.")
 (defvar gnuplot-process-frame nil
@@ -537,7 +537,7 @@ This is used by the function that plot from the comint 
buffer.  It is
 reset every time something is plotted from a script buffer.")
 
 (defcustom gnuplot-gnuplot-buffer "plot.gp"
-  "*The name of the gnuplot scratch buffer opened by 'gnuplot-make-buffer'."
+  "The name of the gnuplot scratch buffer opened by 'gnuplot-make-buffer'."
   :group 'gnuplot
   :type 'string)
 
@@ -552,7 +552,7 @@ The values are
                 (const :tag "Separate window" window)
                 (const :tag "Not displayed"   nil)))
 (defcustom gnuplot-info-display 'window
-  "*Determines how `gnuplot-info-lookup-symbol' displays the info file.
+  "Determines how `gnuplot-info-lookup-symbol' displays the info file.
 The values are
    'frame    display info file in a separate frame
    'window   display info file in another window
@@ -563,7 +563,8 @@ The values are
                 (const :tag "This window"     nil)))
 
 (defcustom gnuplot-echo-command-line-flag (not gnuplot-ntemacs-p)
-  "*This sets the fall-back value of `comint-process-echos'.
+  "Non-nil means the gnuplot subprocess echoes any input.
+This sets the fall-back value of `comint-process-echoes'.
 If `gnuplot-mode' cannot figure out what version number of gnuplot
 this is, then the value of this variable will be used for
 `comint-process-echos'.  It seems that gnuplot 3.5 wants this to be
@@ -575,29 +576,28 @@ and start it again."
   :group 'gnuplot
   :type 'boolean)
 (defcustom gnuplot-insertions-show-help-flag nil
-  "*Non-nil means to display certain help messages automatically.
+  "Non-nil means to display certain help messages automatically.
 These messages are shown after menu insertion of gnuplot commands."
   :group 'gnuplot-insertions
   :type 'boolean)
 
 (defcustom gnuplot-delay 0.01
-  "*Amount of time to delay before sending a new line to gnuplot.
+  "Amount of time to delay before sending a new line to gnuplot.
 This is needed so that the the line is not written in the gnuplot
 buffer in advance of its prompt.  Increase this number if the
 prompts and lines are displayed out of order."
   :group 'gnuplot
   :type 'number)
 (defcustom gnuplot-buffer-max-size 1000
-  "*The maximum size in lines of the gnuplot process buffer.
+  "The maximum size in lines of the gnuplot process buffer.
 Each time text is written in the gnuplot process buffer, lines are
 trimmed from the beginning of the buffer so that the buffer is this
 many lines long.  The lines are deleted after the most recent lines
-were interpretted by gnuplot.  Setting to 0 turns off this feature
-\(i.e. no lines get trimmed)."
+were interpretted by gnuplot.  Setting to 0 turns off this feature."
   :group 'gnuplot
   :type 'integer)
 (defcustom gnuplot-quote-character "\'"
-  "*Quotation character used for inserting quoted strings.
+  "Quotation character used for inserting quoted strings.
 Gnuplot can use single or double quotes.  If you prefer to have the
 filename insertion function never insert quotes for you, set this
 to the empty string."
@@ -609,18 +609,18 @@ to the empty string."
   "Number of columns to indent lines inside a do- or if-else-block.
 
 This applies only to new-style do- and if-statements using
-braces. Commands continued over a linebreak using a backslash are
-always indented to line up with the second word on the line
+braces.  Commands continued over a linebreak using a backslash
+are always indented to line up with the second word on the line
 beginning the continued command."
   :group 'gnuplot
   :type 'integer)
 
 ;; (defcustom gnuplot-gnuplot-version nil
-;;   "*Force gnuplot-mode to behave for this version of gnuplot."
+;;   "Force gnuplot-mode to behave for this version of gnuplot."
 ;;   :group 'gnuplot
 ;;   :type '(radio (const :tag "unspecified"   nil)
-;;             (const :tag "3.8 or newer" "3.8")
-;;             (const :tag "3.7 or older" "3.7")))
+;;              (const :tag "3.8 or newer" "3.8")
+;;              (const :tag "3.7 or older" "3.7")))
 
 (defvar gnuplot-info-frame nil)
 (defvar gnuplot-info-nodes '())
@@ -635,7 +635,7 @@ beginning the continued command."
 These are set by `gnuplot-set-keywords-list' from the values in
 `info-lookup-cache'.")
 (defvar gnuplot-keywords-alist nil) ;; For all-completions
-(defvar gnuplot-keywords-pending t     ;; <HW>
+(defvar gnuplot-keywords-pending t      ;; <HW>
   "A boolean which gets toggled when the info file is probed.")
 (defcustom gnuplot-keywords-when 'deferred ;; 'immediately
   "This variable controls when the info file is parsed.
@@ -646,14 +646,6 @@ time that data is needed."
   '(radio (const :tag "Parse info file when gnuplot-mode starts"    
immediately)
           (const :tag "Parse info file the first time it is needed" deferred)))
 
-(defun gnuplot-set-context-sensitive-completion (_variable value)
-  "Customize :set function for `gnuplot-use-context-sensitive-completion'."
-  (dolist (buffer (buffer-list))
-    (with-current-buffer buffer
-      (when (derived-mode-p 'gnuplot-mode 'gnuplot-comint-mode)
-        (gnuplot-context-sensitive-mode
-         (if value 1 0))))))
-
 (defcustom gnuplot-use-context-sensitive-completion t
   "Non-nil if `gnuplot-context-sensitive-mode' should be enabled by default.
 
@@ -663,7 +655,12 @@ suggestions."
   :group 'gnuplot
   :type 'boolean
   :initialize 'custom-set-default
-  :set 'gnuplot-set-context-sensitive-completion
+  :set (lambda (sym value)
+         (dolist (buffer (buffer-list))
+           (with-current-buffer buffer
+             (when (derived-mode-p 'gnuplot-mode 'gnuplot-comint-mode)
+               (gnuplot-context-sensitive-mode
+                (if value 1 0))))))
   :link '(emacs-commentary-link "gnuplot-context"))
 
 (defcustom gnuplot-eldoc-mode nil
@@ -676,13 +673,14 @@ on."
 (defcustom gnuplot-tab-completion nil
   "Non-nil if TAB should perform completion in gnuplot-mode buffers.
 
-Setting this to `t' sets the `tab-always-indent' variable to the
+Setting this to non-nil sets the `tab-always-indent' variable to the
 symbol `complete' in gnuplot-mode buffers."
   :group 'gnuplot
   :type 'boolean)
 
 (defun gnuplot-set-display-mode (variable value &rest args)
-  "Customize :set function for `gnuplot-inline-image-mode'."
+  "Customize :set function for `gnuplot-inline-image-mode'.
+Set VARIABLE to VALUE.  ARGS is optional args."
   (if (and (eq variable 'gnuplot-inline-image-mode)
            value
            (not (gnuplot-display-images-p)))
@@ -697,7 +695,7 @@ symbol `complete' in gnuplot-mode buffers."
 
 Possible values are nil, `inline' and `dedicated'.
 
-When this is `nil', Gnuplot output is handled outside of Emacs in
+When this is nil, Gnuplot output is handled outside of Emacs in
 the normal way.  Otherwise, Emacs attempts to capture Gnuplot's
 output and display it in a buffer.  Output is inserted inline in
 the Gnuplot interaction buffer it this is `inline', in a
@@ -840,8 +838,7 @@ non-nil."
     ["Show gnuplot-mode version"        gnuplot-show-version t]
     ["Show gnuplot version"             gnuplot-show-gnuplot-version t]
     "---"
-    ["Kill gnuplot"                     gnuplot-kill-gnuplot-buffer t]
-    )
+    ["Kill gnuplot"                     gnuplot-kill-gnuplot-buffer t])
   "Menu for `gnuplot-mode'.")
 
 
@@ -887,9 +884,9 @@ the \"regis\" terminal type to the terminal sub-menu:
   'gnuplot-load-hook
   '(lambda ()
       (setq gnuplot-insertions-terminal
-           (append gnuplot-insertions-terminal
-                   (list
-                    [\"regis\"
+            (append gnuplot-insertions-terminal
+                    (list
+                     [\"regis\"
                       (gnuplot-insert \"set terminal regis\")
                        t])))))")
 
@@ -898,7 +895,7 @@ the \"regis\" terminal type to the terminal sub-menu:
 See the document string for `gnuplot-insertions-menu'")
 
 (defcustom gnuplot-insertions-menu-flag t
-  "*Non-nil means to place the insertion menu in the menubar.
+  "Non-nil means to place the insertion menu in the menubar.
 Changing this will not effect a change in any currently existing
 `gnuplot-mode' buffer.  You will see the change the next time you
 create a `gnuplot-mode' buffer."
@@ -908,42 +905,42 @@ create a `gnuplot-mode' buffer."
 (defcustom gnuplot-insertions-adornments ; this is icky...
   (if gnuplot-three-eight-p
       '("adornments"
-        ["arrow"       (gnuplot-insert "set arrow ")         t]
-        ["bar"        (gnuplot-insert "set bar")             t]
-        ["border"      (gnuplot-insert "set border")         t]
-        ["boxwidth"    (gnuplot-insert "set boxwidth ")              t]
-        ["format"      (gnuplot-insert "set format ")        t]
-        ["grid"               (gnuplot-insert "set grid")            t]
-        ["key"        (gnuplot-insert "set key ")            t]
-        ["label"       (gnuplot-insert "set label ")         t]
+        ["arrow"       (gnuplot-insert "set arrow ")          t]
+        ["bar"         (gnuplot-insert "set bar")             t]
+        ["border"      (gnuplot-insert "set border")          t]
+        ["boxwidth"    (gnuplot-insert "set boxwidth ")       t]
+        ["format"      (gnuplot-insert "set format ")         t]
+        ["grid"        (gnuplot-insert "set grid")            t]
+        ["key"         (gnuplot-insert "set key ")            t]
+        ["label"       (gnuplot-insert "set label ")          t]
         ["pointsize"   (gnuplot-insert "set pointsize ")      t]
-        ["samples"     (gnuplot-insert "set samples ")       t]
-        ["size"        (gnuplot-insert "set size ")          t]
+        ["samples"     (gnuplot-insert "set samples ")        t]
+        ["size"        (gnuplot-insert "set size ")           t]
         ["style"       (gnuplot-insert "set style ")          t]
-        ["tics"        (gnuplot-insert "set tics ")          t]
+        ["tics"        (gnuplot-insert "set tics ")           t]
         ["timefmt"     (gnuplot-insert "set timefmt ")        t]
         ["timestamp"   (gnuplot-insert "set timestamp ")      t]
-        ["title"       (gnuplot-insert "set title ")         t]
-        ["zeroaxis"    (gnuplot-insert "set zeroaxis")        t] )
+        ["title"       (gnuplot-insert "set title ")          t]
+        ["zeroaxis"    (gnuplot-insert "set zeroaxis")        t])
     '("adornments"
       ["data style"     (gnuplot-insert "set data style ")     t]
       ["function style" (gnuplot-insert "set function style ") t]
-      ["arrow"          (gnuplot-insert "set arrow ")         t]
-      ["bar"           (gnuplot-insert "set bar")             t]
-      ["border"         (gnuplot-insert "set border")         t]
+      ["arrow"          (gnuplot-insert "set arrow ")          t]
+      ["bar"            (gnuplot-insert "set bar")             t]
+      ["border"         (gnuplot-insert "set border")          t]
       ["boxwidth"       (gnuplot-insert "set boxwidth ")       t]
-      ["format"         (gnuplot-insert "set format ")        t]
-      ["grid"          (gnuplot-insert "set grid")            t]
-      ["key"           (gnuplot-insert "set key ")            t]
-      ["label"          (gnuplot-insert "set label ")         t]
+      ["format"         (gnuplot-insert "set format ")         t]
+      ["grid"           (gnuplot-insert "set grid")            t]
+      ["key"            (gnuplot-insert "set key ")            t]
+      ["label"          (gnuplot-insert "set label ")          t]
       ["pointsize"      (gnuplot-insert "set pointsize ")      t]
-      ["samples"        (gnuplot-insert "set samples ")               t]
-      ["size"           (gnuplot-insert "set size ")          t]
-      ["tics"           (gnuplot-insert "set tics ")          t]
+      ["samples"        (gnuplot-insert "set samples ")        t]
+      ["size"           (gnuplot-insert "set size ")           t]
+      ["tics"           (gnuplot-insert "set tics ")           t]
       ["timefmt"        (gnuplot-insert "set timefmt ")        t]
       ["timestamp"      (gnuplot-insert "set timestamp ")      t]
-      ["title"          (gnuplot-insert "set title ")         t]
-      ["zeroaxis"       (gnuplot-insert "set zeroaxis")        t] ))
+      ["title"          (gnuplot-insert "set title ")          t]
+      ["zeroaxis"       (gnuplot-insert "set zeroaxis")        t]))
   "Adornments submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -960,18 +957,18 @@ create a `gnuplot-mode' buffer."
 
 (defcustom gnuplot-insertions-plot-options
   '("plot options"
-    ["autoscale"  (gnuplot-insert "set autoscale ")         t]
-    ["clip"      (gnuplot-insert "set clip ")               t]
-    ["encoding"   (gnuplot-insert "set encoding ")          t]
-    ["locale"     (gnuplot-insert "set locale ")            t]
-    ["logscale"          (gnuplot-insert "set logscale ")           t]
-    ["multiplot"  (gnuplot-insert "set multiplot")          t]
-    ["missing"   (gnuplot-insert "set missing \"\"")        t]
-    ["palette"    (gnuplot-insert "set palette ")            t]        ; <MT>
+    ["autoscale"  (gnuplot-insert "set autoscale ")          t]
+    ["clip"       (gnuplot-insert "set clip ")               t]
+    ["encoding"   (gnuplot-insert "set encoding ")           t]
+    ["locale"     (gnuplot-insert "set locale ")             t]
+    ["logscale"   (gnuplot-insert "set logscale ")           t]
+    ["multiplot"  (gnuplot-insert "set multiplot")           t]
+    ["missing"    (gnuplot-insert "set missing \"\"")        t]
+    ["palette"    (gnuplot-insert "set palette ")            t]         ; <MT>
     ["pm3d"       (gnuplot-insert "set pm3d ")               t]
-    ["offsets"   (gnuplot-insert "set offsets ")            t]
-    ["output"     (gnuplot-insert "set output ")            t]
-    ["zero"      (gnuplot-insert "set zero ")               t] )
+    ["offsets"    (gnuplot-insert "set offsets ")            t]
+    ["output"     (gnuplot-insert "set output ")             t]
+    ["zero"       (gnuplot-insert "set zero ")               t])
   "Plot options submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1000,9 +997,9 @@ create a `gnuplot-mode' buffer."
     ["tek40xx"    (gnuplot-insert "set terminal tek40xx")    t]
     ["tkcanvas"   (gnuplot-insert "set terminal tkcanvas")   t]
     ["tpic"       (gnuplot-insert "set terminal tpic")       t]
-    ["vgagl"      (gnuplot-insert "set terminal vgagl")      t]        ; for 
pm3d patch
+    ["vgagl"      (gnuplot-insert "set terminal vgagl")      t]         ; for 
pm3d patch
     ["vttek"      (gnuplot-insert "set terminal vttek")      t]
-    ["x11"        (gnuplot-insert "set terminal x11")        t] )
+    ["x11"        (gnuplot-insert "set terminal x11")        t] ยง)
   "Terminal submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1018,14 +1015,14 @@ create a `gnuplot-mode' buffer."
 
 (defcustom gnuplot-insertions-x-axis
   '("x-axis"
-    ["xdata"     (gnuplot-insert "set xdata ")              t]
-    ["xlabel"    (gnuplot-insert "set xlabel ")             t]
-    ["xrange"    (gnuplot-insert "set xrange [:]")          t]
-    ["xtics"     (gnuplot-insert "set xtics ")              t]
-    ["mxtics"    (gnuplot-insert "set mxtics ")             t]
-    ["xzeroaxis"  (gnuplot-insert "set xzeroaxis ")         t]
-    ["xdtics"    (gnuplot-insert "set xdtics ")             t]
-    ["xmtics"    (gnuplot-insert "set xmtics ")             t])
+    ["xdata"      (gnuplot-insert "set xdata ")              t]
+    ["xlabel"     (gnuplot-insert "set xlabel ")             t]
+    ["xrange"     (gnuplot-insert "set xrange [:]")          t]
+    ["xtics"      (gnuplot-insert "set xtics ")              t]
+    ["mxtics"     (gnuplot-insert "set mxtics ")             t]
+    ["xzeroaxis"  (gnuplot-insert "set xzeroaxis ")          t]
+    ["xdtics"     (gnuplot-insert "set xdtics ")             t]
+    ["xmtics"     (gnuplot-insert "set xmtics ")             t])
   "X-axis submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1041,14 +1038,14 @@ create a `gnuplot-mode' buffer."
 
 (defcustom gnuplot-insertions-x2-axis
   '("x2-axis"
-    ["x2data"    (gnuplot-insert "set xdata ")              t]
-    ["x2label"   (gnuplot-insert "set xlabel ")             t]
-    ["x2range"   (gnuplot-insert "set xrange [:]")          t]
-    ["x2tics"    (gnuplot-insert "set xtics ")              t]
-    ["mx2tics"   (gnuplot-insert "set mxtics ")             t]
-    ["x2zeroaxis" (gnuplot-insert "set xzeroaxis ")         t]
-    ["x2dtics"   (gnuplot-insert "set xdtics ")             t]
-    ["x2mtics"   (gnuplot-insert "set xmtics ")             t])
+    ["x2data"     (gnuplot-insert "set xdata ")              t]
+    ["x2label"    (gnuplot-insert "set xlabel ")             t]
+    ["x2range"    (gnuplot-insert "set xrange [:]")          t]
+    ["x2tics"     (gnuplot-insert "set xtics ")              t]
+    ["mx2tics"    (gnuplot-insert "set mxtics ")             t]
+    ["x2zeroaxis" (gnuplot-insert "set xzeroaxis ")          t]
+    ["x2dtics"    (gnuplot-insert "set xdtics ")             t]
+    ["x2mtics"    (gnuplot-insert "set xmtics ")             t])
   "X2-axis submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1064,14 +1061,14 @@ create a `gnuplot-mode' buffer."
 
 (defcustom gnuplot-insertions-y-axis
   '("y-axis"
-    ["ydata"     (gnuplot-insert "set ydata ")              t]
-    ["ylabel"    (gnuplot-insert "set ylabel ")             t]
-    ["ymtics"    (gnuplot-insert "set ymtics ")             t]
-    ["yrange"    (gnuplot-insert "set yrange [:]")          t]
-    ["ytics"     (gnuplot-insert "set ytics ")              t]
-    ["yzeroaxis"  (gnuplot-insert "set yzeroaxis ")         t]
-    ["ydtics"    (gnuplot-insert "set ydtics ")             t]
-    ["mytics"    (gnuplot-insert "set mytics ")             t])
+    ["ydata"      (gnuplot-insert "set ydata ")              t]
+    ["ylabel"     (gnuplot-insert "set ylabel ")             t]
+    ["ymtics"     (gnuplot-insert "set ymtics ")             t]
+    ["yrange"     (gnuplot-insert "set yrange [:]")          t]
+    ["ytics"      (gnuplot-insert "set ytics ")              t]
+    ["yzeroaxis"  (gnuplot-insert "set yzeroaxis ")          t]
+    ["ydtics"     (gnuplot-insert "set ydtics ")             t]
+    ["mytics"     (gnuplot-insert "set mytics ")             t])
   "Y-axis submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1086,14 +1083,14 @@ create a `gnuplot-mode' buffer."
 
 (defcustom gnuplot-insertions-y2-axis
   '("y2-axis"
-    ["y2data"    (gnuplot-insert "set ydata ")              t]
-    ["y2label"   (gnuplot-insert "set ylabel ")             t]
-    ["y2range"   (gnuplot-insert "set yrange [:]")          t]
-    ["y2tics"    (gnuplot-insert "set ytics ")              t]
-    ["my2tics"   (gnuplot-insert "set mytics ")             t]
-    ["y2zeroaxis"  (gnuplot-insert "set yzeroaxis ")        t]
-    ["y2mtics"   (gnuplot-insert "set ymtics ")             t]
-    ["y2dtics"   (gnuplot-insert "set ydtics ")             t])
+    ["y2data"     (gnuplot-insert "set ydata ")              t]
+    ["y2label"    (gnuplot-insert "set ylabel ")             t]
+    ["y2range"    (gnuplot-insert "set yrange [:]")          t]
+    ["y2tics"     (gnuplot-insert "set ytics ")              t]
+    ["my2tics"    (gnuplot-insert "set mytics ")             t]
+    ["y2zeroaxis"  (gnuplot-insert "set yzeroaxis ")         t]
+    ["y2mtics"    (gnuplot-insert "set ymtics ")             t]
+    ["y2dtics"    (gnuplot-insert "set ydtics ")             t])
   "Y2-axis submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1110,13 +1107,13 @@ create a `gnuplot-mode' buffer."
 
 (defcustom gnuplot-insertions-z-axis
   '("z-axis"
-    ["zdata"     (gnuplot-insert "set zdata ")              t]
-    ["zlabel"    (gnuplot-insert "set zlabel ")             t]
-    ["zrange"    (gnuplot-insert "set zrange [:]")          t]
-    ["ztics"     (gnuplot-insert "set ztics ")              t]
-    ["mztics"    (gnuplot-insert "set mztics ")             t]
-    ["zdtics"    (gnuplot-insert "set zdtics ")             t]
-    ["zmtics"    (gnuplot-insert "set zmtics ")             t] )
+    ["zdata"      (gnuplot-insert "set zdata ")              t]
+    ["zlabel"     (gnuplot-insert "set zlabel ")             t]
+    ["zrange"     (gnuplot-insert "set zrange [:]")          t]
+    ["ztics"      (gnuplot-insert "set ztics ")              t]
+    ["mztics"     (gnuplot-insert "set mztics ")             t]
+    ["zdtics"     (gnuplot-insert "set zdtics ")             t]
+    ["zmtics"     (gnuplot-insert "set zmtics ")             t])
   "Z-axis submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1132,12 +1129,12 @@ create a `gnuplot-mode' buffer."
 
 (defcustom gnuplot-insertions-parametric-plots
   '("parametric plots"
-    ["parametric" (gnuplot-insert "set parametric")         t]
-    ["isosamples" (gnuplot-insert "set isosamples ")        t]
-    ["dummy"     (gnuplot-insert "set dummy ")              t]
-    ["trange"    (gnuplot-insert "set trange [:]")          t]
-    ["urange"    (gnuplot-insert "set urange [:]")          t]
-    ["vrange"    (gnuplot-insert "set vrange [:]")          t] )
+    ["parametric" (gnuplot-insert "set parametric")          t]
+    ["isosamples" (gnuplot-insert "set isosamples ")         t]
+    ["dummy"      (gnuplot-insert "set dummy ")              t]
+    ["trange"     (gnuplot-insert "set trange [:]")          t]
+    ["urange"     (gnuplot-insert "set urange [:]")          t]
+    ["vrange"     (gnuplot-insert "set vrange [:]")          t])
   "Parametric plots submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1153,9 +1150,9 @@ create a `gnuplot-mode' buffer."
 
 (defcustom gnuplot-insertions-polar-plots
   '("polar plots"
-    ["polar"     (gnuplot-insert "set polar")               t]
-    ["angles"    (gnuplot-insert "set angles ")             t]
-    ["rrange"    (gnuplot-insert "set rrange [:]")          t] )
+    ["polar"      (gnuplot-insert "set polar")               t]
+    ["angles"     (gnuplot-insert "set angles ")             t]
+    ["rrange"     (gnuplot-insert "set rrange [:]")          t])
   "Polar plots submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1171,14 +1168,14 @@ create a `gnuplot-mode' buffer."
 
 (defcustom gnuplot-insertions-surface-plots
   '("surface plots"
-    ["clabel"    (gnuplot-insert "set clabel ")             t]
-    ["cntrparam"  (gnuplot-insert "set cntrparam ")         t]
-    ["contour"   (gnuplot-insert "set contour")             t]
-    ["dgrid3d"   (gnuplot-insert "set dgrid3d ")            t]
-    ["hidden3d"          (gnuplot-insert "set hidden3d ")           t]
-    ["mapping"   (gnuplot-insert "set mapping ")            t]
-    ["surface"   (gnuplot-insert "set surface ")            t]
-    ["view"      (gnuplot-insert "set view ")               t] )
+    ["clabel"     (gnuplot-insert "set clabel ")             t]
+    ["cntrparam"  (gnuplot-insert "set cntrparam ")          t]
+    ["contour"    (gnuplot-insert "set contour")             t]
+    ["dgrid3d"    (gnuplot-insert "set dgrid3d ")            t]
+    ["hidden3d"   (gnuplot-insert "set hidden3d ")           t]
+    ["mapping"    (gnuplot-insert "set mapping ")            t]
+    ["surface"    (gnuplot-insert "set surface ")            t]
+    ["view"       (gnuplot-insert "set view ")               t])
   "Surface plots submenu in the insertions menu.
 See the document string for `gnuplot-insertions-menu'
 Changing this will not effect a change in any currently existing
@@ -1192,7 +1189,7 @@ create a `gnuplot-mode' buffer."
                                (boolean  :tag "Enabled" t)))))
 
 
-
+(defvar gnuplot-gui-popup-flag)
 (defvar gnuplot-insertions-bottom ()
   "Bottom part of the insertions menu.
 This part contains the toggle buttons for displaying info or
@@ -1204,7 +1201,7 @@ opening an argument-setting popup.")
         ["Display GUI popup with insertion" gnuplot-gui-toggle-popup
          :active (fboundp 'gnuplot-gui-toggle-popup)
          :style toggle :selected (and (fboundp 'gnuplot-gui-toggle-popup)
-                                      gnuplot-gui-popup-flag)] ))
+                                      gnuplot-gui-popup-flag)]))
 
 
 ;; Regarding a comment by <DB>:
@@ -1230,7 +1227,7 @@ opening an argument-setting popup.")
 
 (defun gnuplot-setup-menubar ()
   "Initial setup of gnuplot and insertions menus."
-  (if gnuplot-insertions-menu-flag     ; set up insertions menu
+  (if gnuplot-insertions-menu-flag      ; set up insertions menu
       (progn
         (if gnuplot-xemacs-p
             (setq gnuplot-insertions-top
@@ -1256,10 +1253,10 @@ opening an argument-setting popup.")
           "Insertions menu used in Gnuplot-mode"
           gnuplot-insertions-menu)
         (easy-menu-add gnuplot-mode-insertions-menu gnuplot-mode-map)))
-  (easy-menu-define                    ; set up gnuplot menu
+  (easy-menu-define                     ; set up gnuplot menu
     gnuplot-mode-menu gnuplot-mode-map "Menu used in gnuplot-mode"
     gnuplot-menu)
-  (easy-menu-add gnuplot-mode-menu gnuplot-mode-map) )
+  (easy-menu-add gnuplot-mode-menu gnuplot-mode-map))
 
 ;; There is no `mark-active' variable in XEmacs.  Hassle!  This is not
 ;; only replicates mark-active, but it only returns true if the region
@@ -1280,19 +1277,19 @@ opening an argument-setting popup.")
   :group 'gnuplot)
 
 (defcustom gnuplot-toolbar-display-flag gnuplot-xemacs-p
-  "*Non-nil means to display display a toolbar in XEmacs."
+  "Non-nil means to display display a toolbar in XEmacs."
   :group 'gnuplot-toolbar
   :type 'boolean)
 
 (defcustom gnuplot-toolbar-use-toolbar (if (featurep 'toolbar) 'left-toolbar 
nil)
-  "*If nil, do not use a toolbar.
+  "If nil, do not use a toolbar.
 If it is non-nil, it must be a toolbar.  The five legal values are
 `default-toolbar', `top-toolbar', `bottom-toolbar', `right-toolbar',
 and `left-toolbar', although choosing `default-toolbar' or
 `top-toolbar' may be a bad idea since either will make the GNUPLOT
 toolbar replace the standard toolbar.  Changing this will not change
 the toolbar in a currently existing buffer, but it will take effect
-the next time you use `gnuplot-mode' and emacs.
+the next time you use `gnuplot-mode' and Emacs.
 
 This is only used if a toolbar can be displayed, thus this is used in
 XEmacs and ignored in FSF Emacs."
@@ -1330,7 +1327,7 @@ This is basically swiped from VM."
      ((eq (symbol-value gnuplot-toolbar-use-toolbar) top-toolbar)
       (setq gnuplot-toolbar-location       "top")
       (set-specifier top-toolbar           toolbar buffer)
-      (set-specifier top-toolbar-height    height frame tag-set))) ))
+      (set-specifier top-toolbar-height    height frame tag-set)))))
 
 (defvar gnuplot-line-xpm
   (if (and (featurep 'xpm) (fboundp 'toolbar-make-button-list))
@@ -1638,13 +1635,14 @@ static char *help_btn[] = {
 
 
 (defun gnuplot-make-toolbar-function ()
+  "Make toolbar."
   (if (and gnuplot-xemacs-p gnuplot-all-buttons-defined)
       (progn
         ;;(remove-specifier gnuplot-toolbar-use-toolbar (current-buffer))
         (gnuplot-toolbar-setup-toolbar gnuplot-toolbar)
         (add-spec-to-specifier (symbol-value gnuplot-toolbar-use-toolbar)
                                gnuplot-toolbar
-                               (current-buffer) ))))
+                               (current-buffer)))))
 
 ;;(defalias 'gnuplot-make-toolbar 'gnuplot-make-toolbar-function)
 
@@ -1703,6 +1701,7 @@ characters.")
 ;; words.  Although gnuplot will recognise unique abbreviations, these
 ;; regular expressions will not.
 (defmacro gnuplot-make-regexp (list)
+  "Macro to generate efficient regexps for keyword matching from LIST."
   `(regexp-opt ,list 'words))
 
 ;; Lists of gnuplot keywords for syntax coloring etc.
@@ -1760,7 +1759,7 @@ These are highlighted using `font-lock-constant-face'.")
     "y2zeroaxis" "ydtics" "ymtics" "ytics" "yzeroaxis" "zdtics" "zmtics" 
"ztics"
     "zzeroaxis")
 
-  "List of gnuplot options which can be negated using `gnuplot-negate-option'")
+  "List of gnuplot options which can be negated using 
`gnuplot-negate-option'.")
 
 (defvar gnuplot-negatable-options-regexp
   (gnuplot-make-regexp gnuplot-keywords-negatable-options))
@@ -1771,7 +1770,7 @@ These are highlighted using `font-lock-constant-face'.")
 (defvar gnuplot-font-lock-syntactic-keywords nil)
 (defvar gnuplot-font-lock-defaults nil)
 
-(when (featurep 'font-lock)            ; <KL>
+(when (featurep 'font-lock)             ; <KL>
   (setq gnuplot-font-lock-keywords
         (list
          ;; stuff in brackets, sugg. by <LB>
@@ -1803,9 +1802,9 @@ These are highlighted using `font-lock-constant-face'.")
 
   (setq gnuplot-font-lock-defaults
         '(gnuplot-font-lock-keywords
-          nil                          ; Use syntactic fontification
-          t                            ; Use case folding
-          nil                          ; No extra syntax
+          nil                           ; Use syntactic fontification
+          t                             ; Use case folding
+          nil                           ; No extra syntax
           ;; calls `gnuplot-beginning-of-continuation'
           ;; to find a safe place to begin syntactic highlighting
           beginning-of-defun))
@@ -1868,14 +1867,14 @@ These are highlighted using `font-lock-constant-face'.")
       (1 "!") (2 "!")))))
 
 (defun gnuplot-syntax-propertize-extend-region (start end)
-  "Expand the region to syntax-propertize for strings and comments.
+  "Expand the region to `syntax-propertize' for strings and comments.
 
+Region range is START to END.
 Ensures that the region being searched begins and ends outside of
 any lines continued with a backslash.
 
-This function is added to
-`syntax-propertize-extend-region-functions' in gnuplot-mode
-buffers."
+This function is added to `syntax-propertize-extend-region-functions'
+in gnuplot-mode buffers."
   (let ((continuation-start
          (min start
               (gnuplot-point-at-beginning-of-continuation start)))
@@ -1889,7 +1888,7 @@ buffers."
 
 ;; Parsing utilities to tell if we are inside a string or comment
 (defun gnuplot-in-string (&optional where)
-  "Returns non-nil if the text at WHERE is within a string.
+  "Return non-nil if the text at WHERE is within a string.
 
 If WHERE is omitted, defaults to text at point.
 This is a simple wrapper for `syntax-ppss'."
@@ -1898,7 +1897,7 @@ This is a simple wrapper for `syntax-ppss'."
       (nth 3 parse-state))))
 
 (defun gnuplot-in-comment (&optional where)
-  "Returns non-nil if the text at WHERE is within a comment.
+  "Return non-nil if the text at WHERE is within a comment.
 
 If WHERE is omitted, defaults to text at point.
 This is a simple wrapper for `syntax-ppss'."
@@ -1907,7 +1906,7 @@ This is a simple wrapper for `syntax-ppss'."
       (nth 4 parse-state))))
 
 (defun gnuplot-in-string-or-comment (&optional where)
-  "Returns non-nil if the text at WHERE is within a string or comment.
+  "Return non-nil if the text at WHERE is within a string or comment.
 
 If WHERE is omitted, defaults to text at point.
 This is a simple wrapper for `syntax-ppss'."
@@ -1934,7 +1933,7 @@ This is a simple wrapper for `syntax-ppss'."
           (setq list (append list (list line))
                 line "")
         (setq line (concat line (char-to-string (elt string index)))))
-      (setq index (1+ index)) )
+      (setq index (1+ index)))
     list))
 
 ;; -- the calls to `sleep-for' are to allow enough time for gnuplot
@@ -1949,7 +1948,7 @@ the type of text being sent to gnuplot and is typically 
one of
 nil, 'line, 'region, 'buffer, or 'file.  TEXT may be useful for
 functions in `gnuplot-after-plot-hook'.  `gnuplot-after-plot-hook' is
 called by this function after all of STRING is sent to gnuplot."
-  (gnuplot-make-gnuplot-buffer)        ; make sure a gnuplot buffer exists
+  (gnuplot-make-gnuplot-buffer)         ; make sure a gnuplot buffer exists
   (gnuplot-fetch-version-number)
   (setq gnuplot-comint-recent-buffer (current-buffer))
 
@@ -1988,8 +1987,8 @@ called by this function after all of STRING is sent to 
gnuplot."
     (run-hooks 'gnuplot-after-plot-hook)))
 
 (defun gnuplot-display-and-recenter-gnuplot-buffer ()
-  "Make sure the gnuplot comint buffer is displayed, and
-move point to the end if necessary"
+  "Make sure the gnuplot comint buffer is displayed.
+Move point to the end if necessary."
   (save-selected-window
     (select-window (display-buffer (get-buffer gnuplot-buffer)))
     (goto-char (point-max))
@@ -2028,7 +2027,7 @@ This sets `gnuplot-recently-sent' to 'line."
              (end-of-line)
              (while (save-excursion
                       (backward-char)
-                      (looking-at "\\\\"))     ; go to end of last 
continuation line
+                      (looking-at "\\\\"))      ; go to end of last 
continuation line
                (end-of-line 2))
              (beginning-of-line 2)
              (setq end (point)))
@@ -2046,13 +2045,14 @@ This sets `gnuplot-recently-sent' to 'line."
 (defun gnuplot-send-line-and-forward (&optional num)
   "Call `gnuplot-send-line-to-gnuplot' and move forward 1 line.
 You can use a numeric prefix to send more than one line.  Blank lines and
-lines with only comments are skipped when moving forward."
+lines with only comments are skipped when moving forward.
+NUM is optional arg."
   (interactive "p")
   (let (end)
     (while (> num 0)
       (setq end (gnuplot-send-line-to-gnuplot))
       (goto-char end)
-      (backward-char 1)                        ; <AR>
+      (backward-char 1)                         ; <AR>
       (gnuplot-forward-script-line 1)
       (setq num (1- num)))))
 
@@ -2090,7 +2090,7 @@ This sets `gnuplot-recently-sent' to 'file."
   (let ((string (read-file-name "Name of file to send to gnuplot > " nil nil 
t)))
     (setq string (concat "load '" (expand-file-name string) "'\n"))
     (message "%S" string)
-    (gnuplot-make-gnuplot-buffer)      ; make sure a gnuplot buffer exists
+    (gnuplot-make-gnuplot-buffer)       ; make sure a gnuplot buffer exists
     (gnuplot-send-string-to-gnuplot string 'file)))
 
 ;; suggested by <JS>
@@ -2151,7 +2151,7 @@ this function is attached to `gnuplot-after-plot-hook'"
             (goto-char (point-min))
             (kill-line)
             (setq nlines (1- nlines)))
-          (goto-char (point-max)) ))))
+          (goto-char (point-max))))))
 (add-hook 'gnuplot-after-plot-hook 'gnuplot-trim-gnuplot-buffer nil nil)
 
 
@@ -2160,9 +2160,9 @@ this function is attached to `gnuplot-after-plot-hook'"
 ;; Menu for the comint-mode buffer
 (defvar gnuplot-comint-menu
   `("Gnuplot"
-    ["Plot most recent gnuplot buffer"         gnuplot-plot-from-comint
+    ["Plot most recent gnuplot buffer"          gnuplot-plot-from-comint
      (buffer-live-p gnuplot-comint-recent-buffer)]
-    ["Save and plot most recent gnuplot buffer"        
gnuplot-save-and-plot-from-comint
+    ["Save and plot most recent gnuplot buffer"         
gnuplot-save-and-plot-from-comint
      (buffer-live-p gnuplot-comint-recent-buffer)]
     "---"
     ,gnuplot-display-options-menu
@@ -2174,24 +2174,23 @@ this function is attached to `gnuplot-after-plot-hook'"
      :style toggle
      :selected eldoc-mode]
     "---"
-    ["Insert filename at point"                        gnuplot-insert-filename 
t]
-    ["Negate set option"                       gnuplot-negate-option t]
-    ["Keyword help"                            gnuplot-info-lookup-symbol
+    ["Insert filename at point"                         
gnuplot-insert-filename t]
+    ["Negate set option"                        gnuplot-negate-option t]
+    ["Keyword help"                             gnuplot-info-lookup-symbol
      (or gnuplot-keywords gnuplot-keywords-pending)]
     ["Quick help for thing at point"            gnuplot-help-function
      gnuplot-context-sensitive-mode]
     ["Info documentation on thing at point"
      gnuplot-info-at-point
      gnuplot-context-sensitive-mode]
-    ["Switch to recent gnuplot script buffer"  gnuplot-pop-to-recent-buffer
+    ["Switch to recent gnuplot script buffer"   gnuplot-pop-to-recent-buffer
      (buffer-live-p gnuplot-comint-recent-buffer)]
     "---"
-    ["Customize gnuplot"                       gnuplot-customize t]
-    ["Show gnuplot-mode version"               gnuplot-show-version t]
-    ["Show gnuplot version"                    gnuplot-show-gnuplot-version t]
+    ["Customize gnuplot"                        gnuplot-customize t]
+    ["Show gnuplot-mode version"                gnuplot-show-version t]
+    ["Show gnuplot version"                     gnuplot-show-gnuplot-version t]
     "---"
-    ["Kill gnuplot"                            gnuplot-kill-gnuplot-buffer t]
-    ))
+    ["Kill gnuplot"                             gnuplot-kill-gnuplot-buffer 
t]))
 
 ;; Major mode `gnuplot-comint-mode' for the interaction buffer
 (define-derived-mode gnuplot-comint-mode comint-mode "Gnuplot interaction"
@@ -2202,7 +2201,7 @@ buffer."
 
   (set-syntax-table gnuplot-mode-syntax-table)
 
-  (if gnuplot-xemacs-p                 ; deal with font-lock
+  (if gnuplot-xemacs-p                  ; deal with font-lock
       (if (fboundp 'turn-on-font-lock) (turn-on-font-lock))
     (progn
       (setq font-lock-defaults gnuplot-font-lock-defaults)
@@ -2237,23 +2236,23 @@ buffer."
   (easy-menu-add gnuplot-comint-mode-menu gnuplot-comint-mode-map))
 
 ;; Key bindings for gnuplot-comint-mode
-(define-key gnuplot-comint-mode-map "\M-\C-p"  'gnuplot-plot-from-comint)
-(define-key gnuplot-comint-mode-map "\M-\C-f"  
'gnuplot-save-and-plot-from-comint)
-(define-key gnuplot-comint-mode-map "\C-d"     'gnuplot-delchar-or-maybe-eof)
+(define-key gnuplot-comint-mode-map "\M-\C-p"   'gnuplot-plot-from-comint)
+(define-key gnuplot-comint-mode-map "\M-\C-f"   
'gnuplot-save-and-plot-from-comint)
+(define-key gnuplot-comint-mode-map "\C-d"      'gnuplot-delchar-or-maybe-eof)
 (let ((completion-function
        (if (and (>= emacs-major-version 24)
                 (>= emacs-minor-version 1))
            'completion-at-point
          'comint-dynamic-complete)))
-  (define-key gnuplot-comint-mode-map "\M-\r"  completion-function)
-  (define-key gnuplot-comint-mode-map "\M-\t"  completion-function))
+  (define-key gnuplot-comint-mode-map "\M-\r"   completion-function)
+  (define-key gnuplot-comint-mode-map "\M-\t"   completion-function))
 (define-key gnuplot-comint-mode-map "\C-c\C-d"  'gnuplot-info-lookup-symbol)
-(define-key gnuplot-comint-mode-map "\C-c\C-w" 'gnuplot-show-version)
-(define-key gnuplot-comint-mode-map "\C-c\C-i" 'gnuplot-insert-filename)
-(define-key gnuplot-comint-mode-map "\C-c\C-n" 'gnuplot-negate-option)
-(define-key gnuplot-comint-mode-map "\C-c\C-p" 'gnuplot-show-gnuplot-version)
-(define-key gnuplot-comint-mode-map "\C-c\C-z" 'gnuplot-customize)
-(define-key gnuplot-comint-mode-map "\C-c\C-e" 'gnuplot-pop-to-recent-buffer)
+(define-key gnuplot-comint-mode-map "\C-c\C-w"  'gnuplot-show-version)
+(define-key gnuplot-comint-mode-map "\C-c\C-i"  'gnuplot-insert-filename)
+(define-key gnuplot-comint-mode-map "\C-c\C-n"  'gnuplot-negate-option)
+(define-key gnuplot-comint-mode-map "\C-c\C-p"  'gnuplot-show-gnuplot-version)
+(define-key gnuplot-comint-mode-map "\C-c\C-z"  'gnuplot-customize)
+(define-key gnuplot-comint-mode-map "\C-c\C-e"  'gnuplot-pop-to-recent-buffer)
 (define-key gnuplot-comint-mode-map "\C-c\M-i"  'gnuplot-inline-image-mode)
 
 ;; Menu for gnuplot-comint-mode
@@ -2280,9 +2279,9 @@ buffer."
 (defun gnuplot-fetch-version-number ()
   "Determine the installed version of the gnuplot program.
 
-If `gnuplot-program-version' is already set, does
-nothing. Otherwise, runs `gnuplot-program' and searches the text
-printed at startup for a string like \"Version N.N\".
+If `gnuplot-program-version' is already set, does nothing.
+Otherwise, runs `gnuplot-program' and searches the text printed
+at startup for a string like \"Version N.N\".
 
 Sets the variables `gnuplot-program-version',
 `gnuplot-program-major-version', `gnuplot-program-minor-version',
@@ -2320,11 +2319,12 @@ defaults to 3.7."
     (gnuplot-setup-menu-and-toolbar)))
 
 (defun gnuplot-setup-menu-and-toolbar ()
+  "Setup stuff that depends on version number."
   ;; set up the menubar (possibly dependent on version number)
   (gnuplot-setup-menubar)
   ;; set up the toolbar (possibly dependent on version number)
   (if (and gnuplot-xemacs-p gnuplot-toolbar-display-flag)
-      (condition-case ()               ; deal with the toolbar
+      (condition-case ()                ; deal with the toolbar
           (and (require 'toolbar)
                (require 'xpm)
                (gnuplot-make-toolbar-function))
@@ -2335,7 +2335,7 @@ defaults to 3.7."
 
 (defvar gnuplot-prompt-regexp
   (regexp-opt '("gnuplot> " "multiplot> "))
-  "Regexp for recognizing the GNUPLOT prompt")
+  "Regexp for recognizing the GNUPLOT prompt.")
 
 (defun gnuplot-protect-prompt-fn (string)
   "Prevent the Gnuplot prompt from being deleted or overwritten.
@@ -2353,7 +2353,7 @@ STRING is the text as originally inserted in the comint 
buffer."
             (put-text-property b e 'intangible t)
             (put-text-property b e 'face 'gnuplot-prompt-face)
             ;;(put-text-property b e 'read-only t)
-            )) )))
+            )))))
 
 (defun gnuplot-close-down ()
   "Tidy up when deleting the gnuplot buffer."
@@ -2415,30 +2415,35 @@ gnuplot process buffer will be displayed in a window."
 (defvar gnuplot-image-buffer-name "*gnuplot output*")
 
 (defun gnuplot-display-images-p ()
-  ;; Inline images require GNU Emacs.
+  "Inline images require GNU Emacs."
   (and (not (featurep 'xemacs))
        (fboundp 'display-images-p)
        (display-images-p)))
 
 (defun gnuplot-external-display-mode ()
+  "Display image in external."
   (interactive)
   (gnuplot-set-display-mode 'gnuplot-inline-image-mode nil))
 
 (defun gnuplot-inline-display-mode ()
+  "Display image in inline."
   (interactive)
   (gnuplot-set-display-mode 'gnuplot-inline-image-mode 'inline))
 
 (defun gnuplot-dedicated-display-mode ()
+  "Display image in dedicated."
   (interactive)
   (gnuplot-set-display-mode 'gnuplot-inline-image-mode 'dedicated))
 
 (defun gnuplot-set-image-format (format)
+  "Display image in FORMAT."
   (interactive "sGnuplot image format: ")
   (gnuplot-set-display-mode 'gnuplot-image-format format)
   (unless gnuplot-inline-image-mode
     (message "Setting will take effect when plots are displayed in Emacs")))
 
 (defun gnuplot-setup-comint-for-image-mode ()
+  "Setup comint for image."
   (when (and gnuplot-buffer (buffer-live-p gnuplot-buffer)
              (get-buffer-process gnuplot-buffer))
     (with-current-buffer gnuplot-buffer
@@ -2462,10 +2467,10 @@ gnuplot process buffer will be displayed in a window."
 (defvar gnuplot-inhibit-filter nil)
 
 (defun gnuplot-insert-inline-image-output (string)
-  "Insert Gnuplot graphical output in the gnuplot-comint buffer.
+  "Insert Gnuplot graphical output STRING in the gnuplot-comint buffer.
 
 Called via `comint-preoutput-filter-functions' hook when
-`gnuplot-inline-image-mode' is enabled. Checks the status of the
+`gnuplot-inline-image-mode' is enabled.  Checks the status of the
 file `gnuplot-inline-image-filename'; if it exists and has
 nonzero size, inserts it as an inline image, stores a new
 temporary filename in `gnuplot-inline-image-filename', and
@@ -2513,13 +2518,13 @@ updates Gnuplot with the appropriate 'set output' 
command."
   (comint-send-string (get-buffer-process gnuplot-buffer) string))
 
 (defun gnuplot-discard-output (string)
-  ;; Temporary preoutput filter for hiding Gnuplot output & prompt.
-  ;; Accumulates output in a buffer until it finds the next prompt,
-  ;; then removes itself from comint-preoutput-filter-functions.
+  "Temporary preoutput filter for hiding Gnuplot output & prompt.
+Accumulates output STRING in a buffer until it finds the next prompt,
+then removes itself from `comint-preoutput-filter-functions'."
   (with-current-buffer
       (get-buffer-create gnuplot-hidden-output-buffer)
     (insert string)
-    (when (looking-back gnuplot-prompt-regexp)
+    (when (looking-back gnuplot-prompt-regexp (point-min))
       (with-current-buffer gnuplot-buffer
         (remove-hook 'comint-preoutput-filter-functions
                      'gnuplot-discard-output t))))
@@ -2538,7 +2543,7 @@ Bound to \\[gnuplot-insert-filename]"
   (insert gnuplot-quote-character
           (file-relative-name (read-file-name "Filename > " "")
                               default-directory)
-          gnuplot-quote-character) )
+          gnuplot-quote-character))
 
 
 ;; Adjust indentation for the line containing point
@@ -2584,13 +2589,13 @@ Add additional indentation for continuation lines."
     (let ((point-at-indent (+ (point-at-bol) indent)))
       (when (< (point) point-at-indent) (goto-char point-at-indent)))))
 
-;; Adjust indentation on inserting a close brace
-;; The blink-paren fix is stolen from cc-mode
-(defun gnuplot-electric-insert (arg)
+(defun gnuplot-electric-insert (BRACE)
+  "Adjust indentation on inserting a close BRACE.
+The blink-paren fix is stolen from cc-mode"
   (interactive "*p")
   (let ((old-blink-paren blink-paren-function)
         (blink-paren-function nil))
-    (self-insert-command arg)
+    (self-insert-command BRACE)
     (gnuplot-indent-line)
     (when old-blink-paren (funcall old-blink-paren))))
 
@@ -2622,7 +2627,7 @@ If not in a continuation line, move point to beginning of 
line."
 (defun gnuplot-end-of-continuation ()
   "Move point to the end of the continuation lines containing point.
 
-If there are no continuation lines, move point to end-of-line."
+If there are no continuation lines, move point to `end-of-line'."
   (end-of-line)
   (unless (bobp)
     (catch 'eob
@@ -2636,7 +2641,8 @@ If there are no continuation lines, move point to 
end-of-line."
 (defun gnuplot-point-at-beginning-of-continuation (&optional pos)
   "Return value of point at beginning of the continued block containing point.
 
-If there are no continuation lines, returns point-at-bol."
+If there are no continuation lines, returns `point-at-bol'.
+If specify POS, move POS befere execution."
   (save-excursion
     (when pos (goto-char pos))
     (gnuplot-beginning-of-continuation)
@@ -2645,18 +2651,19 @@ If there are no continuation lines, returns 
point-at-bol."
 (defun gnuplot-point-at-end-of-continuation (&optional pos)
   "Return value of point at the end of the continued block containing point.
 
-If there are no continuation lines, returns point-at-eol."
+If there are no continuation lines, returns `point-at-eol'.
+If specify POS, move POS before execution."
   (save-excursion
     (when pos (goto-char pos))
     (gnuplot-end-of-continuation)
     (point)))
 
-;; We also treat a block of continuation lines as a 'defun' for
-;; movement purposes
 (defun gnuplot-beginning-of-defun (&optional arg)
+  "We also treat a block of continuation lines as a `defun'.
+ARG is optional arg."
   (if (not arg) (setq arg 1))
   (if (> arg 0)
-      (catch 'bob              ; go to beginning of ARGth prev. defun
+      (catch 'bob               ; go to beginning of ARGth prev. defun
         (dotimes (n arg)
           (when (= (point)
                    (gnuplot-point-at-beginning-of-continuation))
@@ -2668,7 +2675,7 @@ If there are no continuation lines, returns point-at-eol."
           (gnuplot-beginning-of-continuation))
         t)
 
-    (catch 'eob                  ; find beginning of (-ARG)th following defun
+    (catch 'eob                   ; find beginning of (-ARG)th following defun
       (dotimes (n (- arg))
         (gnuplot-end-of-continuation)
         (forward-line)
@@ -2737,7 +2744,7 @@ Negatable options are defined in 
`gnuplot-keywords-negatable-options'."
                         (insert "no"))
                        (t
                         (message "There is not a negatable set option on this 
line")))))
-        (message "There is not a set option on this line")) )))
+        (message "There is not a set option on this line")))))
 
 ;; (defun gnuplot-set-binding ()
 ;;   "Interactively select a key sequence for binding to a plot function.
@@ -2745,19 +2752,19 @@ Negatable options are defined in 
`gnuplot-keywords-negatable-options'."
 ;; key bindings (i.e. those covered by pm3d)."
 ;;   (interactive)
 ;;   (let ((keyseq (read-key-sequence "Choose a key sequence now"))
-;;     (command (read-string "Bind to this command > ")))
+;;      (command (read-string "Bind to this command > ")))
 ;;     (setq keyseq (format "%S" keyseq))
 ;;     (string-match "keypress-event\\s-+" keyseq)
 ;;     (setq keyseq (substring keyseq (match-end 0) -2))
 ;;     ;; need to convert from emacs nomenclature to gnuplot.  what a pain.
 ;;     (let* ((alist '(("backspace" . "Backspace") ("tab" . "Tab") ("linefeed" 
. "Linefeed")
-;;                 ("clear" . "Clear") ("return" . "Return") ("pause" . 
"Pause")
-;;                 ("scroll-lock" . "Scroll_Lock") ("SysReq" . "sys-req")
-;;                 ("escape" . "Escape") ("delete" . "Delete") ("home" . 
"Home")
-;;                 ("left" . "Left") ("right" . "Right") ("up" . "Up") ("down" 
. "Down")
-;;                 ("prior" . "PageUp") ("next" . "PageDown") ("end" . "End")
-;;                 ("begin". "Begin")))
-;;        (match (assoc keyseq alist)))
+;;                  ("clear" . "Clear") ("return" . "Return") ("pause" . 
"Pause")
+;;                  ("scroll-lock" . "Scroll_Lock") ("SysReq" . "sys-req")
+;;                  ("escape" . "Escape") ("delete" . "Delete") ("home" . 
"Home")
+;;                  ("left" . "Left") ("right" . "Right") ("up" . "Up") 
("down" . "Down")
+;;                  ("prior" . "PageUp") ("next" . "PageDown") ("end" . "End")
+;;                  ("begin". "Begin")))
+;;         (match (assoc keyseq alist)))
 ;;       (if match (setq keyseq (cdr match)))
 ;;
 ;;     (insert (format "bind \"%s\" \"%s\"" keyseq command)))))
@@ -2816,7 +2823,7 @@ See the comments in `gnuplot-info-hook'."
                         `((gnuplot-mode
                            "[a-zA-Z][_a-zA-Z0-9]*" nil
                            ,doc-spec "[_a-zA-Z0-9]+" )))))
-                (t                     ; newer version
+                (t                      ; newer version
                  (info-lookup-add-help
                   :mode 'gnuplot-mode :topic 'symbol
                   :regexp "[a-zA-Z][_a-zA-Z0-9]*"
@@ -2839,7 +2846,7 @@ See the comments in `gnuplot-info-hook'."
           (and (get-buffer "info dir")    (kill-buffer "info dir"))
           (and (get-buffer "info dir<2>") (kill-buffer "info dir<2>")))
         (setq gnuplot-keywords (gnuplot-set-keywords-list))
-        (setq gnuplot-keywords-alist   ; needed for all-completions
+        (setq gnuplot-keywords-alist    ; needed for all-completions
               (mapcar 'list gnuplot-keywords)))
 
     ;; or do something sensible if info-look is not installed
@@ -2878,6 +2885,7 @@ Return a list of keywords."
   "Function to call to perform completion in Gnuplot buffers.")
 
 (defun gnuplot-completion-at-point ()
+  "Perform completion in Gnuplot buffers."
   (funcall gnuplot-completion-at-point-function))
 
 (defvar gnuplot-eldoc-hash nil
@@ -2972,12 +2980,12 @@ distribution. See gnuplot-context.el for details."
 (defun gnuplot-completion-at-point-info-look ()
   "Return completions of keyword preceding point.
 
-Uses the cache of keywords generated by info-lookup. See
-`gnuplot-setup-info-look'. If not nil, the return value is in the form
+Uses the cache of keywords generated by info-lookup.  See
+`gnuplot-setup-info-look'.  If non-nil, the return value is in the form
 \(BEGIN END COMPLETIONS) where BEGIN and END are buffer
 positions and COMPLETIONS is a list."
 
-  (if gnuplot-keywords-pending         ; <HW>
+  (if gnuplot-keywords-pending          ; <HW>
       (gnuplot-setup-info-look))
   (let* ((end (point))
          (beg (unwind-protect (save-excursion (backward-sexp 1) (point))))
@@ -3015,7 +3023,7 @@ according to the value of `gnuplot-info-display'."
   (interactive
    (cond (gnuplot-keywords
           (info-lookup-interactive-arguments 'symbol))
-         (gnuplot-keywords-pending     ; <HW>
+         (gnuplot-keywords-pending      ; <HW>
           (gnuplot-setup-info-look)
           (info-lookup-interactive-arguments 'symbol))
          (t
@@ -3029,11 +3037,11 @@ according to the value of `gnuplot-info-display'."
     (gnuplot--adjust-info-display)))
 
 (defun gnuplot--adjust-info-display ()
-  "Displays the *info* buffer in a window or frame as specified
-by the value of `gnuplot-info-display'.  If
-`gnuplot-info-display' is 'window, then the window will be shrunk
-to the size of the info entry if it is smaller than half the
-height of the frame.
+  "Displays the *info* buffer in a window or frame.
+Specified by the value of `gnuplot-info-display'.
+If `gnuplot-info-display' is 'window, then the window will be
+shrunk to the size of the info entry if it is smaller than half
+the height of the frame.
 
 The *info* buffer should already exist when this function is
 called."
@@ -3072,7 +3080,7 @@ shown."
   (cond ((and (not gnuplot-three-eight-p)
               (string-match "\\(emf\\|p\\(alette\\|m3d\\)\\|vgagl\\)" string))
          (message "%S is an option introduced in gnuplot 3.8 (You are using 
%s)"
-                  string gnuplot-program-version) )
+                  string gnuplot-program-version))
         (t
          (insert string)
          (let ((topic string) term)
@@ -3087,11 +3095,12 @@ shown."
                        gnuplot-gui-popup-flag)
                   (gnuplot-gui-set-options-and-insert))
                  (gnuplot-insertions-show-help-flag
-                  (if gnuplot-keywords-pending         ; <HW>
+                  (if gnuplot-keywords-pending          ; <HW>
                       (gnuplot-setup-info-look))
-                  (gnuplot-info-lookup-symbol topic)) ) )) ) )
+                  (gnuplot-info-lookup-symbol topic)))))))
 
 (defun gnuplot-toggle-info-display ()
+  "Toggle info display."
   (interactive)
   (setq gnuplot-insertions-show-help-flag (not 
gnuplot-insertions-show-help-flag))
   (message (if gnuplot-insertions-show-help-flag
@@ -3109,7 +3118,7 @@ work with newer and older versions.
 
 Report bugs at https://github.com/emacsorphanage/gnuplot/issues
 
-                           ------O------
+                            ------O------
 
 Gnuplot-mode includes two different systems for keyword
 completion and documentation lookup: a newer one,
@@ -3124,11 +3133,11 @@ distribution, or is available at the `gnuplot-mode' web 
page:
 https://github.com/emacsorphanage/gnuplot/
 
 With the new context-sensitive mode active, gnuplot-mode can also
-provide `eldoc-mode' syntax hints as you type.  This requires a
+provide function/`eldoc-mode' syntax hints as you type.  This requires a
 separate file of strings, `gnuplot-eldoc.el', which is also
 provided by recent Gnuplot distributions.
 
-                           ------O------
+                            ------O------
 
 There are several known shortcomings of `gnuplot-mode', version 0.5g
 and up.  Many of the shortcomings involve the graphical interface
@@ -3150,7 +3159,7 @@ a list:
  5.  The GUI handling of \"hidden3d\" is flaky and \"cntrparam\" is
      unsupported.
 
-                           ------O------
+                            ------O------
 
  Key bindings:
  \\{gnuplot-mode-map}"
@@ -3176,7 +3185,7 @@ a list:
   (when (eq gnuplot-keywords-when 'immediately) ; <HW>
     (gnuplot-setup-info-look)) ;; <SE>
 
-  (if gnuplot-xemacs-p                 ; deal with font-lock
+  (if gnuplot-xemacs-p                  ; deal with font-lock
       (when (fboundp 'turn-on-font-lock)
         (turn-on-font-lock))
     (progn
@@ -3191,11 +3200,11 @@ a list:
       (set (make-local-variable 'font-lock-multiline) t)
       (set (make-local-variable 'parse-sexp-lookup-properties) t)))
 
-  (if (fboundp 'widget-create)         ; gnuplot-gui
+  (if (fboundp 'widget-create)          ; gnuplot-gui
       (condition-case ()
           (require 'gnuplot-gui)
         (error nil)))
-  (setq gnuplot-first-call nil         ; a few more details ...
+  (setq gnuplot-first-call nil          ; a few more details ...
         gnuplot-comint-recent-buffer (current-buffer)
         comint-process-echoes        gnuplot-echo-command-line-flag)
   (run-hooks 'gnuplot-mode-hook)
@@ -3228,12 +3237,12 @@ following in your .emacs file:
   (pop-to-buffer gnuplot-buffer))
 
 (defun gnuplot-show-version ()
-  "Show version number in echo area"
+  "Show version number in echo area."
   (interactive)
   (message "gnuplot-mode %s -- URL: %s" gnuplot-version 
gnuplot-maintainer-url))
 
 (defun gnuplot-show-gnuplot-version ()
-  "Show gnuplot program and version number in echo area"
+  "Show gnuplot program and version number in echo area."
   (interactive)
   (gnuplot-fetch-version-number)
   (message "You are calling gnuplot %s as %s" gnuplot-program-version 
gnuplot-program))

Reply via email to