From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/18125 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 01:17:05 +0100 Message-ID: <87ziuxzh8e.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> 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 1455841056 31462 80.91.229.3 (19 Feb 2016 00:17:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Feb 2016 00:17:36 +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 01:17:27 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 1aWYlB-0000bx-Cj for gegu-info-gnus-english@m.gmane.org; Fri, 19 Feb 2016 01:17:25 +0100 Original-Received: from localhost ([::1]:46775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWYlA-00015q-H4 for gegu-info-gnus-english@m.gmane.org; Thu, 18 Feb 2016 19:17:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWYl8-00015T-Hp for info-gnus-english@gnu.org; Thu, 18 Feb 2016 19:17:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWYl5-0002F9-Aa for info-gnus-english@gnu.org; Thu, 18 Feb 2016 19:17:22 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:49566) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWYl5-0002F2-3I for info-gnus-english@gnu.org; Thu, 18 Feb 2016 19:17:19 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aWYl2-0000U6-Ru for info-gnus-english@gnu.org; Fri, 19 Feb 2016 01:17:16 +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 01:17:16 +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 01:17:16 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: info-gnus-english@gnu.org Original-Lines: 57 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:kmMXvOFNYFC0XLyVJ/eT2DSZNMc= 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:18125 Archived-At: 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) ))) 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 :)) When you understand it move on to do other things :) -- underground experts united http://user.it.uu.se/~embe8573