emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113793: lisp/*.el: More lexical-binding warnings' c


From: Juanma Barranquero
Subject: [Emacs-diffs] trunk r113793: lisp/*.el: More lexical-binding warnings' cleanups.
Date: Sun, 11 Aug 2013 00:08:04 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113793
revision-id: address@hidden
parent: address@hidden
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Sun 2013-08-11 02:07:48 +0200
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/tutorial.el               
tutorial.el-20091113204419-o5vbwnq5f7feedwu-4434
  lisp/view.el                   view.el-20091113204419-o5vbwnq5f7feedwu-100
  lisp/woman.el                  woman.el-20091113204419-o5vbwnq5f7feedwu-1805
  lisp/xml.el                    xml.el-20091113204419-o5vbwnq5f7feedwu-1886
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-08-10 15:17:29 +0000
+++ b/lisp/ChangeLog    2013-08-11 00:07:48 +0000
@@ -1,5 +1,25 @@
 2013-08-10  Juanma Barranquero  <address@hidden>
 
+       * 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.
+
        * calculator.el (calculator): Mark unused argument.
        (calculator-paste, calculator-quit, calculator-integer-p):
        Use ignore-errors.

=== modified file 'lisp/tutorial.el'
--- a/lisp/tutorial.el  2013-08-05 14:26:57 +0000
+++ b/lisp/tutorial.el  2013-08-11 00:07:48 +0000
@@ -156,7 +156,7 @@
                           " RET instead."))
               (insert "\n\nWith your current key bindings"
                       " you can use "
-                      (if (string-match "^the .*menus?$" where)
+                      (if (string-match-p "^the .*menus?$" where)
                           ""
                         "the key")
                       where
@@ -346,10 +346,8 @@
                    (def-fun-txt (nth 2 tk))
                    (where       (nth 3 tk))
                    (remark      (nth 4 tk))
-                   (rem-fun (command-remapping def-fun))
                    (key-txt (key-description key))
-                   (key-fun (with-current-buffer tutorial-buffer (key-binding 
key)))
-                   tot-len)
+                   (key-fun (with-current-buffer tutorial-buffer (key-binding 
key))))
               (unless (eq def-fun key-fun)
                 ;; Insert key binding description:
                 (when (string= key-txt explain-key-desc)
@@ -723,9 +721,7 @@
                            saved-file
                            (error-message-string err))))
             ;; An error is raised here?? Is this a bug?
-            (condition-case nil
-                (undo-only)
-              (error nil))
+            (ignore-errors (undo-only))
             ;; Restore point
             (goto-char old-point)
             (if save-err
@@ -881,7 +877,7 @@
           ;; or just delete the <<...>> line if a [...] line follows.
           (cond ((save-excursion
                    (forward-line 1)
-                   (looking-at "\\["))
+                   (looking-at-p "\\["))
                  (delete-region (point) (progn (forward-line 1) (point))))
                 ((looking-at "<<Blank lines inserted.*>>")
                  (replace-match "[Middle of page left blank for didactic 
purposes.   Text continues below]"))

=== modified file 'lisp/view.el'
--- a/lisp/view.el      2013-02-12 04:46:18 +0000
+++ b/lisp/view.el      2013-08-11 00:07:48 +0000
@@ -322,7 +322,7 @@
     (view-mode-enter nil exit-action)))
 
 ;;;###autoload
-(defun view-buffer-other-window (buffer &optional not-return exit-action)
+(defun view-buffer-other-window (buffer &optional _not-return exit-action)
   "View BUFFER in View mode in another window.
 Emacs commands editing the buffer contents are not available;
 instead, a special set of commands (mostly letters and
@@ -349,7 +349,7 @@
     (view-mode-enter nil exit-action)))
 
 ;;;###autoload
-(defun view-buffer-other-frame (buffer &optional not-return exit-action)
+(defun view-buffer-other-frame (buffer &optional _not-return exit-action)
   "View BUFFER in View mode in another frame.
 Emacs commands editing the buffer contents are not available;
 instead, a special set of commands (mostly letters and

=== modified file 'lisp/woman.el'
--- a/lisp/woman.el     2013-01-02 16:13:04 +0000
+++ b/lisp/woman.el     2013-08-11 00:07:48 +0000
@@ -438,7 +438,7 @@
   (if (memq system-type '(windows-nt ms-dos))
       (cond ((null paths)
             (mapcar 'woman-Cyg-to-Win (woman-parse-man.conf)))
-           ((string-match ";" paths)
+           ((string-match-p ";" paths)
             ;; Assume DOS-style path-list...
             (woman-mapcan              ; splice list into list
              (lambda (x)
@@ -446,7 +446,7 @@
                    (list x)
                  (mapcar 'woman-Cyg-to-Win (woman-parse-man.conf))))
              (parse-colon-path paths)))
-           ((string-match "\\`[a-zA-Z]:" paths)
+           ((string-match-p "\\`[a-zA-Z]:" paths)
             ;; Assume single DOS-style path...
             (list paths))
            (t
@@ -974,7 +974,7 @@
     ;; With NTEmacs 20.5, the PATTERN option to `x-list-fonts' does
     ;; not seem to work and fonts may be repeated, so ...
     (dolist (font fonts)
-      (and (string-match "-Symbol-" font)
+      (and (string-match-p "-Symbol-" font)
           (not (member font symbol-fonts))
           (setq symbol-fonts (cons font symbol-fonts))))
     symbol-fonts))
@@ -1173,7 +1173,7 @@
 should be a topic string and non-nil RE-CACHE forces re-caching."
   (interactive (list nil current-prefix-arg))
   ;; The following test is for non-interactive calls via gnudoit etc.
-  (if (or (not (stringp topic)) (string-match "\\S " topic))
+  (if (or (not (stringp topic)) (string-match-p "\\S " topic))
       (let ((file-name (woman-file-name topic re-cache)))
        (if file-name
            (woman-find-file file-name)
@@ -1614,7 +1614,7 @@
        (let* ((bufname (file-name-nondirectory file-name))
               (case-fold-search t)
               (compressed
-               (not (not (string-match woman-file-compression-regexp 
bufname)))))
+               (and (string-match-p woman-file-compression-regexp bufname) t)))
          (if compressed
              (setq bufname (file-name-sans-extension bufname)))
          (setq bufname (if exists
@@ -1756,7 +1756,7 @@
       ;; Co-operate with auto-compression mode:
       (if (and compressed
               (or (eq compressed t)
-                  (string-match woman-file-compression-regexp filename))
+                  (string-match-p woman-file-compression-regexp filename))
               ;; (not auto-compression-mode)
               (not (rassq 'jka-compr-handler file-name-handler-alist)) )
          ;; (error "Compressed file requires Auto File Decompression turned 
on")
@@ -2192,7 +2192,7 @@
   (let ((face-list (face-list)))
     (dolist (face face-list)
       (let ((face-name (symbol-name face)))
-       (if (and (string-match "\\`woman-" face-name)
+       (if (and (string-match-p "\\`woman-" face-name)
                 (face-underline-p face))
            (let ((face-no-ul (intern (concat face-name "-no-ul"))))
              (copy-face face face-no-ul)
@@ -3029,6 +3029,8 @@
   "Delete any double-quote characters up to the end of the line."
   (woman-unquote (save-excursion (end-of-line) (point-marker))))
 
+(defvar woman1-unquote)          ; bound locally by woman1-roff-buffer
+
 (defun woman1-roff-buffer ()
   "Process non-breaking requests."
   (let ((case-fold-search t)
@@ -3069,8 +3071,6 @@
   ".I -- Set words of current line in italic font."
   (woman1-B-or-I ".ft I\n"))
 
-(defvar woman1-unquote)          ; bound locally by woman1-roff-buffer
-
 (defun woman1-B-or-I (B-or-I)
   ".B/I -- Set words of current line in bold/italic font.
 B-OR-I is the appropriate complete control line."

=== modified file 'lisp/xml.el'
--- a/lisp/xml.el       2013-02-13 07:24:11 +0000
+++ b/lisp/xml.el       2013-08-11 00:07:48 +0000
@@ -479,7 +479,7 @@
                 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 @@
         (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 @@
        (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 @@
        (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 @@
          (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 @@
        (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 @@
   (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 @@
 
       ;; 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 @@
                (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 @@
          (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 @@
            (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 @@
        (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 @@
   (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))


reply via email to

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