unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19092: 25.0.50; [PATCH] ispell-message spell checks marked parts of messages
@ 2014-11-18 10:55 Matthew Leach
  2014-11-18 15:54 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Leach @ 2014-11-18 10:55 UTC (permalink / raw)
  To: 19092

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

emacs -Q

C-x m
C-c C-b
some wrong spelllling. <RET>
C-<SPC>
C-p
C-c M-m
M-x ispell-message

you should now be prompted to spell check the word spelllling.  Since
text in the marked parts of messages is usually quoted -- be it text,
code or otherwise -- I propose that we skip spell checking on these
parts of messages.  It can be a real hassle when quoting a large body
of code or text.

Attached is a patch to implement this.  Any comments welcome.

Thanks,
Matt

lisp/ChangeLog:

2014-11-18  Matthew Leach  <matthew@mattleach.net>

	* textmodes/ispell.el (ispell-message): add regexp versions of
	`message-mark-insert-begin' and `message-mark-insert-end' to
	`ispell-skip-region-alist' to skip marked message parts.

etc/ChangeLog:
2014-11-18  Matthew Leach  <matthew@mattleach.net>

	* NEWS: Mention ispell-message now skips marked message parts.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ispell-skip-maked-message-part.patch --]
[-- Type: text/x-diff, Size: 1637 bytes --]

diff --git a/etc/NEWS b/etc/NEWS
index 05210df..bdad732 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -161,6 +161,9 @@ buffers you want to keep separate.
 *** text/html messages that contain inline image parts will be
 transformed into multipart/related messages before sending.
 
+*** Marked parts of messages (created with C-c M-m) are no longer
+spell checked.
+
 ** pcase
 *** New UPatterns `quote' and `app'.
 *** New UPatterns can be defined with `pcase-defmacro'.
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 0fc6b4a..6d537c2 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -4095,10 +4095,18 @@ You can bind this to the key C-c i in GNUS or mail by adding to
 	      (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 (concat "^\\(" cite-regexp "\\)")
-			(function forward-line))
-		  ispell-skip-region-alist))
+            (append
+             (list
+              (cons message-mark-insert-begin-regexp
+                    message-mark-insert-end-regexp)
+              (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))

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#19092: 25.0.50; [PATCH] ispell-message spell checks marked parts of messages
  2014-11-18 10:55 bug#19092: 25.0.50; [PATCH] ispell-message spell checks marked parts of messages Matthew Leach
@ 2014-11-18 15:54 ` Eli Zaretskii
  2014-11-18 19:53   ` Matthew Leach
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2014-11-18 15:54 UTC (permalink / raw)
  To: Matthew Leach; +Cc: 19092

> From: Matthew Leach <matthew@mattleach.net>
> Date: Tue, 18 Nov 2014 10:55:45 +0000
> 
> emacs -Q
> 
> C-x m
> C-c C-b
> some wrong spelllling. <RET>
> C-<SPC>
> C-p
> C-c M-m
> M-x ispell-message
> 
> you should now be prompted to spell check the word spelllling.  Since
> text in the marked parts of messages is usually quoted -- be it text,
> code or otherwise -- I propose that we skip spell checking on these
> parts of messages.  It can be a real hassle when quoting a large body
> of code or text.
> 
> Attached is a patch to implement this.  Any comments welcome.

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.)


> 2014-11-18  Matthew Leach  <matthew@mattleach.net>
> 
> 	* textmodes/ispell.el (ispell-message): add regexp versions of
> 	`message-mark-insert-begin' and `message-mark-insert-end' to
> 	`ispell-skip-region-alist' to skip marked message parts.

ChangeLog entries should start with a capital letter (as any English
sentence).

Thanks.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#19092: 25.0.50; [PATCH] ispell-message spell checks marked parts of messages
  2014-11-18 15:54 ` Eli Zaretskii
@ 2014-11-18 19:53   ` Matthew Leach
  2016-02-23 11:57     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Leach @ 2014-11-18 19:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 19092

[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]

Hi Eli,

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Matthew Leach <matthew@mattleach.net>
>> Date: Tue, 18 Nov 2014 10:55:45 +0000
>> 
>> emacs -Q
>> 
>> C-x m
>> C-c C-b
>> some wrong spelllling. <RET>
>> C-<SPC>
>> C-p
>> C-c M-m
>> M-x ispell-message
>> 
>> you should now be prompted to spell check the word spelllling.  Since
>> text in the marked parts of messages is usually quoted -- be it text,
>> code or otherwise -- I propose that we skip spell checking on these
>> parts of messages.  It can be a real hassle when quoting a large body
>> of code or text.
>> 
>> Attached is a patch to implement this.  Any comments welcome.
>
> 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.

>
>
>
>> 2014-11-18  Matthew Leach  <matthew@mattleach.net>
>> 
>> 	* textmodes/ispell.el (ispell-message): add regexp versions of
>> 	`message-mark-insert-begin' and `message-mark-insert-end' to
>> 	`ispell-skip-region-alist' to skip marked message parts.
>
> ChangeLog entries should start with a capital letter (as any English
> sentence).

Ah, missed that one, sorry.  Revised ChangeLogs below.

Thanks,
Matt

lisp/ChangeLog:
2014-11-18  Matthew Leach  <matthew@mattleach.net>

	* textmodes/ispell.el (ispell-message-check-marked-regions): New.
	(ispell-message): Add regexp versions of
	`message-mark-insert-begin' and `message-mark-insert-end' to
	`ispell-skip-region-alist' to skip marked message parts.

etc/ChangeLog:
2014-11-18  Matthew Leach  <matthew@mattleach.net>

	* NEWS: Mention ispell-message now skips marked message parts when
	`ispell-message-check-marked-regions' is nil.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ispell-skip-maked-message-part.patch --]
[-- Type: text/x-diff, Size: 2413 bytes --]

diff --git a/etc/NEWS b/etc/NEWS
index 05210df..2823f91 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -161,6 +161,11 @@ buffers you want to keep separate.
 *** text/html messages that contain inline image parts will be
 transformed into multipart/related messages before sending.
 
+---
+*** 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' and `app'.
 *** New UPatterns can be defined with `pcase-defmacro'.
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 0fc6b4a..36eb3d9 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -400,6 +400,16 @@ Always stores Fcc copy of message when nil."
   :type '(choice integer (const :tag "off" nil))
   :group 'ispell)
 
+(defcustom ispell-message-check-marked-regions nil
+  "When nil ispell-message will skip makred 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
@@ -4095,10 +4105,17 @@ You can bind this to the key C-c i in GNUS or mail by adding to
 	      (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 (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)))
+              ,(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))

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#19092: 25.0.50; [PATCH] ispell-message spell checks marked parts of messages
  2014-11-18 19:53   ` Matthew Leach
@ 2016-02-23 11:57     ` Lars Ingebrigtsen
  2019-06-25 21:10       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-23 11:57 UTC (permalink / raw)
  To: Matthew Leach; +Cc: 19092

Matthew Leach <matthew@mattleach.net> 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
 \f
 * 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





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#19092: 25.0.50; [PATCH] ispell-message spell checks marked parts of messages
  2016-02-23 11:57     ` Lars Ingebrigtsen
@ 2019-06-25 21:10       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-25 21:10 UTC (permalink / raw)
  To: Matthew Leach; +Cc: 19092

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Matthew Leach <matthew@mattleach.net> 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...

I think there should instead be a way for modes to tell ispell what
parts of the buffer should (perhaps) not be spellcheked, and this patch
approaches this from the opposite side, so I don't think it's the right
solution.  Closing the bug report.

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-25 21:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18 10:55 bug#19092: 25.0.50; [PATCH] ispell-message spell checks marked parts of messages Matthew Leach
2014-11-18 15:54 ` Eli Zaretskii
2014-11-18 19:53   ` Matthew Leach
2016-02-23 11:57     ` Lars Ingebrigtsen
2019-06-25 21:10       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).