all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kan-Ru Chen <kanru@kanru.info>
To: Alan Mackenzie <acm@muc.de>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Slow fontification in C mode buffers
Date: Fri, 16 Dec 2011 00:16:25 +0800	[thread overview]
Message-ID: <87y5udizdy.fsf@isil.kanru.info> (raw)
In-Reply-To: <20111215134332.GA5698@acm.acm> (Alan Mackenzie's message of "Thu, 15 Dec 2011 13:43:32 +0000")

Alan Mackenzie <acm@muc.de> writes:

> Would you please try the following patch and let me know how it goes.
> Thanks!

No change. c-cheap-inside-bracelist-p seems not called at all.

> *** orig/cc-engine.el	2011-12-15 09:06:28.000000000 +0000
> --- cc-engine.el	2011-12-15 13:41:25.000000000 +0000
> ***************
> *** 8073,8078 ****
> --- 8073,8094 ----
>   	    next-open-brace (c-pull-open-brace paren-state)))
>       open-brace))
>   
> + (defun c-cheap-inside-bracelist-p (paren-state)
> +   ;; Return the position of the L-brace if point is inside a brace list
> +   ;; initialization of an array, etc.  This is an approximate function,
> +   ;; designed for speed over accuracy.  We simply search for "= {" (naturally
> +   ;; with syntactic whitespace allowed).  PAREN-STATE is the normal thing that
> +   ;; it is everywhere else.
> +   (let (b-pos)
> +     (save-excursion
> +       (while
> + 	  (and (setq b-pos (c-pull-open-brace paren-state))
> + 	       (progn (goto-char b-pos)
> + 		      (c-backward-sws)
> + 		      (c-backward-token-2)
> + 		      (not (looking-at "=")))))
> +       b-pos)))
> + 
>   (defun c-inside-bracelist-p (containing-sexp paren-state)
>     ;; return the buffer position of the beginning of the brace list
>     ;; statement if we're inside a brace list, otherwise return nil.
> *** orig/cc-fonts.el	2011-12-15 09:06:28.000000000 +0000
> --- cc-fonts.el	2011-12-15 13:15:43.000000000 +0000
> ***************
> *** 1394,1399 ****
> --- 1394,1405 ----
>   	      (c-fontify-recorded-types-and-refs)
>   	      nil)
>   
> + 	     ;; If point is inside a bracelist, there's no point checking it
> + 	     ;; being at a declarator.
> + 	     ((let ((paren-state (c-parse-state)))
> + 		(c-cheap-inside-bracelist-p paren-state))
> + 	      nil)
> + 
>   	     (t
>   	      ;; Are we at a declarator?  Try to go back to the declaration
>   	      ;; to check this.  If we get there, check whether a "typedef"
>
>> -- 
>> Kanru

-- 
Kanru



  reply	other threads:[~2011-12-15 16:16 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-03 13:19 Slow fontification in C mode buffers Eli Zaretskii
2011-12-03 15:03 ` Sujith
2011-12-03 15:14   ` Eli Zaretskii
2011-12-03 15:32     ` Sujith
2011-12-03 15:18 ` Alan Mackenzie
2011-12-03 16:19   ` Eli Zaretskii
2011-12-13 15:31   ` Kan-Ru Chen
2011-12-14 11:19     ` Alan Mackenzie
2011-12-14 11:30     ` Alan Mackenzie
2011-12-14 12:23       ` Alan Mackenzie
2011-12-14 13:14     ` Alan Mackenzie
2011-12-14 15:02       ` Kan-Ru Chen
2011-12-15 13:43     ` Alan Mackenzie
2011-12-15 16:16       ` Kan-Ru Chen [this message]
2011-12-15 18:12         ` Alan Mackenzie
2011-12-16  2:32           ` Kan-Ru Chen
2011-12-16 11:26             ` Alan Mackenzie
2011-12-17 16:06               ` Kan-Ru Chen
2011-12-21 10:56                 ` Alan Mackenzie
2011-12-21 13:33                   ` Geoff Gole
2011-12-21 16:04                     ` Alan Mackenzie
2011-12-21 16:48                       ` Geoff Gole
2011-12-21 18:06                         ` Alan Mackenzie
2011-12-21 18:16                     ` Eli Zaretskii
2011-12-21 18:32                       ` Geoff Gole
2011-12-21 19:35                         ` Eli Zaretskii
2011-12-23  1:56                     ` Kentaro NAKAZAWA
2011-12-23 12:03                       ` Alan Mackenzie
2012-01-06 22:08                       ` Alan Mackenzie
2012-01-07  0:09                         ` Kentaro NAKAZAWA
2012-01-07 13:50                           ` Alan Mackenzie
2012-01-08  1:26                             ` Kentaro NAKAZAWA
2012-01-08 10:05                               ` Alan Mackenzie
2012-01-20 17:26                               ` Alan Mackenzie
2012-02-06 16:14                                 ` Kentaro NAKAZAWA
2011-12-22 16:06                   ` Kan-Ru Chen
2012-01-13 19:12                 ` Alan Mackenzie
2012-01-14  9:12                   ` Kan-Ru Chen
2012-01-15 21:12                 ` Alan Mackenzie
2012-01-22  4:20                   ` Kan-Ru Chen
2011-12-03 21:15 ` Alan Mackenzie
2011-12-04  6:00   ` Eli Zaretskii

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=87y5udizdy.fsf@isil.kanru.info \
    --to=kanru@kanru.info \
    --cc=acm@muc.de \
    --cc=eliz@gnu.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.