emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog nxml/rng-valid.el


From: Stefan Monnier
Subject: [Emacs-diffs] emacs/lisp ChangeLog nxml/rng-valid.el
Date: Sat, 28 Nov 2009 21:32:10 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        09/11/28 21:32:09

Modified files:
        lisp           : ChangeLog 
        lisp/nxml      : rng-valid.el 

Log message:
        Try and remove assumptions about point-min==1.
        * nxml/rng-valid.el (rng-validate-mode): Don't hardcode point-min==1.
        (rng-compute-mode-line-string): Show the validation percentage in
        terms of the narrowed text, not the widened text.
        (rng-do-some-validation): Don't catch internal errors when debugging.
        (rng-first-error): Simplify.
        (rng-after-change-function): Remove work around.  AFAIK the bug has
        been fixed a while ago.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16761&r2=1.16762
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/nxml/rng-valid.el?cvsroot=emacs&r1=1.9&r2=1.10

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16761
retrieving revision 1.16762
diff -u -b -r1.16761 -r1.16762
--- ChangeLog   28 Nov 2009 20:45:19 -0000      1.16761
+++ ChangeLog   28 Nov 2009 21:32:06 -0000      1.16762
@@ -1,5 +1,14 @@
 2009-11-28  Stefan Monnier  <address@hidden>
 
+       Try and remove assumptions about point-min==1.
+       * nxml/rng-valid.el (rng-validate-mode): Don't hardcode point-min==1.
+       (rng-compute-mode-line-string): Show the validation percentage in
+       terms of the narrowed text, not the widened text.
+       (rng-do-some-validation): Don't catch internal errors when debugging.
+       (rng-first-error): Simplify.
+       (rng-after-change-function): Remove work around.  AFAIK the bug has
+       been fixed a while ago.
+
        * image-mode.el (image-minor-mode): Exit more gracefully when the image
        cannot be displayed (e.g. when doing C-x C-f some-new-file.svg RET).
 

Index: nxml/rng-valid.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/nxml/rng-valid.el,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- nxml/rng-valid.el   5 Jan 2009 03:22:55 -0000       1.9
+++ nxml/rng-valid.el   28 Nov 2009 21:32:09 -0000      1.10
@@ -247,8 +247,8 @@
     (nxml-with-unmodifying-text-property-changes
       (rng-clear-cached-state (point-min) (point-max)))
     ;; 1+ to clear empty overlays at (point-max)
-    (rng-clear-overlays (point-min) (1+ (point-max))))
-  (setq rng-validate-up-to-date-end 1)
+    (rng-clear-overlays (point-min) (1+ (point-max)))
+    (setq rng-validate-up-to-date-end (point-min)))
   (rng-clear-conditional-region)
   (setq rng-error-count 0)
   ;; do this here to avoid infinite loop if we set the schema
@@ -304,10 +304,6 @@
   (or rng-validate-mode (rng-validate-mode)))
 
 (defun rng-after-change-function (start end pre-change-len)
-  ;; Work around bug in insert-file-contents.
-  (when (> end (1+ (buffer-size)))
-    (setq start 1)
-    (setq end (1+ (buffer-size))))
   (setq rng-message-overlay-inhibit-point nil)
   (nxml-with-unmodifying-text-property-changes
     (rng-clear-cached-state start end))
@@ -335,11 +331,13 @@
       (setq rng-validate-up-to-date-end start))
   ;; Must make rng-validate-up-to-date-end < point-max
   ;; (unless the buffer is empty).
-  ;; otherwise validate-prepare will say there's nothing to do.
-  ;; Don't use (point-max) because we may be narrowed.
-  (if (> rng-validate-up-to-date-end (buffer-size))
+  ;; otherwise rng-validate-prepare will say there's nothing to do.
+  (when (>= rng-validate-up-to-date-end (point-max))
       (setq rng-validate-up-to-date-end
-           (max 1 (1- rng-validate-up-to-date-end))))
+          (if (< (point-min) (point-max))
+              (1- (point-max))
+            ;; Only widen if really necessary.
+            (save-restriction (widen) (max (point-min) (1- (point-max)))))))
   ;; Arrange to revalidate
   (rng-activate-timers)
   ;; Need to do this after activating the timer
@@ -354,8 +352,9 @@
                  ;; the end.
                  (floor (if (eq (buffer-size) 0)
                             0.0
-                          (/ (* (- rng-validate-up-to-date-end 1) 100.0)
-                             (buffer-size)))))
+                          (/ (* (- rng-validate-up-to-date-end (point-min))
+                                 100.0)
+                             (- (point-max) (point-min))))))
                 "%%"))
        ((> rng-error-count 0)
         (concat " "
@@ -476,7 +475,7 @@
     (save-restriction
       (widen)
       (nxml-with-invisible-motion
-       (condition-case err
+       (condition-case-no-debug err
            (and (rng-validate-prepare)
                 (let ((rng-dt-namespace-context-getter '(nxml-ns-get-context)))
                   (nxml-with-unmodifying-text-property-changes
@@ -809,9 +808,7 @@
 Turn on `rng-validate-mode' if it is not already on."
   (interactive)
   (or rng-validate-mode (rng-validate-mode))
-  (when (and (eq rng-validate-up-to-date-end 1)
-            (< rng-validate-up-to-date-end (point-max)))
-    (rng-do-some-validation))
+  (rng-do-some-validation)
   (let ((err (rng-find-next-error-overlay (1- (point-min)))))
     (if err
        (rng-goto-error-overlay err)




reply via email to

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