[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb d9b4865 146/350: More tweaks to snarfing process
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb d9b4865 146/350: More tweaks to snarfing process |
Date: |
Mon, 14 Aug 2017 11:46:24 -0400 (EDT) |
branch: externals/ebdb
commit d9b486587de1493a3f582092ce1a4c0da9240369
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
More tweaks to snarfing process
* ebdb-snarf.el (ebdb-snarf): Okay, they're mostly bugs. Was
clobbering the parameter name here.
(ebdb-snarf-collect): Pick up the correct name regexp grouping.
Also, special-case matching email addresses -- drop the domain part.
And don't match quite so much.
(ebdb-snarf-query): Fix bug leftover from old implementation.
---
ebdb-snarf.el | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/ebdb-snarf.el b/ebdb-snarf.el
index c0274cf..db647a1 100644
--- a/ebdb-snarf.el
+++ b/ebdb-snarf.el
@@ -70,7 +70,7 @@ with other field types."
:type 'list)
;;;###autoload
-(defun ebdb-snarf (&optional string start end records)
+(defun ebdb-snarf (&optional string start end recs)
"Snarf text and attempt to display/update/create a record from it.
If STRING is given, snarf the string. If START and END are given
@@ -99,7 +99,7 @@ be relevant to snarfed field data."
(insert (string-trim str))
(setq records (ebdb-snarf-query
(ebdb-snarf-collapse
- (ebdb-snarf-collect records)))))
+ (ebdb-snarf-collect recs)))))
(when records
(ebdb-display-records records nil nil t (ebdb-popup-window)
(format "*%s-Snarf*" ebdb-buffer-name)))))
@@ -160,24 +160,29 @@ have something to do with the text in the buffer."
;; likely to see email headers in
;; the message body, for instance
;; in quoted replies.
- "\\(?:From: \\|To: \\|Cc: \\)?"
+ "\\(?:From: \\|To: \\|Cc: \\)?\\("
(mapconcat #'identity
- ebdb-snarf-name-re "\\|"))
+ ebdb-snarf-name-re "\\|")
+ "\\)")
(match-beginning 0) t)
;; If something goes wrong with the
;; name, don't worry about it.
(ignore-errors
(ebdb-parse
'ebdb-field-name
- (string-trim (match-string-no-properties
0)))))))
+ (string-trim (match-string-no-properties
1)))))))
;; Make a regular expression that stands a chance
;; of matching an existing record or record
;; fields. This is likely *too* permissive.
(generic-re
(regexp-opt
(append (split-string
- (downcase (ebdb-string found))
- "[-_.@)(]" t)
+ (downcase
+ (car (split-string
+ ;; Sneaky special-casing of email
addresses.
+ (ebdb-string found)
+ "@")))
+ "[-_.)(]" t)
(when name
(split-string
(downcase (ebdb-string name))
@@ -195,7 +200,9 @@ have something to do with the text in the buffer."
(when (or (and record
(ebdb-search (list record)
`((ebdb-field-name
,generic-re)
- (,(car class)
,generic-re))))
+ ;; This catches too
much.
+ ;(,(car class) ,generic-re)
+ )))
(and (or fields names)
(seq-some
(lambda (elt)
@@ -363,11 +370,11 @@ automatically."
(when-let ((record
(cond ((yes-or-no-p
(format "Add %s to existing record? "
- (ebdb-string (cdr f))))
+ (ebdb-string f)))
(ebdb-prompt-for-record))
((yes-or-no-p
(format "Add %s to new record? "
- (ebdb-string (cdr f))))
+ (ebdb-string f)))
(ebdb-init-record
(ebdb-db-add-record
(car ebdb-db-list)
- [elpa] externals/ebdb dd83c7e 115/350: Short-circuit ebdb-info, (continued)
- [elpa] externals/ebdb dd83c7e 115/350: Short-circuit ebdb-info, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a0eada8 128/350: Change some of the EBDB buffer formatting defaults, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 20906ae 131/350: ebdb-prompt-for-record should load if necessary, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 1bc78ab 133/350: Add helm-ebdb file, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ed3e270 119/350: Reverse order of args in return value of ebdb-popup-window, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ed6e228 136/350: Make ebdb-annotate-message more class agnostic, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb aa2d973 147/350: Allow optional records argument to ebdb-initialize, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 42f6dce 130/350: Add "Hacking EBDB" section to manual, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5dda311 118/350: Force mode line update after renaming EBDB buffers, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a94483d 122/350: Refinements to snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb d9b4865 146/350: More tweaks to snarfing process,
Eric Abrahamsen <=
- [elpa] externals/ebdb b635b4e 155/350: First stab at article snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 6c267e9 159/350: Fix pop-up mouse menus in EBDB buffers, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 55b3f82 160/350: Fixup with fix popup menus, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb abdb8cd 158/350: Update copyright years to 2017, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5fdf286 166/350: Feeding incorrect args to ebdb-snarf, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 9b6c88d 167/350: Fix incorrect variable name, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb dd13813 171/350: Bah, fixups to a19ff0a, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb f1448f4 174/350: Remove this empty file, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 6479c87 173/350: Remove unused code, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb db930f6 163/350: Compiler-inspired fixes, and removal of old-code references, Eric Abrahamsen, 2017/08/14