annotate lisp/mh-e/mh-identity.el @ 110292:3afdbf4cdf4b

* net/tramp-cache.el (tramp-parse-connection-properties): Set tramp-autoload cookie.
author Michael Albinus <michael.albinus@gmx.de>
date Thu, 09 Sep 2010 15:24:39 +0200
parents 1d1d5d9bd884
children 376148b31b5e
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
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 101473
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
101473
636890f31d3b Follow Glenn's lead and update format of Copyright.
Bill Wohler <wohler@newt.com>
parents: 100908
diff changeset
4 ;; 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
5
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
6 ;; 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
7 ;; 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
8 ;; Keywords: mail
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
9 ;; 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
10
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
11 ;; 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
12
94663
90c9ebd43589 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79713
diff changeset
13 ;; 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
14 ;; 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
15 ;; 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
16 ;; (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
17
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
18 ;; 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
19 ;; 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
20 ;; 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
21 ;; 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
22
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
23 ;; 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
24 ;; 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
25
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
26 ;;; Commentary:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
27
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
28 ;; Multiple identity support for MH-E.
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
29
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
30 ;; Used to easily set different fields such as From and Organization,
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
31 ;; as well as different signature files.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
32
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
33 ;; Customize the variable `mh-identity-list' and see the Identity menu
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
34 ;; 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
35 ;; 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
36
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
37 ;;; Change Log:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
38
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
39 ;;; Code:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
40
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
41 (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
42
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
43 (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
44
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
45 (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
46 "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
47 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
48 `mh-identity-list'.")
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
49 (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
50
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
51 (defvar mh-identity-menu nil
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
52 "The Identity menu.")
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
53
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
54 (defalias 'mh-identity-make-menu-no-autoload 'mh-identity-make-menu)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
55
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
56 ;;;###mh-autoload
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
57 (defun mh-identity-make-menu ()
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
58 "Build the Identity menu.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
59 This should be called any time `mh-identity-list' or
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
60 `mh-auto-fields-list' change.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
61 See `mh-identity-add-menu'."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
62 (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
63 "MH-E identity menu"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
64 (append
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
65 '("Identity")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
66 ;; 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
67 ;; e.g.:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
68 ;; ["Home" (mh-insert-identity "Home")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
69 ;; :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
70 ;; :selected (equal mh-identity-local "Home")]
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
71 '(["Insert Auto Fields"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
72 (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
73 "--")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
74
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
75 (mapcar (function
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
76 (lambda (arg)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
77 `[,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
78 :selected (equal mh-identity-local ,arg)]))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
79 (mapcar 'car mh-identity-list))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
80 '(["None"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
81 (mh-insert-identity "None") :style radio
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
82 :selected (not mh-identity-local)]
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
83 "--"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
84 ["Set Default for Session"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
85 (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
86 ["Save as Default"
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
87 (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
88 ["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
89 ))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49578
diff changeset
90
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
91 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
92 (defun mh-identity-add-menu ()
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
93 "Add the current Identity menu.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
94 See `mh-identity-make-menu'."
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
95 (if mh-identity-menu
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
96 (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
97
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
98 (defvar mh-identity-local nil
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
99 "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
100 (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
101
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
102 (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
103 "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
104 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
105 (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
106 field
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
107 (concat field ":"))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
108 (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
109 (if (not value-only)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
110 (beginning-of-line)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
111 (forward-char))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
112 (delete-region (point)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
113 (progn (mh-header-field-end)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
114 (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
115 (point)))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
116 t)))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
117
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
118 (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
119 "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
120 (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
121 "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
122
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
123 (defun mh-identity-field-handler (field)
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
124 "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
125 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
126 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
127 `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
128 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
129 (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
130 (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
131 (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
132 (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
133 'mh-identity-handler-default))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
134
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
135 ;;;###mh-autoload
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
136 (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
137 "Insert fields specified by given IDENTITY.
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
138
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
139 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
140 `mh-identity-default' is non-nil, and fields have already been
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
141 inserted.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
142
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
143 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
144 (interactive
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
145 (list (completing-read
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
146 "Identity: "
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
147 (if mh-identity-local
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
148 (cons '("None")
49459
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)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
150 (mapcar 'list (mapcar 'car mh-identity-list)))
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
151 nil t)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
152 nil))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
153
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
154 (when (or (not maybe-insert)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
155 (and (boundp 'mh-identity-default)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
156 mh-identity-default
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
157 (not mh-identity-local)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
158 (save-excursion
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
159 ;;First remove old settings, if any.
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
160 (when mh-identity-local
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
161 (let ((pers-list (cadr (assoc mh-identity-local mh-identity-list))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
162 (while pers-list
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
163 (let* ((field (caar pers-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
164 (handler (mh-identity-field-handler field)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
165 (funcall handler field 'remove))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
166 (setq pers-list (cdr pers-list)))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
167 ;; Then insert the replacement
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
168 (when (not (equal "None" identity))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
169 (let ((pers-list (cadr (assoc identity mh-identity-list))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
170 (while pers-list
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
171 (let* ((field (caar pers-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
172 (value (cdar pers-list))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
173 (handler (mh-identity-field-handler field)))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
174 (funcall handler field 'add value))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
175 (setq pers-list (cdr pers-list))))))
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
176 ;; Remember what is in use in this buffer
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
177 (if (equal "None" identity)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
178 (setq mh-identity-local nil)
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
179 (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
180
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
181 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
182 (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
183 "Process header FIELD \":pgg-default-user-id\".
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62465
diff changeset
184 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
185 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
186 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
187 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
188 ((or (equal action 'remove)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
189 (not value)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
190 (string= value ""))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
191 (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
192 ((equal action 'add)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
193 (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
194
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
195 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
196 (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
197 "Process header FIELD \":signature\".
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
198 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
199 added."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
200 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
201 ((equal action 'remove)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
202 (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
203 (markerp mh-identity-signature-end))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
204 (delete-region mh-identity-signature-start
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
205 mh-identity-signature-end)))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
206 (t
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
207 ;; 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
208 (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
209 (goto-char (point-max))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
210 (save-restriction
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
211 (narrow-to-region (point) (point))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
212 (if (null value)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
213 (mh-insert-signature)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
214 (mh-insert-signature value))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
215 (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
216 (point-min-marker))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
217 (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
218 (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
219 (point-max-marker)))))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
220
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
221 (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
222 "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
223 (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
224 "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
225
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
226 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
227 (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
228 "Process header FIELD \":attribution-verb\".
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
229 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
230 added."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
231 (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
232 (markerp mh-identity-attribution-verb-end))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
233 (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
234 mh-identity-attribution-verb-end)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
235 (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
236 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
237 ((equal action 'remove) ; Replace with default
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
238 (mh-identity-insert-attribution-verb nil))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
239 (t ; Insert attribution verb.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
240 (mh-identity-insert-attribution-verb value)))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
241
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
242 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
243 (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
244 "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
245 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
246 (save-restriction
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
247 (narrow-to-region (point) (point))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
248 (if (null value)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
249 (insert mh-extract-from-attribution-verb)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
250 (insert value))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
251 (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
252 (point-min-marker))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
253 (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
254 (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
255 (point-max-marker))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
256
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
257 (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
258 "Process header FIELD.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
259 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
260 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
261 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
262 (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
263 field
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
264 (concat field ":"))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
265 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
266 ((equal action 'remove)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
267 (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
268 (t
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
269 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
270 ;; No value, remove field
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
271 ((or (not value)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
272 (string= value ""))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
273 (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
274 ;; Existing field, replace
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
275 ((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
276 (insert value))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
277 ;; 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
278 (t
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
279 (goto-char (point-min))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
280 (if (not top)
68465
37d03b3298bf The Great Cleanup
Bill Wohler <wohler@newt.com>
parents: 68213
diff changeset
281 (mh-goto-header-end 0))
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
282 (insert field-colon " " value "\n")))))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
283
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
284 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
285 (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
286 "Process header FIELD.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
287 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
288 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
289 header."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
290 (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
291
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
292 ;;;###mh-autoload
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
293 (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
294 "Process header FIELD.
67758
6b063593fdad Follow Emacs coding conventions. Use default setting of
Bill Wohler <wohler@newt.com>
parents: 67681
diff changeset
295 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
296 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
297 the header."
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 56406
diff changeset
298 (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
299
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
300 (provide 'mh-identity)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
301
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
302 ;; Local Variables:
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
303 ;; indent-tabs-mode: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
304 ;; sentence-end-double-space: nil
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
305 ;; End:
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
306
67681
3a8785724cca * mh-acros.el:
Bill Wohler <wohler@newt.com>
parents: 66357
diff changeset
307 ;; 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
308 ;;; mh-identity.el ends here