commit/cc-mode: 2 new changesets
12 years, 9 months
Bitbucket
2 new commits in cc-mode:
https://bitbucket.org/xemacs/cc-mode/changeset/dac1c784ef66/
changeset: dac1c784ef66
user: acm
date: 2012-03-12 22:28:36
summary: Make c-mark-defun extend region when repeated and leave a mark.
affected #: 1 file
diff -r 72c17e2c12a5cd58f7e46f3d8a8a322d840ac564 -r dac1c784ef66a4cbddc0d882bb88d7d68904be2f cc-cmds.el
--- a/cc-cmds.el
+++ b/cc-cmds.el
@@ -1950,10 +1950,17 @@
(defun c-mark-function ()
"Put mark at end of the current top-level declaration or macro, point at beginning.
-If point is not inside any then the closest following one is chosen.
+If point is not inside any then the closest following one is
+chosen. Each successive call of this command extends the marked
+region by one function.
+
+A mark is left where the command started.
As opposed to \\[c-beginning-of-defun] and \\[c-end-of-defun], this
function does not require the declaration to contain a brace block."
+ ;; Middle sentence of doc-string was: A mark is left where the command
+ ;; started, unless the region is already active \(in Transient Mark mode).
+ ;; FIXME!!! for transient-mark/zemacs sometime. (2012-03-08.)
(interactive)
(let (decl-limits)
@@ -1966,8 +1973,26 @@
(if (not decl-limits)
(error "Cannot find any declaration")
- (goto-char (car decl-limits))
- (push-mark (cdr decl-limits) nil t))))
+ (let* ((extend-region-p
+ (and (eq this-command 'c-mark-function)
+ (eq last-command 'c-mark-function)))
+ (push-mark-p (and (eq this-command 'c-mark-function)
+ (not extend-region-p)
+ ;; (not (and transient-mark-mode mark-active))
+ ;; FIXME!!!, sometime (2012-03-08.)
+ )))
+ (if push-mark-p (push-mark (point)))
+ (if extend-region-p
+ (progn
+ (exchange-point-and-mark)
+ (setq decl-limits (c-declaration-limits t))
+ (when (not decl-limits)
+ (exchange-point-and-mark)
+ (error "Cannot find any declaration"))
+ (goto-char (cdr decl-limits))
+ (exchange-point-and-mark))
+ (goto-char (car decl-limits))
+ (push-mark (cdr decl-limits) nil t))))))
(defun c-cpp-define-name ()
"Return the name of the current CPP macro, or NIL if we're not in one."
https://bitbucket.org/xemacs/cc-mode/changeset/e8d870ec5a3a/
changeset: e8d870ec5a3a
user: acm
date: 2012-03-12 22:31:25
summary: merge.
affected #: 3 files
diff -r dac1c784ef66a4cbddc0d882bb88d7d68904be2f -r e8d870ec5a3a004aa9e98907d2bf3c95e1b7ffb5 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -84,3 +84,4 @@
965402f1148652d2f746460a4886d3089a160d94 cc-mode-1_49
c98d6d26469325e40ca583a4405d121fa0d44ca8 cc-mode-1_50
3eb9de826afe87ee4f9f5a718373c616a00d1c40 cc-mode-1_51
+ca5959d9f677f0de84c0607fd20cf8f19121b9ec cc-mode-1_52
diff -r dac1c784ef66a4cbddc0d882bb88d7d68904be2f -r e8d870ec5a3a004aa9e98907d2bf3c95e1b7ffb5 ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-06 Norbert Koch <viteno(a)xemacs.org>
+
+ * Makefile (VERSION): XEmacs package 1.52 released.
+
2012-02-14 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.51 released.
diff -r dac1c784ef66a4cbddc0d882bb88d7d68904be2f -r e8d870ec5a3a004aa9e98907d2bf3c95e1b7ffb5 Makefile
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-VERSION = 1.51
+VERSION = 1.52
AUTHOR_VERSION = 5.32.2
MAINTAINER = Alan Mackenzie <bug-cc-mode(a)gnu.org>
PACKAGE = cc-mode
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/xemacs-packages: 3 new changesets
12 years, 9 months
Bitbucket
3 new commits in xemacs-packages:
https://bitbucket.org/xemacs/xemacs-packages/changeset/b2a39ecb9373/
changeset: b2a39ecb9373
user: Norbert Koch
date: 2012-03-06 09:37:29
summary: update cc-mode
affected #: 1 file
diff -r eb9ae6b9b5c6fd1c23df7eb5809eeb752f1d3d70 -r b2a39ecb9373ddc50ccbb57657c68ffd97c304d3 .hgsubstate
--- a/.hgsubstate
+++ b/.hgsubstate
@@ -17,7 +17,7 @@
da4e7d4a51c502e5ac05a224cb756f382f0ba4d7 xemacs-packages/c-support
11074b3808d1e349f3fddb3c4d50f8be7c0f859e xemacs-packages/calc
7524e4fb9de45d77812090a724fac4ebd7549d6e xemacs-packages/calendar
-db47e6262e803b627424eb59286b44f8a000ae3f xemacs-packages/cc-mode
+72c17e2c12a5cd58f7e46f3d8a8a322d840ac564 xemacs-packages/cc-mode
a7ae1cfb2376bcd32617c1c88afe08872b11d298 xemacs-packages/cedet-common
87dd21fac17ea98219267b1378b4696698d6c4ff xemacs-packages/clearcase
e18acdbfcd36295d052cd56fa2e6d78c68b4b7d4 xemacs-packages/cogre
https://bitbucket.org/xemacs/xemacs-packages/changeset/f99d97470348/
changeset: f99d97470348
user: Norbert Koch
date: 2012-03-06 09:37:55
summary: XEmacs Package Release
affected #: 1 file
diff -r b2a39ecb9373ddc50ccbb57657c68ffd97c304d3 -r f99d97470348129b6632f39e6045e2f2fa5ae85f ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-06 Norbert Koch <viteno(a)xemacs.org>
+
+ * Packages released: cc-mode.
+
2012-02-14 Norbert Koch <viteno(a)xemacs.org>
* Packages released: cc-mode.
https://bitbucket.org/xemacs/xemacs-packages/changeset/ca7e48216cc6/
changeset: ca7e48216cc6
user: Norbert Koch
date: 2012-03-06 13:51:50
summary: Prerelease cc-mode
affected #: 1 file
diff -r f99d97470348129b6632f39e6045e2f2fa5ae85f -r ca7e48216cc69c460a049c48fa4a7e3184888e46 .hgsubstate
--- a/.hgsubstate
+++ b/.hgsubstate
@@ -17,7 +17,7 @@
da4e7d4a51c502e5ac05a224cb756f382f0ba4d7 xemacs-packages/c-support
11074b3808d1e349f3fddb3c4d50f8be7c0f859e xemacs-packages/calc
7524e4fb9de45d77812090a724fac4ebd7549d6e xemacs-packages/calendar
-72c17e2c12a5cd58f7e46f3d8a8a322d840ac564 xemacs-packages/cc-mode
+7e0e0dedcf55f80521a208ff1d64d1f42b13fb98 xemacs-packages/cc-mode
a7ae1cfb2376bcd32617c1c88afe08872b11d298 xemacs-packages/cedet-common
87dd21fac17ea98219267b1378b4696698d6c4ff xemacs-packages/clearcase
e18acdbfcd36295d052cd56fa2e6d78c68b4b7d4 xemacs-packages/cogre
Repository URL: https://bitbucket.org/xemacs/xemacs-packages/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/cc-mode: 2 new changesets
12 years, 9 months
Bitbucket
2 new commits in cc-mode:
https://bitbucket.org/xemacs/cc-mode/changeset/ca5959d9f677/
changeset: ca5959d9f677
user: Norbert Koch
date: 2012-03-06 09:37:55
summary: XEmacs Package Release 1.52
affected #: 2 files
diff -r 72c17e2c12a5cd58f7e46f3d8a8a322d840ac564 -r ca5959d9f677f0de84c0607fd20cf8f19121b9ec ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-06 Norbert Koch <viteno(a)xemacs.org>
+
+ * Makefile (VERSION): XEmacs package 1.52 released.
+
2012-02-14 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.51 released.
diff -r 72c17e2c12a5cd58f7e46f3d8a8a322d840ac564 -r ca5959d9f677f0de84c0607fd20cf8f19121b9ec Makefile
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-VERSION = 1.51
+VERSION = 1.52
AUTHOR_VERSION = 5.32.2
MAINTAINER = Alan Mackenzie <bug-cc-mode(a)gnu.org>
PACKAGE = cc-mode
https://bitbucket.org/xemacs/cc-mode/changeset/7e0e0dedcf55/
changeset: 7e0e0dedcf55
user: Norbert Koch
date: 2012-03-06 09:37:55
summary: Added tag cc-mode-1_52 for changeset ca5959d9f677
affected #: 1 file
diff -r ca5959d9f677f0de84c0607fd20cf8f19121b9ec -r 7e0e0dedcf55f80521a208ff1d64d1f42b13fb98 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -84,3 +84,4 @@
965402f1148652d2f746460a4886d3089a160d94 cc-mode-1_49
c98d6d26469325e40ca583a4405d121fa0d44ca8 cc-mode-1_50
3eb9de826afe87ee4f9f5a718373c616a00d1c40 cc-mode-1_51
+ca5959d9f677f0de84c0607fd20cf8f19121b9ec cc-mode-1_52
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/cc-mode: 4 new changesets
12 years, 9 months
Bitbucket
4 new commits in cc-mode:
https://bitbucket.org/xemacs/cc-mode/changeset/8dbdc285ad39/
changeset: 8dbdc285ad39
user: acm
date: 2012-03-05 15:14:34
summary: Optimise c-state-safe-place
affected #: 1 file
diff -r 0966dd523d17f3f03847def27b95a0b0e5c25281 -r 8dbdc285ad39c20db54cfa7624b541f218961e0e cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -2130,43 +2130,45 @@
(widen)
(save-excursion
(let ((c c-state-nonlit-pos-cache)
- pos npos lit macro-beg macro-end)
+ pos npos high-pos lit macro-beg macro-end)
;; Trim the cache to take account of buffer changes.
(while (and c (> (car c) c-state-nonlit-pos-cache-limit))
(setq c (cdr c)))
(setq c-state-nonlit-pos-cache c)
(while (and c (> (car c) here))
+ (setq high-pos (car c))
(setq c (cdr c)))
(setq pos (or (car c) (point-min)))
- (while
- ;; Add an element to `c-state-nonlit-pos-cache' each iteration.
- (and
- (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
-
- ;; Test for being in a literal.
- (progn
- (setq lit (car (cddr (c-state-pp-to-literal pos npos))))
- (or (null lit)
- (prog1 (<= (cdr lit) here)
- (setq npos (cdr lit)))))
-
- ;; Test for being in a macro.
- (progn
- (goto-char npos)
- (setq macro-beg
- (and (c-beginning-of-macro) (/= (point) npos) (point)))
- (when macro-beg
- (c-syntactic-end-of-macro)
- (or (eobp) (forward-char))
- (setq macro-end (point)))
- (or (null macro-beg)
- (prog1 (<= macro-end here)
- (setq npos macro-end)))))
-
- (setq pos npos)
- (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
+ (unless high-pos
+ (while
+ ;; Add an element to `c-state-nonlit-pos-cache' each iteration.
+ (and
+ (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
+
+ ;; Test for being in a literal. If so, go to after it.
+ (progn
+ (setq lit (car (cddr (c-state-pp-to-literal pos npos))))
+ (or (null lit)
+ (prog1 (<= (cdr lit) here)
+ (setq npos (cdr lit)))))
+
+ ;; Test for being in a macro. If so, go to after it.
+ (progn
+ (goto-char npos)
+ (setq macro-beg
+ (and (c-beginning-of-macro) (/= (point) npos) (point)))
+ (when macro-beg
+ (c-syntactic-end-of-macro)
+ (or (eobp) (forward-char))
+ (setq macro-end (point)))
+ (or (null macro-beg)
+ (prog1 (<= macro-end here)
+ (setq npos macro-end)))))
+
+ (setq pos npos)
+ (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache))))
(if (> pos c-state-nonlit-pos-cache-limit)
(setq c-state-nonlit-pos-cache-limit pos))
https://bitbucket.org/xemacs/cc-mode/changeset/1301ab06c9fa/
changeset: 1301ab06c9fa
user: acm
date: 2012-03-05 15:15:44
summary: Merge
affected #: 3 files
diff -r 8dbdc285ad39c20db54cfa7624b541f218961e0e -r 1301ab06c9fac5010f17a064b773f64911f48b94 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -83,3 +83,4 @@
d9e2f6a5fc7f15598c443cc92ff7593d4a4caa18 cc-mode-1_48
965402f1148652d2f746460a4886d3089a160d94 cc-mode-1_49
c98d6d26469325e40ca583a4405d121fa0d44ca8 cc-mode-1_50
+3eb9de826afe87ee4f9f5a718373c616a00d1c40 cc-mode-1_51
diff -r 8dbdc285ad39c20db54cfa7624b541f218961e0e -r 1301ab06c9fac5010f17a064b773f64911f48b94 ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-02-14 Norbert Koch <viteno(a)xemacs.org>
+
+ * Makefile (VERSION): XEmacs package 1.51 released.
+
2012-02-09 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.50 released.
diff -r 8dbdc285ad39c20db54cfa7624b541f218961e0e -r 1301ab06c9fac5010f17a064b773f64911f48b94 Makefile
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-VERSION = 1.50
+VERSION = 1.51
AUTHOR_VERSION = 5.32.2
MAINTAINER = Alan Mackenzie <bug-cc-mode(a)gnu.org>
PACKAGE = cc-mode
https://bitbucket.org/xemacs/cc-mode/changeset/90a496f451d4/
changeset: 90a496f451d4
user: acm
date: 2012-03-05 15:20:21
summary: Optimise macro handling with a 1 element cache of beginning and end.
affected #: 4 files
diff -r 1301ab06c9fac5010f17a064b773f64911f48b94 -r 90a496f451d448a75b99ae38cd79b8ff0fd13ac6 cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -222,6 +222,38 @@
(point))))
c-macro-start))
+;; One element macro cache to cope with continual movement within very large
+;; CPP macros.
+(defvar c-macro-cache nil)
+(make-variable-buffer-local 'c-macro-cache)
+;; Nil or cons of the bounds of the most recent CPP form probed by
+;; `c-beginning-of-macro', `c-end-of-macro' or `c-syntactic-end-of-macro'.
+;; The cdr will be nil if we know only the start of the CPP form.
+(defvar c-macro-cache-start-pos nil)
+(make-variable-buffer-local 'c-macro-cache-start-pos)
+;; The starting position from where we determined `c-macro-cache'.
+(defvar c-macro-cache-syntactic nil)
+(make-variable-buffer-local 'c-macro-cache-syntactic)
+;; non-nil iff `c-macro-cache' has both elements set AND the cdr is at a
+;; syntactic end of macro, not merely an apparent one.
+
+(defun c-invalidate-macro-cache (beg end)
+ ;; Called from a before-change function. If the change region is before or
+ ;; in the macro characterised by `c-macro-cache' etc., nullify it
+ ;; appropriately. BEG and END are the standard before-change-functions
+ ;; parameters. END isn't used.
+ (cond
+ ((null c-macro-cache))
+ ((< beg (car c-macro-cache))
+ (setq c-macro-cache nil
+ c-macro-cache-start-pos nil
+ c-macro-cache-syntactic nil))
+ ((and (cdr c-macro-cache)
+ (< beg (cdr c-macro-cache)))
+ (setcdr c-macro-cache nil)
+ (setq c-macro-cache-start-pos beg
+ c-macro-cache-syntactic nil))))
+
(defun c-beginning-of-macro (&optional lim)
"Go to the beginning of a preprocessor directive.
Leave point at the beginning of the directive and return t if in one,
@@ -229,19 +261,36 @@
Note that this function might do hidden buffer changes. See the
comment at the start of cc-engine.el for more info."
- (when c-opt-cpp-prefix
- (let ((here (point)))
- (save-restriction
- (if lim (narrow-to-region lim (point-max)))
- (beginning-of-line)
- (while (eq (char-before (1- (point))) ?\\)
- (forward-line -1))
- (back-to-indentation)
- (if (and (<= (point) here)
- (looking-at c-opt-cpp-start))
- t
- (goto-char here)
- nil)))))
+ (let ((here (point)))
+ (when c-opt-cpp-prefix
+ (if (and (car c-macro-cache)
+ (>= (point) (car c-macro-cache))
+ (or (and (cdr c-macro-cache)
+ (<= (point) (cdr c-macro-cache)))
+ (<= (point) c-macro-cache-start-pos)))
+ (unless (< (car c-macro-cache) (or lim (point-min)))
+ (progn (goto-char (max (or lim (point-min)) (car c-macro-cache)))
+ (setq c-macro-cache-start-pos
+ (max c-macro-cache-start-pos here))
+ t))
+ (setq c-macro-cache nil
+ c-macro-cache-start-pos nil
+ c-macro-cache-syntactic nil)
+
+ (save-restriction
+ (if lim (narrow-to-region lim (point-max)))
+ (beginning-of-line)
+ (while (eq (char-before (1- (point))) ?\\)
+ (forward-line -1))
+ (back-to-indentation)
+ (if (and (<= (point) here)
+ (looking-at c-opt-cpp-start))
+ (progn
+ (setq c-macro-cache (cons (point) nil)
+ c-macro-cache-start-pos here)
+ t)
+ (goto-char here)
+ nil))))))
(defun c-end-of-macro ()
"Go to the end of a preprocessor directive.
@@ -251,12 +300,24 @@
Note that this function might do hidden buffer changes. See the
comment at the start of cc-engine.el for more info."
- (while (progn
- (end-of-line)
- (when (and (eq (char-before) ?\\)
- (not (eobp)))
- (forward-char)
- t))))
+ (if (and (cdr c-macro-cache)
+ (<= (point) (cdr c-macro-cache))
+ (>= (point) (car c-macro-cache)))
+ (goto-char (cdr c-macro-cache))
+ (unless (and (car c-macro-cache)
+ (<= (point) c-macro-cache-start-pos)
+ (>= (point) (car c-macro-cache)))
+ (setq c-macro-cache nil
+ c-macro-cache-start-pos nil
+ c-macro-cache-syntactic nil))
+ (while (progn
+ (end-of-line)
+ (when (and (eq (char-before) ?\\)
+ (not (eobp)))
+ (forward-char)
+ t)))
+ (when (car c-macro-cache)
+ (setcdr c-macro-cache (point)))))
(defun c-syntactic-end-of-macro ()
;; Go to the end of a CPP directive, or a "safe" pos just before.
@@ -271,12 +332,15 @@
;; at the start of cc-engine.el for more info.
(let* ((here (point))
(there (progn (c-end-of-macro) (point)))
- (s (parse-partial-sexp here there)))
- (while (and (or (nth 3 s) ; in a string
- (nth 4 s)) ; in a comment (maybe at end of line comment)
- (> there here)) ; No infinite loops, please.
- (setq there (1- (nth 8 s)))
- (setq s (parse-partial-sexp here there)))
+ s)
+ (unless c-macro-cache-syntactic
+ (setq s (parse-partial-sexp here there))
+ (while (and (or (nth 3 s) ; in a string
+ (nth 4 s)) ; in a comment (maybe at end of line comment)
+ (> there here)) ; No infinite loops, please.
+ (setq there (1- (nth 8 s)))
+ (setq s (parse-partial-sexp here there)))
+ (setq c-macro-cache-syntactic (car c-macro-cache)))
(point)))
(defun c-forward-over-cpp-define-id ()
diff -r 1301ab06c9fac5010f17a064b773f64911f48b94 -r 90a496f451d448a75b99ae38cd79b8ff0fd13ac6 cc-fonts.el
--- a/cc-fonts.el
+++ b/cc-fonts.el
@@ -409,7 +409,8 @@
(cc-eval-when-compile
(boundp 'parse-sexp-lookup-properties)))
(BOD-limit
- (c-determine-limit 1000)))
+ (c-determine-limit 500 ;; 1000
+ )))
(goto-char
(let ((here (point)))
(if (eq (car (c-beginning-of-decl-1 BOD-limit)) 'same)
diff -r 1301ab06c9fac5010f17a064b773f64911f48b94 -r 90a496f451d448a75b99ae38cd79b8ff0fd13ac6 cc-langs.el
--- a/cc-langs.el
+++ b/cc-langs.el
@@ -444,8 +444,10 @@
;; For documentation see the following c-lang-defvar of the same name.
;; The value here may be a list of functions or a single function.
t nil
- c++ '(c-extend-region-for-CPP c-before-change-check-<>-operators)
- (c objc) 'c-extend-region-for-CPP
+ c++ '(c-extend-region-for-CPP
+ c-before-change-check-<>-operators
+ c-invalidate-macro-cache)
+ (c objc) '(c-extend-region-for-CPP c-invalidate-macro-cache)
;; java 'c-before-change-check-<>-operators
awk 'c-awk-record-region-clear-NL)
(c-lang-defvar c-get-state-before-change-functions
diff -r 1301ab06c9fac5010f17a064b773f64911f48b94 -r 90a496f451d448a75b99ae38cd79b8ff0fd13ac6 cc-vars.el
--- a/cc-vars.el
+++ b/cc-vars.el
@@ -1653,7 +1653,8 @@
c-macro-names-with-semicolon))))))
(defvar c-macro-names-with-semicolon
- '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS")
+; '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS")
+ nil
"List of #defined symbols whose expansion ends with a semicolon.
Alternatively it can be a string, a regular expression which
matches all such symbols.
https://bitbucket.org/xemacs/cc-mode/changeset/72c17e2c12a5/
changeset: 72c17e2c12a5
user: acm
date: 2012-03-05 15:25:59
summary: Depessimize the handling of very large macros.
affected #: 3 files
diff -r 90a496f451d448a75b99ae38cd79b8ff0fd13ac6 -r 72c17e2c12a5cd58f7e46f3d8a8a322d840ac564 cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -2154,6 +2154,18 @@
;; reduced by buffer changes, and increased by invocations of
;; `c-state-literal-at'.
+(defvar c-state-semi-nonlit-pos-cache nil)
+(make-variable-buffer-local 'c-state-semi-nonlit-pos-cache)
+;; A list of buffer positions which are known not to be in a literal. This is
+;; ordered with higher positions at the front of the list. Only those which
+;; are less than `c-state-semi-nonlit-pos-cache-limit' are valid.
+
+(defvar c-state-semi-nonlit-pos-cache-limit 1)
+(make-variable-buffer-local 'c-state-semi-nonlit-pos-cache-limit)
+;; An upper limit on valid entries in `c-state-semi-nonlit-pos-cache'. This is
+;; reduced by buffer changes, and increased by invocations of
+;; `c-state-literal-at'. FIMXE!!!
+
(defsubst c-state-pp-to-literal (from to)
;; Do a parse-partial-sexp from FROM to TO, returning either
;; (STATE TYPE (BEG . END)) if TO is in a literal; or
@@ -2232,12 +2244,55 @@
(setq npos macro-end)))))
(setq pos npos)
- (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache))))
+ (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
+ ;; Add one extra element above HERE so as to to avoid the previous
+ ;; expensive calculation when the next call is close to the current
+ ;; one. This is especially useful when inside a large macro.
+ (setq c-state-nonlit-pos-cache (cons npos c-state-nonlit-pos-cache)))
(if (> pos c-state-nonlit-pos-cache-limit)
(setq c-state-nonlit-pos-cache-limit pos))
pos))))
+(defun c-state-semi-safe-place (here)
+ ;; Return a buffer position before HERE which is "safe", i.e. outside any
+ ;; string or comment. It may be in a macro.
+ (save-restriction
+ (widen)
+ (save-excursion
+ (let ((c c-state-semi-nonlit-pos-cache)
+ pos npos high-pos lit macro-beg macro-end)
+ ;; Trim the cache to take account of buffer changes.
+ (while (and c (> (car c) c-state-semi-nonlit-pos-cache-limit))
+ (setq c (cdr c)))
+ (setq c-state-semi-nonlit-pos-cache c)
+
+ (while (and c (> (car c) here))
+ (setq high-pos (car c))
+ (setq c (cdr c)))
+ (setq pos (or (car c) (point-min)))
+
+ (unless high-pos
+ (while
+ ;; Add an element to `c-state-semi-nonlit-pos-cache' each iteration.
+ (and
+ (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
+
+ ;; Test for being in a literal. If so, go to after it.
+ (progn
+ (setq lit (car (cddr (c-state-pp-to-literal pos npos))))
+ (or (null lit)
+ (prog1 (<= (cdr lit) here)
+ (setq npos (cdr lit))))))
+
+ (setq pos npos)
+ (setq c-state-semi-nonlit-pos-cache
+ (cons pos c-state-semi-nonlit-pos-cache))))
+
+ (if (> pos c-state-semi-nonlit-pos-cache-limit)
+ (setq c-state-semi-nonlit-pos-cache-limit pos))
+ pos))))
+
(defun c-state-literal-at (here)
;; If position HERE is inside a literal, return (START . END), the
;; boundaries of the literal (which may be outside the accessible bit of the
@@ -3056,9 +3111,11 @@
;;
;; This function is called from c-after-change.
- ;; The cache of non-literals:
+ ;; The caches of non-literals:
(if (< here c-state-nonlit-pos-cache-limit)
(setq c-state-nonlit-pos-cache-limit here))
+ (if (< here c-state-semi-nonlit-pos-cache-limit)
+ (setq c-state-semi-nonlit-pos-cache-limit here))
;; `c-state-cache':
;; Case 1: if `here' is in a literal containing point-min, everything
@@ -4310,7 +4367,7 @@
comment at the start of cc-engine.el for more info."
(save-restriction
(widen)
- (let* ((safe-place (c-state-safe-place (point)))
+ (let* ((safe-place (c-state-semi-safe-place (point)))
(lit (c-state-pp-to-literal safe-place (point))))
(or (cadr lit)
(and detect-cpp
@@ -4334,7 +4391,7 @@
(save-excursion
(let* ((pos (point))
- (lim (or lim (c-state-safe-place pos)))
+ (lim (or lim (c-state-semi-safe-place pos)))
(pp-to-lit (save-restriction
(widen)
(c-state-pp-to-literal lim pos)))
@@ -4452,7 +4509,7 @@
;; Get a "safe place" approximately TRY-SIZE characters before START.
;; This doesn't preserve point.
(let* ((pos (max (- start try-size) (point-min)))
- (base (c-state-safe-place pos))
+ (base (c-state-semi-safe-place pos))
(s (parse-partial-sexp base pos)))
(if (or (nth 4 s) (nth 3 s)) ; comment or string
(nth 8 s)
diff -r 90a496f451d448a75b99ae38cd79b8ff0fd13ac6 -r 72c17e2c12a5cd58f7e46f3d8a8a322d840ac564 cc-fonts.el
--- a/cc-fonts.el
+++ b/cc-fonts.el
@@ -409,8 +409,7 @@
(cc-eval-when-compile
(boundp 'parse-sexp-lookup-properties)))
(BOD-limit
- (c-determine-limit 500 ;; 1000
- )))
+ (c-determine-limit 1000)))
(goto-char
(let ((here (point)))
(if (eq (car (c-beginning-of-decl-1 BOD-limit)) 'same)
diff -r 90a496f451d448a75b99ae38cd79b8ff0fd13ac6 -r 72c17e2c12a5cd58f7e46f3d8a8a322d840ac564 cc-vars.el
--- a/cc-vars.el
+++ b/cc-vars.el
@@ -1653,8 +1653,7 @@
c-macro-names-with-semicolon))))))
(defvar c-macro-names-with-semicolon
-; '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS")
- nil
+ '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS")
"List of #defined symbols whose expansion ends with a semicolon.
Alternatively it can be a string, a regular expression which
matches all such symbols.
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
[COMMIT] select-coercion-alist, not select-conversion-alist, select.el
12 years, 9 months
Aidan Kehoe
Ar an séú lá is fiche de mí Feabhra, scríobh Philip Aston:
> I've recently pulled the latest beta.
>
> If I copy some text them run yank-clipboard-selection, I recieve the
> following error:
>
> Debugger entered--Lisp error: (void-variable selection-conversion-alist)
> select-coerce(CLIPBOARD TARGETS "expression")
This was my bug; thank you Philip!
APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1330712774 0
# Node ID 0df3cedee9ac6e12eac0e246466909560da38b3b
# Parent 611a6845ebeeecf74cb6f56bb15a1115e76affa9
select-coercion-alist, not select-conversion-alist, select.el
2012-03-02 Aidan Kehoe <kehoea(a)parhasard.net>
* select.el (select-coerce):
Whoops, selection-coercion-alist, not selection-conversion-alist,
thank you Philip Aston in 4F4A2CBC.1060709(a)mail.com .
diff -r 611a6845ebee -r 0df3cedee9ac lisp/ChangeLog
--- a/lisp/ChangeLog Mon Feb 13 08:00:23 2012 -0500
+++ b/lisp/ChangeLog Fri Mar 02 18:26:14 2012 +0000
@@ -1,3 +1,9 @@
+2012-03-02 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * select.el (select-coerce):
+ Whoops, selection-coercion-alist, not selection-conversion-alist,
+ thank you Philip Aston in 4F4A2CBC.1060709(a)mail.com .
+
2012-01-14 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-catch):
diff -r 611a6845ebee -r 0df3cedee9ac lisp/select.el
--- a/lisp/select.el Mon Feb 13 08:00:23 2012 -0500
+++ b/lisp/select.el Fri Mar 02 18:26:14 2012 +0000
@@ -443,7 +443,7 @@
suitable for return from `get-selection' in the specified DATA-TYPE. Return
nil if this is impossible, or a suitable representation otherwise."
(and value
- (funcall (or (cdr (assq type selection-conversion-alist)) #'ignore)
+ (funcall (or (cdr (assq type selection-coercion-alist)) #'ignore)
selection type value)))
;; The rest of the functions on this "page" are conversion handlers,
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit/XEmacs: kehoea: select-coercion-alist, not select-conversion-alist, select.el
12 years, 9 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/changeset/0df3cedee9ac/
changeset: 0df3cedee9ac
user: kehoea
date: 2012-03-02 19:26:14
summary: select-coercion-alist, not select-conversion-alist, select.el
2012-03-02 Aidan Kehoe <kehoea(a)parhasard.net>
* select.el (select-coerce):
Whoops, selection-coercion-alist, not selection-conversion-alist,
thank you Philip Aston in 4F4A2CBC.1060709(a)mail.com .
affected #: 2 files
diff -r 611a6845ebeeecf74cb6f56bb15a1115e76affa9 -r 0df3cedee9ac6e12eac0e246466909560da38b3b lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-02 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * select.el (select-coerce):
+ Whoops, selection-coercion-alist, not selection-conversion-alist,
+ thank you Philip Aston in 4F4A2CBC.1060709(a)mail.com .
+
2012-01-14 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-catch):
diff -r 611a6845ebeeecf74cb6f56bb15a1115e76affa9 -r 0df3cedee9ac6e12eac0e246466909560da38b3b lisp/select.el
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -443,7 +443,7 @@
suitable for return from `get-selection' in the specified DATA-TYPE. Return
nil if this is impossible, or a suitable representation otherwise."
(and value
- (funcall (or (cdr (assq type selection-conversion-alist)) #'ignore)
+ (funcall (or (cdr (assq type selection-coercion-alist)) #'ignore)
selection type value)))
;; The rest of the functions on this "page" are conversion handlers,
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches