emacs-diffs
[Top][All Lists]
Advanced

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

master f254c8b: Prefer setq-local in mail/*.el


From: Stefan Kangas
Subject: master f254c8b: Prefer setq-local in mail/*.el
Date: Sat, 5 Dec 2020 04:54:28 -0500 (EST)

branch: master
commit f254c8b5f3df13bdee246fd9217870fa74dceea6
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Prefer setq-local in mail/*.el
    
    * lisp/mail/emacsbug.el (report-emacs-bug):
    * lisp/mail/rfc822.el (rfc822-addresses):
    * lisp/mail/rmail.el (rmail-perm-variables, rmail-show-message-1):
    * lisp/mail/rmailedit.el (rmail-edit-mode):
    (rmail-edit-current-message, rmail-cease-edit):
    * lisp/mail/rmailsum.el (rmail-new-summary-1, rmail-summary-mode):
    (rmail-summary-update-highlight):
    * lisp/mail/sendmail.el (mail-mode): Prefer setq-local.
---
 lisp/mail/emacsbug.el  |  9 ++++----
 lisp/mail/rfc822.el    |  3 +--
 lisp/mail/rmail.el     | 57 +++++++++++++++++++-------------------------------
 lisp/mail/rmailedit.el | 22 ++++++++-----------
 lisp/mail/rmailsum.el  | 15 +++++--------
 lisp/mail/sendmail.el  | 26 ++++++++++-------------
 6 files changed, 52 insertions(+), 80 deletions(-)

diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index d524b26..5ad1b98 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -241,12 +241,12 @@ Already submitted bugs can be found in the Emacs bug 
tracker:
       ;; that report-emacs-bug-orig-text remains valid.  (Bug#5178)
       (message-sort-headers)
       ;; Stop message-mode stealing the properties we will add.
-      (set (make-local-variable 'message-strip-special-text-properties) nil)
+      (setq-local message-strip-special-text-properties nil)
       ;; Make sure we default to the From: address as envelope when sending
       ;; through sendmail.  FIXME: Why?
       (when (and (not (message--sendmail-envelope-from))
                 (message-bogus-recipient-p (message-make-address)))
-       (set (make-local-variable 'message-sendmail-envelope-from) 'header)))
+        (setq-local message-sendmail-envelope-from 'header)))
     (rfc822-goto-eoh)
     (forward-line 1)
     ;; Move the mail signature to the proper place.
@@ -381,9 +381,8 @@ usually do not have translators for other languages.\n\n")))
         (add-hook report-emacs-bug-send-hook 'report-emacs-bug-hook nil t))
     (goto-char (point-max))
     (skip-chars-backward " \t\n")
-    (make-local-variable 'report-emacs-bug-orig-text)
-    (setq report-emacs-bug-orig-text
-          (buffer-substring-no-properties (point-min) (point)))
+    (setq-local report-emacs-bug-orig-text
+                (buffer-substring-no-properties (point-min) (point)))
     (goto-char user-point)))
 
 (defun emacs-bug--system-description ()
diff --git a/lisp/mail/rfc822.el b/lisp/mail/rfc822.el
index 4572f27..70480d4 100644
--- a/lisp/mail/rfc822.el
+++ b/lisp/mail/rfc822.el
@@ -279,8 +279,7 @@
     (let ((buf (generate-new-buffer " rfc822")))
       (unwind-protect
           (with-current-buffer buf
-            (make-local-variable 'case-fold-search)
-            (setq case-fold-search nil)        ;For speed(?)
+            (setq-local case-fold-search nil)  ;For speed(?)
             (insert header-text)
             ;; unfold continuation lines
             (goto-char (point-min))
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 2c972ee..63d992d 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1431,27 +1431,23 @@ If so restore the actual mbox message collection."
 (defun rmail-perm-variables ()
   (make-local-variable 'rmail-last-regexp)
   (make-local-variable 'rmail-deleted-vector)
-  (make-local-variable 'rmail-buffer)
-  (make-local-variable 'rmail-was-converted)
-  (setq rmail-was-converted nil)
-  (make-local-variable 'rmail-seriously-modified)
-  (setq rmail-seriously-modified nil)
-  (setq rmail-buffer (current-buffer))
+  (setq-local rmail-was-converted nil)
+  (setq-local rmail-seriously-modified nil)
+  (setq-local rmail-buffer (current-buffer))
   (set-buffer-multibyte nil)
   (with-current-buffer (setq rmail-view-buffer (rmail-generate-viewer-buffer))
     (setq buffer-undo-list t)
     ;; Note that this does not erase the buffer.  Should it?
     ;; It depends on how this is called.  If somehow called with the
     ;; rmail buffers swapped, it would erase the message collection.
-    (set (make-local-variable 'rmail-overlay-list) nil)
+    (setq-local rmail-overlay-list nil)
     (set-buffer-multibyte t)
     ;; Force C-x C-s write Unix EOLs.
     (set-buffer-file-coding-system 'undecided-unix))
   (make-local-variable 'rmail-summary-buffer)
   (make-local-variable 'rmail-summary-vector)
   (make-local-variable 'rmail-current-message)
-  (make-local-variable 'rmail-total-messages)
-  (setq rmail-total-messages 0)
+  (setq-local rmail-total-messages 0)
   (make-local-variable 'rmail-message-vector)
   (make-local-variable 'rmail-msgref-vector)
   (make-local-variable 'rmail-inbox-list)
@@ -1466,39 +1462,30 @@ If so restore the actual mbox message collection."
                           ;; FIXME expand-file-name?
                           (concat rmail-spool-directory
                                   (user-login-name)))))))
-  (set (make-local-variable 'tool-bar-map) rmail-tool-bar-map))
+  (setq-local tool-bar-map rmail-tool-bar-map))
 
 ;; Set up the non-permanent locals associated with Rmail mode.
 (defun rmail-variables ()
   ;; Turn off undo.  We turn it back on in rmail-edit.
   (setq buffer-undo-list t)
   ;; Don't let a local variables list in a message cause confusion.
-  (make-local-variable 'local-enable-local-variables)
-  (setq local-enable-local-variables nil)
+  (setq-local local-enable-local-variables nil)
   ;; Don't turn off auto-saving based on the size of the buffer
   ;; because that code does not understand buffer-swapping.
-  (make-local-variable 'auto-save-include-big-deletions)
-  (setq auto-save-include-big-deletions t)
-  (make-local-variable 'revert-buffer-function)
-  (setq revert-buffer-function 'rmail-revert)
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults
-       '(rmail-font-lock-keywords
-         t t nil nil
-         (font-lock-maximum-size . nil)
-          (font-lock-dont-widen . t)
-         (font-lock-inhibit-thing-lock . (lazy-lock-mode fast-lock-mode))))
-  (make-local-variable 'require-final-newline)
-  (setq require-final-newline nil)
-  (make-local-variable 'version-control)
-  (setq version-control 'never)
+  (setq-local auto-save-include-big-deletions t)
+  (setq-local revert-buffer-function 'rmail-revert)
+  (setq-local font-lock-defaults
+              '(rmail-font-lock-keywords
+                t t nil nil
+                (font-lock-maximum-size . nil)
+                (font-lock-dont-widen . t)
+                (font-lock-inhibit-thing-lock . (lazy-lock-mode 
fast-lock-mode))))
+  (setq-local require-final-newline nil)
+  (setq-local version-control 'never)
   (add-hook 'kill-buffer-hook #'rmail-mode-kill-summary nil t)
-  (make-local-variable 'file-precious-flag)
-  (setq file-precious-flag t)
-  (make-local-variable 'desktop-save-buffer)
-  (setq desktop-save-buffer t)
-  (make-local-variable 'save-buffer-coding-system)
-  (setq save-buffer-coding-system 'no-conversion)
+  (setq-local file-precious-flag t)
+  (setq-local desktop-save-buffer t)
+  (setq-local save-buffer-coding-system 'no-conversion)
   (setq next-error-move-function 'rmail-next-error-move))
 
 ;; Handle M-x revert-buffer done in an rmail-mode buffer.
@@ -2787,7 +2774,7 @@ The current mail message becomes the message displayed."
          ;; rmail-header-style based on the binding in effect when
           ;; this function is called; `rmail-toggle-header' can
          ;; inspect this value to determine how to toggle.
-         (set (make-local-variable 'rmail-header-style) header-style)
+          (setq-local rmail-header-style header-style)
           ;; In case viewing the previous message sets the paragraph
           ;; direction non-nil, we reset it here to allow independent
           ;; dynamic determination of paragraph direction in every
@@ -2798,7 +2785,7 @@ The current mail message becomes the message displayed."
                 (re-search-forward "mime-version: 1.0" nil t))
            (let ((rmail-buffer mbox-buf)
                  (rmail-view-buffer view-buf))
-             (set (make-local-variable 'rmail-mime-decoded) t)
+              (setq-local rmail-mime-decoded t)
              (funcall rmail-show-mime-function))
          (setq body-start (search-forward "\n\n" nil t))
          (narrow-to-region beg (point))
diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el
index 3026283..72a5603 100644
--- a/lisp/mail/rmailedit.el
+++ b/lisp/mail/rmailedit.el
@@ -66,8 +66,7 @@ This function runs the hooks `text-mode-hook' and 
`rmail-edit-mode-hook'.
     (setq mode-line-modified (default-value 'mode-line-modified))
     ;; Don't turn off auto-saving based on the size of the buffer
     ;; because that code does not understand buffer-swapping.
-    (make-local-variable 'auto-save-include-big-deletions)
-    (setq auto-save-include-big-deletions t)
+    (setq-local auto-save-include-big-deletions t)
     ;; If someone uses C-x C-s, don't clobber the rmail file (bug#2625).
     (add-hook 'write-region-annotate-functions
              'rmail-write-region-annotate nil t)
@@ -98,10 +97,9 @@ This function runs the hooks `text-mode-hook' and 
`rmail-edit-mode-hook'.
   (if (zerop rmail-total-messages)
       (error "No messages in this buffer"))
   (rmail-modify-format)
-  (make-local-variable 'rmail-old-pruned)
-  (setq rmail-old-pruned (rmail-msg-is-pruned))
+  (setq-local rmail-old-pruned (rmail-msg-is-pruned))
   (rmail-edit-mode)
-  (set (make-local-variable 'rmail-old-mime-state)
+  (setq-local rmail-old-mime-state
        (and rmail-enable-mime
            ;; If you use something else, you are on your own.
            (eq rmail-mime-feature 'rmailmm)
@@ -125,13 +123,11 @@ This function runs the hooks `text-mode-hook' and 
`rmail-edit-mode-hook'.
                (goto-char (point-min))
                ;; t = decoded; raw = raw.
                (aref (aref (rmail-mime-entity-display entity) 0) 0)))))
-  (make-local-variable 'rmail-old-text)
-  (setq rmail-old-text
-       (save-restriction
-         (widen)
-         (buffer-substring (point-min) (point-max))))
-  (make-local-variable 'rmail-old-headers)
-  (setq rmail-old-headers (rmail-edit-headers-alist t))
+  (setq-local rmail-old-text
+              (save-restriction
+                (widen)
+                (buffer-substring (point-min) (point-max))))
+  (setq-local rmail-old-headers (rmail-edit-headers-alist t))
   (setq buffer-read-only nil)
   (setq buffer-undo-list nil)
   ;; Whether the buffer is initially marked as modified or not
@@ -209,7 +205,7 @@ This function runs the hooks `text-mode-hook' and 
`rmail-edit-mode-hook'.
       (kill-all-local-variables)
       (rmail-mode-1)
       (if (boundp 'tool-bar-map)
-         (set (make-local-variable 'tool-bar-map) rmail-tool-bar-map))
+          (setq-local tool-bar-map rmail-tool-bar-map))
       (setq buffer-undo-list t)
       (rmail-variables))
     ;; If text has really changed, mark message as edited.
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 521659b..a085e0b 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -532,8 +532,7 @@ message."
        ;; Set up the rest of its state and local variables.
        (setq buffer-read-only t)
        (rmail-summary-mode)
-       (make-local-variable 'minor-mode-alist)
-       (setq minor-mode-alist (list (list t (concat ": " description))))
+        (setq-local minor-mode-alist (list (list t (concat ": " description))))
        (setq rmail-buffer rbuf
              rmail-summary-redo redo
              rmail-total-messages total)))
@@ -1089,13 +1088,10 @@ Commands for sorting the summary:
   (set-syntax-table text-mode-syntax-table)
   (make-local-variable 'rmail-buffer)
   (make-local-variable 'rmail-total-messages)
-  (make-local-variable 'rmail-current-message)
-  (setq rmail-current-message nil)
-  (make-local-variable 'rmail-summary-redo)
-  (setq rmail-summary-redo nil)
+  (setq-local rmail-current-message nil)
+  (setq-local rmail-summary-redo nil)
   (make-local-variable 'revert-buffer-function)
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(rmail-summary-font-lock-keywords t))
+  (setq-local font-lock-defaults '(rmail-summary-font-lock-keywords t))
   (rmail-summary-enable))
 
 ;; Summary features need to be disabled during edit mode.
@@ -1288,8 +1284,7 @@ Returns non-nil if message N was found."
   ;; Make sure we have an overlay to use.
   (or rmail-summary-overlay
       (progn
-       (make-local-variable 'rmail-summary-overlay)
-       (setq rmail-summary-overlay (make-overlay (point) (point)))
+        (setq-local rmail-summary-overlay (make-overlay (point) (point)))
        (overlay-put rmail-summary-overlay 'rmail-summary t)))
   ;; If this message is in the summary, use the overlay to highlight it.
   ;; Otherwise, don't highlight anything.
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 7610939..02a852f 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -691,29 +691,25 @@ Turning on Mail mode runs the normal hooks 
`text-mode-hook' and
   (make-local-variable 'mail-reply-action)
   (make-local-variable 'mail-send-actions)
   (make-local-variable 'mail-return-action)
-  (make-local-variable 'mail-encode-mml)
-  (setq mail-encode-mml nil)
+  (setq-local mail-encode-mml nil)
   (setq buffer-offer-save t)
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(mail-font-lock-keywords t t))
+  (setq-local font-lock-defaults '(mail-font-lock-keywords t t))
   (make-local-variable 'paragraph-separate)
   (setq-local normal-auto-fill-function #'mail-mode-auto-fill)
   (setq-local fill-paragraph-function #'mail-mode-fill-paragraph)
   ;; Allow using comment commands to add/remove quoting (this only does
   ;; anything if mail-yank-prefix is set to a non-nil value).
-  (set (make-local-variable 'comment-start) mail-yank-prefix)
+  (setq-local comment-start mail-yank-prefix)
   (if mail-yank-prefix
-      (set (make-local-variable 'comment-start-skip)
-          (concat "^" (regexp-quote mail-yank-prefix) "[ \t]*")))
-  (make-local-variable 'adaptive-fill-regexp)
+      (setq-local comment-start-skip
+                  (concat "^" (regexp-quote mail-yank-prefix) "[ \t]*")))
   ;; Also update the paragraph-separate entry if you change this.
-  (setq adaptive-fill-regexp
-       (concat "[ \t]*[-[:alnum:]]+>+[ \t]*\\|"
-               adaptive-fill-regexp))
-  (make-local-variable 'adaptive-fill-first-line-regexp)
-  (setq adaptive-fill-first-line-regexp
-       (concat "[ \t]*[-[:alnum:]]*>+[ \t]*\\|"
-               adaptive-fill-first-line-regexp))
+  (setq-local adaptive-fill-regexp
+              (concat "[ \t]*[-[:alnum:]]+>+[ \t]*\\|"
+                      adaptive-fill-regexp))
+  (setq-local adaptive-fill-first-line-regexp
+              (concat "[ \t]*[-[:alnum:]]*>+[ \t]*\\|"
+                      adaptive-fill-first-line-regexp))
   (add-hook 'completion-at-point-functions #'mail-completion-at-point-function
             nil 'local)
   ;; `-- ' precedes the signature.  `-----' appears at the start of the



reply via email to

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