From: Alan Mackenzie <acm@muc.de>
To: Daniel Colascione <dancol@dancol.org>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] emacs-24 d69e9f1: CC Mode: Stop Font Lock forcing fontification from BOL. Fixes debbugs#19669.
Date: Wed, 18 Mar 2015 12:08:07 +0000 [thread overview]
Message-ID: <20150318120806.GA4160@acm.fritz.box> (raw)
In-Reply-To: <55076CF8.60309@dancol.org>
Hello, Daniel.
On Mon, Mar 16, 2015 at 04:53:28PM -0700, Daniel Colascione wrote:
> On 02/01/2015 01:22 PM, Alan Mackenzie wrote:
> > branch: emacs-24
> > commit d69e9f1c24f37f36af33b0468c5a4e100dbb09b6
> > Author: Alan Mackenzie <acm@muc.de>
> > Commit: Alan Mackenzie <acm@muc.de>
> > CC Mode: Stop Font Lock forcing fontification from BOL. Fixes debbugs#19669.
> > cc-mode.el (c-font-lock-init): Setq font-lock-extend-region-functions to
> > nil.
> This change is driving me nuts. Consider the following buffer, with @
> representing point:
> void foo() {
> @
> }
> If I type [f o r SPC], then depending on timing, I see only the "or", or
> only the "r", fontified in font-lock-keyword-face. A moment later,
> jit-lock kicks in and refontifies the entire chunk properly.
Sorry about this.
> Can we please extend the start of the region back to at least the last `}'?
This could be a tricky one to solve. For the sake of your sanity, please
consider applying the following temporary patch; it "solves" the current
problem, but unfortunately leaves bug #19669's symptoms apparent again.
diff -r cffcacba7345 cc-mode.el
--- a/cc-mode.el Sun Feb 01 21:06:18 2015 +0000
+++ b/cc-mode.el Wed Mar 18 12:04:00 2015 +0000
@@ -1208,7 +1208,17 @@
;; Type a space in the first blank line, and the fontification of the next
;; line was fouled up by context fontification.
(let ((new-beg beg) (new-end end) new-region case-fold-search
- open-paren-in-column-0-is-defun-start)
+ open-paren-in-column-0-is-defun-start
+ ;; Except in the after-change case, prevent
+ ;; `font-lock-default-fontify-region' extending the region it will
+ ;; fontify to whole lines. The following binding removes
+ ;; `font-lock-extend-region-whole-lines' from
+ ;; `font-lock-extend-region-functions'. (Emacs only). This fixes
+ ;; Emacs bug #19669.
+ (font-lock-extend-region-functions
+ (and (boundp 'font-lock-extend-region-functions)
+ c-in-after-change-fontification
+ font-lock-extend-region-functions)))
(if c-in-after-change-fontification
(setq c-in-after-change-fontification nil)
(save-restriction
@@ -1247,13 +1257,13 @@
(font-lock-mark-block-function
. c-mark-function)))
- ;; Prevent `font-lock-default-fontify-region' extending the region it will
- ;; fontify to whole lines by removing `font-lock-extend-region-whole-lines'
- ;; (and, coincidentally, `font-lock-extend-region-multiline' (which we do
- ;; not need)) from `font-lock-extend-region-functions'. (Emacs only). This
- ;; fixes Emacs bug #19669.
- (when (boundp 'font-lock-extend-region-functions)
- (setq font-lock-extend-region-functions nil))
+ ;; ;; Prevent `font-lock-default-fontify-region' extending the region it will
+ ;; ;; fontify to whole lines by removing `font-lock-extend-region-whole-lines'
+ ;; ;; (and, coincidentally, `font-lock-extend-region-multiline' (which we do
+ ;; ;; not need)) from `font-lock-extend-region-functions'. (Emacs only). This
+ ;; ;; fixes Emacs bug #19669.
+ ;; (when (boundp 'font-lock-extend-region-functions)
+ ;; (setq font-lock-extend-region-functions nil))
(make-local-variable 'font-lock-fontify-region-function)
(setq font-lock-fontify-region-function 'c-font-lock-fontify-region)
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2015-03-18 12:08 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150201212213.17840.3710@vcs.savannah.gnu.org>
[not found] ` <E1YI1y9-0004eO-Re@vcs.savannah.gnu.org>
2015-02-02 18:50 ` [Emacs-diffs] emacs-24 d69e9f1: CC Mode: Stop Font Lock forcing fontification from BOL. Fixes debbugs#19669 Stefan Monnier
2015-02-02 19:27 ` Alan Mackenzie
2015-02-03 2:12 ` Stefan Monnier
2015-02-02 18:54 ` Stefan Monnier
2015-02-02 21:39 ` Alan Mackenzie
2015-02-03 2:26 ` Stefan Monnier
2015-02-07 12:27 ` Alan Mackenzie
2015-02-07 15:29 ` Stefan Monnier
2015-02-07 15:40 ` Alan Mackenzie
2015-03-16 23:53 ` Daniel Colascione
2015-03-18 12:08 ` Alan Mackenzie [this message]
2015-03-19 3:34 ` Daniel Colascione
2015-03-19 9:31 ` Alan Mackenzie
2015-03-19 13:49 ` Stefan Monnier
2015-03-19 20:37 ` Alan Mackenzie
2015-03-19 20:56 ` Stefan Monnier
2015-03-20 16:30 ` Alan Mackenzie
2015-03-20 16:34 ` Daniel Colascione
2015-03-20 17:29 ` Alan Mackenzie
2015-03-20 21:25 ` Daniel Colascione
2015-03-20 22:30 ` Alan Mackenzie
2015-03-20 18:05 ` Stefan Monnier
2015-03-20 21:12 ` Alan Mackenzie
2015-03-20 22:01 ` Stefan Monnier
2015-03-30 16:44 ` Alan Mackenzie
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=20150318120806.GA4160@acm.fritz.box \
--to=acm@muc.de \
--cc=dancol@dancol.org \
--cc=emacs-devel@gnu.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.