# HG changeset patch # User Katsumi Yamaoka # Date 1277160496 0 # Node ID f55bbc59cc752bc398944dd32110202b6cd00c1a # Parent 9557b86a556a17203ff7dc44aab898f54d9b65ef# Parent bfaf9e31b45e68e929a04d192fb4b2af3643ce72 Merge from mainline. diff -r 9557b86a556a -r f55bbc59cc75 INSTALL --- a/INSTALL Sun Jun 20 22:46:22 2010 +0000 +++ b/INSTALL Mon Jun 21 22:48:16 2010 +0000 @@ -105,8 +105,7 @@ Note that the install automatically saves space by compressing (provided you have the `gzip' program) those installed Lisp source (.el) - files that have corresponding .elc versions. You may also wish - to compress the installed Info files. + files that have corresponding .elc versions, as well as the Info files. ADDITIONAL DISTRIBUTION FILES diff -r 9557b86a556a -r f55bbc59cc75 lisp/ChangeLog --- a/lisp/ChangeLog Sun Jun 20 22:46:22 2010 +0000 +++ b/lisp/ChangeLog Mon Jun 21 22:48:16 2010 +0000 @@ -1,3 +1,21 @@ +2010-06-21 Alan Mackenzie + + Fix an indentation bug: + + * progmodes/cc-mode.el (c-common-init): Initialise c-new-BEG/END. + (c-neutralize-syntax-in-and-mark-CPP): c-new-BEG/END: Take account + of existing values. + + * progmodes/cc-engine.el (c-clear-<-pair-props-if-match-after) + (c-clear->-pair-props-if-match-before): now return t when they've + cleared properties, nil otherwise. + (c-before-change-check-<>-operators): Set c-new-beg/end correctly + by taking account of the existing value. + + * progmodes/cc-defs.el + (c-clear-char-property-with-value-function): Fix this to clear the + property rather than overwriting it with nil. + 2010-06-20 Chong Yidong * emacs-lisp/package.el (package-print-package): Add link to diff -r 9557b86a556a -r f55bbc59cc75 lisp/progmodes/cc-defs.el --- a/lisp/progmodes/cc-defs.el Sun Jun 20 22:46:22 2010 +0000 +++ b/lisp/progmodes/cc-defs.el Mon Jun 21 22:48:16 2010 +0000 @@ -1082,7 +1082,7 @@ (setq place (next-single-property-change place property nil to))) (< place to)) (setq end-place (next-single-property-change place property nil to)) - (put-text-property place end-place property nil) + (remove-text-properties place end-place (cons property nil)) ;; Do we have to do anything with stickiness here? (setq place end-place)))) diff -r 9557b86a556a -r f55bbc59cc75 lisp/progmodes/cc-engine.el --- a/lisp/progmodes/cc-engine.el Sun Jun 20 22:46:22 2010 +0000 +++ b/lisp/progmodes/cc-engine.el Mon Jun 21 22:48:16 2010 +0000 @@ -4985,7 +4985,8 @@ ;; POS (default point) is at a < character. If it is both marked ;; with open/close paren syntax-table property, and has a matching > ;; (also marked) which is after LIM, remove the property both from - ;; the current > and its partner. + ;; the current > and its partner. Return t when this happens, nil + ;; when it doesn't. (save-excursion (if pos (goto-char pos) @@ -4998,13 +4999,15 @@ (equal (c-get-char-property (1- (point)) 'syntax-table) c->-as-paren-syntax)) ; should always be true. (c-unmark-<->-as-paren (1- (point))) - (c-unmark-<->-as-paren pos))))) + (c-unmark-<->-as-paren pos)) + t))) (defun c-clear->-pair-props-if-match-before (lim &optional pos) ;; POS (default point) is at a > character. If it is both marked ;; with open/close paren syntax-table property, and has a matching < ;; (also marked) which is before LIM, remove the property both from - ;; the current < and its partner. + ;; the current < and its partner. Return t when this happens, nil + ;; when it doesn't. (save-excursion (if pos (goto-char pos) @@ -5017,7 +5020,8 @@ (equal (c-get-char-property (point) 'syntax-table) c-<-as-paren-syntax)) ; should always be true. (c-unmark-<->-as-paren (point)) - (c-unmark-<->-as-paren pos))))) + (c-unmark-<->-as-paren pos)) + t))) (defun c-before-change-check-<>-operators (beg end) ;; Unmark certain pairs of "< .... >" which are currently marked as @@ -5040,25 +5044,39 @@ ;; 2010-01-29. (save-excursion (let ((beg-lit-limits (progn (goto-char beg) (c-literal-limits))) - (end-lit-limits (progn (goto-char end) (c-literal-limits)))) + (end-lit-limits (progn (goto-char end) (c-literal-limits))) + new-beg new-end need-new-beg need-new-end) ;; Locate the barrier before the changed region (goto-char (if beg-lit-limits (car beg-lit-limits) beg)) (c-syntactic-skip-backward "^;{}" (max (- beg 2048) (point-min))) + (setq new-beg (point)) ;; Remove the syntax-table properties from each pertinent <...> pair. ;; Firsly, the ones with the < before beg and > after beg. (while (c-search-forward-char-property 'category 'c-<-as-paren-syntax beg) - (c-clear-<-pair-props-if-match-after beg (1- (point)))) + (if (c-clear-<-pair-props-if-match-after beg (1- (point))) + (setq need-new-beg t))) ;; Locate the barrier after END. (goto-char (if end-lit-limits (cdr end-lit-limits) end)) (c-syntactic-re-search-forward "[;{}]" (min (+ end 2048) (point-max)) 'end) + (setq new-end (point)) ;; Remove syntax-table properties from the remaining pertinent <...> ;; pairs, those with a > after end and < before end. (while (c-search-backward-char-property 'category 'c->-as-paren-syntax end) - (c-clear->-pair-props-if-match-before end))))) + (if (c-clear->-pair-props-if-match-before end) + (setq need-new-end t))) + + ;; Extend the fontification region, if needed. + (when need-new-beg + (goto-char new-beg) + (c-forward-syntactic-ws) + (and (< (point) c-new-BEG) (setq c-new-BEG (point)))) + + (when need-new-end + (and (> new-end c-new-END) (setq c-new-END new-end)))))) diff -r 9557b86a556a -r f55bbc59cc75 lisp/progmodes/cc-mode.el --- a/lisp/progmodes/cc-mode.el Sun Jun 20 22:46:22 2010 +0000 +++ b/lisp/progmodes/cc-mode.el Mon Jun 21 22:48:16 2010 +0000 @@ -640,6 +640,8 @@ ;; Starting a mode is a sort of "change". So call the change functions... (save-restriction (widen) + (setq c-new-BEG (point-min)) + (setq c-new-END (point-max)) (save-excursion (if c-get-state-before-change-functions (mapc (lambda (fn) @@ -886,17 +888,19 @@ ;; inside a string, comment, or macro. (goto-char c-old-BOM) ; already set to old start of macro or begg. (setq c-new-BEG - (if (setq limits (c-state-literal-at (point))) - (cdr limits) ; go forward out of any string or comment. - (point))) + (min c-new-BEG + (if (setq limits (c-state-literal-at (point))) + (cdr limits) ; go forward out of any string or comment. + (point)))) (goto-char endd) (if (setq limits (c-state-literal-at (point))) (goto-char (car limits))) ; go backward out of any string or comment. (if (c-beginning-of-macro) (c-end-of-macro)) - (setq c-new-END (max (+ (- c-old-EOM old-len) (- endd begg)) - (point))) + (setq c-new-END (max c-new-END + (+ (- c-old-EOM old-len) (- endd begg)) + (point))) ;; Clear all old relevant properties. (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1))