diff options
Diffstat (limited to 'lisp/nxml')
| -rw-r--r-- | lisp/nxml/nxml-mode.el | 8 | ||||
| -rw-r--r-- | lisp/nxml/nxml-outln.el | 4 | ||||
| -rw-r--r-- | lisp/nxml/nxml-rap.el | 4 | ||||
| -rw-r--r-- | lisp/nxml/nxml-util.el | 21 | ||||
| -rw-r--r-- | lisp/nxml/rng-maint.el | 2 | ||||
| -rw-r--r-- | lisp/nxml/rng-nxml.el | 4 | ||||
| -rw-r--r-- | lisp/nxml/rng-valid.el | 79 |
7 files changed, 44 insertions, 78 deletions
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 2ee73235dd0..44271a689cf 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el | |||
| @@ -540,7 +540,7 @@ Many aspects this mode can be customized using | |||
| 540 | (widen) | 540 | (widen) |
| 541 | (nxml-clear-dependent-regions (point-min) (point-max)) | 541 | (nxml-clear-dependent-regions (point-min) (point-max)) |
| 542 | (setq nxml-scan-end (copy-marker (point-min) nil)) | 542 | (setq nxml-scan-end (copy-marker (point-min) nil)) |
| 543 | (nxml-with-unmodifying-text-property-changes | 543 | (with-silent-modifications |
| 544 | (nxml-clear-inside (point-min) (point-max)) | 544 | (nxml-clear-inside (point-min) (point-max)) |
| 545 | (nxml-with-invisible-motion | 545 | (nxml-with-invisible-motion |
| 546 | (nxml-scan-prolog))))) | 546 | (nxml-scan-prolog))))) |
| @@ -601,7 +601,7 @@ Many aspects this mode can be customized using | |||
| 601 | (save-excursion | 601 | (save-excursion |
| 602 | (save-restriction | 602 | (save-restriction |
| 603 | (widen) | 603 | (widen) |
| 604 | (nxml-with-unmodifying-text-property-changes | 604 | (with-silent-modifications |
| 605 | (nxml-clear-inside (point-min) (point-max)))))) | 605 | (nxml-clear-inside (point-min) (point-max)))))) |
| 606 | 606 | ||
| 607 | ;;; Change management | 607 | ;;; Change management |
| @@ -625,7 +625,7 @@ Many aspects this mode can be customized using | |||
| 625 | (widen) | 625 | (widen) |
| 626 | (save-match-data | 626 | (save-match-data |
| 627 | (nxml-with-invisible-motion | 627 | (nxml-with-invisible-motion |
| 628 | (nxml-with-unmodifying-text-property-changes | 628 | (with-silent-modifications |
| 629 | (nxml-after-change1 | 629 | (nxml-after-change1 |
| 630 | start end pre-change-length))))))))) | 630 | start end pre-change-length))))))))) |
| 631 | 631 | ||
| @@ -910,7 +910,7 @@ Called with `font-lock-beg' and `font-lock-end' dynamically bound." | |||
| 910 | (widen) | 910 | (widen) |
| 911 | (save-match-data | 911 | (save-match-data |
| 912 | (nxml-with-invisible-motion | 912 | (nxml-with-invisible-motion |
| 913 | (nxml-with-unmodifying-text-property-changes | 913 | (with-silent-modifications |
| 914 | (nxml-extend-after-change-region1 | 914 | (nxml-extend-after-change-region1 |
| 915 | start end pre-change-length))))))))) | 915 | start end pre-change-length))))))))) |
| 916 | (if (consp region) region)))) | 916 | (if (consp region) region)))) |
diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el index e30aee3de53..dab22f7559f 100644 --- a/lisp/nxml/nxml-outln.el +++ b/lisp/nxml/nxml-outln.el | |||
| @@ -149,7 +149,7 @@ See the variable `nxml-section-element-name-regexp' for more details." | |||
| 149 | (defun nxml-show-all () | 149 | (defun nxml-show-all () |
| 150 | "Show all elements in the buffer normally." | 150 | "Show all elements in the buffer normally." |
| 151 | (interactive) | 151 | (interactive) |
| 152 | (nxml-with-unmodifying-text-property-changes | 152 | (with-silent-modifications |
| 153 | (remove-text-properties (point-min) | 153 | (remove-text-properties (point-min) |
| 154 | (point-max) | 154 | (point-max) |
| 155 | '(nxml-outline-state nil))) | 155 | '(nxml-outline-state nil))) |
| @@ -370,7 +370,7 @@ customize which elements are recognized as sections and headings." | |||
| 370 | (get-text-property pos 'nxml-outline-state)) | 370 | (get-text-property pos 'nxml-outline-state)) |
| 371 | 371 | ||
| 372 | (defun nxml-set-outline-state (pos state) | 372 | (defun nxml-set-outline-state (pos state) |
| 373 | (nxml-with-unmodifying-text-property-changes | 373 | (with-silent-modifications |
| 374 | (if state | 374 | (if state |
| 375 | (put-text-property pos (1+ pos) 'nxml-outline-state state) | 375 | (put-text-property pos (1+ pos) 'nxml-outline-state state) |
| 376 | (remove-text-properties pos (1+ pos) '(nxml-outline-state nil))))) | 376 | (remove-text-properties pos (1+ pos) '(nxml-outline-state nil))))) |
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el index bc87044cde6..5bc4d74456b 100644 --- a/lisp/nxml/nxml-rap.el +++ b/lisp/nxml/nxml-rap.el | |||
| @@ -293,7 +293,7 @@ Sets variables like `nxml-token-after'." | |||
| 293 | (cond ((memq xmltok-type '(comment | 293 | (cond ((memq xmltok-type '(comment |
| 294 | cdata-section | 294 | cdata-section |
| 295 | processing-instruction)) | 295 | processing-instruction)) |
| 296 | (nxml-with-unmodifying-text-property-changes | 296 | (with-silent-modifications |
| 297 | (nxml-set-inside (1+ xmltok-start) (point) xmltok-type))) | 297 | (nxml-set-inside (1+ xmltok-start) (point) xmltok-type))) |
| 298 | (xmltok-dependent-regions | 298 | (xmltok-dependent-regions |
| 299 | (nxml-mark-parse-dependent-regions))) | 299 | (nxml-mark-parse-dependent-regions))) |
| @@ -338,7 +338,7 @@ Leave point unmoved if it is not inside anything special." | |||
| 338 | '(comment | 338 | '(comment |
| 339 | processing-instruction | 339 | processing-instruction |
| 340 | cdata-section)) | 340 | cdata-section)) |
| 341 | (nxml-with-unmodifying-text-property-changes | 341 | (with-silent-modifications |
| 342 | (nxml-set-inside (1+ xmltok-start) | 342 | (nxml-set-inside (1+ xmltok-start) |
| 343 | (point) | 343 | (point) |
| 344 | xmltok-type))) | 344 | xmltok-type))) |
diff --git a/lisp/nxml/nxml-util.el b/lisp/nxml/nxml-util.el index b2d9cdde183..6ba6d21f7ed 100644 --- a/lisp/nxml/nxml-util.el +++ b/lisp/nxml/nxml-util.el | |||
| @@ -78,27 +78,6 @@ This is the inverse of `nxml-make-namespace'." | |||
| 78 | (nxml-degrade ,context ,error-symbol)))) | 78 | (nxml-degrade ,context ,error-symbol)))) |
| 79 | `(progn ,@body))) | 79 | `(progn ,@body))) |
| 80 | 80 | ||
| 81 | (defmacro nxml-with-unmodifying-text-property-changes (&rest body) | ||
| 82 | "Evaluate BODY without any text property changes modifying the buffer. | ||
| 83 | Any text properties changes happen as usual but the changes are not treated as | ||
| 84 | modifications to the buffer." | ||
| 85 | (let ((modified (make-symbol "modified"))) | ||
| 86 | `(let ((,modified (buffer-modified-p)) | ||
| 87 | (inhibit-read-only t) | ||
| 88 | (inhibit-modification-hooks t) | ||
| 89 | (buffer-undo-list t) | ||
| 90 | (deactivate-mark nil) | ||
| 91 | ;; Apparently these avoid file locking problems. | ||
| 92 | (buffer-file-name nil) | ||
| 93 | (buffer-file-truename nil)) | ||
| 94 | (unwind-protect | ||
| 95 | (progn ,@body) | ||
| 96 | (unless ,modified | ||
| 97 | (restore-buffer-modified-p nil)))))) | ||
| 98 | |||
| 99 | (put 'nxml-with-unmodifying-text-property-changes 'lisp-indent-function 0) | ||
| 100 | (def-edebug-spec nxml-with-unmodifying-text-property-changes t) | ||
| 101 | |||
| 102 | (defmacro nxml-with-invisible-motion (&rest body) | 81 | (defmacro nxml-with-invisible-motion (&rest body) |
| 103 | "Evaluate body without calling any point motion hooks." | 82 | "Evaluate body without calling any point motion hooks." |
| 104 | `(let ((inhibit-point-motion-hooks t)) | 83 | `(let ((inhibit-point-motion-hooks t)) |
diff --git a/lisp/nxml/rng-maint.el b/lisp/nxml/rng-maint.el index 74192f213dc..ff73e3718ec 100644 --- a/lisp/nxml/rng-maint.el +++ b/lisp/nxml/rng-maint.el | |||
| @@ -259,7 +259,7 @@ | |||
| 259 | (defun rng-validate-buffer () | 259 | (defun rng-validate-buffer () |
| 260 | (save-restriction | 260 | (save-restriction |
| 261 | (widen) | 261 | (widen) |
| 262 | (nxml-with-unmodifying-text-property-changes | 262 | (with-silent-modifications |
| 263 | (rng-clear-cached-state (point-min) (point-max))) | 263 | (rng-clear-cached-state (point-min) (point-max))) |
| 264 | ;; 1+ to clear empty overlays at (point-max) | 264 | ;; 1+ to clear empty overlays at (point-max) |
| 265 | (rng-clear-overlays (point-min) (1+ (point-max)))) | 265 | (rng-clear-overlays (point-min) (1+ (point-max)))) |
diff --git a/lisp/nxml/rng-nxml.el b/lisp/nxml/rng-nxml.el index cfb8e33cccb..bc070136adb 100644 --- a/lisp/nxml/rng-nxml.el +++ b/lisp/nxml/rng-nxml.el | |||
| @@ -380,9 +380,7 @@ set `xmltok-dtd'. Returns the position of the end of the token." | |||
| 380 | (< rng-validate-up-to-date-end pos)) | 380 | (< rng-validate-up-to-date-end pos)) |
| 381 | ;; Display percentage validated. | 381 | ;; Display percentage validated. |
| 382 | (force-mode-line-update) | 382 | (force-mode-line-update) |
| 383 | ;; Force redisplay but don't allow idle timers to run. | 383 | (sit-for 0)) |
| 384 | (let ((timer-idle-list nil)) | ||
| 385 | (sit-for 0))) | ||
| 386 | (message "Parsing...done")) | 384 | (message "Parsing...done")) |
| 387 | (save-excursion | 385 | (save-excursion |
| 388 | (save-restriction | 386 | (save-restriction |
diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index a87ab2532ce..e1140980813 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el | |||
| @@ -244,7 +244,7 @@ to use for finding the schema." | |||
| 244 | (> (prefix-numeric-value arg) 0))) | 244 | (> (prefix-numeric-value arg) 0))) |
| 245 | (save-restriction | 245 | (save-restriction |
| 246 | (widen) | 246 | (widen) |
| 247 | (nxml-with-unmodifying-text-property-changes | 247 | (with-silent-modifications |
| 248 | (rng-clear-cached-state (point-min) (point-max))) | 248 | (rng-clear-cached-state (point-min) (point-max))) |
| 249 | ;; 1+ to clear empty overlays at (point-max) | 249 | ;; 1+ to clear empty overlays at (point-max) |
| 250 | (rng-clear-overlays (point-min) (1+ (point-max))) | 250 | (rng-clear-overlays (point-min) (1+ (point-max))) |
| @@ -305,7 +305,7 @@ The schema is set like `rng-auto-set-schema'." | |||
| 305 | 305 | ||
| 306 | (defun rng-after-change-function (start end pre-change-len) | 306 | (defun rng-after-change-function (start end pre-change-len) |
| 307 | (setq rng-message-overlay-inhibit-point nil) | 307 | (setq rng-message-overlay-inhibit-point nil) |
| 308 | (nxml-with-unmodifying-text-property-changes | 308 | (with-silent-modifications |
| 309 | (rng-clear-cached-state start end)) | 309 | (rng-clear-cached-state start end)) |
| 310 | ;; rng-validate-up-to-date-end holds the position before the change | 310 | ;; rng-validate-up-to-date-end holds the position before the change |
| 311 | ;; Adjust it to reflect the change. | 311 | ;; Adjust it to reflect the change. |
| @@ -414,26 +414,17 @@ The schema is set like `rng-auto-set-schema'." | |||
| 414 | (defvar rng-validate-display-modified-p nil) | 414 | (defvar rng-validate-display-modified-p nil) |
| 415 | 415 | ||
| 416 | (defun rng-validate-while-idle-continue-p () | 416 | (defun rng-validate-while-idle-continue-p () |
| 417 | ;; input-pending-p and sit-for run timers that are | 417 | (and (not (input-pending-p)) |
| 418 | ;; ripe. Binding timer-idle-list to nil prevents | 418 | ;; Fake rng-validate-up-to-date-end so that the mode line |
| 419 | ;; this. If we don't do this, then any ripe timers | 419 | ;; shows progress. Also use this to save point. |
| 420 | ;; will get run, and we won't get any chance to | 420 | (let ((rng-validate-up-to-date-end (point))) |
| 421 | ;; validate until Emacs becomes idle again or until | 421 | (goto-char rng-validate-display-point) |
| 422 | ;; the other lower priority timers finish (which | 422 | (when (not rng-validate-display-modified-p) |
| 423 | ;; can take a very long time in the case of | 423 | (restore-buffer-modified-p nil)) |
| 424 | ;; jit-lock). | 424 | (force-mode-line-update) |
| 425 | (let ((timer-idle-list nil)) | 425 | (let ((continue (sit-for 0))) |
| 426 | (and (not (input-pending-p)) | 426 | (goto-char rng-validate-up-to-date-end) |
| 427 | ;; Fake rng-validate-up-to-date-end so that the mode line | 427 | continue)))) |
| 428 | ;; shows progress. Also use this to save point. | ||
| 429 | (let ((rng-validate-up-to-date-end (point))) | ||
| 430 | (goto-char rng-validate-display-point) | ||
| 431 | (when (not rng-validate-display-modified-p) | ||
| 432 | (restore-buffer-modified-p nil)) | ||
| 433 | (force-mode-line-update) | ||
| 434 | (let ((continue (sit-for 0))) | ||
| 435 | (goto-char rng-validate-up-to-date-end) | ||
| 436 | continue))))) | ||
| 437 | 428 | ||
| 438 | ;; Calling rng-do-some-validation once with a continue-p function, as | 429 | ;; Calling rng-do-some-validation once with a continue-p function, as |
| 439 | ;; opposed to calling it repeatedly, helps on initial validation of a | 430 | ;; opposed to calling it repeatedly, helps on initial validation of a |
| @@ -442,24 +433,26 @@ The schema is set like `rng-auto-set-schema'." | |||
| 442 | ;; validation process down. | 433 | ;; validation process down. |
| 443 | 434 | ||
| 444 | (defun rng-validate-while-idle (buffer) | 435 | (defun rng-validate-while-idle (buffer) |
| 445 | (with-current-buffer buffer | 436 | (when (buffer-live-p buffer) ; bug#13999 |
| 446 | (if rng-validate-mode | 437 | (with-current-buffer buffer |
| 447 | (if (let ((rng-validate-display-point (point)) | 438 | (if rng-validate-mode |
| 448 | (rng-validate-display-modified-p (buffer-modified-p))) | 439 | (if (let ((rng-validate-display-point (point)) |
| 449 | (rng-do-some-validation 'rng-validate-while-idle-continue-p)) | 440 | (rng-validate-display-modified-p (buffer-modified-p))) |
| 450 | (force-mode-line-update) | 441 | (rng-do-some-validation 'rng-validate-while-idle-continue-p)) |
| 451 | (rng-validate-done)) | 442 | (force-mode-line-update) |
| 452 | ;; must have done kill-all-local-variables | 443 | (rng-validate-done)) |
| 453 | (rng-kill-timers)))) | 444 | ;; must have done kill-all-local-variables |
| 445 | (rng-kill-timers))))) | ||
| 454 | 446 | ||
| 455 | (defun rng-validate-quick-while-idle (buffer) | 447 | (defun rng-validate-quick-while-idle (buffer) |
| 456 | (with-current-buffer buffer | 448 | (when (buffer-live-p buffer) ; bug#13999 |
| 457 | (if rng-validate-mode | 449 | (with-current-buffer buffer |
| 458 | (if (rng-do-some-validation) | 450 | (if rng-validate-mode |
| 459 | (force-mode-line-update) | 451 | (if (rng-do-some-validation) |
| 460 | (rng-validate-done)) | 452 | (force-mode-line-update) |
| 461 | ;; must have done kill-all-local-variables | 453 | (rng-validate-done)) |
| 462 | (rng-kill-timers)))) | 454 | ;; must have done kill-all-local-variables |
| 455 | (rng-kill-timers))))) | ||
| 463 | 456 | ||
| 464 | (defun rng-validate-done () | 457 | (defun rng-validate-done () |
| 465 | (when (or (not (current-message)) | 458 | (when (or (not (current-message)) |
| @@ -478,7 +471,7 @@ The schema is set like `rng-auto-set-schema'." | |||
| 478 | (condition-case-unless-debug err | 471 | (condition-case-unless-debug err |
| 479 | (and (rng-validate-prepare) | 472 | (and (rng-validate-prepare) |
| 480 | (let ((rng-dt-namespace-context-getter '(nxml-ns-get-context))) | 473 | (let ((rng-dt-namespace-context-getter '(nxml-ns-get-context))) |
| 481 | (nxml-with-unmodifying-text-property-changes | 474 | (with-silent-modifications |
| 482 | (rng-do-some-validation-1 continue-p-function)))) | 475 | (rng-do-some-validation-1 continue-p-function)))) |
| 483 | ;; errors signaled from a function run by an idle timer | 476 | ;; errors signaled from a function run by an idle timer |
| 484 | ;; are ignored; if we don't catch them, validation | 477 | ;; are ignored; if we don't catch them, validation |
| @@ -880,9 +873,7 @@ means goto the first error." | |||
| 880 | (< rng-validate-up-to-date-end (point-max))) | 873 | (< rng-validate-up-to-date-end (point-max))) |
| 881 | ;; Display percentage validated. | 874 | ;; Display percentage validated. |
| 882 | (force-mode-line-update) | 875 | (force-mode-line-update) |
| 883 | ;; Force redisplay but don't allow idle timers to run. | 876 | (sit-for 0) |
| 884 | (let ((timer-idle-list nil)) | ||
| 885 | (sit-for 0)) | ||
| 886 | (setq pos | 877 | (setq pos |
| 887 | (max pos (1- rng-validate-up-to-date-end))) | 878 | (max pos (1- rng-validate-up-to-date-end))) |
| 888 | t))))) | 879 | t))))) |
| @@ -905,9 +896,7 @@ means goto the first error." | |||
| 905 | (while (and (rng-do-some-validation) | 896 | (while (and (rng-do-some-validation) |
| 906 | (< rng-validate-up-to-date-end (min pos (point-max)))) | 897 | (< rng-validate-up-to-date-end (min pos (point-max)))) |
| 907 | (force-mode-line-update) | 898 | (force-mode-line-update) |
| 908 | ;; Force redisplay but don't allow idle timers to run. | 899 | (sit-for 0)) |
| 909 | (let ((timer-idle-list nil)) | ||
| 910 | (sit-for 0))) | ||
| 911 | (while (and (> arg 0) | 900 | (while (and (> arg 0) |
| 912 | (setq err (rng-find-previous-error-overlay pos))) | 901 | (setq err (rng-find-previous-error-overlay pos))) |
| 913 | (setq pos (overlay-start err)) | 902 | (setq pos (overlay-start err)) |