branch: elpa/iedit
commit c47505d11424a8bad85df77adf467c69d316cc39
Author: Pierre Rouleau <prouleau...@gmail.com>
Commit: Victor Ren <victor...@gmail.com>

    Fix warnings detected by Emacs 30.2
    
    * Added lexical-binding and then fixed the warnings detected, listed below.
    
    Compiling: iedit-lib.el
       iedit-lib.el:1:1: Warning: file has no ‘lexical-binding’ directive on its
           first line
       iedit-lib.el:135:9: Warning: defvar ‘iedit-search-invisible’ docstring 
has
           wrong usage of unescaped single quotes (use \=' or different quoting 
such
           as `...')
    
       In iedit-case-pattern:
       iedit-lib.el:1029:2: Warning: docstring has wrong usage of unescaped 
single
           quotes (use \=' or different quoting such as `...')
    
       Compiling: iedit-lib.el
       iedit-lib.el:134:9: Warning: defvar ‘iedit-search-invisible’ docstring 
has
           wrong usage of unescaped single quotes (use \=' or different quoting 
such
           as `...')
    
       In iedit-apply-change:
       iedit-lib.el:620:35: Warning: Unused lexical variable ‘ending’
    
       In iedit-next-occurrence:
       iedit-lib.el:648:20: Warning: Unused lexical variable ‘i’
    
       In iedit-prev-occurrence:
       iedit-lib.el:689:20: Warning: Unused lexical variable ‘i’
    
       In iedit-case-pattern:
       iedit-lib.el:1028:2: Warning: docstring has wrong usage of unescaped 
single
           quotes (use \=' or different quoting such as `...')
    
    Compiling: iedit-rect.el
       iedit-rect.el:1:1: Warning: file has no ‘lexical-binding’ directive on 
its
           first line
    
    Compiling: iedit-tests.el
       iedit-tests.el:1:1: Warning: file has no ‘lexical-binding’ directive on 
its
           first line
       iedit-tests.el:202:18: Warning: ‘point-at-eol’ is an obsolete function 
(as of
           29.1); use ‘line-end-position’ or ‘pos-eol’ instead.
       iedit-tests.el:376:7: Warning: ‘backward-delete-char’ is for interactive 
use
           only; use ‘delete-char’ instead.
       iedit-tests.el:588:7: Warning: ‘backward-delete-char’ is for interactive 
use
           only; use ‘delete-char’ instead.
    
       In with-iedit-test-fixture:
       iedit-tests.el:77:10: Warning: Unused lexical variable
           ‘old-iedit-transient-sensitive’
---
 iedit-lib.el   | 45 ++++++++++++++++++++++-----------------------
 iedit-rect.el  |  4 ++--
 iedit-tests.el | 10 +++++-----
 iedit.el       | 32 ++++++++++++++++----------------
 4 files changed, 45 insertions(+), 46 deletions(-)

diff --git a/iedit-lib.el b/iedit-lib.el
index 8bd30d3124b..956a994ab7b 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -1,9 +1,8 @@
-;;; iedit-lib.el --- APIs for editing multiple regions in the same way
-;;; simultaneously.
+;;; iedit-lib.el --- APIs for editing multiple regions in the same way 
simultaneously. -*-lexical-binding: t-*-
 
 ;; Copyright (C) 2010 - 2022 Victor Ren
 
-;; Time-stamp: <2022-01-14 12:33:36 Victor Ren>
+;; Time-stamp: <2025-09-25 09:22:52 EDT, updated by Pierre Rouleau>
 ;; Author: Victor Ren <victor...@gmail.com>
 ;; Keywords: occurrence region simultaneous rectangle refactoring
 ;; Version: 0.9.9.9.9
@@ -134,7 +133,7 @@ occurrence.")
 
 (defvar iedit-search-invisible search-invisible
   "search-invisible while matching.
-Either nil, t, or 'open.  'open means the same as t except that
+Either nil, t, or \\='open.  \\='open means the same as t except that
 opens hidden overlays. ")
 
 (defvar-local iedit-lib-skip-invisible-count 0
@@ -617,21 +616,21 @@ other occurrences."
                   (when (= 0 offset) (capitalize-region beg end )))))
       (dolist (another-occurrence iedit-occurrences-overlays)
         (when (not (eq another-occurrence occurrence))
-          (let* ((beginning (+ (overlay-start another-occurrence) offset))
-                                (ending (+ beginning (- end beg))))
-                       (when (/= 0 change) (delete-region beginning (+ 
beginning change))) ;; delete
-                       (when (/= beg end) ;; insert
-                         (goto-char beginning)
-                         (insert-and-inherit
-                          ;; preserve the case pattern of each occurrence
-                          (cl-case (overlay-get another-occurrence 'category)
-                            (no-change value)
-                            (all-caps
-                             (upcase value))
-                            (cap-initial
-                             (if (= 0 offset)
-                                  (capitalize value)
-                               value))))))
+          (let ((beginning (+ (overlay-start another-occurrence) offset)))
+           (when (/= 0 change)
+              (delete-region beginning (+ beginning change))) ;; delete
+           (when (/= beg end) ;; insert
+             (goto-char beginning)
+             (insert-and-inherit
+              ;; preserve the case pattern of each occurrence
+              (cl-case (overlay-get another-occurrence 'category)
+                (no-change value)
+                (all-caps
+                 (upcase value))
+                (cap-initial
+                 (if (= 0 offset)
+                      (capitalize value)
+                   value))))))
           (iedit-move-conjoined-overlays another-occurrence))))))
 
 (defun iedit-next-occurrence (&optional arg)
@@ -646,7 +645,7 @@ from last to first occurrence will cost one repetition."
   (interactive "p")
   (cond ((< arg 0) (iedit-prev-occurrence (abs arg)))
         ((> arg 0)
-         (dotimes (i arg)
+         (dotimes (_i arg)
            (let* ((pos (point))
                   (ov (iedit-find-current-occurrence-overlay)))
              (if ov
@@ -687,7 +686,7 @@ from first to last occurrence will cost one repetition."
   (interactive "p")
   (cond ((< arg 0) (iedit-next-occurrence (abs arg)))
         ((> arg 0)
-         (dotimes (i arg)
+         (dotimes (_i arg)
            (let ((pos (point))
                  (ov (iedit-find-current-occurrence-overlay))
                  (previous-overlay))
@@ -1045,14 +1044,14 @@ before calling the last keyboard macro."
        (message "Keyboard macro applied to the occurrences.")))
 
 (defun iedit-case-pattern (beg end)
-  "Distinguish the case pattern of the text between `beg' and `end'.
+  "Distinguish the case pattern of the text between BEG and END.
 
 These case patterns are the same as the ones Emacs replace
 commands can recognized - three alternatives - all caps,
 capitalized, the others.
 
 If the text has only capital letters and has at least one
-multi letter word, it is 'all caps'. If all words are capitalized,
+multi letter word, it is \"all caps\". If all words are capitalized,
 it is capitalized.'"
   (let ((some-word nil)
                (some-lowercase nil)
diff --git a/iedit-rect.el b/iedit-rect.el
index e44d6a96e0a..9d72f2bc8ee 100644
--- a/iedit-rect.el
+++ b/iedit-rect.el
@@ -1,8 +1,8 @@
-;;; iedit-rect.el --- visible rectangle editing support based on Iedit.
+;;; iedit-rect.el --- visible rectangle editing support based on Iedit. 
-*-lexical-binding: t-*-
 
 ;; Copyright (C) 2010 - 2019, 2020 Victor Ren
 
-;; Time-stamp: <2025-09-28 17:11:56 Victor Ren>
+;; Time-stamp: <2025-09-29 18:28:59 Victor Ren>
 ;; Author: Victor Ren <victor...@gmail.com>
 ;; Keywords: occurrence region simultaneous rectangle refactoring
 ;; Version: 0.9.9.9.9
diff --git a/iedit-tests.el b/iedit-tests.el
index f6ce7e01155..d3bad4ed728 100644
--- a/iedit-tests.el
+++ b/iedit-tests.el
@@ -1,8 +1,8 @@
-;;; iedit-tests.el --- iedit's automatic-tests
+;;; iedit-tests.el --- iedit's automatic-tests -*-lexical-binding: t-*-
 
 ;; Copyright (C) 2010 - 2022 Victor Ren
 
-;; Time-stamp: <2025-09-29 19:45:30 Victor Ren>
+;; Time-stamp: <2025-09-29 19:45:49 Victor Ren>
 ;; Author: Victor Ren <victor...@gmail.com>
 ;; Version: 0.9.9.9.9
 ;; X-URL: https://github.com/victorhge/iedit
@@ -204,7 +204,7 @@ foo"
    (lambda ()
      (iedit-mode)
      (goto-char (point-min))
-     (goto-char (point-at-eol))
+     (goto-char (line-end-position))
      (iedit-mode)
      (delete-region (point) (1- (point)))
         (run-hooks 'post-command-hook)
@@ -378,7 +378,7 @@ foo
   1foo
    barfoo
    1foo"))
-     (backward-delete-char 1)
+     (delete-char 1)
         (run-hooks 'post-command-hook)
      (should (string= (buffer-string)
 "foo
@@ -597,7 +597,7 @@ foo
     barfoo"))
      (should (= (point) 4))
      (iedit-toggle-buffering)
-     (backward-delete-char 3)
+     (delete-char 3)
      (should (string= (buffer-string)
 "foo
  barfoo
diff --git a/iedit.el b/iedit.el
index e279eff474c..4177e0e7735 100755
--- a/iedit.el
+++ b/iedit.el
@@ -1,8 +1,8 @@
-;;; iedit.el --- Edit multiple regions in the same way simultaneously.
+;;; iedit.el --- Edit multiple regions in the same way simultaneously. 
-*-lexical-binding: t-*-
 
 ;; Copyright (C) 2010 - 2019, 2020, 2021 Victor Ren
 
-;; Time-stamp: <2025-09-28 17:11:25 Victor Ren>
+;; Time-stamp: <2025-09-29 18:31:32 Victor Ren>
 ;; Author: Victor Ren <victor...@gmail.com>
 ;; Keywords: occurrence region simultaneous refactoring
 ;; Version: 0.9.9.9.9
@@ -105,9 +105,9 @@
 (require 'iedit-lib)
 
 (defcustom iedit-toggle-key-default (kbd "C-;")
-  "If no-nil, the key is inserted into global-map,
+  "If non-nil, the key is inserted into global-map,
 isearch-mode-map, esc-map and help-map."
-  :type 'vector
+  :type 'string
   :group 'iedit)
 
 (defvar iedit-mode-hook nil
@@ -177,22 +177,22 @@ point should be included in the replacement region.")
 It is called in `iedit-default-occurrence'.  This buffer local
 variable can be configured in some modes.  An example of how to
 use this variable:
-(add-hook 'perl-mode-hook
-          '(lambda ()
+(add-hook \\='perl-mode-hook
+          \\='(lambda ()
              (setq iedit-default-occurrence-local
-                   '(lambda ()
-                      (let* ((bound (bounds-of-thing-at-point 'symbol))
+                   \\='(lambda ()
+                      (let* ((bound (bounds-of-thing-at-point \\='symbol))
                              (prefix-char (char-after (1- (car bound)))))
-                        (if (memq prefix-char '(?$ ?% ?@ ?*))
+                        (if (memq prefix-char \\='(?$ ?% ?@ ?*))
                             (progn
-                              (setq iedit-occurrence-type-local 'regexp)
+                              (setq iedit-occurrence-type-local \\='regexp)
                               (concat (regexp-quote
                                        (buffer-substring-no-properties
                                         (1- (car bound)) (cdr bound)))
                                        \"\\\\_>\"))
                           (buffer-substring-no-properties (car bound)
                                                           (cdr bound))))))))
-'$%@*' will be included in the occurrences in perl mode.")
+\\='$%@*\\=' will be included in the occurrences in perl mode.")
 
 (defcustom iedit-mode-line
   `(" Iedit:" (:eval (format ,(propertize "%d/%d" 'face 
'font-lock-warning-face)
@@ -534,9 +534,9 @@ The candidate depends on the thing at point."
 (defun iedit-regexp-quote (exp)
   "Return a regexp string."
   (cl-case iedit-occurrence-type-local
-    ('symbol (concat "\\_<" (regexp-quote exp) "\\_>"))
-    ('word   (concat "\\<" (regexp-quote exp) "\\>"))
-    ('regexp exp)
+    (symbol (concat "\\_<" (regexp-quote exp) "\\_>"))
+    (word   (concat "\\<" (regexp-quote exp) "\\>"))
+    (regexp exp)
     ( t      (regexp-quote exp))))
 
 (defun iedit-mark-sgml-pair ()
@@ -549,7 +549,7 @@ The code is adapted from
 `sgml-electric-tag-pair-before-change-function'.
 
 Return the tag if succeeded, nil if failed."
-  (condition-case err
+  (condition-case nil
   (save-excursion
     (skip-chars-backward "[:alnum:]-_.:")
     (if  (or (eq (char-before) ?<)
@@ -621,7 +621,7 @@ the initial string globally."
        (iedit-mode 0)))
 
 ;;;###autoload
-(defun iedit-execute-last-modification (&optional arg)
+(defun iedit-execute-last-modification ()
   "Apply last modification in Iedit mode to the current buffer or an active 
region."
   (interactive "*P")
   (or (and iedit-last-initial-string-global

Reply via email to