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

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

[elpa] externals/ebdb e98b18a 06/16: New command ebdb-create-record-and-


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb e98b18a 06/16: New command ebdb-create-record-and-role
Date: Sun, 16 Jun 2019 12:23:07 -0400 (EDT)

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

    New command ebdb-create-record-and-role
    
    * ebdb-com.el (ebdb-create-record-and-role): New convenience function
      for creating a new record and adding a role all at once. Really need
      some way of differentiating the prompts.
    * ebdb.org (Role fields): Document.
---
 ebdb-com.el | 32 ++++++++++++++++++++
 ebdb.info   | 99 ++++++++++++++++++++++++++++++++-----------------------------
 ebdb.org    | 10 +++++--
 ebdb.texi   |  9 ++++--
 4 files changed, 99 insertions(+), 51 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 40b5617..f238f4d 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -263,6 +263,7 @@ display information."
     (define-key km (kbd "A")           'ebdb-mail-aliases)
     (define-key km (kbd "c")           'ebdb-create-record)
     (define-key km (kbd "C")           'ebdb-create-record-extended)
+    (define-key km (kbd "R")            'ebdb-create-record-and-role)
     (define-key km (kbd "e")           'ebdb-edit-field)
     (define-key km (kbd "E")           'ebdb-edit-field-customize)
     (define-key km (kbd ";")           'ebdb-edit-foo)
@@ -1712,6 +1713,37 @@ for these values."
     (ebdb-create-record db record-class)))
 
 ;;;###autoload
+(defun ebdb-create-record-and-role (rec)
+  "Convenience function for creating a record and role at once.
+If called on an organization record, create a new person record
+and give them a role at the organization.  If called on a person,
+do the reverse."
+  (interactive
+   (list (ebdb-current-record)))
+  (let ((make-org (if (object-of-class-p rec 'ebdb-record-person)
+                     t nil))
+       (db (car (slot-value (ebdb-record-cache rec) 'database)))
+       new-rec role-field)
+    (ebdb-create-record
+     db
+     (if make-org
+        'ebdb-record-organization
+       'ebdb-record-person))
+    (setq new-rec (ebdb-current-record))
+    (setq role-field (ebdb-read 'ebdb-field-role
+                               `(:record-uuid
+                                 ,(ebdb-record-uuid
+                                   (if make-org rec
+                                     new-rec))
+                                 :org-uuid
+                                 ,(ebdb-record-uuid
+                                   (if make-org new-rec
+                                     rec)))))
+    (ebdb-with-record-edits (if make-org rec new-rec)
+      (ebdb-com-insert-field (if make-org rec new-rec)
+                            role-field))))
+
+;;;###autoload
 (defun ebdb-insert-field (records)
   "Prompt to create a field and insert it into RECORDS.
 If multiple records are marked, insert instances of the same
diff --git a/ebdb.info b/ebdb.info
index b1546aa..302c6bc 100644
--- a/ebdb.info
+++ b/ebdb.info
@@ -547,8 +547,12 @@ come up with a good interface for viewing and manipulating 
these extra
 fields, however, so the functionality remains hidden.  Suggestions are
 very welcome.
 
-   Manipulating role fields is generally a little clunky, at present.
-This will be addressed in future.
+   It can often feel a little clunky creating a new organization to
+associate with a person, or vice versa.  EBDB provides a convenience
+function to create a new person or organization record, and associate it
+with the existing record under point, in one step, using the ‘F’.  This
+will create a new organization if point is on a person record, or a new
+person if point is on an organization.
 
 
 File: ebdb.info,  Node: Tag field,  Next: Mail folder field,  Prev: Role 
fields,  Up: Field Types
@@ -2304,6 +2308,7 @@ File: ebdb.info,  Node: Index,  Prev: Hacking EBDB,  Up: 
Top
 * ebdb-create-record:                    Creating Records.    (line   6)
 * ebdb-create-record <1>:                The Basics of ebdb-mode.
                                                               (line  22)
+* ebdb-create-record-and-role:           Role fields.         (line  33)
 * ebdb-create-record-extended:           Creating Records.    (line  14)
 * ebdb-create-record-extended <1>:       The Basics of ebdb-mode.
                                                               (line  26)
@@ -2578,51 +2583,51 @@ Node: Editing Existing Fields14210
 Node: Deleting Records and Fields14810
 Node: Field Types15206
 Node: Role fields17492
-Node: Tag field19180
-Node: Mail folder field19824
-Node: MUA Interaction20152
-Node: Loading MUA Code20705
-Node: Display and Updating21418
-Node: Pop-up Buffers22184
-Node: Auto-Updating Records23927
-Node: Noticing and Automatic Rules26327
-Node: Interactive Commands27660
-Node: EBDB and MUA summary buffers30135
-Node: Sender name display30653
-Node: Summary buffer marks31880
-Node: Mail Address Completion33059
-Node: A Note on Completion35568
-Node: Specific MUAs36191
-Node: Gnus36339
-Node: Posting Styles36561
-Node: EBDB Buffers38136
-Node: Searching39347
-Node: Changing Search Behavior41009
-Node: The Basics of ebdb-mode42256
-Node: Customizing Record Display46565
-Node: Marking50885
-Node: Exporting/Formatting51312
-Node: Completion52261
-Node: Snarfing53057
-Node: Internationalization55074
-Node: Diary Integration57775
-Node: Mail Aliases58640
-Node: vCard Support59354
-Node: Org Integration59853
-Node: Citing Records61751
-Node: Hacking EBDB62509
-Node: Field Classes65100
-Node: Init and Delete Methods68236
-Node: The Labeled Field Class69743
-Node: The Singleton Field Class70597
-Node: Actions71035
-Node: Custom Field Searching71707
-Node: Fast Lookups74574
-Node: Formatting in the EBDB Buffer76384
-Node: Writing Internationalization Libraries78460
-Node: Writing Integration For New MUAs82874
-Node: Article snarfing86322
-Node: Index87040
+Node: Tag field19473
+Node: Mail folder field20117
+Node: MUA Interaction20445
+Node: Loading MUA Code20998
+Node: Display and Updating21711
+Node: Pop-up Buffers22477
+Node: Auto-Updating Records24220
+Node: Noticing and Automatic Rules26620
+Node: Interactive Commands27953
+Node: EBDB and MUA summary buffers30428
+Node: Sender name display30946
+Node: Summary buffer marks32173
+Node: Mail Address Completion33352
+Node: A Note on Completion35861
+Node: Specific MUAs36484
+Node: Gnus36632
+Node: Posting Styles36854
+Node: EBDB Buffers38429
+Node: Searching39640
+Node: Changing Search Behavior41302
+Node: The Basics of ebdb-mode42549
+Node: Customizing Record Display46858
+Node: Marking51178
+Node: Exporting/Formatting51605
+Node: Completion52554
+Node: Snarfing53350
+Node: Internationalization55367
+Node: Diary Integration58068
+Node: Mail Aliases58933
+Node: vCard Support59647
+Node: Org Integration60146
+Node: Citing Records62044
+Node: Hacking EBDB62802
+Node: Field Classes65393
+Node: Init and Delete Methods68529
+Node: The Labeled Field Class70036
+Node: The Singleton Field Class70890
+Node: Actions71328
+Node: Custom Field Searching72000
+Node: Fast Lookups74867
+Node: Formatting in the EBDB Buffer76677
+Node: Writing Internationalization Libraries78753
+Node: Writing Integration For New MUAs83167
+Node: Article snarfing86615
+Node: Index87333
 
 End Tag Table
 
diff --git a/ebdb.org b/ebdb.org
index 91bb961..818cebb 100644
--- a/ebdb.org
+++ b/ebdb.org
@@ -388,8 +388,14 @@ to come up with a good interface for viewing and 
manipulating these
 extra fields, however, so the functionality remains hidden.
 Suggestions are very welcome.
 
-Manipulating role fields is generally a little clunky, at present.
-This will be addressed in future.
+#+FINDEX: ebdb-create-record-and-role
+It can often feel a little clunky creating a new organization to
+associate with a person, or vice versa.  EBDB provides a convenience
+function to create a new person or organization record, and associate
+it with the existing record under point, in one step, using the
+{{{kbd(F)}}}.  This will create a new organization if point is on a
+person record, or a new person if point is on an organization.
+
 *** Tag field
 :PROPERTIES:
 :ID:       d9073bc7-8731-4919-9fc0-7d1dcf98426e
diff --git a/ebdb.texi b/ebdb.texi
index 960df2d..b676273 100644
--- a/ebdb.texi
+++ b/ebdb.texi
@@ -580,8 +580,13 @@ to come up with a good interface for viewing and 
manipulating these
 extra fields, however, so the functionality remains hidden.
 Suggestions are very welcome.
 
-Manipulating role fields is generally a little clunky, at present.
-This will be addressed in future.
+@findex ebdb-create-record-and-role
+It can often feel a little clunky creating a new organization to
+associate with a person, or vice versa.  EBDB provides a convenience
+function to create a new person or organization record, and associate
+it with the existing record under point, in one step, using the
+@kbd{F}.  This will create a new organization if point is on a
+person record, or a new person if point is on an organization.
 
 @node Tag field
 @subsection Tag field



reply via email to

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