From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: `define-globalized-minor-mode': why the need for a separate TURN-ON function? Date: Thu, 5 Apr 2012 08:44:42 -0700 Message-ID: <792A96A59B454A7596A0A1676765A152@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1333728706 5365 80.91.229.3 (6 Apr 2012 16:11:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 Apr 2012 16:11:46 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 06 18:11:45 2012 Return-path: Envelope-to: ged-emacs-devel@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 1SGBlB-0006QS-Ot for ged-emacs-devel@m.gmane.org; Fri, 06 Apr 2012 18:11:37 +0200 Original-Received: from localhost ([::1]:34580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGBbS-0004Jt-VF for ged-emacs-devel@m.gmane.org; Fri, 06 Apr 2012 12:01:34 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SForv-0001Tz-Eu for emacs-devel@gnu.org; Thu, 05 Apr 2012 11:45:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SForj-0005xP-MY for emacs-devel@gnu.org; Thu, 05 Apr 2012 11:45:01 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:45815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SForj-0005x6-G0 for emacs-devel@gnu.org; Thu, 05 Apr 2012 11:44:51 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q35Fiiil004929 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 5 Apr 2012 15:44:45 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q35Fihpl010543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 5 Apr 2012 15:44:44 GMT Original-Received: from abhmt110.oracle.com (abhmt110.oracle.com [141.146.116.62]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q35Fihrv013996 for ; Thu, 5 Apr 2012 10:44:43 -0500 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 05 Apr 2012 08:44:42 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Ac0TQwRmk96WiptYSg6h3aJu2856eA== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090205.4F7DBDED.0017,ss=1,re=0.000,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 141.146.126.227 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:149428 Archived-At: I've only looked briefly at this, and am no doubt not noticing something. Anyway, why for `define-globalized-minor-mode' must one define a separate TURN-ON function to turn the mode on, but using the (local) minor-mode function suffices to turn it off? The relevant code in the definition of `define-globalized-minor-mode' seems to be this part: ;; Go through existing buffers. (dolist (buf (buffer-list)) (with-current-buffer buf (if ,global-mode (,turn-on) (when ,mode (,mode -1)))))) Why not just this? (dolist (buf (buffer-list)) (with-current-buffer buf (if ,global-mode (,mode 1) (when ,mode (,mode -1)))))) There is another bit of code later on, but it seems similar - same question: why not just (,mode 1) instead of (,turn-on)? The (local) minor-mode function is already defined, and it does a fine job of turning on the mode in a single buffer - why the need for another, no-args function to do that? There is no doubt a reason, otherwise we wouldn't have introduced this extra TURN-ON hoop as a mandatory arg to `define-globalized-minor-mode'. (I could understand an optional arg, I guess, for the cases where such a turn-on function already exists and might differ for some reason from what the minor-mode function does with a positive arg.) What am I missing? Thx.