emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/gnuplot e74ca19d8b: Cleanup and simplifications (#75)


From: ELPA Syncer
Subject: [nongnu] elpa/gnuplot e74ca19d8b: Cleanup and simplifications (#75)
Date: Wed, 29 Dec 2021 09:02:54 -0500 (EST)

branch: elpa/gnuplot
commit e74ca19d8b10f844f80aac4caf55e7da3035af22
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: GitHub <noreply@github.com>

    Cleanup and simplifications (#75)
    
    * Use setq-local
    
    * Customize is available
    
    * Remove messages from gnuplot-sensitive-mode
    
    The mode will already print a message when turning it on/off interactively.
    
    * split-string exists since Emacs 20
    
    * display-images-p exists since Emacs 21
    
    * font-lock is available
    
    * Feature info-look is available
    
    * Function widget-create exists
    
    * Function syntax-propertize exists
    
    * comint-dynamic-complete is obsolete since 24.1
    
    * Remove unnecessary fboundp checks
    
    * Cleanup require
---
 gnuplot-gui.el          | 180 ++++++++++++++++++------------------------
 gnuplot-test-context.el |   3 +-
 gnuplot-tests.el        |   6 +-
 gnuplot.el              | 202 +++++++++++++++++++++---------------------------
 4 files changed, 165 insertions(+), 226 deletions(-)

diff --git a/gnuplot-gui.el b/gnuplot-gui.el
index 45020a994d..042b9b1404 100644
--- a/gnuplot-gui.el
+++ b/gnuplot-gui.el
@@ -58,37 +58,9 @@
 ;;; Code:
 
 (require 'gnuplot)
-(eval-and-compile
-  (condition-case ()
-      (progn
-        (require 'widget)
-        (require 'wid-edit))
-    (error nil)))
+(require 'widget)
+(require 'wid-edit)
 (require 'cl-lib)
-(eval-when-compile          ; suppress some compiler warnings
-  (defvar gnuplot-quote-character nil)
-  (defvar gnuplot-info-display nil)
-  (defvar gnuplot-mode-map nil))
-
-;; (eval-when-compile
-;;   (require 'wid-edit))
-
-(eval-and-compile           ; I need this!
-  (if (fboundp 'split-string)
-      ()
-    (defun split-string (string &optional pattern)
-      "Return a list of substrings of STRING which are separated by PATTERN.
-If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
-      (or pattern
-          (setq pattern "[ \f\t\n\r\v]+"))
-      ;; The FSF version of this function takes care not to cons in case
-      ;; of infloop.  Maybe we should synch?
-      (let (parts (start 0))
-        (while (string-match pattern string start)
-          (setq parts (cons (substring string start (match-beginning 0)) parts)
-                start (match-end 0)))
-        (nreverse (cons (substring string start) parts)))) ))
-
 
 
 ;;; customizable variables
@@ -860,10 +832,9 @@ EVENT is a mouse event.  Bound to \\[gnuplot-gui-mouse-set]
 Note that \"plot\", \"splot\", \"fit\", and \"cntrparam\" are not
 currently supported."
   (interactive "@e")
-  (when (fboundp 'widget-create)
-    (save-excursion
-      (mouse-set-point event)
-      (gnuplot-gui-set-options-and-insert))))
+  (save-excursion
+    (mouse-set-point event)
+    (gnuplot-gui-set-options-and-insert)))
 
 (defun gnuplot-gui-get-frame-param (param)
   (cdr (assoc param gnuplot-gui-frame-parameters)))
@@ -877,81 +848,80 @@ Determine contents of current line and set up the 
appropriate GUI
 frame.  Bound to \\[gnuplot-gui-set-options-and-insert]
 Note that \"cntrparam\" is not currently supported."
   (interactive)
-  (when (fboundp 'widget-create)
-    (let ((begin  (gnuplot-point-at-beginning-of-command))
-          (end    (save-excursion (end-of-line)       (point-marker)))
-          (termin (concat "\\(,\\s-*" (regexp-quote "\\") "\\|;\\)"))
-          (set nil) (term nil))
-      (save-excursion
-        ;; there can be more then one command per line
-        (if (re-search-forward termin end "to_limit")
-            (progn (backward-char (length (match-string 1)))
-                   (setq end (point-marker))))
-        (goto-char begin)
-        (skip-syntax-forward "-" end)
-        ;; various constructions are recognized here. at the end of this
-        ;; cond, point should be just after the word whose arguments are
-        ;; to be set
-        (cond ((looking-at "set\\s-+")
-               (setq set t)
-               (goto-char (match-end 0))
-               (if (looking-at "\\sw+") (goto-char (match-end 0)))
-               (when (string-match "^ter" (gnuplot-this-word)) ; terminal?
-                 (setq term t)
-                 (forward-word 1))
-               (when (string-match "^\\(da\\|fu\\)" (gnuplot-this-word))
-                 (unless (looking-at "\\s-+st")
-                   (insert " style") (forward-word 1))
-                 (forward-word 1)))
-              ((looking-at (concat "\\(cd\\|ca\\|lo\\|pa\\|pr\\|sa\\|u\\)"
-                                   "\\w*"
-                                   "[\\s-\\']"))
+  (let ((begin  (gnuplot-point-at-beginning-of-command))
+        (end    (save-excursion (end-of-line)       (point-marker)))
+        (termin (concat "\\(,\\s-*" (regexp-quote "\\") "\\|;\\)"))
+        (set nil) (term nil))
+    (save-excursion
+      ;; there can be more then one command per line
+      (if (re-search-forward termin end "to_limit")
+          (progn (backward-char (length (match-string 1)))
+                 (setq end (point-marker))))
+      (goto-char begin)
+      (skip-syntax-forward "-" end)
+      ;; various constructions are recognized here. at the end of this
+      ;; cond, point should be just after the word whose arguments are
+      ;; to be set
+      (cond ((looking-at "set\\s-+")
+             (setq set t)
+             (goto-char (match-end 0))
+             (if (looking-at "\\sw+") (goto-char (match-end 0)))
+             (when (string-match "^ter" (gnuplot-this-word)) ; terminal?
+               (setq term t)
                (forward-word 1))
-              ;;(goto-char (match-end 0)))
-              (t
+             (when (string-match "^\\(da\\|fu\\)" (gnuplot-this-word))
+               (unless (looking-at "\\s-+st")
+                 (insert " style") (forward-word 1))
                (forward-word 1)))
-        (if (> (point) end) (goto-char end))
-        (let* ((w (gnuplot-this-word))
-               (wd (try-completion w gnuplot-gui-all-types))
-               (word "") wrd list)
-          (cond ((equal wd t)                     (setq word w))
-                ((equal wd nil)                   (setq word w))
-                ((assoc wd gnuplot-gui-all-types) (setq word wd))
-                (t                                (setq wd nil)))
-          (cond ((equal (string-match "^\\s-*$" w) 0)
-                 (message "Blank line"))
-                ((and wd (stringp word))
-                 (gnuplot-gui-correct-command word set term begin)
-                 (setq gnuplot-gui-alist nil
-                       gnuplot-gui-current-string
-                       (buffer-substring-no-properties (point) end))
-                 (gnuplot-gui-set-alist word gnuplot-gui-current-string)
-                 (let* ((old-height (gnuplot-gui-get-frame-param 'height))
-                        (old-top    (gnuplot-gui-get-frame-param 'top)))
-                   (when (or
-                          (and (equal gnuplot-gui-plot-splot-fit-style 
'complete)
-                               (cl-member word '("plot" "splot" "fit")
+            ((looking-at (concat "\\(cd\\|ca\\|lo\\|pa\\|pr\\|sa\\|u\\)"
+                                 "\\w*"
+                                 "[\\s-\\']"))
+             (forward-word 1))
+            ;;(goto-char (match-end 0)))
+            (t
+             (forward-word 1)))
+      (if (> (point) end) (goto-char end))
+      (let* ((w (gnuplot-this-word))
+             (wd (try-completion w gnuplot-gui-all-types))
+             (word "") wrd list)
+        (cond ((equal wd t)                     (setq word w))
+              ((equal wd nil)                   (setq word w))
+              ((assoc wd gnuplot-gui-all-types) (setq word wd))
+              (t                                (setq wd nil)))
+        (cond ((equal (string-match "^\\s-*$" w) 0)
+               (message "Blank line"))
+              ((and wd (stringp word))
+               (gnuplot-gui-correct-command word set term begin)
+               (setq gnuplot-gui-alist nil
+                     gnuplot-gui-current-string
+                     (buffer-substring-no-properties (point) end))
+               (gnuplot-gui-set-alist word gnuplot-gui-current-string)
+               (let* ((old-height (gnuplot-gui-get-frame-param 'height))
+                      (old-top    (gnuplot-gui-get-frame-param 'top)))
+                 (when (or
+                        (and (equal gnuplot-gui-plot-splot-fit-style 'complete)
+                             (cl-member word '("plot" "splot" "fit")
                                         :test 'string=))
-                          (equal word "test"))
-                     (gnuplot-gui-set-frame-param 'height 32)
-                     (gnuplot-gui-set-frame-param 'top    50))
-                   (gnuplot-gui-prompt-for-frame word)
-                   (when (or
-                          (and (equal gnuplot-gui-plot-splot-fit-style 
'complete)
-                               (cl-member word '("plot" "splot" "fit")
+                        (equal word "test"))
+                   (gnuplot-gui-set-frame-param 'height 32)
+                   (gnuplot-gui-set-frame-param 'top    50))
+                 (gnuplot-gui-prompt-for-frame word)
+                 (when (or
+                        (and (equal gnuplot-gui-plot-splot-fit-style 'complete)
+                             (cl-member word '("plot" "splot" "fit")
                                         :test 'string=))
-                          (equal word "test"))
-                     (gnuplot-gui-set-frame-param 'height old-height)
-                     (gnuplot-gui-set-frame-param 'top    old-top)) ))
-                ((setq wrd (car (all-completions w '(("cntrparam")))))
-                 (message
-                  "Setting arguments for %S is currently unsuported in 
gnuplot-mode"
-                  wrd))
-                ((setq list (all-completions w gnuplot-gui-all-types))
-                 (message "%S could be one of %S" w list))
-                (t
-                 (message
-                  "%S is not a gnuplot command which takes options" w)))) ))))
+                        (equal word "test"))
+                   (gnuplot-gui-set-frame-param 'height old-height)
+                   (gnuplot-gui-set-frame-param 'top    old-top)) ))
+              ((setq wrd (car (all-completions w '(("cntrparam")))))
+               (message
+                "Setting arguments for %S is currently unsuported in 
gnuplot-mode"
+                wrd))
+              ((setq list (all-completions w gnuplot-gui-all-types))
+               (message "%S could be one of %S" w list))
+              (t
+               (message
+                "%S is not a gnuplot command which takes options" w)))) )))
 
 (defun gnuplot-gui-toggle-popup ()
   (interactive)
diff --git a/gnuplot-test-context.el b/gnuplot-test-context.el
index baa0eeff12..eb08223bdb 100644
--- a/gnuplot-test-context.el
+++ b/gnuplot-test-context.el
@@ -24,8 +24,7 @@
   (with-temp-buffer
     (gnuplot-mode)
     (insert string)
-    (when (fboundp 'syntax-propertize)
-      (syntax-propertize (point-max)))
+    (syntax-propertize (point-max))
     (goto-char (point-max))
     (gnuplot-tokenize)))
 
diff --git a/gnuplot-tests.el b/gnuplot-tests.el
index 858000bda1..5f73703f89 100644
--- a/gnuplot-tests.el
+++ b/gnuplot-tests.el
@@ -52,8 +52,7 @@ string by `scan-sexps'."
           (insert string)
           (setq end (point))
           (insert epilogue))
-        (when (fboundp 'syntax-propertize)
-          (syntax-propertize (point-max)))
+        (syntax-propertize (point-max))
         (string= (buffer-substring start (scan-sexps start 1))
                  string)))))
 
@@ -199,8 +198,7 @@ comment
           (insert comment)
           (setq end (point))
           (insert epilogue))
-        (when (fboundp 'syntax-propertize)
-          (syntax-propertize (point-max)))
+        (syntax-propertize (point-max))
         (goto-char (1+ start))
         (cl-flet ((in-comment-p (position)
                              (nth 4 (syntax-ppss position))))
diff --git a/gnuplot.el b/gnuplot.el
index b3c1f3a8f1..61aeb79b76 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -363,7 +363,7 @@ symbol `complete' in gnuplot-mode buffers."
 Set VARIABLE to VALUE.  ARGS is optional args."
   (if (and (eq variable 'gnuplot-inline-image-mode)
            value
-           (not (gnuplot-display-images-p)))
+           (not (display-images-p)))
       (progn
         (message "Displaying images is not supported.")
         (set variable nil))
@@ -461,7 +461,7 @@ non-nil."
        :style toggle
        :selected (null gnuplot-inline-image-mode)]
       ["In Comint buffer" gnuplot-inline-display-mode
-       :active (gnuplot-display-images-p)
+       :active (display-images-p)
        :style toggle
        :selected (eq gnuplot-inline-image-mode 'comint)]
       ["In dedicated buffer" gnuplot-dedicated-display-mode
@@ -500,10 +500,8 @@ non-nil."
      gnuplot-info-at-point
      gnuplot-context-sensitive-mode]
     ["Show gnuplot process buffer"      gnuplot-show-gnuplot-buffer t]
-    ["Set arguments at point"           gnuplot-gui-set-options-and-insert
-     (fboundp 'gnuplot-gui-set-options-and-insert)]
-    ["Swap plot/splot/fit lists in GUI" gnuplot-gui-swap-simple-complete
-     (fboundp 'gnuplot-gui-swap-simple-complete)]
+    ["Set arguments at point"           gnuplot-gui-set-options-and-insert t]
+    ["Swap plot/splot/fit lists in GUI" gnuplot-gui-swap-simple-complete t]
     "---"
     ["Customize gnuplot"                gnuplot-customize t]
     "---"
@@ -849,9 +847,8 @@ opening an argument-setting popup.")
         ["Display of info with insertion" gnuplot-toggle-info-display
          :style toggle :selected gnuplot-insertions-show-help-flag]
         ["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)]))
+         :active t
+         :style toggle :selected gnuplot-gui-popup-flag]))
 
 (defun gnuplot-setup-menubar ()
   "Initial setup of gnuplot and insertions menus."
@@ -990,48 +987,43 @@ These are highlighted using `font-lock-constant-face'.")
   (gnuplot-make-regexp gnuplot-keywords-negatable-options))
 
 ;; Set up colorization for gnuplot.
-(defvar gnuplot-font-lock-keywords nil)
-(defvar gnuplot-font-lock-syntactic-keywords nil)
-(defvar gnuplot-font-lock-defaults nil)
-
-(when (featurep 'font-lock)             ; <KL>
-  (setq gnuplot-font-lock-keywords
-        (list
-         ;; stuff in brackets, sugg. by <LB>
-         '("\\[\\([^]]+\\)\\]" 1 font-lock-constant-face)
-
-         ;; variable/function definitions
-         
'("\\(\\(\\sw\\|\\s_\\)+\\s-*\\((\\s-*\\(\\sw\\|\\s_\\)*\\s-*\\(,\\s-*\\sw*\\)*\\s-*)\\)?\\s-*=\\)[^=]"
-           1 font-lock-variable-name-face)
-
-         ;; built-in function names
-         (cons (gnuplot-make-regexp gnuplot-keywords-builtin-functions)
-               font-lock-function-name-face)
-
-         ;; reserved words associated with plotting <AL>
-         (cons (gnuplot-make-regexp gnuplot-keywords-plotting)
-               font-lock-type-face)
-         (cons (gnuplot-make-regexp gnuplot-keywords-plotting-styles)
-               font-lock-function-name-face)
-
-         ;; (s)plot -- also thing (s)plotted
-         '("\\<s?plot\\>" . font-lock-keyword-face)
-         ;; '("\\<s?plot\\s-+\\([^'\" ]+\\)[) \n,\\\\]"
-         ;;   1 font-lock-variable-name-face)
-
-         ;; other common commands
-         (cons (gnuplot-make-regexp gnuplot-keywords-misc)
-               font-lock-constant-face)
-         (cons "!.*$" font-lock-constant-face))) ; what is this for? jjo
-
-  (setq gnuplot-font-lock-defaults
-        '(gnuplot-font-lock-keywords
-          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)))
+(defvar gnuplot-font-lock-keywords
+  (list
+   ;; stuff in brackets, sugg. by <LB>
+   '("\\[\\([^]]+\\)\\]" 1 font-lock-constant-face)
+
+   ;; variable/function definitions
+   
'("\\(\\(\\sw\\|\\s_\\)+\\s-*\\((\\s-*\\(\\sw\\|\\s_\\)*\\s-*\\(,\\s-*\\sw*\\)*\\s-*)\\)?\\s-*=\\)[^=]"
+     1 font-lock-variable-name-face)
+
+   ;; built-in function names
+   (cons (gnuplot-make-regexp gnuplot-keywords-builtin-functions)
+         font-lock-function-name-face)
+
+   ;; reserved words associated with plotting <AL>
+   (cons (gnuplot-make-regexp gnuplot-keywords-plotting)
+         font-lock-type-face)
+   (cons (gnuplot-make-regexp gnuplot-keywords-plotting-styles)
+         font-lock-function-name-face)
+
+   ;; (s)plot -- also thing (s)plotted
+   '("\\<s?plot\\>" . font-lock-keyword-face)
+   ;; '("\\<s?plot\\s-+\\([^'\" ]+\\)[) \n,\\\\]"
+   ;;   1 font-lock-variable-name-face)
+
+   ;; other common commands
+   (cons (gnuplot-make-regexp gnuplot-keywords-misc)
+         font-lock-constant-face)
+   (cons "!.*$" font-lock-constant-face))) ; what is this for? jjo
+
+(defvar gnuplot-font-lock-defaults
+  '(gnuplot-font-lock-keywords
+    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))
 
 ;; Some corner cases in Gnuplot's comment and string syntax are
 ;; difficult to handle accurately using Emacs's built-in syntax tables
@@ -1057,32 +1049,31 @@ These are highlighted using `font-lock-constant-face'.")
 ;; normal syntax-table parser, which is accurate enough for most
 ;; normal cases. (See the definition of `gnuplot-mode-syntax-table'.)
 (defalias 'gnuplot-syntax-propertize
-  (when (fboundp 'syntax-propertize-rules)
-    (syntax-propertize-rules
-     ;; Double quoted strings
-     ((rx
-       (group "\"")
-       (* (or (seq "\\" anything)
-              (not (any "\"" "\n"))))
-       (group (or "\"" "\n" buffer-end)))
-      (1 "|") (2 "|"))
-
-     ;; Single quoted strings
-     ((rx
-       (group "'")
-       (* (or (seq "\\" "\n")
-              "''"
-              (not (any "'" "\n"))))
-       (group (or "'" "\n" buffer-end)))
-      (1 "|") (2 "|"))
-
-     ;; Comments
-     ((rx
-       (group "#")
-       (* (or (seq "\\" "\n")
-              any))
-       (or (group "\n") buffer-end))
-      (1 "!") (2 "!")))))
+  (syntax-propertize-rules
+   ;; Double quoted strings
+   ((rx
+     (group "\"")
+     (* (or (seq "\\" anything)
+            (not (any "\"" "\n"))))
+     (group (or "\"" "\n" buffer-end)))
+    (1 "|") (2 "|"))
+
+   ;; Single quoted strings
+   ((rx
+     (group "'")
+     (* (or (seq "\\" "\n")
+            "''"
+            (not (any "'" "\n"))))
+     (group (or "'" "\n" buffer-end)))
+    (1 "|") (2 "|"))
+
+   ;; Comments
+   ((rx
+     (group "#")
+     (* (or (seq "\\" "\n")
+            any))
+     (or (group "\n") buffer-end))
+    (1 "!") (2 "!"))))
 
 (defun gnuplot-syntax-propertize-extend-region (start end)
   "Expand the region to `syntax-propertize' for strings and comments.
@@ -1410,9 +1401,8 @@ buffer."
   (set-syntax-table gnuplot-mode-syntax-table)
 
   (setq font-lock-defaults gnuplot-font-lock-defaults)
-  (set (make-local-variable 'parse-sexp-lookup-properties) t)
-  (set (make-local-variable 'syntax-propertize-function)
-         #'gnuplot-syntax-propertize)
+  (setq-local parse-sexp-lookup-properties t)
+  (setq-local syntax-propertize-function #'gnuplot-syntax-propertize)
 
   (add-hook 'kill-buffer-hook 'gnuplot-close-down nil t)
 
@@ -1550,11 +1540,6 @@ 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."
-  (and (fboundp 'display-images-p)
-       (display-images-p)))
-
 (defun gnuplot-external-display-mode ()
   "Display image in external."
   (interactive)
@@ -1897,9 +1882,7 @@ Negatable options are defined in 
`gnuplot-keywords-negatable-options'."
 (defun gnuplot-customize ()
   "Customize `gnuplot-mode'."
   (interactive)
-  (if (fboundp 'customize-group)
-      (customize-group "gnuplot")
-    (message "The Custom library is not installed.")))
+  (customize-group "gnuplot"))
 
 
 
@@ -2033,11 +2016,8 @@ distribution. See gnuplot-context.el for details."
         (setq gnuplot-completion-at-point-function 
#'gnuplot-context-completion-at-point)
 
         ;; Setup Eldoc
-        (set (make-local-variable 'eldoc-documentation-function)
-             'gnuplot-eldoc-function)
+        (setq-local eldoc-documentation-function #'gnuplot-eldoc-function)
         (eldoc-add-command 'completion-at-point)     ; Check for eldoc after 
completion
-        (when (fboundp 'comint-dynamic-complete)
-          (eldoc-add-command 'comint-dynamic-complete))
 
         ;; Try to load Eldoc strings
         (when gnuplot-eldoc-mode
@@ -2055,15 +2035,12 @@ distribution. See gnuplot-context.el for details."
 
         ;; Set up tab-to-complete
         (when gnuplot-tab-completion
-          (set (make-local-variable 'tab-always-indent) 'complete))
-
-        (message "Gnuplot context-sensitive help & completion enabled."))
+          (setq-local tab-always-indent 'complete)))
 
     ;; Turn off
     (setq gnuplot-completion-at-point-function 
#'gnuplot-completion-at-point-info-look)
     (setq eldoc-documentation-function nil)
-    (eldoc-mode 0)
-    (message "Gnuplot context-sensitive help & completion disabled.")))
+    (eldoc-mode 0)))
 
 ;; Older completion method using info-look
 (defun gnuplot-completion-at-point-info-look ()
@@ -2098,7 +2075,7 @@ according to the value of `gnuplot-info-display'."
           (list nil (message
                      "Help is not available.  The gnuplot info file could not 
be found.")))))
 
-  (when (and (featurep 'info-look) gnuplot-keywords)
+  (when gnuplot-keywords
     (unless symbol (setq symbol "Commands"))
     (save-window-excursion
       (info-lookup-symbol symbol mode))
@@ -2153,8 +2130,7 @@ shown."
           (setq topic (downcase (match-string 2 string))
                 term            (match-string 4 string))
           (if (string= topic "terminal") (setq topic (downcase term)))))
-    (cond ((and (fboundp 'gnuplot-gui-set-options-and-insert)
-                gnuplot-gui-popup-flag)
+    (cond (gnuplot-gui-popup-flag
            (gnuplot-gui-set-options-and-insert))
           (gnuplot-insertions-show-help-flag
            (if gnuplot-keywords-pending          ; <HW>
@@ -2230,14 +2206,14 @@ a list:
   (use-local-map gnuplot-mode-map)
   (setq major-mode 'gnuplot-mode
         mode-name "Gnuplot")
-  (set (make-local-variable 'comment-start) "# ")
-  (set (make-local-variable 'comment-end) "")
-  (set (make-local-variable 'comment-column) 32)
-  (set (make-local-variable 'comment-start-skip) "#[ \t]*")
-  (set (make-local-variable 'indent-line-function) 'gnuplot-indent-line)
+  (setq-local comment-start "# ")
+  (setq-local comment-end "")
+  (setq-local comment-column 32)
+  (setq-local comment-start-skip "#[ \t]*")
+  (setq-local indent-line-function #'gnuplot-indent-line)
 
-  (set (make-local-variable 'beginning-of-defun-function) 
'gnuplot-beginning-of-defun)
-  (set (make-local-variable 'end-of-defun-function) 
'gnuplot-end-of-continuation)
+  (setq-local beginning-of-defun-function #'gnuplot-beginning-of-defun)
+  (setq-local end-of-defun-function #'gnuplot-end-of-continuation)
 
   (add-hook 'completion-at-point-functions 'gnuplot-completion-at-point nil t)
 
@@ -2247,20 +2223,16 @@ a list:
     (gnuplot-setup-info-look)) ;; <SE>
 
   ;; Add syntax-propertizing functions to search for strings and comments
-  (set (make-local-variable 'syntax-propertize-function)
-       #'gnuplot-syntax-propertize)
+  (setq-local syntax-propertize-function #'gnuplot-syntax-propertize)
   (add-hook 'syntax-propertize-extend-region-functions
             #'gnuplot-syntax-propertize-extend-region nil t)
 
   ;; Set up font-lock
   (setq font-lock-defaults gnuplot-font-lock-defaults)
-  (set (make-local-variable 'font-lock-multiline) t)
-  (set (make-local-variable 'parse-sexp-lookup-properties) t)
+  (setq-local font-lock-multiline t)
+  (setq-local parse-sexp-lookup-properties t)
 
-  (if (fboundp 'widget-create)          ; gnuplot-gui
-      (condition-case ()
-          (require 'gnuplot-gui)
-        (error nil)))
+  (require 'gnuplot-gui)
   (setq gnuplot-first-call nil          ; a few more details ...
         gnuplot-comint-recent-buffer (current-buffer))
   (setq-local comint-process-echoes gnuplot-echo-command-line-flag)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]