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

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

[elpa] externals/ebdb 64b5e43 170/350: Fix autoloads in ebdb.el


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 64b5e43 170/350: Fix autoloads in ebdb.el
Date: Mon, 14 Aug 2017 11:46:29 -0400 (EDT)

branch: externals/ebdb
commit 64b5e43bf2614e6a06c8cfa1777ab39dd923adf8
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Fix autoloads in ebdb.el
    
    * ebdb-com.el: First of all, remove `ebdb-dwim-mail' from this file.
    * ebdb.el: And add it here.  It's a general-use function, it shouldn't
      be in ebdb-com.el.  Also adjust autoloads: half of the autoloaded
      functions weren't being used in this file, and nothing here should
      ever depend on ebdb-com.el.  Lastly, there's no need to wrap in
      `eval-when-compile': the autoloads should be available at load and
      compile times.
---
 ebdb-com.el | 48 ------------------------------------------
 ebdb.el     | 69 ++++++++++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 55 insertions(+), 62 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index a076b56..0745f56 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -2088,54 +2088,6 @@ the record to be displayed or nil otherwise."
 
 ;;; Send-Mail interface
 
-;;;###autoload
-(defun ebdb-dwim-mail (record &optional mail)
-  ;; Do What I Mean!
-  "Return a string to use as the mail address of RECORD.
-
-However, if both the first name and last name are constituents of
-the address as in address@hidden, and
-`ebdb-mail-avoid-redundancy' is non-nil, then the address is used
-as is.  If `ebdb-mail-avoid-redundancy' is 'mail-only the name
-is never included.  MAIL may be a mail address to be used for
-RECORD.  If MAIL is an integer, use the MAILth mail address of
-RECORD.  If MAIL is nil use RECORD's primary mail address."
-  (unless mail
-    (let ((mails (ebdb-record-mail record t)))
-      (setq mail (or (and (integerp mail) (nth mail mails))
-                     (object-assoc 'primary 'priority mails)
-                    (car mails)))))
-  (unless mail (error "Record has no mail addresses"))
-  (let* ((name-base (or (slot-value mail 'aka) (ebdb-record-name record)))
-        (mail (slot-value mail 'mail))
-        (name
-         (cond
-          ((or (eq 'mail-only ebdb-mail-avoid-redundancy)
-               (and ebdb-mail-avoid-redundancy
-                    (string-match-p
-                     (regexp-quote
-                      (replace-regexp-in-string
-                       "\s" "" name-base))
-                     (replace-regexp-in-string
-                      "[-._]" "" (car (split-string mail "@"))))))
-           nil)
-          (name-base)
-          (t nil))))
-    (if name
-       (progn
-         ;; If the name contains backslashes or double-quotes, backslash them.
-         (setq name (replace-regexp-in-string "[\\\"]" "\\\\\\&" name))
-         ;; If the name contains control chars or RFC822 specials, it needs
-         ;; to be enclosed in quotes.  This quotes a few extra characters as
-         ;; well (!,%, and $) just for common sense.
-         ;; `define-mail-alias' uses regexp "[^- !#$%&'*+/0-9=?A-Za-z^_`{|}~]".
-
-         (format (if (string-match "[][[:cntrl:]\177()<>@,;:.!$%[:nonascii:]]" 
name)
-                     "\"%s\" <%s>"
-                   "%s <%s>")
-                 name mail))
-      mail)))
-
 (defun ebdb-compose-mail (&rest args)
   "Start composing a mail message to send."
   (apply 'compose-mail args))
diff --git a/ebdb.el b/ebdb.el
index f748f99..d0e00d5 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -51,20 +51,14 @@
 (require 'eieio-base)
 (require 'eieio-opt)
 
-(eval-when-compile              ; pacify the compiler.
-  (autoload 'widget-group-match "wid-edit")
-  (autoload 'ebdb-migrate-from-bbdb "ebdb-migrate")
-  (autoload 'ebdb-do-records "ebdb-com")
-  (autoload 'ebdb-append-display-p "ebdb-com")
-  (autoload 'ebdb-toggle-records-layout "ebdb-com")
-  (autoload 'ebdb-dwim-mail "ebdb-com")
-  (autoload 'ebdb-spec-prefix "ebdb-com")
-  (autoload 'ebdb-completing-read-records "ebdb-com")
-  (autoload 'eieio-customize-object "eieio-custom")
-  (autoload 'calendar-gregorian-from-absolute "calendar")
-  (autoload 'calendar-read-date "calendar")
-  (autoload 'diary-sexp-entry "diary-lib")
-  (autoload 'org-agenda-list "org-agenda"))
+; pacify the compiler.
+(autoload 'widget-group-match "wid-edit")
+(autoload 'ebdb-migrate-from-bbdb "ebdb-migrate")
+(autoload 'eieio-customize-object "eieio-custom")
+(autoload 'calendar-gregorian-from-absolute "calendar")
+(autoload 'calendar-read-date "calendar")
+(autoload 'diary-sexp-entry "diary-lib")
+(autoload 'org-agenda-list "org-agenda")
 
 ;; These are the most important internal variables, holding EBDB's
 ;; data structures.
@@ -3730,6 +3724,53 @@ of corresponding mail addresses."
   :type '(choice (const :tag "Update the EBDB buffer" t)
                  (const :tag "Do not update the EBDB buffer" nil)))
 
+(defun ebdb-dwim-mail (record &optional mail)
+  ;; Do What I Mean!
+  "Return a string to use as the mail address of RECORD.
+
+However, if both the first name and last name are constituents of
+the address as in address@hidden, and
+`ebdb-mail-avoid-redundancy' is non-nil, then the address is used
+as is.  If `ebdb-mail-avoid-redundancy' is 'mail-only the name
+is never included.  MAIL may be a mail address to be used for
+RECORD.  If MAIL is an integer, use the MAILth mail address of
+RECORD.  If MAIL is nil use RECORD's primary mail address."
+  (unless mail
+    (let ((mails (ebdb-record-mail record t)))
+      (setq mail (or (and (integerp mail) (nth mail mails))
+                     (object-assoc 'primary 'priority mails)
+                    (car mails)))))
+  (unless mail (error "Record has no mail addresses"))
+  (let* ((name-base (or (slot-value mail 'aka) (ebdb-record-name record)))
+        (mail (slot-value mail 'mail))
+        (name
+         (cond
+          ((or (eq 'mail-only ebdb-mail-avoid-redundancy)
+               (and ebdb-mail-avoid-redundancy
+                    (string-match-p
+                     (regexp-quote
+                      (replace-regexp-in-string
+                       "\s" "" name-base))
+                     (replace-regexp-in-string
+                      "[-._]" "" (car (split-string mail "@"))))))
+           nil)
+          (name-base)
+          (t nil))))
+    (if name
+       (progn
+         ;; If the name contains backslashes or double-quotes, backslash them.
+         (setq name (replace-regexp-in-string "[\\\"]" "\\\\\\&" name))
+         ;; If the name contains control chars or RFC822 specials, it needs
+         ;; to be enclosed in quotes.  This quotes a few extra characters as
+         ;; well (!,%, and $) just for common sense.
+         ;; `define-mail-alias' uses regexp "[^- !#$%&'*+/0-9=?A-Za-z^_`{|}~]".
+
+         (format (if (string-match "[][[:cntrl:]\177()<>@,;:.!$%[:nonascii:]]" 
name)
+                     "\"%s\" <%s>"
+                   "%s <%s>")
+                 name mail))
+      mail)))
+
 
 ;;;Dialing
 (defcustom ebdb-dial-local-prefix-alist



reply via email to

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