bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#19092: 25.0.50; [PATCH] ispell-message spell checks marked parts of


From: Lars Ingebrigtsen
Subject: bug#19092: 25.0.50; [PATCH] ispell-message spell checks marked parts of messages
Date: Tue, 23 Feb 2016 22:57:11 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Matthew Leach <address@hidden> writes:

>> This changes behavior, so I think we should have a defcustom that
>> could be used to get the old behavior back.  (And the NEWS entry
>> should describe that.)
>
> Ah, yes sorry about that.  The revised patch fixes that.

The patch no longer applies, so I've tried to fit it in.  However, the
patch is using variables defined in message.el.  Does it make sense to
have ispell.el require 'message?  That seems rather odd...

So I'm not sure this should go into Emacs in its present form...

diff --git a/etc/NEWS b/etc/NEWS
index 04c1ee8..2bbe246 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1637,6 +1637,11 @@ that happen, `unhandled-file-name-directory' now 
defaults to calling
 
 * Lisp Changes in Emacs 25.1
 
+---
+*** Marked parts of messages (created with C-c M-m) are no longer
+spell checked.  To revert to the original behaviour set
+`ispell-message-check-marked-regions' to t.
+
 ** pcase
 +++
 *** New UPatterns `quote', `app'.
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index db03a32..fdbab5d 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -400,6 +400,16 @@ ispell-message-fcc-skip
   :type '(choice integer (const :tag "off" nil))
   :group 'ispell)
 
+(defcustom ispell-message-check-marked-regions nil
+  "When nil ispell-message will skip marked regions.
+These are regions that are enclosed with
+`message-mark-insert-begin' and `message-mark-insert-end'.
+
+When non-nil, ispell-message will check the spelling inside these
+regions."
+  :type '(choice (const :tag "Check spelling" t)
+                 (const :tag "Don't check spellng" nil))
+  :group 'ispell)
 
 (defcustom ispell-grep-command
   ;; MS-Windows/MS-DOS have `egrep' as a Unix shell script, so they
@@ -4167,11 +4177,18 @@ ispell-message
              (concat "[^,;&+=\n]+ writes:" "\\|"
                      (ispell-non-empty-string vm-included-text-prefix)))
             (t default-prefix)))
+           (message-mark-insert-begin-regexp
+            (concat "^" (regexp-quote message-mark-insert-begin)))
+           (message-mark-insert-end-regexp
+            (concat "^" (regexp-quote message-mark-insert-end)))
           (ispell-skip-region-alist
-           (cons (list (ispell--make-filename-or-URL-re))
-                  (cons (list (concat "^\\(" cite-regexp "\\)")
-                              (function forward-line))
-                        ispell-skip-region-alist)))
+            `(,@(unless ispell-message-check-marked-regions
+                  (list (cons 'message-mark-insert-begin-regexp
+                              'message-mark-insert-end-regexp)))
+              ,(cons (list (ispell--make-filename-or-URL-re))
+                     (list (concat "^\\(" cite-regexp "\\)")
+                           (function forward-line)))
+              ,@ispell-skip-region-alist))
           (old-case-fold-search case-fold-search)
           (dictionary-alist ispell-message-dictionary-alist)
           (ispell-checking-message t))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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