From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Richard Newsgroups: gmane.emacs.help Subject: Re: Cancel enabling of minor-mode. Date: Thu, 28 Nov 2013 13:22:09 +0100 Message-ID: <87li08u366.fsf@yahoo.fr> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1385641340 17925 80.91.229.3 (28 Nov 2013 12:22:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Nov 2013 12:22:20 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 28 13:22:24 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 1Vm0bw-0000Za-6S for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Nov 2013 13:22:24 +0100 Original-Received: from localhost ([::1]:41505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm0bv-0003eB-KO for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Nov 2013 07:22:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm0be-0003e4-Rt for help-gnu-emacs@gnu.org; Thu, 28 Nov 2013 07:22:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vm0bX-00087M-Il for help-gnu-emacs@gnu.org; Thu, 28 Nov 2013 07:22:06 -0500 Original-Received: from mxin.ulb.ac.be ([164.15.128.112]:2575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm0bX-00085q-CE for help-gnu-emacs@gnu.org; Thu, 28 Nov 2013 07:21:59 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EADE0l1KkD4Nx/2dsb2JhbABZvFmBM3SCJQEBBAF5EAgDISUPAQRJiAEBDAawKoc/AYhZF4d4hw8HhDMDmBSGLotlgyo7gSwE Original-Received: from geodiff-mac3.ulb.ac.be (HELO geodiff-mac3) ([164.15.131.113]) by smtp.ulb.ac.be with ESMTP; 28 Nov 2013 13:21:56 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 27 Nov 2013 15:53:23 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 164.15.128.112 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:94699 Archived-At: >> Can I somehow cancel enabling of my minor-mode? > > To cancel, you can (setq test-mode nil). IIUC, it will still run any hook associated with the mode like for any mode change (+ show the message "Test mode disabled"). Not too bad, but not exactly like cancelling either. Perhaps some (user-error ...) would be ok in that case ? Otherwise, the OP could define a helper function `test-mode-maybe' which would check and only activate if it's ok. -- Nico.