all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: 13891@debbugs.gnu.org
Cc: josh@foxtail.org
Subject: bug#13891: 24.3.50; highlight-regexp incorrectly retains partial state after buffer reversion
Date: Sun, 31 Mar 2013 21:41:12 +0530	[thread overview]
Message-ID: <87k3ono8gv.fsf@gmail.com> (raw)
In-Reply-To: <CANdFEAFUhw-5iMdhZn-XP=vvqnspAvpnOPiYGHqOtoE6XGAgDA@mail.gmail.com>

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> I noticed two things that show that partial highlight-regexp state
>> lingers after calling revert-buffer, see items 9 and 12.  After buffer
>
> I've installed the patch below which should fix those problems.

(This is not a comment on the patch you have put in, but my initial
thoughts as I investigated the bug.)

I have a feeling that your fix is "inconsistent" with having
`hi-lock-interactive-patterns' as `permanent-local'.

`hi-lock-interactive-patterns' is marked as `permanent-local'.  So the
original intention is clearly to *retain* the highlighting across the
reverts and change of major modes.  With `global-hi-lock-mode' ON, you
will notice that highlighting will be retained across reverts.

When M-s h r is used, hi-lock-mode is turned on automatically.  But
after revert, the hi-lock-mode (being a minor mode) never gets turned
back again.

I was thinking of fix along the lines of 

1. If `hi-lock-interactive-patterns' is non-nil, turn on hi-lock-mode.

2. I think `font-lock-fontify-buffer' should be added to
   `hi-lock-font-lock-hook'.  For some reason, `hi-lock-font-lock-hook'
   doesn't get called at all (even though it is added to the
   `font-lock-mode-hook'.)  

   Problem area: `font-lock-mode-hook' is not documented and I really
   don't when it is getting called.

>
>
>         Stefan
>
>
> === modified file 'lisp/hi-lock.el'
> --- lisp/hi-lock.el	2013-03-08 04:18:16 +0000
> +++ lisp/hi-lock.el	2013-03-31 13:31:41 +0000
> @@ -389,7 +389,9 @@
>  	(define-key-after menu-bar-edit-menu [hi-lock]
>  	  (cons "Regexp Highlighting" hi-lock-menu))
>  	(hi-lock-find-patterns)
> -	(add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook nil t))
> +        (add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook nil t)
> +        ;; Remove regexps from font-lock-keywords (bug#13891).
> +	(add-hook 'change-major-mode-hook (lambda () (hi-lock-mode -1)) nil t))
>      ;; Turned off.
>      (when (or hi-lock-interactive-patterns
>  	      hi-lock-file-patterns)





  reply	other threads:[~2013-03-31 16:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06 17:21 bug#13891: 24.3.50; highlight-regexp incorrectly retains partial state after buffer reversion Josh
2013-03-06 19:10 ` Jambunathan K
2013-03-18  7:35   ` Jambunathan K
2013-03-18 14:47     ` Josh
2013-03-31 13:36 ` Stefan Monnier
2013-03-31 16:11   ` Jambunathan K [this message]
2013-04-03 22:55     ` Stefan Monnier
2013-04-04 15:46       ` Jambunathan K

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=87k3ono8gv.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=13891@debbugs.gnu.org \
    --cc=josh@foxtail.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.