all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Gregory Heytings <gregory@heytings.org>
Cc: 51580@debbugs.gnu.org
Subject: bug#51580: hl-line-mode doesn't override global-hl-line-mode in current buffer
Date: Wed, 3 Nov 2021 17:06:08 -0700	[thread overview]
Message-ID: <CADwFkmmTde304uYr6VUVPnD4HbmvOxAvwXjpqkKPeRHSYs6q-Q@mail.gmail.com> (raw)
In-Reply-To: <11d5fecb447e1d78ea0f@heytings.org> (Gregory Heytings's message of "Wed, 03 Nov 2021 11:42:22 +0000")

Gregory Heytings <gregory@heytings.org> writes:

>>>> It seems like there is currently no way to use `global-hl-line-mode' while
>>>> disabling it for individual buffers.
>>>
>>> There is one: (setq-local global-hl-line-mode nil).
>>
>> Here, that leaves an overlay in the buffer.  Does it not do that for you?
>>
>> [You didn't quote it, but I wrote "(setq-default global-hl-line-mode nil)" in
>> the bug report.  That was a typo.  I meant to write "(setq-local
>> global-hl-line-mode nil)".]
>>
>
> Oh, now I see what you mean.  Indeed I had seen your setq-default, but did not
> guess it meant setq-local.  Indeed, M-: (setq-local global-hl-line-mode nil)
> leaves an overlay in the buffer.  I use this in buffer setup hooks, so the
> overlay is not created.  If you want to remove that overlay, you also need to
> call global-hl-line-unhighlight:
>
> (defun buffer-deactivate-global-hl-line-mode ()
>   (interactive)
>   (global-hl-line-unhighlight)
>   (setq-local global-hl-line-mode nil))

My understanding is that our convention for minor modes that provide
both a global and local variant is that calling the local mode should
disable the global mode in the current buffer.

See for example `show-paren-mode' and `show-paren-local-mode'.

So in line with this convention, I expect that no new command is needed:
I should just be able call `M-x hl-line-mode' to disable it.





  parent reply	other threads:[~2021-11-04  0:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  6:47 bug#51580: hl-line-mode doesn't override global-hl-line-mode in current buffer Stefan Kangas
2021-11-03 10:06 ` Gregory Heytings
2021-11-03 11:28   ` Stefan Kangas
2021-11-03 11:42     ` Gregory Heytings
2021-11-03 11:51       ` Gregory Heytings
2021-11-03 13:11         ` Gregory Heytings
2021-11-04  0:06       ` Stefan Kangas [this message]
2021-11-04 18:09         ` Lars Ingebrigtsen
2022-09-20 11:55 ` 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

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

  git send-email \
    --in-reply-to=CADwFkmmTde304uYr6VUVPnD4HbmvOxAvwXjpqkKPeRHSYs6q-Q@mail.gmail.com \
    --to=stefan@marxist.se \
    --cc=51580@debbugs.gnu.org \
    --cc=gregory@heytings.org \
    /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.