From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/85042 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?Peter_M=C3=BCnster?= Newsgroups: gmane.emacs.gnus.general Subject: Re: spell checking message buffer Date: Fri, 26 Sep 2014 00:05:49 +0200 Message-ID: <87lhp7icea.fsf@micropit.roche-blanche.homenet.org> References: <874n1n9urz.fsf@micropit.couberia.selfip.net> <87sip65wk2.fsf@micropit.couberia.selfip.net> <87zjdoisvf.fsf@lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1411682894 6174 80.91.229.3 (25 Sep 2014 22:08:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Sep 2014 22:08:14 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M33286@lists.math.uh.edu Fri Sep 26 00:08:07 2014 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XXHCo-0005Vh-64 for ding-account@gmane.org; Fri, 26 Sep 2014 00:08:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1XXHBg-00061Z-I0; Thu, 25 Sep 2014 17:06:56 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1XXHBe-00061B-LC for ding@lists.math.uh.edu; Thu, 25 Sep 2014 17:06:54 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1XXHBc-0004nP-VH for ding@lists.math.uh.edu; Thu, 25 Sep 2014 17:06:54 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1XXHAr-0008UU-DA for ding@gnus.org; Fri, 26 Sep 2014 00:06:14 +0200 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XXHAp-0003UF-P3 for ding@gnus.org; Fri, 26 Sep 2014 00:06:03 +0200 Original-Received: from arennes-651-1-309-144.w2-12.abo.wanadoo.fr ([2.12.132.144]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Sep 2014 00:06:03 +0200 Original-Received: from pmlists by arennes-651-1-309-144.w2-12.abo.wanadoo.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Sep 2014 00:06:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 72 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: arennes-651-1-309-144.w2-12.abo.wanadoo.fr User-Agent: Gnus/5.130012 (=?utf-8?Q?=E7=9C=9F?= Gnus v0.12) Emacs/24.4.50 (gnu/linux) Cancel-Lock: sha1:jXVY95kf0ZsSa0f4zV5OSw3epYQ= X-Spam-Score: -3.6 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:85042 Archived-At: On Wed, Sep 24 2014, Ted Zlatanov wrote: > On Mon, 21 Apr 2014 21:09:33 +0200 Peter Münster 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