emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/ebdb f9948d7: Fixups and code shuffling to appease comp


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb f9948d7: Fixups and code shuffling to appease compiler
Date: Wed, 2 Jun 2021 14:47:46 -0400 (EDT)

branch: externals/ebdb
commit f9948d7ab11e3a5a483fea0c167484b8be7d594f
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Fixups and code shuffling to appease compiler
    
    * ebdb-com.el (ebdb-format-all-records): Move this function here from
    ebdb-format.el; it belongs here anyway.
    * ebdb-i18n-basic.el: Needs the eieio library for `with-slots'.
    * ebdb.el (ebdb-record-completion-table, ebdb-completion-predicate):
    Move these here from ebdb-com.el, they also belong here.
    * ebdb.el (ebdb-read): Silence warnings about `calendar-read'.
    * ebdb-vm.el: Get rid of all the "xfield" references and functions.
    * ebdb-helm.el: Don't provide an arglist to declare-function, it was
    getting confused about the &key signature.
---
 ebdb-com.el        | 53 ++++++----------------------------------------
 ebdb-format.el     |  6 ------
 ebdb-helm.el       |  3 +--
 ebdb-i18n-basic.el |  4 ++++
 ebdb-vm.el         | 54 +++++++++++++++++++++++------------------------
 ebdb-wl.el         |  1 +
 ebdb.el            | 62 ++++++++++++++++++++++++++++++++++++++++++++++++------
 7 files changed, 94 insertions(+), 89 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 8a9a38b..7b29d0d 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -2566,53 +2566,6 @@ otherwise inline."
 
 ;;; Completion
 
-(defun ebdb-record-completion-table (str pred action)
-  "Function used as a completion table for EBDB records.
-STR is used to search the database.  The return value is the
-completed name string."
-  (let* ((completion-ignore-case ebdb-case-fold-search)
-        (newstring (concat "^" str))
-        ;; Completion searches the database, but we only use "fast
-        ;; lookup" search clauses which use the hashtable, instead of
-        ;; cycling over all records one by one.  Still pretty slow,
-        ;; though.  Also unfortunate is that EBDB has a broader
-        ;; concept of "matching string" than the completion
-        ;; framework, which will later filter out strings that we
-        ;; consider matching (e.g. according to character folding, or
-        ;; romanization of non-English scripts).  Perhaps we could
-        ;; make our own completion style to take care of that.
-        (strings
-         (mapcar #'ebdb-string
-                 (if (string-empty-p str)
-                     (ebdb-records)
-                   (ebdb-search
-                    (ebdb-records)
-                    (append
-                     (list `(ebdb-field-name ,newstring)
-                           `(ebdb-field-mail ,newstring)
-                           `(ebdb-field-tags ,newstring))
-                     (mapcar (lambda (f)
-                               (list f newstring))
-                             ebdb-hash-extra-predicates)))))))
-    (if (eq action 'metadata)
-       '(metadata . ((category . ebdb-contact)))
-      (complete-with-action action strings str pred))))
-
-;;;###autoload
-(defun ebdb-completion-predicate (key records)
-  "Check if KEY is a value key to return RECORDS.
-For use as the third argument to `completing-read'.
-Obey `ebdb-completion-list'."
-  (cond ((null ebdb-completion-list)
-         nil)
-        ((eq t ebdb-completion-list)
-         t)
-        (t
-         (catch 'ebdb-hash-ok
-          (dolist (record records)
-            (ebdb-hash-p key record ebdb-completion-list))
-          nil))))
-
 (defun ebdb-completing-read-record (prompt)
   "Read and return a record from the EBDB.
 PROMPT is used in `completing-read'.  Actual completion is done
@@ -3180,6 +3133,12 @@ RECORDS is the record under point, or all marked 
records."
        (funcall f)))))
 
 ;;;###autoload
+(defun ebdb-format-all-records (&optional formatter records)
+  (interactive
+   (list (ebdb-prompt-for-formatter)))
+  (ebdb-format-to-tmp-buffer formatter (or records (ebdb-records))))
+
+;;;###autoload
 (defun ebdb-format-these-records (formatter)
   "Format all records in the current *EBDB* buffer.
 Prompts for FORMATTER to use."
diff --git a/ebdb-format.el b/ebdb-format.el
index 4156a36..234e0e3 100644
--- a/ebdb-format.el
+++ b/ebdb-format.el
@@ -533,11 +533,5 @@ multiple instances in a single alist."
     (cdr (assoc (completing-read "Use formatter: " collection)
                collection))))
 
-;;;###autoload
-(defun ebdb-format-all-records (&optional formatter records)
-  (interactive
-   (list (ebdb-prompt-for-formatter)))
-  (ebdb-format-to-tmp-buffer formatter (or records (ebdb-records))))
-
 (provide 'ebdb-format)
 ;;; ebdb-format.el ends here
diff --git a/ebdb-helm.el b/ebdb-helm.el
index 9e6ebaf..830dbd5 100644
--- a/ebdb-helm.el
+++ b/ebdb-helm.el
@@ -28,8 +28,7 @@
 (declare-function helm-other-buffer "ext:helm"
                  (any-sources any-buffer))
 
-(declare-function helm-marked-candidates "ext:helm"
-                 (&key with-wildcard all-sources))
+(declare-function helm-marked-candidates "ext:helm")
 
 (defun ebdb-helm-candidates ()
   "Return a list of all records in the database."
diff --git a/ebdb-i18n-basic.el b/ebdb-i18n-basic.el
index 0d57fc9..d566a83 100644
--- a/ebdb-i18n-basic.el
+++ b/ebdb-i18n-basic.el
@@ -25,6 +25,10 @@
 
 ;;; Code:
 
+(eval-when-compile
+  ;; For `with-slots'.
+  (require 'eieio))
+
 ;;; USA
 
 (defvar ebdb-i18n-usa-states
diff --git a/ebdb-vm.el b/ebdb-vm.el
index a0692bf..ebc3cd6 100644
--- a/ebdb-vm.el
+++ b/ebdb-vm.el
@@ -107,7 +107,7 @@ Respect `vm-summary-uninteresting-senders'."
       (let* ((data (ebdb-extract-address-components address))
              (record (car (ebdb-message-search (car data) (cadr data)))))
         (if record
-            (or (ebdb-record-xfield record 'mail-name)
+            (or (slot-value (ebdb-record-one-mail record) 'aka)
                 (ebdb-record-name-string record))))))
 
 
@@ -126,13 +126,13 @@ The order in this list is the order how matching will be 
performed."
   :type '(repeat (string :tag "header name")))
 
 ;;;###autoload
-(defcustom ebdb/vm-auto-folder-field 'vm-folder
+(defcustom ebdb/vm-auto-folder-field "vm-folder"
   "The xfield which `ebdb/vm-auto-folder' searches for."
   :group 'ebdb-mua-vm
   :type 'symbol)
 
 ;;;###autoload
-(defcustom ebdb/vm-virtual-folder-field 'vm-virtual
+(defcustom ebdb/vm-virtual-folder-field "vm-virtual"
   "The xfield which `ebdb/vm-virtual-folder' searches for."
   :group 'ebdb-mua-vm
   :type 'symbol)
@@ -148,23 +148,23 @@ If nil use `vm-primary-inbox'."
 ;;;###autoload
 (defun ebdb/vm-auto-folder ()
   "Add entries to `vm-auto-folder-alist' for the records in EBDB.
-For each record that has a `vm-folder' xfield, add an element
+For each record that has a `vm-folder' field, add an element
 \(MAIL-REGEXP . FOLDER-NAME) to `vm-auto-folder-alist'.
 The element gets added to the sublists of `vm-auto-folder-alist'
 specified in `ebdb/vm-auto-folder-headers'.
 MAIL-REGEXP matches the mail addresses of the EBDB record.
-The value of the `vm-folder' xfield becomes FOLDER-NAME.
-The `vm-folder' xfield is defined via `ebdb/vm-auto-folder-field'.
+The value of the `vm-folder' field becomes FOLDER-NAME.
+The `vm-folder' field is defined via `ebdb/vm-auto-folder-field'.
 
 Add this function to `ebdb-before-save-hook' and your .vm."
   (interactive)
-  (let ((records ; Collect EBDB records with a vm-folder xfield.
-          (delq nil
-                (mapcar (lambda (r)
-                          (if (ebdb-record-xfield r ebdb/vm-auto-folder-field)
-                              r))
-                        (ebdb-records))))
-         folder-list folder-name mail-regexp)
+  (let ((records       ; Collect EBDB records with a vm-folder field.
+         (delq nil
+               (mapcar (lambda (r)
+                         (if (ebdb-record-field r ebdb/vm-auto-folder-field)
+                             r))
+                       (ebdb-records))))
+        folder-list folder-name mail-regexp)
     ;; Add (MAIL-REGEXP . FOLDER-NAME) pair to this sublist of 
`vm-auto-folder-alist'
     (dolist (header ebdb/vm-auto-folder-headers)
       ;; create the folder-list in `vm-auto-folder-alist' if it does not exist
@@ -173,11 +173,11 @@ Add this function to `ebdb-before-save-hook' and your 
.vm."
         (setq folder-list (assoc header vm-auto-folder-alist)))
       (dolist (record records)
         ;; Ignore everything past a comma
-        (setq folder-name (car (ebdb-record-xfield-split
+        (setq folder-name (car (ebdb-record-field
                                 record ebdb/vm-auto-folder-field))
               ;; quote all the mail addresses for the record and join them
               mail-regexp (regexp-opt (ebdb-record-mail record)))
-        ;; In general, the values of xfields are strings (required for 
editing).
+        ;; In general, the values of fields are strings (required for editing).
         ;; If we could set the value of `ebdb/vm-auto-folder-field' to a 
symbol,
         ;; it could be a function that is called with arg record to calculate
         ;; the value of folder-name.
@@ -197,23 +197,23 @@ Add this function to `ebdb-before-save-hook' and your 
.vm."
 ;;;###autoload
 (defun ebdb/vm-virtual-folder ()
   "Create `vm-virtual-folder-alist' according to the records in EBDB.
-For each record that has a `vm-virtual' xfield, add or modify the
+For each record that has a `vm-virtual' field, add or modify the
 corresponding VIRTUAL-FOLDER-NAME element of `vm-virtual-folder-alist'.
 
   (VIRTUAL-FOLDER-NAME ((FOLDER-NAME ...)
                         (author-or-recipient MAIL-REGEXP)))
 
-VIRTUAL-FOLDER-NAME is the first element of the `vm-virtual' xfield.
-FOLDER-NAME ... are either the remaining elements of the `vm-virtual' xfield,
+VIRTUAL-FOLDER-NAME is the first element of the `vm-virtual' field.
+FOLDER-NAME ... are either the remaining elements of the `vm-virtual' field,
 or `ebdb/vm-virtual-real-folders' or `vm-primary-inbox'.
 MAIL-REGEXP matches the mail addresses of the EBDB record.
-The `vm-virtual' xfield is defined via `ebdb/vm-virtual-folder-field'.
+The `vm-virtual' field is defined via `ebdb/vm-virtual-folder-field'.
 
 Add this function to `ebdb-before-save-hook' and your .vm."
   (interactive)
   (let (real-folders mail-regexp folder val tmp)
     (dolist (record (ebdb-records))
-      (when (setq val (ebdb-record-xfield-split
+      (when (setq val (ebdb-record-field
                        record ebdb/vm-virtual-folder-field))
         (setq mail-regexp (regexp-opt (ebdb-record-mail record)))
         (unless (string= "" mail-regexp)
@@ -247,7 +247,7 @@ Add this function to `ebdb-before-save-hook' and your .vm."
 ;; the required labels in a rather simplistic way, checking merely
 ;; whether the sender's EBDB record uses a certain mail alias.
 ;; (Note that `ebdb/vm-virtual-folder' can achieve the same goal,
-;; yet this requires a second xfield that must be kept up-to-date, too.)
+;; yet this requires a second field that must be kept up-to-date, too.)
 ;; To make auto labels yet more useful, the code could allow more
 ;; sophisticated schemes, too.  Are there real-world applications
 ;; for this?
@@ -255,16 +255,16 @@ Add this function to `ebdb-before-save-hook' and your 
.vm."
 ;;; Howard Melman, contributed Jun 16 2000
 (defcustom ebdb/vm-auto-add-label-list nil
   "List used by `ebdb/vm-auto-add-label' to automatically label VM messages.
-Its elements may be strings used both as the xfield value to check for
+Its elements may be strings used both as the field value to check for
 and as the label to apply to the message.
-If an element is a cons pair (VALUE . LABEL), VALUE is the xfield value
+If an element is a cons pair (VALUE . LABEL), VALUE is the field value
 to search for and LABEL is the label to apply."
   :group 'ebdb-mua-vm
   :type 'list)
 
 (defcustom ebdb/vm-auto-add-label-field 'ebdb-mail-alias-field
-  "Xfields used by `ebdb/vm-auto-add-label' to automatically label messages.
-This is either a single EBDB xfield or a list of xfields that
+  "Fields used by `ebdb/vm-auto-add-label' to automatically label messages.
+This is either a single EBDB field or a list of fields that
 `ebdb/vm-auto-add-label' uses to check for labels to apply to a message.
 Defaults to `ebdb-mail-alias-field' which defaults to `mail-alias'."
   :group 'ebdb-mua-vm
@@ -291,10 +291,10 @@ from different senders."
               ;; Inspect the relevant fields of RECORD
               (append
                (mapcar (lambda (field)
-                         (ebdb-record-xfield-split record field))
+                         (ebdb-record-field record field))
                        (cond ((listp ebdb/vm-auto-add-label-field)
                               ebdb/vm-auto-add-label-field)
-                             ((symbolp ebdb/vm-auto-add-label-field)
+                             ((stringp ebdb/vm-auto-add-label-field)
                               (list ebdb/vm-auto-add-label-field))
                              (t (error "Bad value for 
ebdb/vm-auto-add-label-field"))))))
              ;; Collect the relevant labels from `ebdb/vm-auto-add-label-list'
diff --git a/ebdb-wl.el b/ebdb-wl.el
index d4a5cb3..5e6ef1b 100644
--- a/ebdb-wl.el
+++ b/ebdb-wl.el
@@ -37,6 +37,7 @@
 (defvar wl-draft-mode-map)
 (defvar wl-folder-buffer-name)
 (defvar wl-highlight-signature-separator)
+(defvar mime-view-mode-default-map)
 
 (defgroup ebdb-mua-wl nil
   "Options for EBDB's interaction with Wanderlust."
diff --git a/ebdb.el b/ebdb.el
index 22a76fa..450207b 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -786,7 +786,7 @@ corresponding mail addresses."
   :type 'function)
 
 (defcustom ebdb-completion-display-record t
-  "If non-nil function `ebdb-complete-mail' displays the EBDB record after 
completion."
+  "If non-nil, `ebdb-complete-mail' will display records after completion."
   :group 'ebdb-sendmail
   :type '(choice (const :tag "Update the EBDB buffer" t)
                  (const :tag "Do not update the EBDB buffer" nil)))
@@ -1134,7 +1134,7 @@ old field.  By now we've sucked all the useful 
information out of
 it, and if this process is successful it will get deleted."
   (apply 'make-instance class slots))
 
-(cl-defmethod ebdb-read :around ((cls (subclass ebdb-field))
+(cl-defmethod ebdb-read :around ((_cls (subclass ebdb-field))
                                 &optional _slots _obj)
   (let ((completion-ignore-case ebdb-completion-ignore-case))
     (cl-call-next-method)))
@@ -2188,11 +2188,12 @@ Eventually this method will go away."
         (last (calendar-last-day-of-month
                ;; If no year, assume a non-leap year.
                month (or year 2017)))
-        (day (calendar-read (format "Day (1-%d): " last)
-                            (lambda (x) (and (< 0 x)
-                                             (<= x last)))
-                            (when obj (number-to-string
-                                       (nth 1 (slot-value obj 'date)))))))
+        (day (with-no-warnings ; `with-suppressed-warnings' is too new.
+               (calendar-read (format "Day (1-%d): " last)
+                              (lambda (x) (and (< 0 x)
+                                               (<= x last)))
+                              (when obj (number-to-string
+                                         (nth 1 (slot-value obj 'date))))))))
     (cl-call-next-method class
                         (plist-put slots :date
                                    (list month day year))
@@ -4674,6 +4675,53 @@ Also see the variable `ebdb-ignore-redundant-mails'."
             `(ebdb-contact (styles substring basic)
                            (cycle . ,ebdb-complete-mail-allow-cycling)))
 
+(defun ebdb-record-completion-table (str pred action)
+  "Function used as a completion table for EBDB records.
+STR is used to search the database.  The return value is the
+completed name string."
+  (let* ((completion-ignore-case ebdb-case-fold-search)
+        (newstring (concat "^" str))
+        ;; Completion searches the database, but we only use "fast
+        ;; lookup" search clauses which use the hashtable, instead of
+        ;; cycling over all records one by one.  Still pretty slow,
+        ;; though.  Also unfortunate is that EBDB has a broader
+        ;; concept of "matching string" than the completion
+        ;; framework, which will later filter out strings that we
+        ;; consider matching (e.g. according to character folding, or
+        ;; romanization of non-English scripts).  Perhaps we could
+        ;; make our own completion style to take care of that.
+        (strings
+         (mapcar #'ebdb-string
+                 (if (string-empty-p str)
+                     (ebdb-records)
+                   (ebdb-search
+                    (ebdb-records)
+                    (append
+                     (list `(ebdb-field-name ,newstring)
+                           `(ebdb-field-mail ,newstring)
+                           `(ebdb-field-tags ,newstring))
+                     (mapcar (lambda (f)
+                               (list f newstring))
+                             ebdb-hash-extra-predicates)))))))
+    (if (eq action 'metadata)
+       '(metadata . ((category . ebdb-contact)))
+      (complete-with-action action strings str pred))))
+
+;;;###autoload
+(defun ebdb-completion-predicate (key records)
+  "Check if KEY is a value key to return RECORDS.
+For use as the third argument to `completing-read'.
+Obey `ebdb-completion-list'."
+  (cond ((null ebdb-completion-list)
+         nil)
+        ((eq t ebdb-completion-list)
+         t)
+        (t
+         (catch 'ebdb-hash-ok
+          (dolist (record records)
+            (ebdb-hash-p key record ebdb-completion-list))
+          nil))))
+
 
 ;;; Dialing and texting.
 



reply via email to

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