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: How to get hook var of the current major mode? Date: Sat, 18 May 2013 17:38:16 +0400 Message-ID: <87r4h45rxz.fsf@yandex.ru> References: <51974E79.1000406@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1368884336 30714 80.91.229.3 (18 May 2013 13:38:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 May 2013 13:38:56 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "netjunegg2\@gmail.com" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 18 15:38:55 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 1UdhLa-0007Op-07 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 May 2013 15:38:54 +0200 Original-Received: from localhost ([::1]:60446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdhLZ-0003Aj-Cm for geh-help-gnu-emacs@m.gmane.org; Sat, 18 May 2013 09:38:53 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdhLF-0003AN-9n for help-gnu-emacs@gnu.org; Sat, 18 May 2013 09:38:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdhL4-0004jP-MB for help-gnu-emacs@gnu.org; Sat, 18 May 2013 09:38:33 -0400 Original-Received: from mail-lb0-f174.google.com ([209.85.217.174]:64551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdhL4-0004iL-Db for help-gnu-emacs@gnu.org; Sat, 18 May 2013 09:38:22 -0400 Original-Received: by mail-lb0-f174.google.com with SMTP id u10so3247444lbi.19 for ; Sat, 18 May 2013 06:38:21 -0700 (PDT) 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:x-antivirus :x-antivirus-status; bh=4ACiN0qPvkV/IwP7cig4AEMwjnkWBFDIjFWER4C2xNo=; b=TFh70Y9movfgTG8qYufIHQwG5Gf/UGoT2Erbg5d+hiG/M1eUyObAMLu3TAsIsjCqZh RfqSNaSVSR9ViiN8Iagzb5u61JqE6yV56lu9N+etW1VpZj046Sq13x5LHMpuq3e/t2dn x9WnwZPb7kD4xyoCDibQTHph9sVe91X6X16HT3+O077SPxjgi6BhNPFF1YrTViF4Acsg HZzrwTN9210YlAuY8W/uX1Rzomqg/q04mRTW5472gWoe0O0FaPyCONyiORU9pJWIwVqo 2gRzsxABzyabKmaMUDl+XbuJ3JXry38dNH35WY4zjwVxJIcwMJqczlgKuiuEae4YADKj RPsA== X-Received: by 10.152.30.103 with SMTP id r7mr3146618lah.25.1368884300990; Sat, 18 May 2013 06:38:20 -0700 (PDT) Original-Received: from SOL ([178.252.98.87]) by mx.google.com with ESMTPSA id ky7sm6510282lbc.16.2013.05.18.06.38.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 18 May 2013 06:38:20 -0700 (PDT) In-Reply-To: <51974E79.1000406@gmail.com> (netjunegg2@gmail.com's message of "Sat, 18 May 2013 09:48:41 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-Antivirus: avast! (VPS 130518-0, 18.05.2013), Outbound message X-Antivirus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.217.174 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:90892 Archived-At: "netjunegg2@gmail.com" writes: > I want to do somthing like this: > (let ((hook (get--the--current--major--mode--hook))) > (add-hook hook (lambda () > (setq truncate-lines t)))) If the major mode is already current, then the hook has already run, hasn't it? Adding a lambda to it will have to effect on the next buffer in the same mode. And if the above form is run many times, each time a new lambda will be added to the hook. But anyway, try (intern (format "%s-hook" major-mode)).