unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: 21507@debbugs.gnu.org
Subject: bug#21507: 25.0.50: (global-SOME-MINOR-MODE) not affecting fundamental mode buffers
Date: Mon, 28 Dec 2020 01:28:44 +0100	[thread overview]
Message-ID: <87h7o66af7.fsf@gnus.org> (raw)
In-Reply-To: <CAFyQvY0uZUu62CN9Cqcx6DWrpWdJa4TYAHrHKXs5KUpiUNm=fA@mail.gmail.com> (Kaushal Modi's message of "Thu, 17 Sep 2015 12:15:46 -0400")

Kaushal Modi <kaushal.modi@gmail.com> writes:

> Please review the below code, eval and run it and proceed with my explanation
> after the code.

It had to be adjusted a bit:

;; my1-mode - init value nil - enabled using its global variant
(define-minor-mode my1-mode
  ""
  :init-value nil
  :lighter " my1")
(defun turn-on-my1-mode () (my1-mode 1))
(define-globalized-minor-mode global-my1-mode my1-mode turn-on-my1-mode)
(global-my1-mode)

;; my2-mode - init value nil - enabled using setq-default
(define-minor-mode my2-mode
  ""
  :init-value nil
  :lighter " my2")
(defun turn-on-my2-mode () (my2-mode 1))
(define-globalized-minor-mode global-my2-mode my2-mode turn-on-my2-mode)
(setq-default my2-mode t)

;; my3-mode - init value t (so enabled by default)
(define-minor-mode my3-mode
  ""
  :init-value t
  :lighter " my3")

> My minor mode is of the type my1-mode above where the init value is
> nil but I enable it in my config using (global-my1-mode).
>
> The global enabling of my1-mode is seen everywhere, all the newly
> created buffers except for the cases where a package would create some
> sort of temp buffer using `get-buffer-create'. Such buffers would be
> in Fundamental mode by default and I noticed that the
> (global-my1-mode) had no effect on those buffers.

I'm still seeing this behaviour in Emacs 28.

> If I tweak my minor mode to be of my2-mode (change the init value to
> t)or my3-mode (force the init value to t using setq-default) types
> above, then my minor mode gets enabled globally in true sense (even in
> buffers created using get-create-buffer).
>
> In essence, setting the init value as t is not the same as enabling a
> globalized minor mode.
>
> Is this by design? 

Anybody know?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-12-28  0:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17 16:15 bug#21507: 25.0.50: (global-SOME-MINOR-MODE) not affecting fundamental mode buffers Kaushal Modi
2020-12-28  0:28 ` Lars Ingebrigtsen [this message]
2021-05-26 22:33   ` Lars Ingebrigtsen
2021-05-26 22:41     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-27 23:37       ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7o66af7.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=21507@debbugs.gnu.org \
    --cc=kaushal.modi@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).