branch: elpa/forth-mode
commit 14ee8241f6ad38aa5d83bda8c2c5d68ef874b3d6
Author: Pierre Rouleau <[email protected]>
Commit: Lars Brinkhoff <[email protected]>

    Fix byte and native compiler warnings
    
    * Use lexical-binding in all files
    * Fix docstring markup issues
    * use cl-plusp instead of deprecated plusp
    * prevent warning of undefined pcase replacement (it should be ok since
      with-no-warnings is available since (at least) Emacs 21.
---
 forth-block-mode.el       |  8 ++++++--
 forth-interaction-mode.el |  4 +++-
 forth-mode.el             |  4 ++--
 forth-parse.el            |  2 ++
 forth-smie.el             | 10 ++++++----
 forth-syntax.el           |  7 ++++---
 6 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/forth-block-mode.el b/forth-block-mode.el
index 612163ed26f..de93cf3333c 100644
--- a/forth-block-mode.el
+++ b/forth-block-mode.el
@@ -1,4 +1,8 @@
+;;; forth-block-mode.el --- Block mode for Forth -*-lexical-binding: t-*-
+
 (require 'forth-mode)
+(require 'cl-lib) ; use `cl-plusp'
+
 
 (defvar forth-block-with-newlines)
 
@@ -30,7 +34,7 @@
     (save-excursion
       (forth-beginning)
       (while (forth-pad-line))
-      (while (plusp (logand (point) 1023))
+      (while (cl-plusp (logand (point) 1023))
        (insert " "))
       (insert " "))))
 
@@ -61,7 +65,7 @@
   (setq forth-change-newlines (- (forth-count-newlines start end)
                                 forth-change-newlines))
   (message "New lines: %d" forth-change-newlines)
-  (cond ((plusp forth-change-newlines)
+  (cond ((cl-plusp forth-change-newlines)
         (let ((n (logand (+ (line-number-at-pos) 15) -16)))
           (save-excursion
             (forth-line (1+ n))
diff --git a/forth-interaction-mode.el b/forth-interaction-mode.el
index 4975ad8c971..fa9f0be4a02 100644
--- a/forth-interaction-mode.el
+++ b/forth-interaction-mode.el
@@ -1,3 +1,5 @@
+;;; forth-interaction-mode.el --- Interaction mode Forth -*-lexical-binding: 
t-*-
+
 (eval-when-compile (byte-compile-disable-warning 'cl-functions))
 
 (require 'comint)
@@ -93,7 +95,7 @@
       (add-hook 'comint-preoutput-filter-functions
                'forth-interaction-preoutput-filter nil t)
       (setq forth-interaction-buffer buffer))))
-      
+
 ;;;###autoload
 (defun forth-restart ()
   (interactive)
diff --git a/forth-mode.el b/forth-mode.el
index a211df19376..ef05e025b85 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -1,4 +1,4 @@
-;;; forth-mode.el --- Programming language mode for Forth
+;;; forth-mode.el --- Programming language mode for Forth -*-lexical-binding: 
t-*-
 ;;; Copyright 2014 Lars Brinkhoff
 
 ;; Author: Lars Brinkhoff <[email protected]>
@@ -208,7 +208,7 @@
          ("Variables"
           
"^\\s-*2?\\(variable\\|create\\|value\\)\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 2)
          ("Constants"
-          "\\s-2?constant\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 1))) 
+          "\\s-2?constant\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 1)))
   (forth-mode-init-menu))
 
 ;;;###autoload
diff --git a/forth-parse.el b/forth-parse.el
index c2c0ef4f94f..d4c34a54ef1 100644
--- a/forth-parse.el
+++ b/forth-parse.el
@@ -1,3 +1,5 @@
+;;; forth-parse.el --- Parsing Forth -*-lexical-binding: t-*-
+
 (require 'forth-mode)
 
 (defvar forth-stack-comments (make-hash-table :test 'equal))
diff --git a/forth-smie.el b/forth-smie.el
index 077f387894b..4cf359d384f 100644
--- a/forth-smie.el
+++ b/forth-smie.el
@@ -1,4 +1,5 @@
-;; SMIE based indentation
+;; forth-smie.le --- SMIE based indentation for Forth -*-lexical-binding: t-*-
+
 
 (require 'smie)
 
@@ -14,7 +15,7 @@
 We add this list of BNF rules to the default rules to support
 user defined syntax.  E.g., setting this variable to
 
-  '((gforth-ext (\"?of\" words \"endof\")))
+  \\='((gforth-ext (\"?of\" words \"endof\")))
 
 tells Emacs to recognize ?OF ... ENDOF as a matching pair of tokens.
 
@@ -51,8 +52,9 @@ This variable can also be set in .dir-locals.el, e.g.:
                            forth-smie-bnf-extensions))))
 
 (unless (fboundp 'pcase)
-  (defmacro pcase (form &rest forms)
-    0))
+  (with-no-warnings
+    (defmacro pcase (form &rest forms)
+      0)))
 
 (defun forth-smie--indentation-rules (kind token)
   (pcase (cons kind token)
diff --git a/forth-syntax.el b/forth-syntax.el
index 3f58344aafd..1e64f6aff8b 100644
--- a/forth-syntax.el
+++ b/forth-syntax.el
@@ -19,9 +19,10 @@
     (skip-chars-forward forth-syntax-non-whitespace)
     start))
 
-;; Return the whitespace-delimited word at position POS.
-;; Return nil if POS is at end-of-buffer.
+
 (defun forth-syntax--word-at (pos)
+  "Return the whitespace-delimited word at position POS.
+Return nil if POS is at `end-of-buffer'."
   (save-excursion
     (goto-char pos)
     (let ((start (forth-syntax--skip-word)))
@@ -29,7 +30,7 @@
            (t (buffer-substring-no-properties start (point)))))))
 
 (defmacro forth-syntax--set-syntax (start end syntax)
-  "Set the 'syntax-table property in the region START/END to SYNTAX.
+  "Set the \\='syntax-table property in the region START/END to SYNTAX.
 SYNTAX must be a valid argument for `string-to-syntax'."
   `(put-text-property ,start ,end 'syntax-table ',(string-to-syntax syntax)))
 

Reply via email to