From: Lars Ingebrigtsen <larsi@gnus.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 11929@debbugs.gnu.org
Subject: bug#11929: 24.1.50; Globalized minor mode turn-on function is called twice for each opened file
Date: Sat, 17 Aug 2019 14:59:14 -0700 [thread overview]
Message-ID: <87blwnlah9.fsf@mouse.gnus.org> (raw)
In-Reply-To: <4FFFA314.5030509@yandex.ru> (Dmitry Gutov's message of "Fri, 13 Jul 2012 08:24:52 +0400")
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
prev parent reply other threads:[~2019-08-17 21:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87blwnlah9.fsf@mouse.gnus.org \
--to=larsi@gnus.org \
--cc=11929@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.