Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Pietro <pulsarpietro@posteo.net>
To: info-gnus-english@gnu.org
Subject: Re: Trigger spell checking before sending
Date: Thu, 18 Feb 2016 10:11:23 -0600	[thread overview]
Message-ID: <877fi2dmms.fsf@pietrop-debian64RfL.eng.citrite.net> (raw)
In-Reply-To: <87mvr5ql03.fsf@debian.uxu>

Emanuel Berg <embe8573@student.uu.se> writes:

> Pietro <pulsarpietro@posteo.net> writes:
>
>> Alternatively I am thinking of writing a function
>> which asks the user for the language the ispell
>> function should check for, it does not need to
>> accept all the languages and for instance I would be
>> more than happy to have something like that :
>>
>> Mini-buffer says: [Which language ?[e : English, i:
>> Italian]
>
> I still don't like the idea of having this complicated
> a thing in a hook; on the other hand, I just realized
> that the code I provided isn't compatible with the
> hook solution, so it isn't of any help if you are set
> on that idea.
>
> OK, try this, only change the Swedish stuff for
> Italian, no?
>
> (defun message-spell-before-send (lang-char)
>   (interactive "s(e)nglish or (s)wedish: ")
>   (let ((lang (pcase lang-char
>                 ("e" "american-insane") ; these has to be added outside of Emacs
>                 ("s" "svenska") )))
>     (if lang
>         (progn
>           (ispell-change-dictionary lang) ; N.B. side-effect - this isn't reset
>           (ispell-message) )
>       (message "Spelling not done - no support for: %s" lang-char) )))
>
> If you don't want to spell, just hit RET.
Hi,
sorry for my late reply, I was busy ... working! Ouch!

Thanks a lot for your answers guys, much appreciated :-)

I would like to implement one of the previous follow up which explained how to auto
detect the buffer's language but for now I would be more than happy with
this simple and good solution, the function works fine when I call it
from M-x "name-function" but something strange happens when that is
called by the message-send hook:

run-hooks: Wrong number of arguments: (lambda (lang-char) (interactive
"s(e)nglish or (s)wedish: ") (let ((lang (cond ((equal lang-char "e")
(let nil "british")) ((equal lang-char "i") (let nil "italiano")) (t
nil)))) (if lang (progn (ispell-change-dictionary lang)
(ispell-message)) (message "Spelling not done - no support for: %s"
lang-char)))), 0

This is what I get in my mini-buffer when I send my email, any thoughts ?
I am new to Emacs Lisp therefore I could some  silly mistake.

Thanks a lot.
Pietro



  reply	other threads:[~2016-02-18 16:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 22:47 Pietro
2016-02-11 23:34 ` Emanuel Berg
2016-02-12 14:05   ` Pietro
2016-02-13  3:27     ` Emanuel Berg
2016-02-13  4:42     ` Emanuel Berg
2016-02-18 16:11       ` Pietro [this message]
2016-02-19  0:17         ` Emanuel Berg
2016-02-19 10:20           ` Pietro
2016-03-05 17:38             ` Pietro
2016-03-05 17:43               ` Pietro
2016-03-06  5:53                 ` Emanuel Berg
2016-02-19 13:53           ` B.V. Raghav
2016-02-19 20:15             ` Emanuel Berg
2016-02-20  7:12               ` B.V. Raghav
2016-02-15 11:12     ` Peter Münster
2016-02-12  0:07 ` Trigger spell checking before sending [flyspell?] Andrzej A. Filip
2016-02-12  0:21   ` Emanuel Berg
2016-02-12  8:58     ` Andrzej A. Filip
2016-02-13  4:47       ` Emanuel Berg
     [not found]   ` <mailman.4442.1455236524.843.info-gnus-english@gnu.org>
2016-02-12  9:41     ` Loris Bennett
2016-02-13  5:00       ` Emanuel Berg
2016-02-12  7:31 ` Trigger spell checking before sending Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877fi2dmms.fsf@pietrop-debian64RfL.eng.citrite.net \
    --to=pulsarpietro@posteo.net \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).