aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2015-02-04 14:43:47 -0500
committerStefan Monnier2015-02-04 14:43:47 -0500
commitebbdc6c30dc883ffb9ddb53c0263ef325d251903 (patch)
tree426e005e6a51bc14dff3ef0e6fbb0d149ae7c73e
parentda9c6486d27a350685d473abb9ffd9345e6eda31 (diff)
downloademacs-ebbdc6c30dc883ffb9ddb53c0263ef325d251903.tar.gz
emacs-ebbdc6c30dc883ffb9ddb53c0263ef325d251903.zip
* 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.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/textmodes/flyspell.el45
2 files changed, 33 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 432ca69ac6f..a76d83a69dd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12015-02-04 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * textmodes/flyspell.el: Use lexical-binding and cl-lib.
4 (mail-mode-flyspell-verify): Fix last change.
5 (flyspell-external-point-words, flyspell-large-region):
6 Avoid add-to-list on local vars.
7
12015-02-04 Tassilo Horn <tsdh@gnu.org> 82015-02-04 Tassilo Horn <tsdh@gnu.org>
2 9
3 * emacs-lisp/package.el (package-installed-p): Fix typo causing 10 * emacs-lisp/package.el (package-installed-p): Fix typo causing
@@ -57,8 +64,8 @@
57 64
582015-02-02 Artur Malabarba <bruce.connor.am@gmail.com> 652015-02-02 Artur Malabarba <bruce.connor.am@gmail.com>
59 66
60 * emacs-lisp/package.el (package--find-non-dependencies): New 67 * emacs-lisp/package.el (package--find-non-dependencies):
61 function. 68 New function.
62 (package-initialize): Use it to populate `package-selected-packages'. 69 (package-initialize): Use it to populate `package-selected-packages'.
63 (package-menu-execute): Clean unnecessary `and'. 70 (package-menu-execute): Clean unnecessary `and'.
64 (package--get-deps): Fix returning duplicates. 71 (package--get-deps): Fix returning duplicates.
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 66243b42102..91a43f0b9f7 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1,4 +1,4 @@
1;;; flyspell.el --- on-the-fly spell checker 1;;; flyspell.el --- On-the-fly spell checker -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1998, 2000-2015 Free Software Foundation, Inc. 3;; Copyright (C) 1998, 2000-2015 Free Software Foundation, Inc.
4 4
@@ -39,6 +39,7 @@
39;;; Code: 39;;; Code:
40 40
41(require 'ispell) 41(require 'ispell)
42(eval-when-compile (require 'cl-lib))
42 43
43;;*---------------------------------------------------------------------*/ 44;;*---------------------------------------------------------------------*/
44;;* Group ... */ 45;;* Group ... */
@@ -312,21 +313,22 @@ property of the major mode name.")
312(defvar message-signature-separator) 313(defvar message-signature-separator)
313(defun mail-mode-flyspell-verify () 314(defun mail-mode-flyspell-verify ()
314 "Function used for `flyspell-generic-check-word-predicate' in Mail mode." 315 "Function used for `flyspell-generic-check-word-predicate' in Mail mode."
315 (let ((header-end (save-excursion 316 (let* ((header-end (save-excursion
316 (goto-char (point-min)) 317 (goto-char (point-min))
317 (re-search-forward 318 (re-search-forward
318 (concat "^" 319 (concat "^\\(?:"
319 (regexp-quote mail-header-separator) 320 (regexp-quote mail-header-separator)
320 "$") 321 "\\)?$")
321 nil t) 322 nil t)
322 (point))) 323 (point)))
323 (signature-begin 324 (signature-begin
324 (if (not (boundp 'message-signature-separator)) 325 (if (not (boundp 'message-signature-separator))
325 (point-max) 326 (point-max)
326 (save-excursion 327 (save-excursion
327 (goto-char (point-max)) 328 (goto-char (point-max))
328 (re-search-backward message-signature-separator nil t) 329 (re-search-backward message-signature-separator
329 (point))))) 330 (max header-end (- (point) 4000)) t)
331 (point)))))
330 (cond ((< (point) header-end) 332 (cond ((< (point) header-end)
331 (and (save-excursion (beginning-of-line) 333 (and (save-excursion (beginning-of-line)
332 (looking-at "^Subject:")) 334 (looking-at "^Subject:"))
@@ -791,7 +793,7 @@ before the current command."
791;;*---------------------------------------------------------------------*/ 793;;*---------------------------------------------------------------------*/
792;;* flyspell-after-change-function ... */ 794;;* flyspell-after-change-function ... */
793;;*---------------------------------------------------------------------*/ 795;;*---------------------------------------------------------------------*/
794(defun flyspell-after-change-function (start stop len) 796(defun flyspell-after-change-function (start stop _len)
795 "Save the current buffer and point for Flyspell's post-command hook." 797 "Save the current buffer and point for Flyspell's post-command hook."
796 (push (cons start stop) flyspell-changes)) 798 (push (cons start stop) flyspell-changes))
797 799
@@ -1420,9 +1422,9 @@ The buffer to mark them in is `flyspell-large-region-buffer'."
1420 ;; end of last validated match. 1422 ;; end of last validated match.
1421 (setq buffer-scan-pos (point)))) 1423 (setq buffer-scan-pos (point))))
1422 ;; Record if misspelling is not found and try new one 1424 ;; Record if misspelling is not found and try new one
1423 (add-to-list 'words-not-found 1425 (cl-pushnew (concat " -> " word " - "
1424 (concat " -> " word " - " 1426 (int-to-string wordpos))
1425 (int-to-string wordpos))) 1427 words-not-found :test #'equal)
1426 (setq keep nil))))))) 1428 (setq keep nil)))))))
1427 ;; we are done 1429 ;; we are done
1428 (if flyspell-issue-message-flag (message "Spell Checking completed."))) 1430 (if flyspell-issue-message-flag (message "Spell Checking completed.")))
@@ -1528,7 +1530,8 @@ The buffer to mark them in is `flyspell-large-region-buffer'."
1528 (let ((extended-char-mode (ispell-get-extended-character-mode))) 1530 (let ((extended-char-mode (ispell-get-extended-character-mode)))
1529 (and extended-char-mode ; ~ extended character mode 1531 (and extended-char-mode ; ~ extended character mode
1530 (string-match "[^~]+$" extended-char-mode) 1532 (string-match "[^~]+$" extended-char-mode)
1531 (add-to-list 'args (concat "-T" (match-string 0 extended-char-mode))))) 1533 (cl-pushnew (concat "-T" (match-string 0 extended-char-mode))
1534 args :test #'equal)))
1532 1535
1533 ;; Add ispell-extra-args 1536 ;; Add ispell-extra-args
1534 (setq args (append args ispell-extra-args)) 1537 (setq args (append args ispell-extra-args))