[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 3fb4762f84 4/8: Prefer defvar-local.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 3fb4762f84 4/8: Prefer defvar-local. |
Date: |
Thu, 17 Feb 2022 04:58:34 -0500 (EST) |
branch: elpa/iedit
commit 3fb4762f844baae1db9c19c6c5506558bfaae323
Author: Jimmy Aguilar Mena <kratsbinovish@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Prefer defvar-local.
Prefer defvar-local over defvar + make-variable-buffer-local.
Also use :local t in defcustom.
---
iedit-lib.el | 72 ++++++++++++++++++++---------------------------------------
iedit-rect.el | 7 ++----
iedit.el | 28 +++++++++--------------
3 files changed, 36 insertions(+), 71 deletions(-)
diff --git a/iedit-lib.el b/iedit-lib.el
index eef9a0a39a..08862076aa 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -94,6 +94,7 @@ mode, set it as nil."
"If no-nil, iedit-mode automatically starts buffering the changes.
This could be a workaround for lag problem under certain modes."
:type 'boolean
+ :local t
:group 'iedit)
(defcustom iedit-overlay-priority 200
@@ -114,19 +115,19 @@ This is used by `iedit-number-occurrences'."
:type 'string
:group 'iedit)
-(defvar iedit-occurrences-overlays nil
+(defvar-local iedit-occurrences-overlays nil
"The occurrences slot contains a list of overlays used to
indicate the position of each editable occurrence. In addition, the
occurrence overlay is used to provide a different face
configurable via `iedit-occurrence'.")
-(defvar iedit-read-only-occurrences-overlays nil
+(defvar-local iedit-read-only-occurrences-overlays nil
"The occurrences slot contains a list of overlays used to
indicate the position of each read-only occurrence. In addition, the
occurrence overlay is used to provide a different face
configurable via `iedit-ready-only-occurrence'.")
-(defvar iedit-case-sensitive iedit-case-sensitive-default
+(defvar-local iedit-case-sensitive iedit-case-sensitive-default
"This is buffer local variable.
If no-nil, matching is case sensitive. If nil and `case-replace'
is no-nil, iedit try to preserve the case pattern of each
@@ -137,108 +138,83 @@ occurrence.")
Either nil, t, or 'open. 'open means the same as t except that
opens hidden overlays. ")
-(defvar iedit-lib-skip-invisible-count 0
+(defvar-local iedit-lib-skip-invisible-count 0
"This is buffer local variable which is the number of skipped invisible
occurrence. ")
-(defvar iedit-lib-skip-filtered-count 0
+(defvar-local iedit-lib-skip-filtered-count 0
"This is buffer local variable which is the number of filtered occurrence. ")
-(defvar iedit-hiding nil
+(defvar-local iedit-hiding nil
"This is buffer local variable which indicates whether buffer lines are
hided. ")
-(defvar iedit-forward-success t
+(defvar-local iedit-forward-success t
"This is buffer local variable which indicates the moving
forward or backward successful")
-(defvar iedit-before-modification-string ""
+(defvar-local iedit-before-modification-string ""
"This is buffer local variable which is the buffer substring
that is going to be changed.")
-(defvar iedit-before-buffering-string ""
+(defvar-local iedit-before-buffering-string ""
"This is buffer local variable which is the buffer substring
that is going to be changed.")
-(defvar iedit-before-buffering-undo-list nil
+(defvar-local iedit-before-buffering-undo-list nil
"This is buffer local variable which is the buffer undo list before
modification.")
-(defvar iedit-before-buffering-point nil
+(defvar-local iedit-before-buffering-point nil
"This is buffer local variable which is the point before modification.")
-(defvar iedit-buffering-overlay nil
+(defvar-local iedit-buffering-overlay nil
"This is buffer local variable which is the current overlay before starting
recording kmacro.")
-(defvar iedit-start-kmacro-offset nil
+(defvar-local iedit-start-kmacro-offset nil
"This is buffer local variable which is the offset from the
current overlay start before starting recording kmacro.")
;; `iedit-record-changes' gets called twice when change==0 and
;; occurrence is zero-width (beg==end) -- for front and back insertion.
-(defvar iedit-skip-modification-once t
+(defvar-local iedit-skip-modification-once t
"Variable used to skip first modification hook run when
insertion against a zero-width occurrence.")
-(defvar iedit-aborting nil
+(defvar-local iedit-aborting nil
"This is buffer local variable which indicates Iedit mode is aborting.")
-(defvar iedit-lib-quit-func nil
+(defvar-local iedit-lib-quit-func nil
"Function to call to exit mode using `iedit-lib'.
Should be set in `iedit-lib-start'.")
-(defvar iedit-post-undo-hook-installed nil
+(defvar-local iedit-post-undo-hook-installed nil
"This is buffer local variable which indicated if
`iedit-post-undo' is installed in `post-command-hook'.")
-(defvar iedit-buffering nil
+(defvar-local iedit-buffering nil
"This is buffer local variable which indicates iedit-mode is
buffering, which means the modification to the current occurrence
is not applied to other occurrences when it is true.")
-(defvar iedit-occurrence-context-lines 1
+(defvar-local iedit-occurrence-context-lines 1
"The number of lines before or after the occurrence.")
-(defvar iedit-occurrence-index 0
+(defvar-local iedit-occurrence-index 0
"The index of the current occurrence, counted from the beginning of the
buffer.
Used in mode-line to indicate the position of the current
occurrence.")
-(defvar iedit-after-change-list nil
+(defvar-local iedit-after-change-list nil
"Used to store the modifications in the command being run.")
-(defvar iedit-updating nil
+(defvar-local iedit-updating nil
"Used to prevent recursive calling change hooks.
It replaces `inhibit-modification-hooks' which prevents calling
`after-change-functions'.")
-(defvar iedit-line-move-ignore-invisible-value nil
+(defvar-local iedit-line-move-ignore-invisible-value nil
"Used to save and restore the value of `line-move-ignore-invisible'.")
-(make-variable-buffer-local 'iedit-updating)
-(make-variable-buffer-local 'iedit-after-change-list)
-(make-variable-buffer-local 'iedit-occurrences-overlays)
-(make-variable-buffer-local 'iedit-read-only-occurrences-overlays)
-(make-variable-buffer-local 'iedit-hiding)
-(make-variable-buffer-local 'iedit-case-sensitive)
-(make-variable-buffer-local 'iedit-forward-success)
-(make-variable-buffer-local 'iedit-before-modification-string)
-(make-variable-buffer-local 'iedit-before-buffering-string)
-(make-variable-buffer-local 'iedit-before-buffering-undo-list)
-(make-variable-buffer-local 'iedit-before-buffering-point)
-(make-variable-buffer-local 'iedit-buffering-overlay)
-(make-variable-buffer-local 'iedit-start-kmacro-offset)
-(make-variable-buffer-local 'iedit-skip-modification-once)
-(make-variable-buffer-local 'iedit-aborting)
-(make-variable-buffer-local 'iedit-buffering)
-(make-variable-buffer-local 'iedit-auto-buffering)
-(make-variable-buffer-local 'iedit-post-undo-hook-installed)
-(make-variable-buffer-local 'iedit-occurrence-context-lines)
-(make-variable-buffer-local 'iedit-occurrence-index)
-(make-variable-buffer-local 'iedit-lib-quit-func)
-(make-variable-buffer-local 'iedit-lib-skip-invisible-count)
-(make-variable-buffer-local 'iedit-lib-skip-filtered-count)
-(make-variable-buffer-local 'iedit-line-move-ignore-invisible-value)
-
(defconst iedit-occurrence-overlay-name 'iedit-occurrence-overlay-name)
(defconst iedit-invisible-overlay-name 'iedit-invisible-overlay-name)
diff --git a/iedit-rect.el b/iedit-rect.el
index c6952ba73a..a610a6c7fd 100644
--- a/iedit-rect.el
+++ b/iedit-rect.el
@@ -45,9 +45,8 @@
(require 'rect) ;; kill-rectangle
(require 'iedit-lib)
-(defvar iedit-rectangle-mode nil) ;; Name of the minor mode
+(defvar-local iedit-rectangle-mode nil) ;; Name of the minor mode
-(make-variable-buffer-local 'iedit-rectangle-mode)
(or (assq 'iedit-rectangle-mode minor-mode-alist)
(nconc minor-mode-alist
(list '(iedit-rectangle-mode iedit-rectangle-mode))))
@@ -66,14 +65,12 @@
(define-key rectangle-mark-mode-map ";" 'iedit-rectangle-mode)
(message "Iedit-rect default key binding is %s" (key-description [C-x r
\;])))))
-(defvar iedit-rectangle nil
+(defvar-local iedit-rectangle nil
"This buffer local variable which is the rectangle geometry if
current mode is iedit-rect. Otherwise it is nil.
\(car iedit-rectangle) is the top-left corner and
\(cadr iedit-rectangle) is the bottom-right corner" )
-(make-variable-buffer-local 'iedit-rectangle)
-
;;; Define Iedit rect mode map
(defvar iedit-rect-keymap
(let ((map (make-sparse-keymap)))
diff --git a/iedit.el b/iedit.el
index 8fceb86e18..0f34db1f9c 100755
--- a/iedit.el
+++ b/iedit.el
@@ -116,7 +116,7 @@ isearch-mode-map, esc-map and help-map."
(defvar iedit-mode-end-hook nil
"Function(s) to call after terminating an iedit.")
-(defvar iedit-mode nil) ;; Name of the minor mode
+(defvar-local iedit-mode nil) ;; Name of the minor mode
(defcustom iedit-auto-narrow nil
"If no-nil, the buffer is narrowed temporarily if iedit-mode
@@ -130,15 +130,15 @@ from iedit mode."
:type 'boolean
:group 'iedit)
-(defvar iedit-is-narrowed nil
+(defvar iedit-is-narrowed-local nil
"This is buffer local variable which indicates if the buffer is
narrowed by iedit temporarily.")
-(defvar iedit-use-symbol-boundaries t
+(defvar-local iedit-use-symbol-boundaries t
"If no-nil, matches have to start and end at symbol boundaries. Otherwise,
matches starts and end at word boundaries.")
-(defvar iedit-occurrence-type-local 'symbol
+(defvar-local iedit-occurrence-type-local 'symbol
"This is buffer local variable which indicates the occurrence
type. It might be (symbol word email url markup-tag regexp selection other).")
@@ -146,7 +146,7 @@ type. It might be (symbol word email url markup-tag regexp
selection other).")
"This is global variable which indicates the last global occurrence
type. It might be (symbol word email url markup-tag regexp selection other).")
-(defvar iedit-last-occurrence-local nil
+(defvar-local iedit-last-occurrence-local nil
"This is buffer local variable which is the occurrence when
Iedit mode is turned off last time.")
@@ -157,9 +157,10 @@ Iedit mode is turned off last time.")
(defvar iedit-last-initial-string-global nil
"This is a global variable which is the last initial occurrence string.")
-(defvar iedit-initial-string-local nil
+(defvar-local iedit-initial-string-local nil
"This is buffer local variable which is the initial string to start Iedit
mode.")
-(defvar iedit-initial-region nil
+
+(defvar-local iedit-initial-region nil
"This is buffer local variable which is the initial region
where Iedit mode is started from.")
@@ -171,7 +172,7 @@ point should be included in the replacement region.")
"This is a global variable indicating how many lines down from
point should be included in the replacement region.")
-(defvar iedit-default-occurrence-local nil
+(defvar-local iedit-default-occurrence-local nil
"This is a function which returns a string as occurrence candidate.
It is called in `iedit-default-occurrence'. This buffer local
variable can be configured in some modes. An example of how to
@@ -199,17 +200,8 @@ use this variable:
"Mode-line format for Iedit.
This should be set before Iedit is loaded."
:type 'string
+ :risky t
:group 'iedit)
-(put 'iedit-mode-line 'risky-local-variable t)
-
-(make-variable-buffer-local 'iedit-mode)
-(make-variable-buffer-local 'iedit-use-symbol-boundaries)
-(make-variable-buffer-local 'iedit-occurrence-type-local)
-(make-variable-buffer-local 'iedit-last-occurrence-local)
-(make-variable-buffer-local 'iedit-initial-string-local)
-(make-variable-buffer-local 'iedit-initial-region)
-(make-variable-buffer-local 'iedit-default-occurrence-local)
-(make-variable-buffer-local 'iedit-is-narrowed)
(or (assq 'iedit-mode minor-mode-alist)
(nconc minor-mode-alist
- [nongnu] elpa/iedit updated (d62dc47575 -> 27c61866b1), ELPA Syncer, 2022/02/17
- [nongnu] elpa/iedit 48ab9e4be2 2/8: Add missing ;;;###autoload, ELPA Syncer, 2022/02/17
- [nongnu] elpa/iedit b13f05b9f1 1/8: New feature: switch from rectangle-mark-mode to iedit-rect mode, ELPA Syncer, 2022/02/17
- [nongnu] elpa/iedit 699e179dac 3/8: New version 0.9.9.9.9, ELPA Syncer, 2022/02/17
- [nongnu] elpa/iedit 3fb4762f84 4/8: Prefer defvar-local.,
ELPA Syncer <=
- [nongnu] elpa/iedit 44968bea9b 5/8: Fixed a typo, ELPA Syncer, 2022/02/17
- [nongnu] elpa/iedit dd5d75b38e 6/8: remove :local introduced in the previous commit, ELPA Syncer, 2022/02/17
- [nongnu] elpa/iedit 27c61866b1 8/8: Merge commit 'd62dc47575', ELPA Syncer, 2022/02/17
- [nongnu] elpa/iedit 2fff88fe5d 7/8: Fix a failed test case, ELPA Syncer, 2022/02/17