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: How do I initialize globalized minor mode only once? Date: Wed, 11 Jul 2012 06:54:12 +0400 Message-ID: <87sjcz80tn.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1341975272 2152 80.91.229.3 (11 Jul 2012 02:54:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 11 Jul 2012 02:54:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 11 04:54:32 2012 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 1Son4R-0002br-Ad for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Jul 2012 04:54:31 +0200 Original-Received: from localhost ([::1]:47631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Son4Q-0002AE-4D for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Jul 2012 22:54:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Son4J-0002A9-Vf for help-gnu-emacs@gnu.org; Tue, 10 Jul 2012 22:54:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Son4I-0004Qp-E5 for help-gnu-emacs@gnu.org; Tue, 10 Jul 2012 22:54:23 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:39365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Son4I-0004Ql-6w for help-gnu-emacs@gnu.org; Tue, 10 Jul 2012 22:54:22 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Son4G-0002PH-7E for help-gnu-emacs@gnu.org; Wed, 11 Jul 2012 04:54:20 +0200 Original-Received: from 178.252.98.87 ([178.252.98.87]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 11 Jul 2012 04:54:20 +0200 Original-Received: from dgutov by 178.252.98.87 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 11 Jul 2012 04:54:20 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 16 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 178.252.98.87 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (windows-nt) Cancel-Lock: sha1:zfDkyS+TpXnl7bnV/g7ulTIb/hQ= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:85774 Archived-At: Hi all, I have written a globalized minor mode which has a relatively costly initialization (external process call), which I need to do when the mode is enabled. But the turn-on function is getting called twice for each new opened buffer, once in default major mode, and once in the final major mode. What's the best way to turn on the minor mode only once? Currently I'm comparing major-mode value to the default value, but that's probably not the best solution, since the minor mode in question can apply to some fundamental-mode (or other default mode) buffers, too. Regards, --Dmitry