comparison lisp/progmodes/cc-mode.el @ 109030:bfaf9e31b45e

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.
author Alan Mackenzie <acm@muc.de>
date Mon, 21 Jun 2010 21:08:26 +0000
parents 5f43377338a0
children 60516122d066
comparison
equal deleted inserted replaced
109029:85a8c1358bb7 109030:bfaf9e31b45e
638 (c-font-lock-init)) 638 (c-font-lock-init))
639 639
640 ;; Starting a mode is a sort of "change". So call the change functions... 640 ;; Starting a mode is a sort of "change". So call the change functions...
641 (save-restriction 641 (save-restriction
642 (widen) 642 (widen)
643 (setq c-new-BEG (point-min))
644 (setq c-new-END (point-max))
643 (save-excursion 645 (save-excursion
644 (if c-get-state-before-change-functions 646 (if c-get-state-before-change-functions
645 (mapc (lambda (fn) 647 (mapc (lambda (fn)
646 (funcall fn (point-min) (point-max))) 648 (funcall fn (point-min) (point-max)))
647 c-get-state-before-change-functions)) 649 c-get-state-before-change-functions))
884 ;; First determine the region, (c-new-BEG c-new-END), which will get font 886 ;; First determine the region, (c-new-BEG c-new-END), which will get font
885 ;; locked. It might need "neutralizing". This region may not start 887 ;; locked. It might need "neutralizing". This region may not start
886 ;; inside a string, comment, or macro. 888 ;; inside a string, comment, or macro.
887 (goto-char c-old-BOM) ; already set to old start of macro or begg. 889 (goto-char c-old-BOM) ; already set to old start of macro or begg.
888 (setq c-new-BEG 890 (setq c-new-BEG
889 (if (setq limits (c-state-literal-at (point))) 891 (min c-new-BEG
890 (cdr limits) ; go forward out of any string or comment. 892 (if (setq limits (c-state-literal-at (point)))
891 (point))) 893 (cdr limits) ; go forward out of any string or comment.
894 (point))))
892 895
893 (goto-char endd) 896 (goto-char endd)
894 (if (setq limits (c-state-literal-at (point))) 897 (if (setq limits (c-state-literal-at (point)))
895 (goto-char (car limits))) ; go backward out of any string or comment. 898 (goto-char (car limits))) ; go backward out of any string or comment.
896 (if (c-beginning-of-macro) 899 (if (c-beginning-of-macro)
897 (c-end-of-macro)) 900 (c-end-of-macro))
898 (setq c-new-END (max (+ (- c-old-EOM old-len) (- endd begg)) 901 (setq c-new-END (max c-new-END
899 (point))) 902 (+ (- c-old-EOM old-len) (- endd begg))
903 (point)))
900 904
901 ;; Clear all old relevant properties. 905 ;; Clear all old relevant properties.
902 (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1)) 906 (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1))
903 (c-clear-char-property-with-value c-new-BEG c-new-END 'category 'c-cpp-delimiter) 907 (c-clear-char-property-with-value c-new-BEG c-new-END 'category 'c-cpp-delimiter)
904 ;; FIXME!!! What about the "<" and ">" category properties? 2009-11-16 908 ;; FIXME!!! What about the "<" and ">" category properties? 2009-11-16