* bug#11929: 24.1.50; Globalized minor mode turn-on function is called twice for each opened file
@ 2012-07-13 4:24 Dmitry Gutov
2019-08-17 21:59 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Gutov @ 2012-07-13 4:24 UTC (permalink / raw)
To: 11929
I raised the topic on help-gnu-emacs previously, but hadn't received an
answer:
http://lists.gnu.org/archive/html/help-gnu-emacs/2012-07/msg00174.html
How to reproduce.
1. Define the minor mode:
(define-minor-mode foo-mode "" :lighter "")
(defun turn-on-foo-mode ()
(message "buffer %s major mode %s" (buffer-name) major-mode)
(foo-mode 1))
(define-globalized-minor-mode global-foo-mode foo-mode turn-on-foo-mode)
2. Turn on the global mode.
3. Open any file, look at the *Messages* buffer.
It will contain something like this:
buffer init.el major mode fundamental-mode
buffer init.el major mode emacs-lisp-mode
If the buffer is going to be immediately switched to another mode,
there's no point in calling the turn-on function in the default mode.
I think this behavior is buggy.
--Dmitry
In GNU Emacs 24.1.50.1 (i386-mingw-nt6.1.7601)
of 2012-07-11 on SOL
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --with-gcc (3.4) --cflags -IH:/Apps/System/gnuwin32/include'
Important settings:
value of $EMACSDATA: C:/Users/gutov/vc/emacs-master/etc
value of $EMACSDOC: C:/Users/gutov/vc/emacs-master/etc
value of $EMACSLOADPATH:
C:/Users/gutov/vc/emacs-master/site-lisp;C:/Users/gutov/vc/emacs-master/../site-lisp;C:/Users/gutov/vc/emacs-master/lisp;C:/Users/gutov/vc/emacs-master/leim
value of $EMACSPATH: C:/Users/gutov/vc/emacs-master/bin
value of $LANG: RU
locale-coding-system: cp1251
default enable-multibyte-characters: t
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#11929: 24.1.50; Globalized minor mode turn-on function is called twice for each opened file
2012-07-13 4:24 bug#11929: 24.1.50; Globalized minor mode turn-on function is called twice for each opened file Dmitry Gutov
@ 2019-08-17 21:59 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-17 21:59 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 11929
Dmitry Gutov <dgutov@yandex.ru> writes:
> 1. Define the minor mode:
>
> (define-minor-mode foo-mode "" :lighter "")
>
> (defun turn-on-foo-mode ()
> (message "buffer %s major mode %s" (buffer-name) major-mode)
> (foo-mode 1))
>
> (define-globalized-minor-mode global-foo-mode foo-mode turn-on-foo-mode)
>
> 2. Turn on the global mode.
>
> 3. Open any file, look at the *Messages* buffer.
> It will contain something like this:
>
> buffer init.el major mode fundamental-mode
> buffer init.el major mode emacs-lisp-mode
>
> If the buffer is going to be immediately switched to another mode,
> there's no point in calling the turn-on function in the default mode.
> I think this behavior is buggy.
If I understand you correctly, you don't think that buffers should first
be opened in `fundamental-mode', and then the "real" major mode, because
this means that globalised minor modes get switched on twice?
I agree that this seems like surprising behaviour, but I think it's been
this way since forever, so perhaps it should just be documented? I'm
not sure where, though... in the `define-globalized-minor-mode' doc
string, perhaps?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-17 21:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-13 4:24 bug#11929: 24.1.50; Globalized minor mode turn-on function is called twice for each opened file Dmitry Gutov
2019-08-17 21:59 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.