]> git.eshelyaron.com Git - emacs.git/commit
Optimize CC Mode a bit for repetitive insertion and replace-regexp
authorAlan Mackenzie <acm@muc.de>
Fri, 10 May 2019 10:21:09 +0000 (10:21 +0000)
committerAlan Mackenzie <acm@muc.de>
Fri, 10 May 2019 10:21:09 +0000 (10:21 +0000)
commit8ce5e37ce8f3274f0b8dddec723e2c71fbe87ea0
tree248f48c1d12191e8569c135b578cb45323f15048
parenta8d17f35a29d9875e94e28c8405d350b57fd1e80
Optimize CC Mode a bit for repetitive insertion and replace-regexp

This is mainly by enhancing a parse-partial-sexp cache to retain recently
calculated values.  Also, there are several miscellaneous optimizations and
bug fixes.

* lisp/progmodes/cc-engine.el (c-state-semi-nonlit-near-cache): New buffer
local variable.
(c-state-semi-trim-near-cache, c-state-semi-get-near-cache-entry)
(c-state-semi-put-near-cache-entry, c-state-semi-trim-cache): New functions.
(c-state-semi-pp-to-literal, c-state-full-pp-to-literal): Use the new "near"
cache.
(c-parse-ps-state-below): Use the new function c-state-semi-trim-cache.
(c-before-change-check-<>-operators): Check simply for < or > in the
neighbourhood before doing more expensive processing.
(c-maybe-re-mark-raw-string): Give a backward search limit to an operation
which was needlessly lacking one.

* lisp/progmodes/cc-mode.el (c-doc-fl-decl-start, c-doc-fl-decl-end): Check a
certain regexp is valid before performing the (somewhat expensive) actions of
these functions.
(c-fl-decl-start): In the search for a C++ lambda capture list, replace (slow)
calculation of c-parse-state by a (less slow) c-go-up-list-backward.
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-mode.el