@@ -420,18 +420,173 @@ With non-zero numeric argument ARG, the previous field is moved past ARG fields.
420
420
| bbdb-initialize-hook | BBDB的初始化函数`bbdb-initialize'被调用之后 | | |
421
421
| bbdb-canonicalize-mail-functioin | 当BBDB notice a message后 | message中的corresponding email address | 该函数用于对message中的对应email地址作一次转换,转换后的结果才拿来与BBDB中的记录进行对比,或添加入BBDB. 若该函数返回nil,则BBDB认为该message中无email address |
422
422
423
- * hacks
423
+ * 其他
424
424
** 函数
425
425
*** (bbdb-display-records records )
426
426
427
427
在bbdb buffer中显示records中的记录
428
428
429
+ *** (bbdb-record-field RECORD FIELD)
430
+
431
+ 返回记录中的指定域的值. 域的说明为:
432
+ | firstname | Return the first name of RECORD |
433
+ | lastname | Return the last name of RECORD |
434
+ | name | Return the full name of RECORD (first name first) |
435
+ | name-lf | Return the full name of RECORD (last name first) |
436
+ | affix | Return the list of affixes |
437
+ | organization | Return the list of organizations |
438
+ | aka | Return the list of AKAs |
439
+ | aka-all | Return the list of AKAs plus mail-akas. |
440
+ | mail | Return the list of email addresses |
441
+ | mail-aka | Return the list of name parts in mail addresses |
442
+ | mail-canon | Return the list of canonical mail addresses. |
443
+ | phone | Return the list of phone numbers |
444
+ | address | Return the list of addresses |
445
+ | xfields | Return the list of all xfields |
446
+ | 其他 | 指定label的xfields |
447
+
448
+ *** (bbdb-get-records PROMPT)
449
+
450
+ 若在*BBDB* buffer中,则返回光标所在的记录,若在其他buffer中,则询问用户想要返回哪个记录
451
+
452
+ *** (bbdb-update-records ADDRESS-LIST &optional UPDATE-P SORT)
453
+
454
+ 返回匹配ADDRESS-LIST的BBDB记录列表
455
+
456
+ 其中ADDRESS-LIST是一个由email地址组成的列表
457
+
458
+
459
+ 参数UPDATE-P的可选值为:
460
+
461
+ + nil :: 使用变量`bbdb/MUA-update-records-p'中的值, 若该值依然为nil,则`bbdb-update-records'返回nil
462
+
463
+ + search :: 搜索匹配ADDRESS的记录
464
+
465
+ + update :: 搜索匹配ADDRESS的记录,如有必要,会更新name和mail域
466
+
467
+ + query :: 搜索匹配ADDRESS的记录,若记录不存在,提示用户是否创建新记录
468
+
469
+ + create :: 搜索匹配ADDRESS的记录,若记录不存在,则创建新记录
470
+
471
+ + t :: 搜索匹配ADDRESS的记录,若记录不存在,则创建新记录
472
+
473
+ + 函数fn :: bbdb调用该函数,该函数需要返回search,update,query,create或t
474
+
475
+ 若参数SORT为非nil,则返回的记录列表中的记录会经过`bbdb-record-lessp'排序;若SORT为nil,则记录的顺序与参数ADDRESS-LIST中的邮件地址的顺序对应.
476
+
477
+ *** (bbdb-get-mail-aliases)
478
+
479
+ 返回BBDB中使用的mail aliases列表
480
+
481
+ *** (bbdb-search-read &optional FIELD)
482
+
483
+ 提示用户输入一个正则表达式re,并从BBDB数据库中搜索出指定的FIELD符合该re的记录
484
+
485
+ *** (bbdb-search RECORDS &optional NAME-RE ORG-RE MAIL-RE XFIELD-RE PHONE-RE ADDRESS-RE)
486
+
487
+ 从RECORDS中搜索出符合指定域的指定正则表达式的记录. 其中
488
+
489
+ + NAME-RE匹配FIRST_LAST,LAST_FIRST和AKA域
490
+
491
+ + XFIELD-RE匹配xfiled notes域
492
+
493
+ + XFIELD-RE也以格式为(LABEL . RE)表示label为xfield的正则表达式,其中若LABEL为`*'则表示任一个xfield
494
+
495
+ *** (bbdb-display-records-with-layout RECORDS LAYOUT)
496
+
497
+ 使用LAYOUT形式来展示RECORDS,其中LAYOUT参见`bbdb-layout-alist'中的值
498
+
499
+ *** (bbdb-pop-up-window &optional SELECT HORIZ-P)
500
+
501
+ *** (bbdb-display-records RECORDS &optional LAYOUT APPEND SELECT HORIZ-P)
502
+
503
+ 使用LAYOUT形式来显示RECORDS
504
+
505
+ 若参数APPEND为非nil,则会在当前已经显示的记录后,再多显示这些RECORDS;若APPEND为nil,则会用RECORDS的显示结果代替已有的显示结果
506
+
507
+ 参数SELECT与参数HORIZ-P的意义参见`bbdb-pop-up-window'
508
+
509
+ *** (bbdb-display-record RECORD LAYOUT NUMBER)
510
+
511
+ 在当前buffer的光标所在处,插入格式化好的RECORD表示文本.
512
+
513
+ LAYOUT是`bbdb-layout-alist'中描述的layout符号,若为nil则表示`bbdb-layout'
514
+
515
+ NUMBER is the number of RECORD among the displayed records.
516
+
517
+ *** (bbdb-read-record &optional FIRST-AND-LAST)
518
+
519
+ 提示用户输入联系人信息,并创建一个新的BBDB联系人记录.
520
+
521
+ *但该函数不会将新产生的BBDB记录存入数据库,也不会更新BBDB hashtable*
522
+
523
+ *该函数会检查新输入的联系人是否和已存在的联系人记录相冲突*
524
+
525
+ *** (bbdb-read-string PROMPT &optional INIT COLLECTION REQUIRE-MATCH)
526
+
527
+ 读取用户输入的字符串,会取出字符串中的空格和text properties
528
+
529
+ 参数PROMPT为提示说明
530
+
531
+ 参数INIT为预设值,当编辑已存在记录时常用到
532
+
533
+ 参数COLLECTION与REQUIRE-MATCH的意义与`completing-read'中的意义一致
534
+
535
+ *** (bbdb-record-set-field RECORD FIELD VALUE &optional MERGE CHECK)
536
+
537
+ 设置RECORD中的FIELD域的值为VALUE.
538
+
539
+ 该函数的返回值为VALUE
540
+
541
+ 若参数MERGE为非nil,则将参数VALUE合并到FIELD的当前值中
542
+
543
+ 若参数CHECK为非nil,则会检查FIELD是否能够存储VALUE
544
+
545
+ *该函数会更新bbdb hashtable,但不会保存RECORD到bbdb数据库中*. 一般使用函数`bbdb-change-record'来保存RECORD到bbdb数据库中.
546
+
547
+ 其中参数FIELD的说明,参见`bbdb-record-field'中的FIELD说明
548
+
549
+ *** (bbdb-change-record RECORD &optional NEED-TO-SORT NEW)
550
+
551
+ 该函数保存RECORD到BBDB数据库中,若参数RECORD中的值与BBDB数据库中的值相比发生了变化,则该函数返回RECORD,否则该函数返回nil
552
+
553
+ 当RECORD中的联系人名称发生改变,或RECORD为新建的联系人记录时,NEED-TO-SORT参数需要为t
554
+
555
+ 当RECORD为新建的联系人记录时,参数NEW需要为t. 若RECORD为新建联系人记录则该RECORD会自动更新入BBDB hashtable,否则需要手工更新BBDB hashtable
556
+
557
+ *** (bbdb-current-record &optional FULL)
558
+
559
+ 返回光标所处的RECORD
560
+
561
+ 若参数FULL为非nil,则返回包含RECORD和显示格式(layout)的一个list
562
+ #+BEGIN_SRC emacs-lisp
563
+ (bbdb-current-record t)
564
+ ;; ([nil "darksun" nil nil nil (["home" "(+86)15820984397"] ["work" "(0794)6593346"]) nil nil ((creation-date . "2015-03-30 09:46:57 +0000") (timestamp . "2015-03-30 13:17:00 +0000")) ["darksun" "darksun" nil nil "darksun" #<marker at 64 in bbdb>]] multi-line #<marker at 1 in *BBDB*>)
565
+ (bbdb-current-record)
566
+ ;; [nil "darksun" nil nil nil (["home" "(+86)15820984397"] ["work" "(0794)6593346"]) nil nil ((creation-date . "2015-03-30 09:46:57 +0000") (timestamp . "2015-03-30 13:17:00 +0000")) ["darksun" "darksun" nil nil "darksun" #<marker at 64 in bbdb>]]
567
+
568
+ #+END_SRC
569
+
570
+ *** (bbdb-current-field)
571
+
572
+ 返回光标所处的当前域
573
+ #+BEGIN_SRC emacs-lisp
574
+ (bbdb-current-field)
575
+ ;; (name "darksun")
576
+ #+END_SRC
577
+
578
+ *** bbdb-record-set-xxx系列函数
579
+
580
+ 置record中指定field的值
581
+
429
582
** 变量
430
583
*** bbdb-records
431
584
432
585
该变量的值为当前bbdb buffer中的record列表
433
586
434
- ***
587
+ *** bbdb-search-invert
588
+
589
+ 若值为t,则会反转`bbdb-search'的搜索结果
435
590
* FAQ
436
591
437
592
** 如何修改BBDB创建联系人的流程
@@ -440,12 +595,17 @@ With non-zero numeric argument ARG, the previous field is moved past ARG fields.
440
595
441
596
下面是一个例子,它让`bbdb-create'新建联系人时,还会提示你输入生日信息:
442
597
#+BEGIN_SRC emacs-lisp
443
- ;; 该例子抄至sachachua的博客
444
- ;; 该例子为bbdb v2的例子,有待改成bbdb v3
445
- (defadvice bbdb-read-new-record (after wicked activate)
446
- "Prompt for the birthdate as well."
447
- (bbdb-record-putprop ad-return-value 'birthdate
448
- (bbdb-read-string "Birthdate (YYYY.MM.DD): ")))
598
+ (defun bbdb-read-record-advise-function(record)
599
+ "提示存储生日,QQ,微信号"
600
+ (bbdb-record-set-field record 'birthdate
601
+ (bbdb-read-string "Birthdate (YYYY.MM.DD): "))
602
+ (bbdb-record-set-field record 'QQ
603
+ (bbdb-read-string "QQ:"))
604
+ (bbdb-record-set-field record 'WeChat
605
+ (bbdb-read-string "WeChat:"))
606
+ record)
607
+
608
+ (advice-add 'bbdb-read-record :filter-return #'bbdb-read-record-advise-function)
449
609
450
610
#+END_SRC
451
611
0 commit comments