[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: |
Fri, 19 Feb 2016 04:20:01 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
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!
- Trigger spell checking before sending, Pietro, 2016/02/11
- Re: Trigger spell checking before sending, Emanuel Berg, 2016/02/11
- Re: Trigger spell checking before sending, Pietro, 2016/02/12
- Re: Trigger spell checking before sending, Emanuel Berg, 2016/02/12
- Re: Trigger spell checking before sending, Emanuel Berg, 2016/02/12
- Re: Trigger spell checking before sending, Pietro, 2016/02/18
- Re: Trigger spell checking before sending, Emanuel Berg, 2016/02/18
- Re: Trigger spell checking before sending,
Pietro <=
- Re: Trigger spell checking before sending, B.V. Raghav, 2016/02/19
- Re: Trigger spell checking before sending, Emanuel Berg, 2016/02/19
- Re: Trigger spell checking before sending, B.V. Raghav, 2016/02/20
- Re: Trigger spell checking before sending, Peter Münster, 2016/02/15
Re: Trigger spell checking before sending [flyspell?], Andrzej A. Filip, 2016/02/11
Message not available