From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Geoff Gole Newsgroups: gmane.emacs.devel Subject: Re: turning on minor modes from hooks Date: Fri, 4 Sep 2009 14:23:02 -0700 Message-ID: References: <200908292125.n7TLPCdp005058@godzilla.ics.uci.edu> <87eiqui4yx.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1252099403 31017 80.91.229.12 (4 Sep 2009 21:23:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Sep 2009 21:23:23 +0000 (UTC) Cc: stephen@xemacs.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 04 23:23:16 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MjgFX-00043i-KW for ged-emacs-devel@m.gmane.org; Fri, 04 Sep 2009 23:23:15 +0200 Original-Received: from localhost ([127.0.0.1]:51198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjgFW-00064e-Rh for ged-emacs-devel@m.gmane.org; Fri, 04 Sep 2009 17:23:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjgFS-00063g-OY for emacs-devel@gnu.org; Fri, 04 Sep 2009 17:23:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjgFN-0005yP-5X for emacs-devel@gnu.org; Fri, 04 Sep 2009 17:23:09 -0400 Original-Received: from [199.232.76.173] (port=46446 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjgFN-0005y1-0K for emacs-devel@gnu.org; Fri, 04 Sep 2009 17:23:05 -0400 Original-Received: from mail-yx0-f200.google.com ([209.85.210.200]:42306) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjgFM-0001eo-PK for emacs-devel@gnu.org; Fri, 04 Sep 2009 17:23:04 -0400 Original-Received: by yxe38 with SMTP id 38so3273079yxe.6 for ; Fri, 04 Sep 2009 14:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=QcoQp4z80SAiH73xVpuXd7eK+B0OmSdi/+48KEnrU3U=; b=XVSTWspfJKiqsQVjhgUpAwaMKEUCiVs/9B24I+zKTi1qYpxW/cBLbWVGHWC5CcoTMn i5f2XyyUOaVGyZpplWEy3gNscctDWxd4XFDHjAJPA3qvtvIPN5TD2dmybNdluVbKESWJ dmCUv22l3DTLZiY6teYpgyZ7+hSYPxJ1HycSQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=wpqA5aJcdiUtVvd9xwC5tVz7i3w3o5z+dt4cej6R2wMhavZNcKZ7UhYAweOyDup3dp xfr7cv6Sb01jXY6DDjfjnWDZpAd4WAwzgazB/7sQODkQi8C8eKOxwiYSHmgpym6L71XH zjn/s+ZV8WXKXRRhxJYDwz90Q45aorkfxQUL0= Original-Received: by 10.91.20.12 with SMTP id x12mr1339132agi.19.1252099382476; Fri, 04 Sep 2009 14:23:02 -0700 (PDT) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115035 Archived-At: >> What about some kind of enable-minor-mode function? > If you mean a generic function that can enable specific minor modes, > that will just cause proliferation of definitions like > (defun turn-on-auto-fill () (enable-minor-mode 'auto-fill-mode)) > (defun turn-off-auto-fill () (disable-minor-mode 'auto-fill-mode)) Not necessarily. It could return a function suitable for inclusion in a hook: (defun turn-on (minor-mode-symbol) `(lambda () (,minor-mode-symbol t))) (add-hook 'foo-mode-hook (turn-on 'some-minor-mode)) Or maybe (defun turn-on (&rest minor-mode-symbols) `(lambda () ,@(mapcar (lambda (sym) (list sym t)) minor-mode-symbols))) (add-hook 'foo-mode-hook (turn-on 'foo-minor-mode 'bar-minor-mode)) Excuse the fake lexical scoping hack. turn-on is probably also not the right name, as (turn-on 'mode) not turning on any mode might be confusing.