Mercurial > emacs
annotate lisp/mail/rmailout.el @ 13097:59916c4b0b79
Add early support for Solaris 2.5 on PowerPCs.
[USG5_4] (CANNOT_DUMP): Define this if USG5_4.
(UNEXEC): Don't define if already defined.
[USG5_4] (DATA_SEG_BITS, LIBS_MACHINE): Alternate definitions.
(C_SWITCH_MACHINE, LD_SWITCH_MACHINE, NLIST_STRUCT, WORDS_BIG_ENDIAN)
(TEXT_START, DATA_START, TEXT_END, DATA_END):
Don't define, if USG5_4.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 01 Oct 1995 03:43:42 +0000 |
parents | b2df0396fae2 |
children | 83f275dcd93a |
rev | line source |
---|---|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
202
diff
changeset
|
1 ;;; rmailout.el --- "RMAIL" mail reader for Emacs: output message to a file. |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
202
diff
changeset
|
2 |
7298 | 3 ;; Copyright (C) 1985, 1987, 1993, 1994 Free Software Foundation, Inc. |
845 | 4 |
788
c8d4eb38ebfc
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
713
diff
changeset
|
5 ;; Maintainer: FSF |
814
38b2499cb3e9
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: mail |
788
c8d4eb38ebfc
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
713
diff
changeset
|
7 |
63 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
788
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
63 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
788
c8d4eb38ebfc
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
713
diff
changeset
|
24 ;;; Code: |
63 | 25 |
5859
84ad3a2c5373
Add (require 'rmail) so the macro will be byte-compiled properly.
Karl Heuer <kwzh@gnu.org>
parents:
5802
diff
changeset
|
26 (require 'rmail) |
84ad3a2c5373
Add (require 'rmail) so the macro will be byte-compiled properly.
Karl Heuer <kwzh@gnu.org>
parents:
5802
diff
changeset
|
27 |
63 | 28 ;; Temporary until Emacs always has this variable. |
29 (defvar rmail-delete-after-output nil | |
30 "*Non-nil means automatically delete a message that is copied to a file.") | |
31 | |
145 | 32 (defvar rmail-output-file-alist nil |
33 "*Alist matching regexps to suggested output Rmail files. | |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
34 This is a list of elements of the form (REGEXP . NAME-EXP). |
4851
b70799eabd57
(rmail-output-file-alist): Doc fix.
Roland McGrath <roland@gnu.org>
parents:
4836
diff
changeset
|
35 The suggestion is taken if REGEXP matches anywhere in the message buffer. |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
36 NAME-EXP may be a string constant giving the file name to use, |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
37 or more generally it may be any kind of expression that returns |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
38 a file name as a string.") |
145 | 39 |
1866
a712cff3b6e7
* rmailout.el (rmail-output, rmail-output-to-mail-file): Reverse
Jim Blandy <jimb@redhat.com>
parents:
1460
diff
changeset
|
40 ;;; There are functions elsewhere in Emacs that use this function; check |
a712cff3b6e7
* rmailout.el (rmail-output, rmail-output-to-mail-file): Reverse
Jim Blandy <jimb@redhat.com>
parents:
1460
diff
changeset
|
41 ;;; them out before you change the calling method. |
a712cff3b6e7
* rmailout.el (rmail-output, rmail-output-to-mail-file): Reverse
Jim Blandy <jimb@redhat.com>
parents:
1460
diff
changeset
|
42 (defun rmail-output-to-rmail-file (file-name &optional count) |
63 | 43 "Append the current message to an Rmail file named FILE-NAME. |
44 If the file does not exist, ask if it should be created. | |
45 If file is being visited, the message is appended to the Emacs | |
46 buffer visiting that file. | |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
47 If the file exists and is not an Rmail file, |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
48 the message is appended in inbox format. |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
49 |
7332
e30a34bfc536
(rmail-output-menu): Set rmail-default-rmail-file.
Richard M. Stallman <rms@gnu.org>
parents:
7320
diff
changeset
|
50 The default file name comes from `rmail-default-rmail-file', |
5592 | 51 which is updated to the name you use in this command. |
52 | |
63 | 53 A prefix argument N says to output N consecutive messages |
54 starting with the current one. Deleted messages are skipped and don't count." | |
3657
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
55 (interactive |
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
56 (let ((default-file |
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
57 (let (answer tail) |
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
58 (setq tail rmail-output-file-alist) |
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
59 ;; Suggest a file based on a pattern match. |
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
60 (while (and tail (not answer)) |
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
61 (save-excursion |
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
62 (goto-char (point-min)) |
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
63 (if (re-search-forward (car (car tail)) nil t) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
64 (setq answer (eval (cdr (car tail))))) |
3657
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
65 (setq tail (cdr tail)))) |
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
66 ;; If not suggestions, use same file as last time. |
5590
1d9fabec8bec
Use new names rmail-default-file and rmail-default-rmail-file.
Richard M. Stallman <rms@gnu.org>
parents:
5399
diff
changeset
|
67 (or answer rmail-default-rmail-file)))) |
1d9fabec8bec
Use new names rmail-default-file and rmail-default-rmail-file.
Richard M. Stallman <rms@gnu.org>
parents:
5399
diff
changeset
|
68 (list (setq rmail-default-rmail-file |
5399
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
69 (let ((read-file |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
70 (read-file-name |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
71 (concat "Output message to Rmail file: (default " |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
72 (file-name-nondirectory default-file) |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
73 ") ") |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
74 (file-name-directory default-file) |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
75 default-file))) |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
76 (if (file-directory-p read-file) |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
77 (expand-file-name (file-name-nondirectory default-file) |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
78 read-file) |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
79 (expand-file-name |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
80 (or read-file default-file) |
67aa88583b90
(rmail-output-to-rmail-file): If just a dir is specified,
Richard M. Stallman <rms@gnu.org>
parents:
5331
diff
changeset
|
81 (file-name-directory default-file))))) |
3657
7503a402c721
(rmail-output-to-rmail-file): Use the smart default in the prompt.
Richard M. Stallman <rms@gnu.org>
parents:
2717
diff
changeset
|
82 (prefix-numeric-value current-prefix-arg)))) |
1866
a712cff3b6e7
* rmailout.el (rmail-output, rmail-output-to-mail-file): Reverse
Jim Blandy <jimb@redhat.com>
parents:
1460
diff
changeset
|
83 (or count (setq count 1)) |
202 | 84 (setq file-name |
85 (expand-file-name file-name | |
5590
1d9fabec8bec
Use new names rmail-default-file and rmail-default-rmail-file.
Richard M. Stallman <rms@gnu.org>
parents:
5399
diff
changeset
|
86 (file-name-directory rmail-default-rmail-file))) |
13054
b2df0396fae2
(rmail-file-p): Function moved to mail-utils.el
Richard M. Stallman <rms@gnu.org>
parents:
10101
diff
changeset
|
87 (if (and (file-readable-p file-name) (not (mail-file-babyl-p file-name))) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
88 (rmail-output file-name count) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
89 (rmail-maybe-set-message-counters) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
90 (setq file-name (abbreviate-file-name file-name)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
91 (or (get-file-buffer file-name) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
92 (file-exists-p file-name) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
93 (if (yes-or-no-p |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
94 (concat "\"" file-name "\" does not exist, create it? ")) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
95 (let ((file-buffer (create-file-buffer file-name))) |
63 | 96 (save-excursion |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
97 (set-buffer file-buffer) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
98 (rmail-insert-rmail-file-header) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
99 (let ((require-final-newline nil)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
100 (write-region (point-min) (point-max) file-name t 1))) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
101 (kill-buffer file-buffer)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
102 (error "Output file does not exist"))) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
103 (while (> count 0) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
104 (let (redelete) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
105 (unwind-protect |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
106 (progn |
5278
92268e08c166
(rmail-output-to-rmail-file): Call rmail-update-summary.
Richard M. Stallman <rms@gnu.org>
parents:
5051
diff
changeset
|
107 ;; Temporarily turn off Deleted attribute. |
92268e08c166
(rmail-output-to-rmail-file): Call rmail-update-summary.
Richard M. Stallman <rms@gnu.org>
parents:
5051
diff
changeset
|
108 ;; Do this outside the save-restriction, since it would |
92268e08c166
(rmail-output-to-rmail-file): Call rmail-update-summary.
Richard M. Stallman <rms@gnu.org>
parents:
5051
diff
changeset
|
109 ;; shift the place in the buffer where the visible text starts. |
92268e08c166
(rmail-output-to-rmail-file): Call rmail-update-summary.
Richard M. Stallman <rms@gnu.org>
parents:
5051
diff
changeset
|
110 (if (rmail-message-deleted-p rmail-current-message) |
92268e08c166
(rmail-output-to-rmail-file): Call rmail-update-summary.
Richard M. Stallman <rms@gnu.org>
parents:
5051
diff
changeset
|
111 (progn (setq redelete t) |
92268e08c166
(rmail-output-to-rmail-file): Call rmail-update-summary.
Richard M. Stallman <rms@gnu.org>
parents:
5051
diff
changeset
|
112 (rmail-set-attribute "deleted" nil))) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
113 (save-restriction |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
114 (widen) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
115 ;; Decide whether to append to a file or to an Emacs buffer. |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
116 (save-excursion |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
117 (let ((buf (get-file-buffer file-name)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
118 (cur (current-buffer)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
119 (beg (1+ (rmail-msgbeg rmail-current-message))) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
120 (end (1+ (rmail-msgend rmail-current-message)))) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
121 (if (not buf) |
9993
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
122 ;; Output to a file. |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
123 (if rmail-fields-not-to-output |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
124 ;; Delete some fields while we output. |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
125 (let ((obuf (current-buffer))) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
126 (set-buffer (get-buffer-create " rmail-out-temp")) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
127 (insert-buffer-substring obuf beg end) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
128 (rmail-delete-unwanted-fields) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
129 (append-to-file (point-min) (point-max) file-name) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
130 (set-buffer obuf) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
131 (kill-buffer (get-buffer " rmail-out-temp"))) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
132 (append-to-file beg end file-name)) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
133 (if (eq buf (current-buffer)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
134 (error "Can't output message to same file it's already in")) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
135 ;; File has been visited, in buffer BUF. |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
136 (set-buffer buf) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
137 (let ((buffer-read-only nil) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
138 (msg (and (boundp 'rmail-current-message) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
139 rmail-current-message))) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
140 ;; If MSG is non-nil, buffer is in RMAIL mode. |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
141 (if msg |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
142 (progn |
5331
a74ffe260236
(rmail-output-to-rmail-file): When copying to a buffer,
Richard M. Stallman <rms@gnu.org>
parents:
5278
diff
changeset
|
143 ;; Turn on auto save mode, if it's off in this |
a74ffe260236
(rmail-output-to-rmail-file): When copying to a buffer,
Richard M. Stallman <rms@gnu.org>
parents:
5278
diff
changeset
|
144 ;; buffer but enabled by default. |
a74ffe260236
(rmail-output-to-rmail-file): When copying to a buffer,
Richard M. Stallman <rms@gnu.org>
parents:
5278
diff
changeset
|
145 (and (not buffer-auto-save-file-name) |
a74ffe260236
(rmail-output-to-rmail-file): When copying to a buffer,
Richard M. Stallman <rms@gnu.org>
parents:
5278
diff
changeset
|
146 auto-save-default |
a74ffe260236
(rmail-output-to-rmail-file): When copying to a buffer,
Richard M. Stallman <rms@gnu.org>
parents:
5278
diff
changeset
|
147 (auto-save-mode t)) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
148 (rmail-maybe-set-message-counters) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
149 (widen) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
150 (narrow-to-region (point-max) (point-max)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
151 (insert-buffer-substring cur beg end) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
152 (goto-char (point-min)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
153 (widen) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
154 (search-backward "\n\^_") |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
155 (narrow-to-region (point) (point-max)) |
9993
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
156 (rmail-delete-unwanted-fields) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
157 (rmail-count-new-messages t) |
5278
92268e08c166
(rmail-output-to-rmail-file): Call rmail-update-summary.
Richard M. Stallman <rms@gnu.org>
parents:
5051
diff
changeset
|
158 (if (rmail-summary-exists) |
92268e08c166
(rmail-output-to-rmail-file): Call rmail-update-summary.
Richard M. Stallman <rms@gnu.org>
parents:
5051
diff
changeset
|
159 (rmail-select-summary |
92268e08c166
(rmail-output-to-rmail-file): Call rmail-update-summary.
Richard M. Stallman <rms@gnu.org>
parents:
5051
diff
changeset
|
160 (rmail-update-summary))) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
161 (rmail-show-message msg)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
162 ;; Output file not in rmail mode => just insert at the end. |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
163 (narrow-to-region (point-min) (1+ (buffer-size))) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
164 (goto-char (point-max)) |
9993
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
165 (insert-buffer-substring cur beg end) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
166 (rmail-delete-unwanted-fields))))))) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
167 (rmail-set-attribute "filed" t)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
168 (if redelete (rmail-set-attribute "deleted" t)))) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
169 (setq count (1- count)) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
170 (if rmail-delete-after-output |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
171 (rmail-delete-forward) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
172 (if (> count 0) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
173 (rmail-next-undeleted-message 1)))))) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
174 |
9993
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
175 (defvar rmail-fields-not-to-output nil |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
176 "*Regexp describing fields to exclude when outputting a message to a file.") |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
177 |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
178 ;; Delete from the buffer header fields we don't want output. |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
179 ;; NOT-RMAIL if t means this buffer does not have the full header |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
180 ;; and *** EOOH *** that a message in an Rmail file has. |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
181 (defun rmail-delete-unwanted-fields (&optional not-rmail) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
182 (if rmail-fields-not-to-output |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
183 (save-excursion |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
184 (goto-char (point-min)) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
185 ;; Find the end of the header. |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
186 (if (and (or not-rmail (search-forward "\n*** EOOH ***\n" nil t)) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
187 (search-forward "\n\n" nil t)) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
188 (let ((end (point-marker))) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
189 (goto-char (point-min)) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
190 (while (re-search-forward rmail-fields-not-to-output end t) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
191 (beginning-of-line) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
192 (delete-region (point) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
193 (progn (forward-line 1) (point))))))))) |
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
194 |
1866
a712cff3b6e7
* rmailout.el (rmail-output, rmail-output-to-mail-file): Reverse
Jim Blandy <jimb@redhat.com>
parents:
1460
diff
changeset
|
195 ;;; There are functions elsewhere in Emacs that use this function; check |
a712cff3b6e7
* rmailout.el (rmail-output, rmail-output-to-mail-file): Reverse
Jim Blandy <jimb@redhat.com>
parents:
1460
diff
changeset
|
196 ;;; them out before you change the calling method. |
5011
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
197 (defun rmail-output (file-name &optional count noattribute from-gnus) |
6651 | 198 "Append this message to system-inbox-format mail file named FILE-NAME. |
63 | 199 A prefix argument N says to output N consecutive messages |
1866
a712cff3b6e7
* rmailout.el (rmail-output, rmail-output-to-mail-file): Reverse
Jim Blandy <jimb@redhat.com>
parents:
1460
diff
changeset
|
200 starting with the current one. Deleted messages are skipped and don't count. |
4265
2812d8619305
(rmail-output): New arg NOATTRIBUTE.
Richard M. Stallman <rms@gnu.org>
parents:
4264
diff
changeset
|
201 When called from lisp code, N may be omitted. |
2812d8619305
(rmail-output): New arg NOATTRIBUTE.
Richard M. Stallman <rms@gnu.org>
parents:
4264
diff
changeset
|
202 |
4836
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
203 If the pruned message header is shown on the current message, then |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
204 messages will be appended with pruned headers; otherwise, messages |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
205 will be appended with their original headers. |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
206 |
7561
22a4985ddad3
(rmail-output): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7332
diff
changeset
|
207 The default file name comes from `rmail-default-file', |
5592 | 208 which is updated to the name you use in this command. |
209 | |
4265
2812d8619305
(rmail-output): New arg NOATTRIBUTE.
Richard M. Stallman <rms@gnu.org>
parents:
4264
diff
changeset
|
210 The optional third argument NOATTRIBUTE, if non-nil, says not |
5011
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
211 to set the `filed' attribute, and not to display a message. |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
212 |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
213 The optional fourth argument FROM-GNUS is set when called from GNUS." |
63 | 214 (interactive |
5802
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
215 (let ((default-file |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
216 (let (answer tail) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
217 (setq tail rmail-output-file-alist) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
218 ;; Suggest a file based on a pattern match. |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
219 (while (and tail (not answer)) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
220 (save-excursion |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
221 (goto-char (point-min)) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
222 (if (re-search-forward (car (car tail)) nil t) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
223 (setq answer (eval (cdr (car tail))))) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
224 (setq tail (cdr tail)))) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
225 ;; If not suggestions, use same file as last time. |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
226 (or answer rmail-default-file)))) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
227 (list (setq rmail-default-file |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
228 (let ((read-file |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
229 (read-file-name |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
230 (concat "Output message to Unix mail file: (default " |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
231 (file-name-nondirectory default-file) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
232 ") ") |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
233 (file-name-directory default-file) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
234 default-file))) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
235 (if (file-directory-p read-file) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
236 (expand-file-name (file-name-nondirectory default-file) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
237 read-file) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
238 (expand-file-name |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
239 (or read-file default-file) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
240 (file-name-directory default-file))))) |
3db75b13c7f5
(rmail-output): Handle rmail-output-file-alist.
Richard M. Stallman <rms@gnu.org>
parents:
5592
diff
changeset
|
241 (prefix-numeric-value current-prefix-arg)))) |
1866
a712cff3b6e7
* rmailout.el (rmail-output, rmail-output-to-mail-file): Reverse
Jim Blandy <jimb@redhat.com>
parents:
1460
diff
changeset
|
242 (or count (setq count 1)) |
202 | 243 (setq file-name |
244 (expand-file-name file-name | |
5590
1d9fabec8bec
Use new names rmail-default-file and rmail-default-rmail-file.
Richard M. Stallman <rms@gnu.org>
parents:
5399
diff
changeset
|
245 (and rmail-default-file |
1d9fabec8bec
Use new names rmail-default-file and rmail-default-rmail-file.
Richard M. Stallman <rms@gnu.org>
parents:
5399
diff
changeset
|
246 (file-name-directory rmail-default-file)))) |
13054
b2df0396fae2
(rmail-file-p): Function moved to mail-utils.el
Richard M. Stallman <rms@gnu.org>
parents:
10101
diff
changeset
|
247 (if (and (file-readable-p file-name) (mail-file-babyl-p file-name)) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
248 (rmail-output-to-rmail-file file-name count) |
4836
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
249 (let ((orig-count count) |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
250 (rmailbuf (current-buffer)) |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
251 (case-fold-search t) |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
252 (tembuf (get-buffer-create " rmail-output")) |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
253 (original-headers-p |
5011
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
254 (and (not from-gnus) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
255 (save-excursion |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
256 (save-restriction |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
257 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max)) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
258 (goto-char (point-min)) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
259 (forward-line 1) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
260 (= (following-char) ?0))))) |
4836
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
261 header-beginning |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
262 mail-from) |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
263 (while (> count 0) |
5011
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
264 (or from-gnus |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
265 (setq mail-from |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
266 (save-excursion |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
267 (save-restriction |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
268 (widen) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
269 (goto-char (rmail-msgbeg rmail-current-message)) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
270 (setq header-beginning (point)) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
271 (search-forward "\n*** EOOH ***\n") |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
272 (narrow-to-region header-beginning (point)) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
273 (mail-fetch-field "Mail-From"))))) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
274 (save-excursion |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
275 (set-buffer tembuf) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
276 (erase-buffer) |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
277 (insert-buffer-substring rmailbuf) |
9993
26f63d276d89
(rmail-fields-not-to-output): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8910
diff
changeset
|
278 (rmail-delete-unwanted-fields t) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
279 (insert "\n") |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
280 (goto-char (point-min)) |
4836
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
281 (if mail-from |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
282 (insert mail-from "\n") |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
283 (insert "From " |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
284 (mail-strip-quoted-names (or (mail-fetch-field "from") |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
285 (mail-fetch-field "really-from") |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
286 (mail-fetch-field "sender") |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
287 "unknown")) |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
288 " " (current-time-string) "\n")) |
4056
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
289 ;; ``Quote'' "\nFrom " as "\n>From " |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
290 ;; (note that this isn't really quoting, as there is no requirement |
419e92a78e6f
(rmail-output): If file is an Rmail file,
Richard M. Stallman <rms@gnu.org>
parents:
3832
diff
changeset
|
291 ;; that "\n[>]+From " be quoted in the same transparent way.) |
10101
c0afdaf34c6f
(rmail-output): Don't quote "From " lines unless the capitalization is exact.
Karl Heuer <kwzh@gnu.org>
parents:
9993
diff
changeset
|
292 (let ((case-fold-search nil)) |
c0afdaf34c6f
(rmail-output): Don't quote "From " lines unless the capitalization is exact.
Karl Heuer <kwzh@gnu.org>
parents:
9993
diff
changeset
|
293 (while (search-forward "\nFrom " nil t) |
c0afdaf34c6f
(rmail-output): Don't quote "From " lines unless the capitalization is exact.
Karl Heuer <kwzh@gnu.org>
parents:
9993
diff
changeset
|
294 (forward-char -5) |
c0afdaf34c6f
(rmail-output): Don't quote "From " lines unless the capitalization is exact.
Karl Heuer <kwzh@gnu.org>
parents:
9993
diff
changeset
|
295 (insert ?>))) |
4265
2812d8619305
(rmail-output): New arg NOATTRIBUTE.
Richard M. Stallman <rms@gnu.org>
parents:
4264
diff
changeset
|
296 (write-region (point-min) (point-max) file-name t |
2812d8619305
(rmail-output): New arg NOATTRIBUTE.
Richard M. Stallman <rms@gnu.org>
parents:
4264
diff
changeset
|
297 (if noattribute 'nomsg))) |
4836
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
298 (or noattribute |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
299 (if (equal major-mode 'rmail-mode) |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
300 (rmail-set-attribute "filed" t))) |
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
301 (setq count (1- count)) |
5011
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
302 (or from-gnus |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
303 (let ((next-message-p |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
304 (if rmail-delete-after-output |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
305 (rmail-delete-forward) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
306 (if (> count 0) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
307 (rmail-next-undeleted-message 1)))) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
308 (num-appended (- orig-count count))) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
309 (if (and next-message-p original-headers-p) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
310 (rmail-toggle-header)) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
311 (if (and (> count 0) (not next-message-p)) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
312 (progn |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
313 (error |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
314 (save-excursion |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
315 (set-buffer rmailbuf) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
316 (format "Only %d message%s appended" num-appended |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
317 (if (= num-appended 1) "" "s")))) |
22c7b341d536
(rmail-output): New argument FROM-GNUS.
Richard M. Stallman <rms@gnu.org>
parents:
4851
diff
changeset
|
318 (setq count 0)))))) |
4836
38a0f0209707
(rmail-output): If message was shown with full headers,
Richard M. Stallman <rms@gnu.org>
parents:
4265
diff
changeset
|
319 (kill-buffer tembuf)))) |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
202
diff
changeset
|
320 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
202
diff
changeset
|
321 ;;; rmailout.el ends here |