From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/18132 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.gnus.user Subject: Re: Trigger spell checking before sending Date: Fri, 19 Feb 2016 21:15:41 +0100 Message-ID: <87ziuwe9si.fsf@debian.uxu> References: <874mde27a9.fsf@posteo.net> <874mdeddos.fsf@debian.uxu> <87vb5uvxbd.fsf@pietrop-debian64RfL.eng.citrite.net> <87mvr5ql03.fsf@debian.uxu> <877fi2dmms.fsf@pietrop-debian64RfL.eng.citrite.net> <87ziuxzh8e.fsf@debian.uxu> <878u2g3ixx.fsf@ram.bvr.dp.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1455912970 20839 80.91.229.3 (19 Feb 2016 20:16:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Feb 2016 20:16:10 +0000 (UTC) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Fri Feb 19 21:16:01 2016 Return-path: Envelope-to: gegu-info-gnus-english@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aWrT5-0006vF-Ew for gegu-info-gnus-english@m.gmane.org; Fri, 19 Feb 2016 21:15:59 +0100 Original-Received: from localhost ([::1]:55114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWrT4-0007Q4-E3 for gegu-info-gnus-english@m.gmane.org; Fri, 19 Feb 2016 15:15:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWrT2-0007PG-38 for info-gnus-english@gnu.org; Fri, 19 Feb 2016 15:15:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWrSy-0001OV-MA for info-gnus-english@gnu.org; Fri, 19 Feb 2016 15:15:55 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:35284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWrSy-0001OO-Ev for info-gnus-english@gnu.org; Fri, 19 Feb 2016 15:15:52 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aWrSw-0006n7-Ja for info-gnus-english@gnu.org; Fri, 19 Feb 2016 21:15:50 +0100 Original-Received: from nl106-137-54.student.uu.se ([130.243.137.54]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Feb 2016 21:15:50 +0100 Original-Received: from embe8573 by nl106-137-54.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Feb 2016 21:15:50 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: info-gnus-english@gnu.org Original-Lines: 56 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-54.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:5x8XLQ8JEWx1aUTi6PAaf8MeP8A= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Original-Sender: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.gnus.user:18132 Archived-At: "B.V. Raghav" 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