GNU bug report logs -
#29081
25.1; define-globalized-minor-mode does not respect :variable of original mode
Previous Next
Reported by: k <at> rdw.se (Chris Stj)
Date: Tue, 31 Oct 2017 15:41:02 UTC
Severity: normal
Tags: confirmed, easy, fixed
Found in version 25.1
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29081 in the body.
You can then email your comments to 29081 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29081
; Package
emacs
.
(Tue, 31 Oct 2017 15:41:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
k <at> rdw.se (Chris Stj)
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 31 Oct 2017 15:41:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29081
; Package
emacs
.
(Sat, 02 Dec 2017 19:05:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 29081 <at> debbugs.gnu.org (full text, mbox):
tags 29081 + confirmed easy
quit
k <at> rdw.se (Chris Stj) writes:
> 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 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.
Makes sense to me.
Added tag(s) confirmed and easy.
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Sat, 02 Dec 2017 19:05:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29081
; Package
emacs
.
(Thu, 04 Feb 2021 14:24:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 29081 <at> debbugs.gnu.org (full text, mbox):
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:
>> 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.
>
> Makes sense to me.
Me too, so I've added this to Emacs 28.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 04 Feb 2021 14:24:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.1, send any further explanations to
29081 <at> debbugs.gnu.org and k <at> rdw.se (Chris Stj)
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 04 Feb 2021 14:24:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 05 Mar 2021 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 52 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.