* spell checking message buffer
@ 2014-04-21 4:22 Peter Münster
2014-04-21 5:38 ` Katsumi Yamaoka
0 siblings, 1 reply; 7+ messages in thread
From: Peter Münster @ 2014-04-21 4:22 UTC (permalink / raw)
To: ding
Hi,
How would it be possible to spell-check (M-x ispell) only the subject
line and in the body only the unquoted lines please?
TIA for any hints,
--
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spell checking message buffer
2014-04-21 4:22 spell checking message buffer Peter Münster
@ 2014-04-21 5:38 ` Katsumi Yamaoka
2014-04-21 19:09 ` Peter Münster
0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2014-04-21 5:38 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 238 bytes --]
On Mon, 21 Apr 2014 06:22:08 +0200, Peter Münster wrote:
> How would it be possible to spell-check (M-x ispell) only the subject
> line and in the body only the unquoted lines please?
> TIA for any hints,
A quick hack is here:
[-- Attachment #2: Type: application/emacs-lisp, Size: 959 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spell checking message buffer
2014-04-21 5:38 ` Katsumi Yamaoka
@ 2014-04-21 19:09 ` Peter Münster
2014-09-24 21:57 ` Ted Zlatanov
0 siblings, 1 reply; 7+ messages in thread
From: Peter Münster @ 2014-04-21 19:09 UTC (permalink / raw)
To: ding
On Mon, Apr 21 2014, Katsumi Yamaoka wrote:
> A quick hack is here:
>
> (defun my-ispell-message ()
Thanks! Would it make sense to integrate it into Gnus?
--
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spell checking message buffer
2014-04-21 19:09 ` Peter Münster
@ 2014-09-24 21:57 ` Ted Zlatanov
2014-09-25 22:05 ` Peter Münster
0 siblings, 1 reply; 7+ messages in thread
From: Ted Zlatanov @ 2014-09-24 21:57 UTC (permalink / raw)
To: ding
On Mon, 21 Apr 2014 21:09:33 +0200 Peter Münster <pmlists@free.fr> wrote:
PM> On Mon, Apr 21 2014, Katsumi Yamaoka wrote:
>> A quick hack is here:
>>
>> (defun my-ispell-message ()
PM> Thanks! Would it make sense to integrate it into Gnus?
I'm in favor.
Ted
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spell checking message buffer
2014-09-24 21:57 ` Ted Zlatanov
@ 2014-09-25 22:05 ` Peter Münster
2015-01-28 6:16 ` Lars Ingebrigtsen
0 siblings, 1 reply; 7+ messages in thread
From: Peter Münster @ 2014-09-25 22:05 UTC (permalink / raw)
To: ding
On Wed, Sep 24 2014, Ted Zlatanov wrote:
> On Mon, 21 Apr 2014 21:09:33 +0200 Peter Münster <pmlists@free.fr> wrote:
>
> PM> On Mon, Apr 21 2014, Katsumi Yamaoka wrote:
>>> A quick hack is here:
>>>
>>> (defun my-ispell-message ()
>
> PM> Thanks! Would it make sense to integrate it into Gnus?
>
> I'm in favor.
Before doing that, here is a slightly enhanced version:
--8<---------------cut here---------------start------------->8---
(defun my-ispell-message ()
"Do ispell on the subject line and the unquoted body lines."
(interactive)
(let ((case-fold-search t)
(res t)
start end)
(message-goto-subject)
(setq end (point))
(beginning-of-line)
(while (memq (char-after) '(?\t ? ))
(forward-line -1))
(when (looking-at "subject:[\t\n ]*\\(?:\\(fwd\\|re\\):[\t\n ]*\\)*")
(setq start (match-end 0)))
(when (< start end)
(unless (ispell-region start end) (setq res nil)))
(message-goto-body)
(while (not (eobp))
(while (and (not (eobp))
(or (looking-at message-cite-prefix-regexp)
(looking-at "<#.*>$")
(looking-at "[\t ]*$")))
(forward-line 1))
(setq start (point))
(while (not (or (eobp)
(looking-at message-cite-prefix-regexp)
(looking-at "<#.*>$")
(looking-at "[\t ]*$")))
(forward-line 1))
(setq end (point-marker))
(unless (ispell-region start end) (setq res nil))
(goto-char end))
(when (markerp end)
(set-marker end nil))
res))
--8<---------------cut here---------------end--------------->8---
First, mml-tags are excluded from spell-checking.
Second, when ispell fails, the function returns nil.
The latter is useful, when this function is called from the
message-send-hook, and while spell-checking the user sees big mistakes
and wants to edit further the message and wishes to stop the sending.
See for example the last line of my message-send-hook:
--8<---------------cut here---------------start------------->8---
(defun pm/message-send ()
(unless (message-field-value gnus-delay-header)
(unless (string-equal pm/role "list")
(if (jl-epg-check-unique-keys (jl-mail-recipients))
(mml-secure-message-sign-encrypt)
(mml-secure-message-sign)))
(or (pm/spell) (keyboard-quit)))) ; here the sending can be cancelled
--8<---------------cut here---------------end--------------->8---
--
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spell checking message buffer
2014-09-25 22:05 ` Peter Münster
@ 2015-01-28 6:16 ` Lars Ingebrigtsen
2015-01-28 16:45 ` Peter Münster
0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2015-01-28 6:16 UTC (permalink / raw)
To: Peter Münster; +Cc: ding
Peter Münster <pmlists@free.fr> writes:
> Before doing that, here is a slightly enhanced version:
>
> (defun my-ispell-message ()
> "Do ispell on the subject line and the unquoted body lines."
> (interactive)
Looks good. Can you submit a patch to message.el along with some
documentation in message.texi?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spell checking message buffer
2015-01-28 6:16 ` Lars Ingebrigtsen
@ 2015-01-28 16:45 ` Peter Münster
0 siblings, 0 replies; 7+ messages in thread
From: Peter Münster @ 2015-01-28 16:45 UTC (permalink / raw)
To: ding
On Wed, Jan 28 2015, Lars Ingebrigtsen wrote:
>> (defun my-ispell-message ()
>> "Do ispell on the subject line and the unquoted body lines."
>> (interactive)
>
> Looks good. Can you submit a patch to message.el along with some
> documentation in message.texi?
I've just discovered a reference to `ispell-message' in message.el. It seems,
that `ispell-message' is exactly doing the same as `my-ispell-message'.
It's even mentioned in the message manual. I should have looked there
before asking for help...
--
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-01-28 16:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21 4:22 spell checking message buffer Peter Münster
2014-04-21 5:38 ` Katsumi Yamaoka
2014-04-21 19:09 ` Peter Münster
2014-09-24 21:57 ` Ted Zlatanov
2014-09-25 22:05 ` Peter Münster
2015-01-28 6:16 ` Lars Ingebrigtsen
2015-01-28 16:45 ` Peter Münster
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 NNTP newsgroup(s).