diff options
author | Juanma Barranquero <lekktu@gmail.com> | 2013-08-11 02:07:48 +0200 |
---|---|---|
committer | Juanma Barranquero <lekktu@gmail.com> | 2013-08-11 02:07:48 +0200 |
commit | 9a4ebc748797acc8af74f561367aa1b34ca02d2e (patch) | |
tree | 47ff4c1682c4faeb34c44b7a881ddfa0e0a8926f /lisp/xml.el | |
parent | b41bfdd0566140601f0adb65b0052246c1294bb6 (diff) | |
download | emacs-9a4ebc748797acc8af74f561367aa1b34ca02d2e.tar.gz |
lisp/*.el: More lexical-binding warnings' cleanups.
* tutorial.el (tutorial--describe-nonstandard-key): Use string-match-p.
(tutorial--detailed-help): Remove unused local variables.
(tutorial--save-tutorial-to): Use ignore-errors.
(help-with-tutorial): Use looking-at-p.
* view.el (view-buffer-other-window, view-buffer-other-frame):
Mark unused arguments.
* woman.el (woman-parse-colon-path, woman-parse-colon-path)
(woman-select-symbol-fonts, woman, woman-find-file)
(woman-insert-file-contents, woman-non-underline-faces):
Use string-match-p.
(woman1-unquote): Move declaration.
* xml.el (xml-parse-tag-1, xml-parse-string): Use looking-at-p.
(xml-parse-dtd): Use looking-at-p, string-match-p. Mark unused
argument. Remove unused local variable.
(xml-parse-elem-type): Use string-match-p.
(xml-substitute-numeric-entities): Use ignore-errors.
Diffstat (limited to 'lisp/xml.el')
-rw-r--r-- | lisp/xml.el | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/lisp/xml.el b/lisp/xml.el index a3d34670bfb..e4d5f0b6b6d 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -479,7 +479,7 @@ Return one of: xml-default-ns)))) (cond ;; Processing instructions, like <?xml version="1.0"?>. - ((looking-at "<\\?") + ((looking-at-p "<\\?") (search-forward "?>") (skip-syntax-forward " ") (xml-parse-tag-1 parse-dtd xml-ns)) @@ -492,14 +492,14 @@ Return one of: (buffer-substring-no-properties pos (match-beginning 0)) (xml-parse-string)))) ;; DTD for the document - ((looking-at "<!DOCTYPE[ \t\n\r]") + ((looking-at-p "<!DOCTYPE[ \t\n\r]") (let ((dtd (xml-parse-dtd parse-ns))) (skip-syntax-forward " ") (if xml-validating-parser (cons dtd (xml-parse-tag-1 nil xml-ns)) (xml-parse-tag-1 nil xml-ns)))) ;; skip comments - ((looking-at "<!--") + ((looking-at-p "<!--") (search-forward "-->") ;; FIXME: This loses the skipped-over spaces. (skip-syntax-forward " ") @@ -507,7 +507,7 @@ Return one of: (let ((xml-sub-parser t)) (xml-parse-tag-1 parse-dtd xml-ns)))) ;; end tag - ((looking-at "</") + ((looking-at-p "</") '()) ;; opening tag ((looking-at (eval-when-compile (concat "<\\(" xml-name-re "\\)"))) @@ -530,7 +530,7 @@ Return one of: (setq children (list attrs (xml-maybe-do-ns node-name "" xml-ns))) (cond ;; is this an empty element ? - ((looking-at "/>") + ((looking-at-p "/>") (forward-char 2) (nreverse children)) ;; is this a valid start tag ? @@ -538,12 +538,12 @@ Return one of: (forward-char 1) ;; Now check that we have the right end-tag. (let ((end (concat "</" node-name "\\s-*>"))) - (while (not (looking-at end)) + (while (not (looking-at-p end)) (cond ((eobp) (error "XML: (Not Well-Formed) End of document while reading element `%s'" node-name)) - ((looking-at "</") + ((looking-at-p "</") (forward-char 2) (error "XML: (Not Well-Formed) Invalid end tag `%s' (expecting `%s')" (let ((pos (point))) @@ -591,7 +591,7 @@ references." (old-remaining-size (- (buffer-size) (point))) ref val) (while (and (not (eobp)) - (not (looking-at "<"))) + (not (looking-at-p "<"))) ;; Find the next < or & character. (skip-chars-forward "^<&") (when (eq (char-after) ?&) @@ -690,11 +690,11 @@ This follows the rule [28] in the XML specifications." (let ((xml-validating-parser nil)) (xml-parse-dtd))) -(defun xml-parse-dtd (&optional parse-ns) +(defun xml-parse-dtd (&optional _parse-ns) "Parse the DTD at point." (forward-char (eval-when-compile (length "<!DOCTYPE"))) (skip-syntax-forward " ") - (if (and (looking-at ">") + (if (and (looking-at-p ">") xml-validating-parser) (error "XML: (Validity) Invalid DTD (expecting name of the document)")) @@ -755,7 +755,7 @@ This follows the rule [28] in the XML specifications." ;; Parse the rest of the DTD ;; Fixme: Deal with NOTATION, PIs. - (while (not (looking-at "\\s-*\\]")) + (while (not (looking-at-p "\\s-*\\]")) (skip-syntax-forward " ") (cond ((eobp) @@ -771,14 +771,14 @@ This follows the rule [28] in the XML specifications." (end-pos (match-end 0))) ;; Translation of rule [46] of XML specifications (cond - ((string-match "\\`EMPTY\\s-*\\'" type) ; empty declaration + ((string-match-p "\\`EMPTY\\s-*\\'" type) ; empty declaration (setq type 'empty)) - ((string-match "\\`ANY\\s-*$" type) ; any type of contents + ((string-match-p "\\`ANY\\s-*$" type) ; any type of contents (setq type 'any)) ((string-match "\\`(\\(.*\\))\\s-*\\'" type) ; children ([47]) (setq type (xml-parse-elem-type (match-string-no-properties 1 type)))) - ((string-match "^%[^;]+;[ \t\n\r]*\\'" type) ; substitution + ((string-match-p "^%[^;]+;[ \t\n\r]*\\'" type) ; substitution nil) (xml-validating-parser (error "XML: (Validity) Invalid element type in the DTD"))) @@ -803,7 +803,7 @@ This follows the rule [28] in the XML specifications." (goto-char (match-end 0))) ;; Comments (skip to end, ignoring parameter entity): - ((looking-at "<!--") + ((looking-at-p "<!--") (search-forward "-->") (and next-parameter-entity (> (point) next-parameter-entity) @@ -856,7 +856,6 @@ This follows the rule [28] in the XML specifications." (unless (looking-at xml-pe-reference-re) (error "XML: Internal error")) (let* ((entity (match-string 1)) - (beg (point-marker)) (elt (assoc entity xml-parameter-entity-alist))) (if elt (progn @@ -916,11 +915,11 @@ references and parameter-entity references." (progn (setq elem (match-string-no-properties 1 string) modifier (match-string-no-properties 2 string)) - (if (string-match "|" elem) + (if (string-match-p "|" elem) (setq elem (cons 'choice (mapcar 'xml-parse-elem-type (split-string elem "|")))) - (if (string-match "," elem) + (if (string-match-p "," elem) (setq elem (cons 'seq (mapcar 'xml-parse-elem-type (split-string elem ","))))))) @@ -987,13 +986,12 @@ by \"*\"." (if (and string (stringp string)) (let ((start 0)) (while (string-match "&#\\([0-9]+\\);" string start) - (condition-case nil - (setq string (replace-match - (string (read (substring string - (match-beginning 1) - (match-end 1)))) - nil nil string)) - (error nil)) + (ignore-errors + (setq string (replace-match + (string (read (substring string + (match-beginning 1) + (match-end 1)))) + nil nil string))) (setq start (1+ (match-beginning 0)))) string) nil)) |