[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
- [elpa] externals/ebdb 81e23c3 134/350: Simplify record mail citing, (continued)
- [elpa] externals/ebdb 81e23c3 134/350: Simplify record mail citing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb b661aac 124/350: First generalized version of snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb aae57ff 139/350: Ensure that extra name field instances go in 'aka slot, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 057c4c0 144/350: Have ebdb-snarf accept optional records argument, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8d81a19 132/350: Add EBDB record citation, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 7662133 140/350: Simplify ebdb-dwim-mail, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0cfe1ec 164/350: Provide keybinding for ebdb-format-all-records, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb bf51b58 161/350: Fix ebdb-delete-redundant-mails, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 279eb56 169/350: Tweaks and additions to manual, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb eea0abf 165/350: VCard export is good enough, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 64b5e43 170/350: Fix autoloads in ebdb.el,
Eric Abrahamsen <=
- [elpa] externals/ebdb a968dd3 143/350: First actually-working version of snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a8e0221 179/350: Missing local variable binding, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e71548d 172/350: Allow for characters before mail addresses when snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 14b03b5 186/350: Fix menu entry of ebdb-create-record, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 10c1e76 185/350: When replying to messages, start with a populated EBDB buffer, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb b9e6034 187/350: Increase base field indentation in *EBDB* buffers, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a19ff0a 168/350: Simplify pop-up window splitting, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 4c6b6f5 190/350: Protect gnus stuff behind eval-after-load, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e0c3311 177/350: Fix parsing of suffixes in names, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 429cdb0 183/350: Add safety check to ebdb-undisplay-records, Eric Abrahamsen, 2017/08/14