[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trigger spell checking before sending

From: Pietro
Subject: Re: Trigger spell checking before sending
Date: Sat, 05 Mar 2016 17:43:54 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Pietro <> writes:

> Pietro <> writes:
>> Emanuel Berg <> writes:
>>> Pietro <> 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) )))
> How can I modify this function to skip the spell checking ? I would like to
> have a third choice which directly sends the message straight away.
Oh, gosh, I just needed to press enter, and since lang is null at that
point my message is sent straightaway ... :-)

>> 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!
> I am afraid I am not ready yet ... :-(

Definitely not ready !

reply via email to

[Prev in Thread] Current Thread [Next in Thread]