From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: conditionally enabling a mode in define-minor-mode context Date: Sun, 11 May 2014 12:30:34 -0700 (PDT) Message-ID: <32b5873c-d585-4b25-a81c-94fc2c0648e2@default> References: <536F39CC.6080506@binary-island.eu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1399836691 31804 80.91.229.3 (11 May 2014 19:31:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 May 2014 19:31:31 +0000 (UTC) To: Matthias Dahl , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 11 21:31:24 2014 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 1WjZT0-0007la-S7 for geh-help-gnu-emacs@m.gmane.org; Sun, 11 May 2014 21:31:22 +0200 Original-Received: from localhost ([::1]:34127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjZT0-0004Id-Dy for geh-help-gnu-emacs@m.gmane.org; Sun, 11 May 2014 15:31:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjZSh-0004Hb-Sr for help-gnu-emacs@gnu.org; Sun, 11 May 2014 15:31:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjZSZ-00058J-1y for help-gnu-emacs@gnu.org; Sun, 11 May 2014 15:31:03 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:37756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjZSY-00058E-RK for help-gnu-emacs@gnu.org; Sun, 11 May 2014 15:30:54 -0400 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s4BJUXdS003127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 11 May 2014 19:30:35 GMT Original-Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s4BJUW5Y017631 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 11 May 2014 19:30:33 GMT Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s4BJUWet020683; Sun, 11 May 2014 19:30:32 GMT In-Reply-To: <536F39CC.6080506@binary-island.eu> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6691.5000 (x86)] X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 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:97604 Archived-At: > I'm currently working on a new minor mode which requires that for every > newly opened buffer/file which matches several dynamic conditions, it > enables itself (that is key bindings, lighter and such) and otherwise it > silently does nothing (no key bindings, lighter or whatever). Those > conditions go beyond simply tying it to certain major modes or alike. >=20 > Is this possible? Without thinking much about it, I'm guessing you could define two minor modes, one of which you turn on everywhere and which controls the conditional enabling of the other. Again, just a thought, without reflection - ignore if not helpful.