annotate lisp/mh-e/mh-identity.el @ 101472:f3a44ea3d1ae

Follow Glenn's lead and update format of Copyright.
author Bill Wohler <wohler@newt.com>
date Sun, 25 Jan 2009 18:31:31 +0000
parents a9dc0e7c3f2b
children 636890f31d3b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
1 ;;; mh-identity.el --- multiple identify support for MH-E
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
2
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 94663
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
4
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
5 ;; Author: Peter S. Galbraith <psg@debian.org>
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
7 ;; Keywords: mail
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
8 ;; See: mh-e.el
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
9
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
11
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79713
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79713
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79713
diff changeset
15 ;; (at your option) any later version.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
16
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
21
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79713
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
24
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
25 ;;; Commentary:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
26
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
27 ;; Multiple identity support for MH-E.
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
28
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
29 ;; Used to easily set different fields such as From and Organization,
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
30 ;; as well as different signature files.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
31
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
32 ;; Customize the variable `mh-identity-list' and see the Identity menu
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
33 ;; in MH-Letter mode. The command `mh-insert-identity' can be used
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
34 ;; to manually insert an identity.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
35
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
36 ;;; Change Log:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
37
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
38 ;;; Code:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
39
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
40 (require 'mh-e)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
41
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
42 (autoload 'mml-insert-tag "mml")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
43
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
44 (defvar mh-identity-pgg-default-user-id nil
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
45 "Holds the GPG key ID to be used by pgg.el.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
46 This is normally set as part of an Identity in
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
47 `mh-identity-list'.")
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
48 (make-variable-buffer-local 'mh-identity-pgg-default-user-id)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
49
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
50 (defvar mh-identity-menu nil
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
51 "The Identity menu.")
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
52
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
53 (defalias 'mh-identity-make-menu-no-autoload 'mh-identity-make-menu)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
54
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
55 ;;;###mh-autoload
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
56 (defun mh-identity-make-menu ()
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
57 "Build the Identity menu.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
58 This should be called any time `mh-identity-list' or
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
59 `mh-auto-fields-list' change.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
60 See `mh-identity-add-menu'."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
61 (easy-menu-define mh-identity-menu mh-letter-mode-map
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
62 "MH-E identity menu"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
63 (append
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
64 '("Identity")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
65 ;; Dynamically render :type corresponding to `mh-identity-list'
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
66 ;; e.g.:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
67 ;; ["Home" (mh-insert-identity "Home")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
68 ;; :style radio :active (not (equal mh-identity-local "Home"))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
69 ;; :selected (equal mh-identity-local "Home")]
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
70 '(["Insert Auto Fields"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
71 (mh-insert-auto-fields) mh-auto-fields-list]
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
72 "--")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
73
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
74 (mapcar (function
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
75 (lambda (arg)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
76 `[,arg (mh-insert-identity ,arg) :style radio
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
77 :selected (equal mh-identity-local ,arg)]))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
78 (mapcar 'car mh-identity-list))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
79 '(["None"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
80 (mh-insert-identity "None") :style radio
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
81 :selected (not mh-identity-local)]
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
82 "--"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
83 ["Set Default for Session"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
84 (setq mh-identity-default mh-identity-local) t]
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
85 ["Save as Default"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
86 (customize-save-variable 'mh-identity-default mh-identity-local) t]
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
87 ["Customize Identities" (customize-variable 'mh-identity-list) t]
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
88 ))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49578
diff changeset
89
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
90 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
91 (defun mh-identity-add-menu ()
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
92 "Add the current Identity menu.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
93 See `mh-identity-make-menu'."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
94 (if mh-identity-menu
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
95 (easy-menu-add mh-identity-menu)))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
96
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
97 (defvar mh-identity-local nil
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
98 "Buffer-local variable that holds the identity currently in use.")
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
99 (make-variable-buffer-local 'mh-identity-local)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
100
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
101 (defun mh-header-field-delete (field value-only)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
102 "Delete header FIELD, or only its value if VALUE-ONLY is t.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
103 Return t if anything is deleted."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
104 (let ((field-colon (if (string-match "^.*:$" field)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
105 field
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
106 (concat field ":"))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
107 (when (mh-goto-header-field field-colon)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
108 (if (not value-only)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
109 (beginning-of-line)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
110 (forward-char))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
111 (delete-region (point)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
112 (progn (mh-header-field-end)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
113 (if (not value-only) (forward-char 1))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
114 (point)))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
115 t)))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
116
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
117 (defvar mh-identity-signature-start nil
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
118 "Marker for the beginning of a signature inserted by `mh-insert-identity'.")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
119 (defvar mh-identity-signature-end nil
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
120 "Marker for the end of a signature inserted by `mh-insert-identity'.")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
121
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
122 (defun mh-identity-field-handler (field)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
123 "Return the handler for header FIELD or nil if none set.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
124 The field name is downcased. If the FIELD begins with the
67760
9c3504ae6060 Follow MH-E Developers Guide conventions. Use `' quotes for Help
Bill Wohler <wohler@newt.com>
parents: 67758
diff changeset
125 character \":\", then it must have a special handler defined in
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
126 `mh-identity-handlers', else return an error since it is not a
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
127 valid header field."
68520
6a7173abcf59 * mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument
Bill Wohler <wohler@newt.com>
parents: 68465
diff changeset
128 (or (cdr (mh-assoc-string field mh-identity-handlers t))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
129 (and (eq (aref field 0) ?:)
68013
bbc0e52abce5 * mh-alias.el (mh-alias-add-alias): Grand message and error string
Bill Wohler <wohler@newt.com>
parents: 67760
diff changeset
130 (error "Field %s not found in `mh-identity-handlers'" field))
56751
72a02133177e Upgraded to MH-E version 7.81.
Bill Wohler <wohler@newt.com>
parents: 56673
diff changeset
131 (cdr (assoc ":default" mh-identity-handlers))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
132 'mh-identity-handler-default))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
133
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
134 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
135 (defun mh-insert-identity (identity &optional maybe-insert)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
136 "Insert fields specified by given IDENTITY.
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
137
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
138 In a program, do not insert fields if MAYBE-INSERT is non-nil,
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
139 `mh-identity-default' is non-nil, and fields have already been
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
140 inserted.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
141
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
142 See `mh-identity-list'."
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
143 (interactive
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
144 (list (completing-read
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
145 "Identity: "
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
146 (if mh-identity-local
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
147 (cons '("None")
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
148 (mapcar 'list (mapcar 'car mh-identity-list)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
149 (mapcar 'list (mapcar 'car mh-identity-list)))
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
150 nil t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
151 nil))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
152
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
153 (when (or (not maybe-insert)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
154 (and (boundp 'mh-identity-default)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
155 mh-identity-default
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
156 (not mh-identity-local)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
157 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
158 ;;First remove old settings, if any.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
159 (when mh-identity-local
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
160 (let ((pers-list (cadr (assoc mh-identity-local mh-identity-list))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
161 (while pers-list
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
162 (let* ((field (caar pers-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
163 (handler (mh-identity-field-handler field)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
164 (funcall handler field 'remove))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
165 (setq pers-list (cdr pers-list)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
166 ;; Then insert the replacement
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
167 (when (not (equal "None" identity))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
168 (let ((pers-list (cadr (assoc identity mh-identity-list))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
169 (while pers-list
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
170 (let* ((field (caar pers-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
171 (value (cdar pers-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
172 (handler (mh-identity-field-handler field)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
173 (funcall handler field 'add value))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
174 (setq pers-list (cdr pers-list))))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
175 ;; Remember what is in use in this buffer
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
176 (if (equal "None" identity)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
177 (setq mh-identity-local nil)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
178 (setq mh-identity-local identity))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
179
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
180 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
181 (defun mh-identity-handler-gpg-identity (field action &optional value)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
182 "Process header FIELD \":pgg-default-user-id\".
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
183 The ACTION is one of 'remove or 'add. If 'add, the VALUE is added.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
184 The buffer-local variable `mh-identity-pgg-default-user-id' is set to
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
185 VALUE when action 'add is selected."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
186 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
187 ((or (equal action 'remove)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
188 (not value)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
189 (string= value ""))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
190 (setq mh-identity-pgg-default-user-id nil))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
191 ((equal action 'add)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
192 (setq mh-identity-pgg-default-user-id value))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
193
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
194 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
195 (defun mh-identity-handler-signature (field action &optional value)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
196 "Process header FIELD \":signature\".
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
197 The ACTION is one of 'remove or 'add. If 'add, the VALUE is
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
198 added."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
199 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
200 ((equal action 'remove)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
201 (when (and (markerp mh-identity-signature-start)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
202 (markerp mh-identity-signature-end))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
203 (delete-region mh-identity-signature-start
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
204 mh-identity-signature-end)))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
205 (t
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
206 ;; Insert "signature". Nil value means to use `mh-signature-file-name'.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
207 (when (not (mh-signature-separator-p)) ;...unless already present
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
208 (goto-char (point-max))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
209 (save-restriction
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
210 (narrow-to-region (point) (point))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
211 (if (null value)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
212 (mh-insert-signature)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
213 (mh-insert-signature value))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
214 (set (make-local-variable 'mh-identity-signature-start)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
215 (point-min-marker))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
216 (set-marker-insertion-type mh-identity-signature-start t)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
217 (set (make-local-variable 'mh-identity-signature-end)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
218 (point-max-marker)))))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
219
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
220 (defvar mh-identity-attribution-verb-start nil
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
221 "Marker for the beginning of the attribution verb.")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
222 (defvar mh-identity-attribution-verb-end nil
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
223 "Marker for the end of the attribution verb.")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
224
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
225 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
226 (defun mh-identity-handler-attribution-verb (field action &optional value)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
227 "Process header FIELD \":attribution-verb\".
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
228 The ACTION is one of 'remove or 'add. If 'add, the VALUE is
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
229 added."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
230 (when (and (markerp mh-identity-attribution-verb-start)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
231 (markerp mh-identity-attribution-verb-end))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
232 (delete-region mh-identity-attribution-verb-start
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
233 mh-identity-attribution-verb-end)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
234 (goto-char mh-identity-attribution-verb-start)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
235 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
236 ((equal action 'remove) ; Replace with default
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
237 (mh-identity-insert-attribution-verb nil))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
238 (t ; Insert attribution verb.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
239 (mh-identity-insert-attribution-verb value)))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
240
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
241 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
242 (defun mh-identity-insert-attribution-verb (value)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
243 "Insert VALUE as attribution verb, setting up delimiting markers.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
244 If VALUE is nil, use `mh-extract-from-attribution-verb'."
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
245 (save-restriction
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
246 (narrow-to-region (point) (point))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
247 (if (null value)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
248 (insert mh-extract-from-attribution-verb)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
249 (insert value))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
250 (set (make-local-variable 'mh-identity-attribution-verb-start)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
251 (point-min-marker))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
252 (set-marker-insertion-type mh-identity-attribution-verb-start t)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
253 (set (make-local-variable 'mh-identity-attribution-verb-end)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
254 (point-max-marker))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
255
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
256 (defun mh-identity-handler-default (field action top &optional value)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
257 "Process header FIELD.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
258 The ACTION is one of 'remove or 'add. If TOP is non-nil, add the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
259 field and its VALUE at the top of the header, else add it at the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
260 bottom of the header. If action is 'add, the VALUE is added."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
261 (let ((field-colon (if (string-match "^.*:$" field)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
262 field
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
263 (concat field ":"))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
264 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
265 ((equal action 'remove)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
266 (mh-header-field-delete field-colon nil))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
267 (t
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
268 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
269 ;; No value, remove field
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
270 ((or (not value)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
271 (string= value ""))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
272 (mh-header-field-delete field-colon nil))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
273 ;; Existing field, replace
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
274 ((mh-header-field-delete field-colon t)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
275 (insert value))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
276 ;; Other field, add at end or top
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
277 (t
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
278 (goto-char (point-min))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
279 (if (not top)
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
280 (mh-goto-header-end 0))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
281 (insert field-colon " " value "\n")))))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
282
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
283 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
284 (defun mh-identity-handler-top (field action &optional value)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
285 "Process header FIELD.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
286 The ACTION is one of 'remove or 'add. If 'add, the VALUE is
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
287 added. If the field wasn't present, it is added to the top of the
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
288 header."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
289 (mh-identity-handler-default field action t value))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
290
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
291 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
292 (defun mh-identity-handler-bottom (field action &optional value)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
293 "Process header FIELD.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
294 The ACTION is one of 'remove or 'add. If 'add, the VALUE is
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
295 added. If the field wasn't present, it is added to the bottom of
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
296 the header."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
297 (mh-identity-handler-default field action nil value))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
298
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
299 (provide 'mh-identity)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
300
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
301 ;; Local Variables:
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
302 ;; indent-tabs-mode: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
303 ;; sentence-end-double-space: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
304 ;; End:
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
305
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
306 ;; arch-tag: 07d66ef6-8726-4ac6-9ecf-e566cd5bfb45
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
307 ;;; mh-identity.el ends here