|
| 1 | +#+TITLE: bbdb简单使用教程 |
| 2 | +#+AUTHOR: DarkSun |
| 3 | +#+OPTIONS: ^:{} |
| 4 | + |
| 5 | +* 配置 |
| 6 | +最简单的配置方法就是将下面的语句放入Emacs初始化文件中 |
| 7 | +#+BEGIN_SRC emacs-lisp |
| 8 | + (require 'bbdb) |
| 9 | + (bbdb-initialize) |
| 10 | +#+END_SRC |
| 11 | + |
| 12 | +这里的`bbdb-initialize'会初始化bbdb,并开启最基本的查询/维护记录功能. |
| 13 | + |
| 14 | +除了最基本的查询/维护记录功能外,bbdb还有一些与其他package联合使用的特性,要开启这些特性,则需要在调用`bbdb-initialize'时传入其他的参数. |
| 15 | + |
| 16 | +`bbdb-initialize'可以接收一系列的symbol作为参数,这些symbol决定了bbdb初始化时会开启与哪些package交互的特性. 这些symbol的说明如下表所示: |
| 17 | +#+NAME: bbdb-initialize参数说明 |
| 18 | +| symbol | meaning | |
| 19 | +|---------+-----------------------------------------------------------------------| |
| 20 | +| gnus | Gnus mail/news reader. *should probably also pass the message symbol* | |
| 21 | +| mh-e | MH-E mail reader. | |
| 22 | +| rmail | Rmail mail reader. | |
| 23 | +| vm | VM mail reader. | |
| 24 | +| mail | Mail (M-x mail). | |
| 25 | +| message | Message mode. | |
| 26 | +| anniv | Anniversaries in Emacs diary. | |
| 27 | +| sc | Supercite. | |
| 28 | +| pgp | PGP support: | |
| 29 | + |
| 30 | +** 为其他package增加BBDB支持 |
| 31 | +bbdb提供了一系列的`bbdb-insinuate-xxxx'函数来为xxxx package提供BBDB的支持. 这些函数为package增加了默认的快捷键,并且配置这些package当收到新message时,通知bbdb. |
| 32 | + |
| 33 | +例如:为了給gnus增加bbdb的支持,我们可以添加下面的语句到Emacs初始化文件中 |
| 34 | +#+BEGIN_SRC emacs-lisp |
| 35 | + (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus) |
| 36 | +#+END_SRC |
| 37 | +* BBDB基础 |
| 38 | +** BBDB数据库结构 |
| 39 | +BBDB数据库由一系列的记录组成,每条记录对应一个联系人或组织. 每条记录由多种域组成,每种域对应联系人/组织的一个属性. |
| 40 | + |
| 41 | +BBDB内置支持一些类型的域: |
| 42 | +| type | Description | Notes | |
| 43 | +|-------------+------------------------------------------+-------------------------------------------------| |
| 44 | +| NAME | 联系人的名称,若该记录表示一个组织,则为空 | 一条记录只能有一个该类型的域,一个域只能有一个值 | |
| 45 | +| orgnization | 联系人所在的组织,可以为空 | 一条记录只能有一个该类型的域,一个域只能有一个值 | |
| 46 | +| AKA | 联系人的别名 | 一个域可以有多个值,以逗号分隔 | |
| 47 | +| mail | 联系人的email地址 | 一个域可以有多个值,以逗号分隔 | |
| 48 | +| Phone | 联系人的电话 | 一条记录可以有多个该类型的域,一个域只能有一个值 | |
| 49 | +| address | 联系人的地址 | 一条记录可以有多个该类型的域,一个域只能有一个值 | |
| 50 | +| Notes | 其他说明 | 一条记录可以有多个该类型的域,一个域只能有一个值 | |
| 51 | +*** 自定义类型 |
| 52 | +除了上面BBDB内置的域类型,我们还可以自定一些域类型. BBDB处理大多数自定义类型的域时,与Notes类型域一样,但是对有一些特殊名称的域类型,BBDB会进行特殊处理: |
| 53 | ++ aka :: 用于存储指定记录的non-primary names |
| 54 | ++ finger-host :: Address used in place of the listed net address for fingering the entity indicated by the record |
| 55 | ++ gnus-score :: Gnus scoring adjustment for this person. |
| 56 | ++ mail-alias :: Value used instead of name for completion |
| 57 | ++ mail-name :: Used for the storage of non-default names to be used in the reporting of new mail by Reportmail. |
| 58 | ++ mark-char :: The field containing the character to be used for marking a given poster in the Gnus Summary Buffer |
| 59 | ++ tex-name :: The value of this field is used in place of the name field when printing the database using bbdb-print |
| 60 | ++ www :: This field contains the URL associated with the BBDB record. |
| 61 | +** BBDB相关命令 |
| 62 | +*** 搜索记录 |
| 63 | +**** bbdb |
| 64 | + |
| 65 | +执行该命令后,输入一个正则表达式,则bbdb会列出任何域中的值符合该正则表达式的记录 |
| 66 | + |
| 67 | +**** bbdb-search-name/bbdb-search-organization/bbdb-search-address/bbdb-search-mail/bbdb-search-notes/bbdb-search-phone |
| 68 | + |
| 69 | +执行该命令后,输入一个正则表达式,则bbdb会列出指定域中的值符合该正则表达式的记录 |
| 70 | + |
| 71 | +**** bbdb-timestamp-older |
| 72 | + |
| 73 | +执行该命令后,输入一个`yyyy-mm-dd'格式的日期,则bbdb会列出在指定日期之前修改过的记录 |
| 74 | + |
| 75 | +**** bbdb-timestamp-newer |
| 76 | + |
| 77 | +执行该命令后,输入一个`yyyy-mm-dd'格式的日期,则bbdb会列出在指定日期之后修改过的记录 |
| 78 | + |
| 79 | +**** bbdb-creation-older |
| 80 | + |
| 81 | +执行该命令后,输入一个`yyyy-mm-dd'格式的日期,则bbdb会列出在指定日期之前创建的记录 |
| 82 | + |
| 83 | +**** bbdb-creation-newer |
| 84 | + |
| 85 | +执行该命令后,输入一个`yyyy-mm-dd'格式的日期,则bbdb会列出在指定日期之后创建的记录 |
| 86 | + |
| 87 | +**** bbdb-creation-no-change |
| 88 | + |
| 89 | +执行该命令后,bbdb会列出自创建以来,从未修改过的记录 |
| 90 | + |
| 91 | +*** 增加记录 |
| 92 | +**** bbdb-create |
| 93 | + |
| 94 | +执行该命令后,bbdb会以此提示输入各个内置域的相关信息,然后根据这些相关信息新建一条记录 |
| 95 | + |
| 96 | +**** bbdb-snarf |
| 97 | + |
| 98 | +该命令可以根据一定规则将选中的字符串转换成bbdb格式的记录. 默认的转换规则由变量`bbdb-snarf-rule-default'决定. 详细参见`bbdb-snarf-rule-alist' |
| 99 | + |
| 100 | +** BBDB Mode使用说明 |
| 101 | +使用BBDB的查询命令后,会弹出一个名为`*BBDB*'的buffer,该buffer处于bbdb mode下. |
| 102 | + |
| 103 | +bbdb mode下拥有许多维护BBDB记录的各种命令,常用的命令有: |
| 104 | + |
| 105 | +*** e (bbdb-edit-field) |
| 106 | + |
| 107 | +修改记录中当前域的值 |
| 108 | + |
| 109 | +*** ; (bbdb-edit-foo) |
| 110 | + |
| 111 | +若不带前置参数执行该命令,则修改`(car bbdb-edit-foo)'所表示的域(默认为notes) |
| 112 | + |
| 113 | +若代前置参数执行该命令,则修改`(cdr bbdb-edit-foo)'所表示的域(默认为current-fields) |
| 114 | + |
| 115 | +*** d / C-k (bbdb-delete-field-or-record) |
| 116 | + |
| 117 | +删除光标所在的域,若光标所处的域为bbdb记录的第一个行,则会提示删除整个记录. |
| 118 | + |
| 119 | +This may also be applied to multiple records at once by *. |
| 120 | + |
| 121 | +*** i (bbdb-insert-field) |
| 122 | + |
| 123 | +为当前记录添加新域,该新域的类型可以是BBDB的内置类型,也可以是新的用户自定义类型. |
| 124 | + |
| 125 | +*** C-x C-t (bbdb-transpose-fields) |
| 126 | + |
| 127 | +交换光标所在的field与上一行field的位置 |
| 128 | + |
| 129 | +交换的field必须在同一条记录中,且具有相同的类型 |
| 130 | + |
| 131 | +With non-zero numeric argument ARG, the previous field is moved past ARG fields. |
| 132 | + |
| 133 | +With argument 0, the field indicated by point is interchanged with the one indicated by mark. |
0 commit comments