From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthias Dahl Newsgroups: gmane.emacs.help Subject: conditionally enabling a mode in define-minor-mode context Date: Sun, 11 May 2014 10:50:20 +0200 Message-ID: <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: 7bit X-Trace: ger.gmane.org 1399830622 15763 80.91.229.3 (11 May 2014 17:50:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 May 2014 17:50:22 +0000 (UTC) To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 11 19:50:14 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 1WjXt7-0003cN-Oi for geh-help-gnu-emacs@m.gmane.org; Sun, 11 May 2014 19:50:13 +0200 Original-Received: from localhost ([::1]:33834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjXt7-0004gw-D5 for geh-help-gnu-emacs@m.gmane.org; Sun, 11 May 2014 13:50:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjPSn-0004Ea-Us for help-gnu-emacs@gnu.org; Sun, 11 May 2014 04:50:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjPSh-0005D8-OE for help-gnu-emacs@gnu.org; Sun, 11 May 2014 04:50:29 -0400 Original-Received: from hemera.binary-island.eu ([97.107.138.233]:44462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjPSh-0005BM-Ht for help-gnu-emacs@gnu.org; Sun, 11 May 2014 04:50:23 -0400 Original-Received: from [10.0.0.20] (95-90-41-152-dynip.superkabel.de [95.90.41.152]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by hemera.binary-island.eu (Postfix) with ESMTPSA id 302053C12B for ; Sun, 11 May 2014 04:50:58 -0400 (EDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 97.107.138.233 X-Mailman-Approved-At: Sun, 11 May 2014 13:50:03 -0400 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:97601 Archived-At: Hello @all... 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. Basically, it is a global minor mode w/ a snobbish attitude. ;) I cannot get my head around it how to do this w/ define-minor-mode and define-globalized-minor-mode. Is this possible? Or am I going at it from the wrong angle and there is a more Emacs/elisp idiomatic way to approach this kind of problem? Thanks a lot in advance for each and every help. :) So long, Matthias -- Dipl.-Inf. (FH) Matthias Dahl | Software Engineer | binary-island.eu services: custom software [desktop, mobile, web], server administration