From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.help Subject: Re: add-hook Date: Sat, 26 Jan 2013 10:21:48 +0400 Message-ID: <874ni4wjk3.fsf@yandex.ru> References: <902E1C3E-E017-4109-9904-803220E5EE58@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1359181328 22875 80.91.229.3 (26 Jan 2013 06:22:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Jan 2013 06:22:08 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Barry Margolin Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 26 07:22:27 2013 Return-path: Envelope-to: geh-help-gnu-emacs@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 1Tyz9m-0003He-5E for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Jan 2013 07:22:26 +0100 Original-Received: from localhost ([::1]:50928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyz9U-0001bP-Gk for geh-help-gnu-emacs@m.gmane.org; Sat, 26 Jan 2013 01:22:08 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyz9L-0001bK-9u for help-gnu-emacs@gnu.org; Sat, 26 Jan 2013 01:22:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tyz9H-0003t2-7h for help-gnu-emacs@gnu.org; Sat, 26 Jan 2013 01:21:59 -0500 Original-Received: from mail-bk0-f49.google.com ([209.85.214.49]:37182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyz9G-0003sw-Vr for help-gnu-emacs@gnu.org; Sat, 26 Jan 2013 01:21:55 -0500 Original-Received: by mail-bk0-f49.google.com with SMTP id w11so604073bku.8 for ; Fri, 25 Jan 2013 22:21:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=i3oS/Y6CP2xaRBs6cW2qntYappTmPPrhll47JczpdTc=; b=AFKdjuCBFJWwh0fdsNkNjddU34BWJBKbOOYS7Enirx5BmLls/6ADFAvLSSesHWOB9+ L20azPlIMwMkV5SjXo0+8dm/9MOkI8XcvxLuxBJVnEJHfKiCS2+NRv8El2e8GFPoOu8s qAsUe9/EysbztcJs0eXecVe8flBbbgd/smI5w7bC1cSIAN2FqnezUYAz6kIL3uz2FCIq ixkfGSW+1j+y+o1x5dHIxDh6qjsmiZiyTC6osMc0i1G4BGzgZHy1VA8YSap6UlOWgEe7 f5vu/Lzw9IHEbUYJdeknRIQFDikmVOM2HEHP362oJjrwtf8LhCbYy2TfzJ/u7Rr71Z3/ BeHg== X-Received: by 10.204.147.10 with SMTP id j10mr2427967bkv.7.1359181314076; Fri, 25 Jan 2013 22:21:54 -0800 (PST) Original-Received: from SOL ([178.252.98.87]) by mx.google.com with ESMTPS id hc16sm2463155bkc.2.2013.01.25.22.21.51 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 25 Jan 2013 22:21:52 -0800 (PST) In-Reply-To: (Barry Margolin's message of "Sat, 26 Jan 2013 00:33:55 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.214.49 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88824 Archived-At: Barry Margolin writes: > In article , > Dmitry Gutov wrote: > >> "Drew Adams" writes: >> > If HOOK is void then it is initialized to nil. >> > >> > (add-hook 'ruby-mode-hook (lambda () (ruby-electric-mode t))) >> >> Or, even shorter: >> >> (add-hook 'ruby-mode-hook 'ruby-electric-mode) > > Not the same. With no argument it toggles, with an argument it turns the > mode on or off as specified by the argument. Not really. It toggles only when the mode function is called interactively. Otherwise, a no-argument call always means "turn on". Try to eval this a few times, for example: (linum-mode) In the context of ruby-electric this is irrelevant anyway, though, since it doesn't have a concept of turning off. Whenever called, it just modifies ruby-mode-map to use its electric commands.