emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master ebbdc6c: * lisp/textmodes/flyspell.el: Use lexical-


From: Stefan Monnier
Subject: [Emacs-diffs] master ebbdc6c: * lisp/textmodes/flyspell.el: Use lexical-binding and cl-lib.
Date: Wed, 04 Feb 2015 19:43:52 +0000

branch: master
commit ebbdc6c30dc883ffb9ddb53c0263ef325d251903
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/textmodes/flyspell.el: Use lexical-binding and cl-lib.
    
    (mail-mode-flyspell-verify): Fix last change.
    (flyspell-external-point-words, flyspell-large-region):
    Avoid add-to-list on local vars.
---
 lisp/ChangeLog             |   11 ++++++++-
 lisp/textmodes/flyspell.el |   45 +++++++++++++++++++++++--------------------
 2 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 432ca69..a76d83a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-04  Stefan Monnier  <address@hidden>
+
+       * textmodes/flyspell.el: Use lexical-binding and cl-lib.
+       (mail-mode-flyspell-verify): Fix last change.
+       (flyspell-external-point-words, flyspell-large-region):
+       Avoid add-to-list on local vars.
+
 2015-02-04  Tassilo Horn  <address@hidden>
 
        * emacs-lisp/package.el (package-installed-p): Fix typo causing
@@ -57,8 +64,8 @@
 
 2015-02-02  Artur Malabarba  <address@hidden>
 
-       * emacs-lisp/package.el (package--find-non-dependencies): New
-       function.
+       * emacs-lisp/package.el (package--find-non-dependencies):
+       New function.
        (package-initialize): Use it to populate `package-selected-packages'.
        (package-menu-execute): Clean unnecessary `and'.
        (package--get-deps): Fix returning duplicates.
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 66243b4..91a43f0 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1,4 +1,4 @@
-;;; flyspell.el --- on-the-fly spell checker
+;;; flyspell.el --- On-the-fly spell checker  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 1998, 2000-2015 Free Software Foundation, Inc.
 
@@ -39,6 +39,7 @@
 ;;; Code:
 
 (require 'ispell)
+(eval-when-compile (require 'cl-lib))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    Group ...                                                        */
@@ -312,21 +313,22 @@ property of the major mode name.")
 (defvar message-signature-separator)
 (defun mail-mode-flyspell-verify ()
   "Function used for `flyspell-generic-check-word-predicate' in Mail mode."
-  (let ((header-end (save-excursion
-                     (goto-char (point-min))
-                     (re-search-forward
-                      (concat "^"
-                              (regexp-quote mail-header-separator)
-                              "$")
-                      nil t)
-                     (point)))
-       (signature-begin
-         (if (not (boundp 'message-signature-separator))
-             (point-max)
-           (save-excursion
-             (goto-char (point-max))
-             (re-search-backward message-signature-separator nil t)
-             (point)))))
+  (let* ((header-end (save-excursion
+                       (goto-char (point-min))
+                       (re-search-forward
+                        (concat "^\\(?:"
+                                (regexp-quote mail-header-separator)
+                                "\\)?$")
+                        nil t)
+                       (point)))
+         (signature-begin
+          (if (not (boundp 'message-signature-separator))
+              (point-max)
+            (save-excursion
+              (goto-char (point-max))
+              (re-search-backward message-signature-separator
+                                  (max header-end (- (point) 4000)) t)
+              (point)))))
     (cond ((< (point) header-end)
           (and (save-excursion (beginning-of-line)
                                (looking-at "^Subject:"))
@@ -791,7 +793,7 @@ before the current command."
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-after-change-function ...                               */
 ;;*---------------------------------------------------------------------*/
-(defun flyspell-after-change-function (start stop len)
+(defun flyspell-after-change-function (start stop _len)
   "Save the current buffer and point for Flyspell's post-command hook."
   (push (cons start stop) flyspell-changes))
 
@@ -1420,9 +1422,9 @@ The buffer to mark them in is 
`flyspell-large-region-buffer'."
                        ;; end of last validated match.
                        (setq buffer-scan-pos (point))))
                  ;; Record if misspelling is not found and try new one
-                 (add-to-list 'words-not-found
-                              (concat " -> " word " - "
-                                      (int-to-string wordpos)))
+                 (cl-pushnew (concat " -> " word " - "
+                                      (int-to-string wordpos))
+                              words-not-found :test #'equal)
                  (setq keep nil)))))))
       ;; we are done
       (if flyspell-issue-message-flag (message "Spell Checking completed.")))
@@ -1528,7 +1530,8 @@ The buffer to mark them in is 
`flyspell-large-region-buffer'."
       (let ((extended-char-mode (ispell-get-extended-character-mode)))
         (and extended-char-mode          ; ~ extended character mode
             (string-match "[^~]+$" extended-char-mode)
-            (add-to-list 'args (concat "-T" (match-string 0 
extended-char-mode)))))
+            (cl-pushnew (concat "-T" (match-string 0 extended-char-mode))
+                         args :test #'equal)))
 
       ;; Add ispell-extra-args
       (setq args (append args ispell-extra-args))



reply via email to

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