From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/18159 Path: news.gmane.org!not-for-mail From: Pietro Newsgroups: gmane.emacs.gnus.user Subject: Re: Trigger spell checking before sending Date: Sat, 05 Mar 2016 17:43:54 +0000 Message-ID: <87fuw4stut.fsf@posteo.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> <8737spm27i.fsf@pietrop-debian64RfL.eng.citrite.net> <87k2lgsu4h.fsf@posteo.net> 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 1457199926 28713 80.91.229.3 (5 Mar 2016 17:45:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Mar 2016 17:45:26 +0000 (UTC) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Sat Mar 05 18:45:17 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 1acGGS-0001kV-K3 for gegu-info-gnus-english@m.gmane.org; Sat, 05 Mar 2016 18:45:16 +0100 Original-Received: from localhost ([::1]:47498 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acGGO-0006BY-Q4 for gegu-info-gnus-english@m.gmane.org; Sat, 05 Mar 2016 12:45:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acGGM-000696-S8 for info-gnus-english@gnu.org; Sat, 05 Mar 2016 12:45:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acGGJ-0005Xu-LE for info-gnus-english@gnu.org; Sat, 05 Mar 2016 12:45:10 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:54631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acGGJ-0005Xm-Ee for info-gnus-english@gnu.org; Sat, 05 Mar 2016 12:45:07 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1acGGG-0001hz-Sq for info-gnus-english@gnu.org; Sat, 05 Mar 2016 18:45:04 +0100 Original-Received: from host86-181-173-195.range86-181.btcentralplus.com ([86.181.173.195]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Mar 2016 18:45:04 +0100 Original-Received: from pulsarpietro by host86-181-173-195.range86-181.btcentralplus.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Mar 2016 18:45:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 72 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: host86-181-173-195.range86-181.btcentralplus.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:ipZmRHeIlY+sB32eBW9pwvKEuwk= 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:18159 Archived-At: Pietro writes: > Pietro writes: > >> 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) ))) > How can I modify this function to skip the spell checking ? I would like to > have a third choice which directly sends the message straight away. > Oh, gosh, I just needed to press enter, and since lang is null at that point my message is sent straightaway ... :-) >> 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! > I am afraid I am not ready yet ... :-( Definitely not ready !