unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8594: 23.2; flyspell ignores first line in message-mode
@ 2011-04-30 15:38 Peter Oliver
  2011-05-02 16:05 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Oliver @ 2011-04-30 15:38 UTC (permalink / raw)
  To: 8594

[-- Attachment #1: Type: TEXT/PLAIN, Size: 462 bytes --]

When using flyspell-mode with mail-mode or message-mode, the email header is ignored for spellchecking.

However, this incorrectly assumes that any such buffer will always begin with a header.  I use message-mode to edit the email body only, and I find that flyspell ignores the whole first paragraph of such a buffer.

Attached is a patch that causes flyspell to only try to skip over the header if the message really does begin with a header.

-- 
Peter Oliver

[-- Attachment #2: Type: TEXT/PLAIN, Size: 2722 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: bzr@mavit.org.uk-20110430152929-eaj2kamu07rgutgl
# target_branch: nosmart+bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: ef8db088392bf8fcaa680a1b3a15c8330d146423
# timestamp: 2011-04-30 16:30:01 +0100
# source_branch: bzr://bzr.savannah.gnu.org/emacs/trunk
# base_revision_id: viniciusjl@ig.com.br-20110430151507-\
#   wt20qtszxtt47p8y
# 
# Begin patch
=== modified file 'lisp/textmodes/flyspell.el'
--- lisp/textmodes/flyspell.el	2011-04-03 20:59:45 +0000
+++ lisp/textmodes/flyspell.el	2011-04-30 15:29:29 +0000
@@ -316,12 +316,15 @@
   "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)))
+		      (if (not 
+			   (looking-at "^[A-Z]\\(?:\\(?:-[A-Z]\\)?[a-z]*\\)+:"))
+			  0
+			(re-search-forward
+			 (concat "^"
+				 (regexp-quote mail-header-separator)
+				 "$")
+			 nil t)
+			(point))))
 	(signature-begin
          (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Fy2CwgJ3tXAHFlGpVqVRP6TLg8LPwubq/S7Q/1Tx0UiJ2DX
R3Zey3hnLaEpJH5d2i8YtrF5vUOomb1FsfoGEe8s69HjDnp7wgD3B8FXFR/GqIZattnALkb+q5JW
P36jbLpzlEYUSq9t7E2qqBzCrhfe6SriyGZMtUlaaunS1+aKwb3ZQMUe9K1TZ64mNMP+v8k/Ha5l
A5BKu3a2T5Wr4LbyuDe1PFORuSeD4K4ZHvpzxJJZCs7nrbufspGMWBw7MdgWpq8wbNXVnJuwTUJh
1apW3LR3KTy5LqpKUORgTdbGZ092ArYFJ3aikLQuCFTl9lFTjeuosuXclvpZlOxdReq23qGOCgGK
VMsta4LFSR3LCtdviuvEJ3ayy1LYv/F3JFOFCQ5+9Edg

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

* bug#8594: 23.2; flyspell ignores first line in message-mode
  2011-04-30 15:38 bug#8594: 23.2; flyspell ignores first line in message-mode Peter Oliver
@ 2011-05-02 16:05 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2011-05-02 16:05 UTC (permalink / raw)
  To: Peter Oliver; +Cc: 8594

> However, this incorrectly assumes that any such buffer will always begin
> with a header.  I use message-mode to edit the email body only, and I find
> that flyspell ignores the whole first paragraph of such a buffer.

You're misusing message-mode.  I'd be surprised if there aren't more
"bugs" in such a circumstance.  Why don't you solve the problem right by
using message-mode as intended: add a dummy header.


        Stefan





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

end of thread, other threads:[~2011-05-02 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-30 15:38 bug#8594: 23.2; flyspell ignores first line in message-mode Peter Oliver
2011-05-02 16:05 ` Stefan Monnier

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