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 21:15:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

"B.V. Raghav" <bvraghav@iitk.ac.in> writes:

>> 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]: "))
>
> Would it have been possible to hook the
> _interactively_defined_ `spell-before-send' as
> follows:
>
> (add-hook message-send-hook (lambda () "Calls
> spell-before-send interactively" (call-interactively
> 'spell-before-send)))
>
> If so, please enlighten the difference.

I would prefer not to use `add-hook' nor the `lambda'
notation but in essence a non-interactive function
that prompts for input vs. an interactive function
that is called interactively from Elisp code - that
should amount to the same what I can see.

If you want the function to be used interactively *as
well* (i.e., the user invokes it directly) then
obviously it should be interactive.

Or perhaps you are benefited from the
`interactive' interface.

>From a principal/esthetic point of view interactive
stuff doesn't really belong in hooks because those are
all about automatization. But in reality if that is
what you want and it works - why not?

Try it:

(require 'message)

(defun spell-before-send (lang-input)
  (interactive "sLanguage [e or s]: ")
  (let((lang (pcase lang-input
                ("e" "american-insane")
                ("s" "svenska") )))
    (when lang
      (ispell-change-dictionary lang)
      (ispell-message) )))

;; (setq message-send-hook nil)
(defun message-send-hook-f ()
  (call-interactively #'spell-before-send) )
(setq message-send-hook #'message-send-hook-f)

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




reply via email to

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