(nxml-with-invisible-motion): Delete macro.
Don't use this macro any more since it doesn't do anything since Emacs-25 changed the default of `inhibit-point-motion-hooks` to t. * lisp/nxml/nxml-util.el (nxml-with-invisible-motion): Delete macro. * lisp/nxml/nxml-mode.el (nxml-mode, nxml-cleanup): * lisp/nxml/rng-valid.el (rng-do-some-validation): * lisp/nxml/rng-nxml.el (rng-set-state-after): Don't use it.
This commit is contained in:
parent
42fd433aca
commit
3c7f05133c
4 changed files with 58 additions and 68 deletions
|
@ -536,8 +536,7 @@ Many aspects this mode can be customized using
|
|||
(save-restriction
|
||||
(widen)
|
||||
(with-silent-modifications
|
||||
(nxml-with-invisible-motion
|
||||
(nxml-scan-prolog)))))
|
||||
(nxml-scan-prolog))))
|
||||
(setq-local syntax-ppss-table sgml-tag-syntax-table)
|
||||
(setq-local syntax-propertize-function #'nxml-syntax-propertize)
|
||||
(add-function :filter-return (local 'filter-buffer-substring-function)
|
||||
|
@ -584,8 +583,7 @@ Many aspects this mode can be customized using
|
|||
(save-excursion
|
||||
(widen)
|
||||
(with-silent-modifications
|
||||
(nxml-with-invisible-motion
|
||||
(remove-text-properties (point-min) (point-max) '(face nil)))))
|
||||
(remove-text-properties (point-min) (point-max) '(face nil))))
|
||||
(remove-hook 'change-major-mode-hook #'nxml-cleanup t))
|
||||
|
||||
(defun nxml-degrade (context err)
|
||||
|
|
|
@ -65,12 +65,6 @@ This is the inverse of `nxml-make-namespace'."
|
|||
(nxml-degrade ,context ,error-symbol))))
|
||||
`(progn ,@body)))
|
||||
|
||||
(defmacro nxml-with-invisible-motion (&rest body)
|
||||
"Evaluate body without calling any point motion hooks."
|
||||
(declare (indent 0) (debug t))
|
||||
`(let ((inhibit-point-motion-hooks t))
|
||||
,@body))
|
||||
|
||||
(defun nxml-display-file-parse-error (err)
|
||||
(let* ((filename (nth 1 err))
|
||||
(buffer (find-file-noselect filename))
|
||||
|
|
|
@ -366,45 +366,44 @@ set `xmltok-dtd'. Returns the position of the end of the token."
|
|||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(nxml-with-invisible-motion
|
||||
(if (= pos (point-min))
|
||||
(rng-set-initial-state)
|
||||
(let ((state (get-text-property (1- pos) 'rng-state)))
|
||||
(cond (state
|
||||
(rng-restore-state state)
|
||||
(goto-char pos))
|
||||
(t
|
||||
(let ((start (previous-single-property-change pos
|
||||
'rng-state)))
|
||||
(cond (start
|
||||
(rng-restore-state (get-text-property (1- start)
|
||||
'rng-state))
|
||||
(goto-char start))
|
||||
(t (rng-set-initial-state))))))))
|
||||
(xmltok-save
|
||||
(if (= (point) 1)
|
||||
(xmltok-forward-prolog)
|
||||
(setq xmltok-dtd rng-dtd))
|
||||
(cond ((and (< pos (point))
|
||||
;; This handles the case where the prolog ends
|
||||
;; with a < without any following name-start
|
||||
;; character. This will be treated by the parser
|
||||
;; as part of the prolog, but we want to treat
|
||||
;; it as the start of the instance.
|
||||
(eq (char-after pos) ?<)
|
||||
(<= (point)
|
||||
(save-excursion
|
||||
(goto-char (1+ pos))
|
||||
(skip-chars-forward " \t\r\n")
|
||||
(point))))
|
||||
pos)
|
||||
((< (point) pos)
|
||||
(let ((rng-dt-namespace-context-getter
|
||||
'(nxml-ns-get-context))
|
||||
(rng-parsing-for-state t))
|
||||
(rng-forward pos))
|
||||
(point))
|
||||
(t pos)))))))
|
||||
(if (= pos (point-min))
|
||||
(rng-set-initial-state)
|
||||
(let ((state (get-text-property (1- pos) 'rng-state)))
|
||||
(cond (state
|
||||
(rng-restore-state state)
|
||||
(goto-char pos))
|
||||
(t
|
||||
(let ((start (previous-single-property-change pos
|
||||
'rng-state)))
|
||||
(cond (start
|
||||
(rng-restore-state (get-text-property (1- start)
|
||||
'rng-state))
|
||||
(goto-char start))
|
||||
(t (rng-set-initial-state))))))))
|
||||
(xmltok-save
|
||||
(if (= (point) 1)
|
||||
(xmltok-forward-prolog)
|
||||
(setq xmltok-dtd rng-dtd))
|
||||
(cond ((and (< pos (point))
|
||||
;; This handles the case where the prolog ends
|
||||
;; with a < without any following name-start
|
||||
;; character. This will be treated by the parser
|
||||
;; as part of the prolog, but we want to treat
|
||||
;; it as the start of the instance.
|
||||
(eq (char-after pos) ?<)
|
||||
(<= (point)
|
||||
(save-excursion
|
||||
(goto-char (1+ pos))
|
||||
(skip-chars-forward " \t\r\n")
|
||||
(point))))
|
||||
pos)
|
||||
((< (point) pos)
|
||||
(let ((rng-dt-namespace-context-getter
|
||||
'(nxml-ns-get-context))
|
||||
(rng-parsing-for-state t))
|
||||
(rng-forward pos))
|
||||
(point))
|
||||
(t pos))))))
|
||||
|
||||
(defun rng-adjust-state-for-attribute (lt-pos start)
|
||||
(xmltok-save
|
||||
|
|
|
@ -441,25 +441,24 @@ The schema is set like `rng-auto-set-schema'."
|
|||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(nxml-with-invisible-motion
|
||||
(condition-case-unless-debug err
|
||||
(and (rng-validate-prepare)
|
||||
(let ((rng-dt-namespace-context-getter '(nxml-ns-get-context)))
|
||||
(with-silent-modifications
|
||||
(rng-do-some-validation-1 continue-p-function))))
|
||||
;; errors signaled from a function run by an idle timer
|
||||
;; are ignored; if we don't catch them, validation
|
||||
;; will get mysteriously stuck at a single place
|
||||
(rng-compile-error
|
||||
(message "Incorrect schema. %s" (nth 1 err))
|
||||
(rng-validate-mode 0)
|
||||
nil)
|
||||
(error
|
||||
(message "Internal error in rng-validate-mode triggered at buffer position %d. %s"
|
||||
(point)
|
||||
(error-message-string err))
|
||||
(rng-validate-mode 0)
|
||||
nil))))))
|
||||
(condition-case-unless-debug err
|
||||
(and (rng-validate-prepare)
|
||||
(let ((rng-dt-namespace-context-getter '(nxml-ns-get-context)))
|
||||
(with-silent-modifications
|
||||
(rng-do-some-validation-1 continue-p-function))))
|
||||
;; errors signaled from a function run by an idle timer
|
||||
;; are ignored; if we don't catch them, validation
|
||||
;; will get mysteriously stuck at a single place
|
||||
(rng-compile-error
|
||||
(message "Incorrect schema. %s" (nth 1 err))
|
||||
(rng-validate-mode 0)
|
||||
nil)
|
||||
(error
|
||||
(message "Internal error in rng-validate-mode triggered at buffer position %d. %s"
|
||||
(point)
|
||||
(error-message-string err))
|
||||
(rng-validate-mode 0)
|
||||
nil)))))
|
||||
|
||||
(defun rng-validate-prepare ()
|
||||
"Prepare to do some validation, initializing point and the state.
|
||||
|
|
Loading…
Add table
Reference in a new issue