From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/18128 Path: news.gmane.org!not-for-mail From: Pietro Newsgroups: gmane.emacs.gnus.user Subject: Re: Trigger spell checking before sending Date: Fri, 19 Feb 2016 04:20:01 -0600 Message-ID: <8737spm27i.fsf@pietrop-debian64RfL.eng.citrite.net> 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> 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 1455877417 24673 80.91.229.3 (19 Feb 2016 10:23:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Feb 2016 10:23:37 +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 11:23:28 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 1aWiDf-0001ic-6N for gegu-info-gnus-english@m.gmane.org; Fri, 19 Feb 2016 11:23:27 +0100 Original-Received: from localhost ([::1]:50718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWiDe-0003Td-Iv for gegu-info-gnus-english@m.gmane.org; Fri, 19 Feb 2016 05:23:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWiDb-0003Qs-Vg for info-gnus-english@gnu.org; Fri, 19 Feb 2016 05:23:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWiDX-0004FY-Ve for info-gnus-english@gnu.org; Fri, 19 Feb 2016 05:23:23 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:47659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWiDX-0004FG-OL for info-gnus-english@gnu.org; Fri, 19 Feb 2016 05:23:19 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aWiDK-0001Uh-8S for info-gnus-english@gnu.org; Fri, 19 Feb 2016 11:23:16 +0100 Original-Received: from 185.25.64.249 ([185.25.64.249]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Feb 2016 11:23:06 +0100 Original-Received: from pulsarpietro by 185.25.64.249 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Feb 2016 11:23:06 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 60 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 185.25.64.249 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:Cci6B5TnEREgzAopSHtqpgKhVBc= 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:18128 Archived-At: Emanuel Berg writes: > Pietro 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) ))) > Thanks a lot, it works fine now. > 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 :)) > No I fully understand it, it does not look that far from the Racket, the Lisp dialect I have studied > When you understand it move on to do other things :) Sure, and thanks a lot, I hope I will give something back to the community soon!