unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gregory Heytings <gregory@heytings.org>
To: Stefan Kangas <stefan@marxist.se>
Cc: 51580@debbugs.gnu.org
Subject: bug#51580: hl-line-mode doesn't override global-hl-line-mode in current buffer
Date: Wed, 03 Nov 2021 11:42:22 +0000	[thread overview]
Message-ID: <11d5fecb447e1d78ea0f@heytings.org> (raw)
In-Reply-To: <CADwFkmmXnt_8OYyF2yaefBYVNBBv4a2qZT=QtVU3xPJ4KHG+rg@mail.gmail.com>


>>> 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))





  reply	other threads:[~2021-11-03 11:42 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 [this message]
2021-11-03 11:51       ` Gregory Heytings
2021-11-03 13:11         ` Gregory Heytings
2021-11-04  0:06       ` Stefan Kangas
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

  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=11d5fecb447e1d78ea0f@heytings.org \
    --to=gregory@heytings.org \
    --cc=51580@debbugs.gnu.org \
    --cc=stefan@marxist.se \
    /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).