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: Fri, 19 Feb 2016 04:20:01 -0600	[thread overview]
Message-ID: <8737spm27i.fsf@pietrop-debian64RfL.eng.citrite.net> (raw)
In-Reply-To: <87ziuxzh8e.fsf@debian.uxu>

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

> Pietro <pulsarpietro@posteo.net> writes:
>
>> run-hooks: Wrong number of arguments [...]
>>
>> This is what I get in my mini-buffer when I send my
>> email, any thoughts?
>
> OK, I see the problem, it doesn't get
> called interactively.
>
> Try this instead:
>
> (defun spell-before-send ()
>   (let*((lang-input (read-from-minibuffer "Language [e or s]: "))
>         (lang (pcase lang-input
>                 ("e" "american-insane")
>                 ("s" "svenska") )))
>     (when lang
>       (ispell-change-dictionary lang)
>       (ispell-message) )))
>
Thanks a lot, it works fine now.
> You have to change the interface at the second line,
> as well as the dictionaries at lines four and five,
> of course.
>
> Another thing - here is a hint how to do hooks without
> the lambda stuff. It amounts to the same but gives
> more control and more easy-to-handle code.
>
> First check out if you have anything in the hook
> variable already. If you do, and you want it, put it
> before (or after) the third line below.
>
> Then, evaluate the commented (first) line, then
> evaluate the function (at the second line), then set
> the hook to the hook function (the fourth line).
>
> ;; (setq message-send-hook nil)
> (defun message-send-hook-f ()
>   (spell-before-send) )
> (setq message-send-hook #'message-send-hook-f)
>
>> I am new to Emacs Lisp therefore I could some
>> silly mistake.
>
> You don't have to be new to Lisp to do that.
>
> Is there anything you don't understand in the code?
> If it is, find out using the documentation (online
> help: `C-h f', `C-h v', etc.) *or* ask here. ("Online"
> = not on paper :))
>
No I fully understand it, it does not look that far from the Racket, the
Lisp dialect I have studied
> When you understand it move on to do other things :)
Sure, and thanks a lot, I hope I will give something back to the
community soon!



  reply	other threads:[~2016-02-19 10:20 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
2016-02-19  0:17         ` Emanuel Berg
2016-02-19 10:20           ` Pietro [this message]
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=8737spm27i.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).