]> code.delx.au - gnu-emacs-elpa/commitdiff
* debbugs: Use cl-lib. Use lexical-binding when available
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 27 Apr 2016 13:39:46 +0000 (09:39 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 27 Apr 2016 13:39:46 +0000 (09:39 -0400)
* debbugs-gnu.el: Only require subr-x at compile time.  Use cl-lib.
(debbugs-gnu-print-entry): Remove unused var `title-length'.
(debbugs-gnu-sort-title): Mark `s2' as unused.
* debbugs-org.el (debbugs-gnu): Use cl-lib.
* debbugs.el: Add `cl-lib' as dependency.  Use cl-lib.
(debbugs-soap-invoke-async): Mark `args' as unused.

packages/debbugs/debbugs-gnu.el
packages/debbugs/debbugs-org.el
packages/debbugs/debbugs.el

index 10a31cbb482ab6582c2c12cc2faa739edf70321b..a19581465d3c6d6fdaeea1e916e52d97e37e9b7e 100644 (file)
@@ -1,4 +1,4 @@
-;;; debbugs-gnu.el --- interface for the GNU bug tracker
+;;; debbugs-gnu.el --- interface for the GNU bug tracker  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2011-2016 Free Software Foundation, Inc.
 
 (require 'debbugs)
 (require 'tabulated-list)
 (require 'add-log)
-(require 'subr-x)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'subr-x))
+(eval-when-compile (require 'cl-lib))
 
 (autoload 'article-decode-charset "gnus-art")
 (autoload 'diff-goto-source "diff-mode")
@@ -717,7 +717,8 @@ Used instead of `tabulated-list-print-entry'."
        (submitter        (aref cols 2))
        (submitter-length (nth 1 (aref tabulated-list-format 2)))
        (title            (aref cols 3))
-       (title-length     (nth 1 (aref tabulated-list-format 3))))
+       ;; (title-length     (nth 1 (aref tabulated-list-format 3)))
+        )
     (when (and
           ;; We may have a narrowing in effect.
           (or (not debbugs-gnu-limit)
@@ -951,7 +952,7 @@ The following commands are available:
       t)
      (t nil))))
 
-(defun debbugs-gnu-sort-title (s1 s2)
+(defun debbugs-gnu-sort-title (s1 _s2)
   (let ((owner (if (cdr (assq 'owner (car s1)))
                   (car (mail-header-parse-address
                         (decode-coding-string (cdr (assq 'owner (car s1)))
index a95672d5a9fec666620b58eaf523b931a979c92c..ecd522d69213c90046a85113c2f1f9f4b451c58a 100644 (file)
@@ -1,4 +1,4 @@
-;;; debbugs-org.el --- Org-mode interface for the GNU bug tracker
+;;; debbugs-org.el --- Org-mode interface for the GNU bug tracker  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2013-2016 Free Software Foundation, Inc.
 
 
 (require 'debbugs-gnu)
 (require 'org)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;; Buffer-local variables.
 (defvar debbugs-gnu-local-query)
 (defconst debbugs-org-severity-priority
   (let ((priority ?A))
     (mapcar
-     (lambda (x) (prog1 (cons x (char-to-string priority)) (incf priority)))
+     (lambda (x) (prog1 (cons x (char-to-string priority)) (cl-incf priority)))
      debbugs-gnu-all-severities))
   "Mapping of debbugs severities to TODO priorities.")
 
@@ -288,10 +288,10 @@ returned."
 
        ;; Handle tags.
        (when (string-match "^\\([0-9.]+\\); \\(.+\\)$" subject)
-         (let ((x (match-string 1 subject))) (pushnew x tags :test #'equal))
+         (let ((x (match-string 1 subject))) (cl-pushnew x tags :test #'equal))
          (setq subject (match-string 2 subject)))
        (when archived
-          (pushnew "ARCHIVE" tags :test #'equal))
+          (cl-pushnew "ARCHIVE" tags :test #'equal))
        (setq tags
              (mapcar
               ;; Replace all invalid TAG characters by "_".
index cedf93f537bbb18738779d442b0a8a9e5f4cc991..f3dc7c6c78970d77e2c2ac21f4bab7648eccdb69 100644 (file)
@@ -1,4 +1,4 @@
-;;; debbugs.el --- SOAP library to access debbugs servers
+;;; debbugs.el --- SOAP library to access debbugs servers  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2011-2016 Free Software Foundation, Inc.
 
@@ -6,7 +6,7 @@
 ;; Keywords: comm, hypermedia
 ;; Package: debbugs
 ;; Version: 0.9.3
-;; Package-Requires: ((soap-client "3.1.1"))
+;; Package-Requires: ((soap-client "3.1.1") (cl-lib "0.5"))
 
 ;; This file is not part of GNU Emacs.
 
@@ -35,7 +35,7 @@
 
 ;(setq soap-debug t message-log-max t)
 (require 'soap-client)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup debbugs nil
   "Debbugs library"
@@ -120,8 +120,8 @@ This corresponds to the Debbugs server to be accessed, either
 (defun debbugs-soap-invoke-async (operation-name &rest parameters)
   "Invoke the SOAP connection asynchronously."
   (apply
-   'soap-invoke-async
-   (lambda (response &rest args)
+   #'soap-invoke-async
+   (lambda (response &rest _args)
      (setq debbugs-soap-invoke-async-object
           (append debbugs-soap-invoke-async-object (car response))))
    nil debbugs-wsdl debbugs-port operation-name parameters))
@@ -208,7 +208,7 @@ patch:
       (unless (and (keywordp kw) (stringp val))
        (error "Wrong query: %s %s" kw val))
       (setq key (substring (symbol-name kw) 1))
-      (case kw
+      (cl-case kw
        ((:package :severity :tag :src :affects)
         ;; Value shall be one word.
         (if (string-match "\\`\\S-+\\'" val)
@@ -380,7 +380,7 @@ Example:
                  (debbugs-soap-invoke-async
                   "get_status"
                   (apply
-                   'vector
+                   #'vector
                    (butlast
                     bug-ids (- (length bug-ids)
                                debbugs-max-hits-per-request))))))
@@ -415,7 +415,7 @@ Example:
            (setq y (assoc attribute (cdr (assoc 'value x))))
            (when (stringp (cdr y))
              (setcdr y (mapcar
-                        'string-to-number (split-string (cdr y) " " t)))))
+                        #'string-to-number (split-string (cdr y) " " t)))))
          ;; "subject", "originator", "owner" and "summary" may be an
          ;; xsd:base64Binary value containing a UTF-8-encoded string.
          (dolist (attribute '(subject originator owner summary))
@@ -481,7 +481,7 @@ Example:
       (unless (and (keywordp kw) (stringp val))
        (error "Wrong query: %s %s" kw val))
       (setq key (substring (symbol-name kw) 1))
-      (case kw
+      (cl-case kw
        ((:user)
         ;; Value shall be one word.  Extract email address, if existing.
         (if (string-match "\\`\\S-+\\'" val)
@@ -490,12 +490,12 @@ Example:
                 (setq val user-mail-address))
               (when (string-match "<\\(.+\\)>" val)
                 (setq val (match-string 1 val)))
-              (pushnew val user :test #'equal))
+              (cl-pushnew val user :test #'equal))
           (error "Wrong %s: %s" key val)))
        ((:tag)
         ;; Value shall be one word.
         (if (string-match "\\`\\S-+\\'" val)
-            (pushnew val tags :test #'equal)
+            (cl-pushnew val tags :test #'equal)
           (error "Wrong %s: %s" key val)))
        (t (error "Unknown key: %s" kw))))
 
@@ -669,7 +669,7 @@ Examples:
          (while skip
            (setq result1
                  (apply
-                  'debbugs-search-est
+                  #'debbugs-search-est
                   (append
                    (list
                     (append
@@ -683,6 +683,9 @@ Examples:
 
       ;; Compile search arguments.
       (dolist (elt query)
+        ;; FIXME: `vec' is used in an O(N²) way.  It should be a list instead,
+        ;; on which we push elements, and we only convert it to a vector at
+        ;; the end.
        (let (vec kw key val
                  phrase-cond attr-cond)
 
@@ -737,7 +740,7 @@ Examples:
                     (unless (member x val)
                       (setq val (append val (list x))))))
                 (setq vec
-                      (vconcat vec (list key (mapconcat 'identity val " "))))))
+                      (vconcat vec (list key (mapconcat #'identity val " "))))))
 
              (:status
               ;; It shouldn't happen in a phrase condition.
@@ -754,7 +757,7 @@ Examples:
                     (unless (member x val)
                       (setq val (append val (list x))))))
                 (setq vec
-                      (vconcat vec (list key (mapconcat 'identity val " "))))))
+                      (vconcat vec (list key (mapconcat #'identity val " "))))))
 
              ((:subject :package :tags :severity :@title)
               ;; It shouldn't happen in a phrase condition.
@@ -769,7 +772,7 @@ Examples:
                     (unless (member x val)
                       (setq val (append val (list x))))))
                 (setq vec
-                      (vconcat vec (list key (mapconcat 'identity val " "))))))
+                      (vconcat vec (list key (mapconcat #'identity val " "))))))
 
              ((:date :@cdate)
               ;; It shouldn't happen in a phrase condition.
@@ -785,7 +788,7 @@ Examples:
                       (setq val (append val (list x))))))
                 (setq vec
                       (vconcat
-                       vec (list key (mapconcat 'number-to-string val " "))))))
+                       vec (list key (mapconcat #'number-to-string val " "))))))
 
              ((:operator :order)
               ;; It shouldn't happen in a phrase condition.
@@ -818,7 +821,7 @@ BUG-OR-MESSAGE must be list element returned by either
 Example: Return the originator of last submitted bug.
 
 \(debbugs-get-attribute
-  \(car \(apply 'debbugs-get-status \(debbugs-newest-bugs 1))) 'originator)"
+  \(car \(apply #'debbugs-get-status \(debbugs-newest-bugs 1))) 'originator)"
   (cdr (assoc attribute bug-or-message)))
 
 (defun debbugs-get-message-numbers (messages)
@@ -839,7 +842,7 @@ If there is no message with MESSAGE-NUMBER, the function returns `nil'.
 
 Example: Return the first message of last submitted bug.
 
-\(let \(\(messages \(apply 'debbugs-get-bug-log \(debbugs-newest-bugs 1))))
+\(let \(\(messages \(apply #'debbugs-get-bug-log \(debbugs-newest-bugs 1))))
   \(debbugs-get-message messages
                       \(car \(debbugs-get-message-numbers messages))))"
   (while (and messages