"B.V. Raghav" <bvrag...@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 _______________________________________________ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english