From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: k@rdw.se (Chris Stj) Newsgroups: gmane.emacs.bugs Subject: bug#29081: 25.1; define-globalized-minor-mode does not respect :variable of original mode Date: Tue, 31 Oct 2017 13:29:57 +0100 Message-ID: <87efpjijp6.fsf@rdw.se> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1509464488 14967 195.159.176.226 (31 Oct 2017 15:41:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 31 Oct 2017 15:41:28 +0000 (UTC) To: 29081@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 31 16:41:24 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9Yf6-0002Hs-2k for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Oct 2017 16:41:08 +0100 Original-Received: from localhost ([::1]:46249 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9YfD-0008VG-6Y for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Oct 2017 11:41:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9Yf4-0008Tw-0q for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2017 11:41:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9Yf0-0003rL-Ta for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2017 11:41:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35706) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e9Yf0-0003r8-Pw for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2017 11:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e9Yf0-0005HH-KC for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2017 11:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: k@rdw.se (Chris Stj) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Oct 2017 15:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29081 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.150946445120241 (code B ref -1); Tue, 31 Oct 2017 15:41:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 Oct 2017 15:40:51 +0000 Original-Received: from localhost ([127.0.0.1]:44384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9Yeo-0005GP-JH for submit@debbugs.gnu.org; Tue, 31 Oct 2017 11:40:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57492) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9VgP-00073L-Rh for submit@debbugs.gnu.org; Tue, 31 Oct 2017 08:30:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9VgF-00085w-Si for submit@debbugs.gnu.org; Tue, 31 Oct 2017 08:30:12 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:53665) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e9VgF-00085q-PJ for submit@debbugs.gnu.org; Tue, 31 Oct 2017 08:30:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9VgE-0007JN-FI for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2017 08:30:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9Vg8-00081Y-Fp for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2017 08:30:06 -0400 Original-Received: from shelly.rdw.se ([188.226.220.149]:41832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9Vg8-00080v-9K for bug-gnu-emacs@gnu.org; Tue, 31 Oct 2017 08:30:00 -0400 Original-Received: from localhost (vps.xkqr.org [109.74.206.55]) by shelly.rdw.se (Postfix) with ESMTPSA id EDE8E400E9 for ; Tue, 31 Oct 2017 13:29:58 +0100 (CET) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Tue, 31 Oct 2017 11:40:49 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:139268 Archived-At: I tried to define a global version of auto-fill mode by evaluating (define-globalized-minor-mode global-auto-fill-mode auto-fill-mode turn-on-auto-fill) The problem is that when the define-globalized-minor-mode macro expands, it defines the function (defun ,MODE-enable-in-buffers () (dolist (buf ,MODE-buffers) (when (buffer-live-p buf) (with-current-buffer buf (unless ,MODE-set-explicitly (unless (eq ,MODE-major-mode major-mode) (if ,mode (progn (,mode -1) (funcall #',turn-on)) (funcall #',turn-on)))) (setq ,MODE-major-mode major-mode))))) The problem lies in the "if ,mode" condition. This assumes the minor mode variable has the same name as the minor mode itself; which is clearly not true when something else is specified with the :variable keyword in the minor mode definition. I noticed this with auto-fill-mode, since it calls its status variable auto-fill-function rather than auto-fill-mode. I guess the best solution may be to allow users of define-globalized-minor-mode to specify the place in which the minor mode stores its state, since I can't find a good, generic way to extract this from the minor mode definition itself, after the fact. Regards, Chris