all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: josh@foxtail.org, 13891@debbugs.gnu.org
Subject: bug#13891: 24.3.50; highlight-regexp incorrectly retains partial state after buffer reversion
Date: Thu, 04 Apr 2013 21:16:32 +0530	[thread overview]
Message-ID: <87ppya5mef.fsf@gmail.com> (raw)
In-Reply-To: <jwvmwtfxm98.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 03 Apr 2013 18:55:27 -0400")

[-- Attachment #1: Type: text/plain, Size: 792 bytes --]


>> `hi-lock-interactive-patterns' as `permanent-local'.
>
> Agreed.  Even more so for hi-lock-file-patterns.

>> With `global-hi-lock-mode' ON, you will notice that highlighting will
>> be retained across reverts.
>
> Not any more after my patch.

Whether this change in behaviour counts as a regression, I am not sure.


>> 2. I think `font-lock-fontify-buffer' should be added to
>>    `hi-lock-font-lock-hook'.
>
> Why?

`hi-lock-font-lock-hook' adds the font lock keywords.
`font-lock-fontify-buffer' activates the keywords. 

>>    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'.)
>
> What was your test case?

For the sake of discussion, I undid your patch.  

Apply this patch and re-load hi-lock.el. 


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: hi-lock.el.diff --]
[-- Type: text/x-diff, Size: 623 bytes --]

=== modified file 'lisp/hi-lock.el'
--- lisp/hi-lock.el	2013-03-31 13:34:35 +0000
+++ lisp/hi-lock.el	2013-04-04 14:54:39 +0000
@@ -390,8 +390,8 @@ versions before 22 use the following in
 	  (cons "Regexp Highlighting" hi-lock-menu))
 	(hi-lock-find-patterns)
         (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))
+	(hi-lock-font-lock-hook)
+	(font-lock-fontify-buffer))
     ;; Turned off.
     (when (or hi-lock-interactive-patterns
 	      hi-lock-file-patterns)


[-- Attachment #3: Type: text/plain, Size: 700 bytes --]


1. M-s h r something
2. Modify buffer.
3. Revert buffer.
4. M-: hi-lock-interactive-patterns
   Verify that variable is non-nil.

5. M-x hi-lock-mode.  (For now do it by hand.)
6. See that highlighting kicks in.

My expectation was that once `hi-lock-mode' is turned on
`font-lock-mode-hook' will be *automatically* called.  

Is it the minor mode's responsibility to explicitly call it's
fontification handler?

>
>>    Problem area: `font-lock-mode-hook' is not documented and I really
>>    don't when it is getting called.
>
> font-lock-mode is a normal minor-mode, so font-lock-mode-hook is called
> at the end of running font-lock-mode (both to enable and to disable it).
>
>
>         Stefan

      reply	other threads:[~2013-04-04 15:46 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
2013-04-03 22:55     ` Stefan Monnier
2013-04-04 15:46       ` Jambunathan K [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=87ppya5mef.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=13891@debbugs.gnu.org \
    --cc=josh@foxtail.org \
    --cc=monnier@iro.umontreal.ca \
    /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.