From: Emanuel Berg <embe8573@student.uu.se>
To: info-gnus-english@gnu.org
Subject: Re: Trigger spell checking before sending
Date: Fri, 19 Feb 2016 21:15:41 +0100 [thread overview]
Message-ID: <87ziuwe9si.fsf@debian.uxu> (raw)
In-Reply-To: <878u2g3ixx.fsf@ram.bvr.dp.lan>
"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
next prev parent reply other threads:[~2016-02-19 20:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-11 22:47 Pietro
2016-02-11 23:34 ` Emanuel Berg
2016-02-12 14:05 ` Pietro
2016-02-13 3:27 ` Emanuel Berg
2016-02-13 4:42 ` Emanuel Berg
2016-02-18 16:11 ` Pietro
2016-02-19 0:17 ` Emanuel Berg
2016-02-19 10:20 ` Pietro
2016-03-05 17:38 ` Pietro
2016-03-05 17:43 ` Pietro
2016-03-06 5:53 ` Emanuel Berg
2016-02-19 13:53 ` B.V. Raghav
2016-02-19 20:15 ` Emanuel Berg [this message]
2016-02-20 7:12 ` B.V. Raghav
2016-02-15 11:12 ` Peter Münster
2016-02-12 0:07 ` Trigger spell checking before sending [flyspell?] Andrzej A. Filip
2016-02-12 0:21 ` Emanuel Berg
2016-02-12 8:58 ` Andrzej A. Filip
2016-02-13 4:47 ` Emanuel Berg
[not found] ` <mailman.4442.1455236524.843.info-gnus-english@gnu.org>
2016-02-12 9:41 ` Loris Bennett
2016-02-13 5:00 ` Emanuel Berg
2016-02-12 7:31 ` Trigger spell checking before sending Eric S Fraga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ziuwe9si.fsf@debian.uxu \
--to=embe8573@student.uu.se \
--cc=info-gnus-english@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).