info-gnus-english
[Top][All Lists]
Advanced

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

Re: Trigger spell checking before sending


From: Emanuel Berg
Subject: Re: Trigger spell checking before sending
Date: Fri, 19 Feb 2016 01:17:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

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) )))

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 :))

When you understand it move on to do other things :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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