emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r100625: Fix an indentation bug:


From: Alan Mackenzie
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100625: Fix an indentation bug:
Date: Mon, 21 Jun 2010 21:08:26 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100625
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Mon 2010-06-21 21:08:26 +0000
message:
  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.
modified:
  lisp/ChangeLog
  lisp/progmodes/cc-defs.el
  lisp/progmodes/cc-engine.el
  lisp/progmodes/cc-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-06-20 04:55:14 +0000
+++ b/lisp/ChangeLog    2010-06-21 21:08:26 +0000
@@ -1,3 +1,21 @@
+2010-06-21  Alan Mackenzie  <address@hidden>
+
+       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  <address@hidden>
 
        * emacs-lisp/package.el (package-print-package): Add link to

=== modified file 'lisp/progmodes/cc-defs.el'
--- a/lisp/progmodes/cc-defs.el 2010-04-19 15:07:52 +0000
+++ b/lisp/progmodes/cc-defs.el 2010-06-21 21:08:26 +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))))
 

=== modified file 'lisp/progmodes/cc-engine.el'
--- a/lisp/progmodes/cc-engine.el       2010-05-21 19:51:48 +0000
+++ b/lisp/progmodes/cc-engine.el       2010-06-21 21:08:26 +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))))))
 
 
 

=== modified file 'lisp/progmodes/cc-mode.el'
--- a/lisp/progmodes/cc-mode.el 2010-04-29 14:48:32 +0000
+++ b/lisp/progmodes/cc-mode.el 2010-06-21 21:08:26 +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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]