-
Notifications
You must be signed in to change notification settings - Fork 18
/
emacs-17.61-bsd.diff
26725 lines (26551 loc) · 652 KB
/
emacs-17.61-bsd.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 7657046..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,38 +0,0 @@
-Sun Mar 30 14:50:02 1986 Paul Rubin (phr at calder.berkeley.edu)
-
- * CHANGES IN THE EMACS DIRECTORY FOR THE 4.3BSD DISTRIBUTION
- ____________________________________________________________
-
- * src/config.h, src/paths.h:
- Provide sample versions of these files (see INSTALL for details).
- These should work on VAXen with vanilla directories. For other
- CPU's, you'll have to change config.h; if you've moved directories
- around, change paths.h. If you are running the X window system,
- change ``#undef HAVE_X_WINDOWS'' to ``#define HAVE_X_WINDOWS''
- in config.h.
-
- * lisp/mh-e.el (MH mail-handler front end):
- Replace with latest version (3.3) by ucbvax!larus. This
- version incorporates some fixes/improvements that are not
- yet in the FSF distribution (as of the date above).
- Share and enjoy.
-
- * etc/emacs.1 (troff'able man page):
- Change pathnames in FILES section to reflect where they are
- in this distribution.
-
- * INSTALL (installation guide):
- Say in LOSSAGES section to disregard `BSD redefined' and
- `BSD4_3 redefined' warning messages.
-
- * build-install (shell script to build and install emacs):
- Rearrange the installation part somewhat, since 4.3 systems
- typically have sources living in a different places from libraries.
- (Here at Berkeley, sources are all maintained on one machine
- and libraries are distributed to other machines over a local network;
- the script is now set up for this kind of environment).
-
- * README (note to installer):
- Insert pointer to this file.
-
- * dbx and cpp are not included on the distribution.
diff --git a/INSTALL b/INSTALL
index f352c00..cf73e7f 100644
--- a/INSTALL
+++ b/INSTALL
@@ -27,7 +27,7 @@ PREPARATION
1) Choose a place in the file structure for the main directory
of Emacs code to reside. This will ultimately have
- subdirectories named info, lisp, etc, etc. Call this name
+ subdirectories named src, lisp, etc, etc. Call this name
$EMACS. Let $BUILD stand for the name the directory has now.
2) Copy $BUILD/src/config.h.dist to config.h, and edit it to
@@ -134,12 +134,6 @@ The steps below are done by the shell script `build-install'.
LOSSAGES
Known possible problems building and running GNU Emacs
-* In the 4.3bsd distribution, you will get some spurious warning messages
-saying `BSD redefined' or `BSD4_3 redefined' from the C compiler while
-building Emacs. These are due to a last minute surprise in the 4.3
-header files which we did not have time to correct for. For now,
-please disregard the messages.
-
* Watch out for .emacs files and EMACSLOADPATH environment vars
These control the actions of Emacs.
diff --git a/README b/README
index 3722f10..3b5431c 100644
--- a/README
+++ b/README
@@ -18,6 +18,3 @@ The file INSTALL in this directory says how to bring up
The `etc' subdirectory contains several other files,
named in capital letters, which you should look at
when installing GNU Emacs.
-
-For a list of the changes made at Berkeley to the FSF distribution,
- see the file ChangeLog, in this directory.
diff --git a/build-install b/build-install
index ac59cc1..69feba0 100755
--- a/build-install
+++ b/build-install
@@ -2,8 +2,8 @@
#
#Shell script for building and installing Emacs.
-set EMACS=/usr/new/lib/emacs
-set BIN=/usr/new
+set EMACS=/usr/local/emacs
+set BIN=/usr/local/bin
(cd etc; make) || exit 1
(cd src; make) || exit 1
diff --git a/etc/emacs.1 b/etc/emacs.1
index 5e0eb6f..6325273 100644
--- a/etc/emacs.1
+++ b/etc/emacs.1
@@ -72,29 +72,29 @@ make and distribute copies of the Emacs manual. The TeX source to the
manual is also included in the Emacs source distribution.
.PP
.SH FILES
-/usr/src/new/emacs/src - C source files and object files
+/usr/local/emacs/src - C source files and object files
-/usr/new/lib/emacs/lisp - Lisp source files and compiled files
+/usr/local/emacs/lisp - Lisp source files and compiled files
that define most editing commands. Some are preloaded;
others are autoloaded from this directory when used.
-/usr/new/lib/emacs/man - sources for the Emacs reference manual.
+/usr/local/emacs/man - sources for the Emacs reference manual.
-/usr/new/lib/emacs/etc - various programs that are used with
+/usr/local/emacs/etc - various programs that are used with
GNU Emacs, and some files of information.
-/usr/new/lib/emacs/etc/DOC.* - contains the documentation
+/usr/local/emacs/etc/DOC.* - contains the documentation
strings for the Lisp primitives and preloaded Lisp functions
of GNU Emacs. They are stored here to reduce the size of
Emacs proper.
-/usr/new/lib/emacs/etc/DIFF discusses GNU Emacs vs. Twenex Emacs;
+/usr/local/emacs/etc/DIFF discusses GNU Emacs vs. Twenex Emacs;
.br
-/usr/new/lib/emacs/etc/CCADIFF discusses GNU Emacs vs. CCA Emacs;
+/usr/local/emacs/etc/CCADIFF discusses GNU Emacs vs. CCA Emacs;
.br
-/usr/new/lib/emacs/etc/GOSDIFF discusses GNU Emacs vs. Gosling Emacs.
+/usr/local/emacs/etc/GOSDIFF discusses GNU Emacs vs. Gosling Emacs.
.br
-/usr/new/lib/emacs/etc/SERVICE lists people offering various services
+/usr/local/emacs/etc/SERVICE lists people offering various services
to assist users of GNU Emacs, including education, troubleshooting,
porting and customization.
.br
@@ -102,20 +102,20 @@ These files also have information useful to anyone wishing to write
programs in the Emacs Lisp extension language, which has not yet been fully
documented.
-/usr/new/lib/emacs/info - files for the Info documentation browser
+/usr/local/emacs/info - files for the Info documentation browser
(a subsystem of Emacs) to refer to. Currently not much of Unix
is documented here, but the complete text of the Emacs reference
manual is included in a convenient tree structured form.
-/usr/new/lib/emacs/lock - holds lock files that are made for all
+/usr/local/emacs/lock - holds lock files that are made for all
files being modified in Emacs, to prevent simultaneous modification
of one file by two users.
-/usr/src/new/emacs/cpp - the GNU cpp, needed for building Emacs on
+/usr/local/emacs/cpp - the GNU cpp, needed for building Emacs on
certain versions of Unix where the standard cpp cannot handle long
names for macros.
-/usr/src/new/emacs/shortnames - facilities for translating long names to
+/usr/local/emacs/shortnames - facilities for translating long names to
short names in C code, needed for building Emacs on certain versions
of Unix where the C compiler cannot handle long names for functions
or variables.
@@ -138,7 +138,7 @@ a list of people who offer it.
Please do not send anything but bug reports to this mailing list.
Send other stuff to [email protected] (or the
corresponding UUCP address). For more information about Emacs mailing
-lists, see the file /usr/new/lib/emacs/etc/MAILINGLISTS. Bugs tend
+lists, see the file /usr/local/emacs/etc/MAILINGLISTS. Bugs tend
actually to be fixed if they can be isolated, so it is in your
interest to report them in such a way that they can be easily
reproduced.
diff --git a/src/config.h b/src/config.h
deleted file mode 100644
index 1d157fe..0000000
--- a/src/config.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* GNU Emacs site configuration file.
- Copyright (C) 1985 Richard M. Stallman.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the GNU Emacs General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-GNU Emacs, but only under the conditions described in the
-GNU Emacs General Public License. A copy of this license is
-supposed to have been given to you along with GNU Emacs so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-/* NOTE: This is the config file for generic 4.3BSD.
- If you want to make a change to the configuration file which
- is included in the Emacs distribution, the file config.h.dist must
- also be modified.
-*/
-
-/* Include here a s- file that describes the system type you are using.
- Alternatives now defined include
- s-bsd4.1.h, s-bsd4.2.h and s-bsd4.3.h for Berkeley systems,
- s-unipl5.2.h and s-unipl.5.0.h for Unisoft-modified system V,
- and s-usg5.2.h for ordinary losing system V.
- See s-template.h for documentation on writing s- files. */
-#include "s-bsd4.3.h"
-
-/* Include here a m- file that describes the machine and system you use.
- Alternatives implemented so far are
- m-vax.h for vaxen.
- m-mega68.h for Megatest 68000's.
- m-sun.h for Sun 68000's.
- m-ns16000.h for 16000's (not sure how general this is yet)
- m-pyramid.h for pyramids.
- m-dual68.h for dual 68000's (that run Unisoft port).
- m-apollo.h for Apollo running their own system.
- See m-template.h for info on what m- files should define.
- */
-#include "m-vax.h"
-
-
-/* define HAVE_X_WINDOWS if you want to use the X window system */
-
-#undef HAVE_X_WINDOWS
-
-/* subprocesses should be defined if you want to
- have code for asynchronous subprocesses
- (as used in M-x compile and M-x shell).
- These do not work for some USG systems yet;
- for the ones where they work, the s-*.h file defines this flag. */
-
-#ifndef USG
-#define subprocesses
-#endif
-
-/* Define USER_FULL_NAME to return a string
- that is the user's full name.
- It can assume that the variable `pw'
- points to the password file entry for this user.
-
- At some sites, the pw_gecos field contains
- the user's full name. If neither this nor any other
- field contains the right thing, use pw_name,
- giving the user's login name, since that is better than nothing. */
-
-#define USER_FULL_NAME pw->pw_gecos
-
-/* Define AMPERSAND_FULL_NAME if you use the convention
- that & in the full name stands for the login id. */
-
-#define AMPERSAND_FULL_NAME
-
-/* Maximum screen width we handle. */
-
-#define MScreenWidth 300
-
-/* Maximum screen length we handle. */
-
-#define MScreenLength 300
-
-/* # bytes of pure Lisp code to leave space for.
- 130000 is enough for Emacs as distributed by me, Richard Stallman,
- with the set of preloaded packages I set up. */
-
-#define PURESIZE 130000
-
-/* Define HIGHPRI as a negative number
- if you want Emacs to run at a higher than normal priority.
- For this to take effect, you must install it as setuid root. */
-
-#undef HIGHPRI
diff --git a/src/paths.h b/src/paths.h
deleted file mode 100644
index 64360d8..0000000
--- a/src/paths.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* the default search path for Lisp function "load" */
-#define PATH_LOADSEARCH ":/usr/new/lib/emacs/lisp"
-
-/* the extra search path for programs to invoke.
- This is appended to whatever the PATH environment variable says. */
-#define PATH_EXEC "/usr/new/lib/emacs/etc"
-
-/* the name of the directory that contains lock files
- with which we record what files are being modified in Emacs.
- This directory should be writable by everyone.
- THE STRING MUST END WITH A SLASH!!! */
-#define PATH_LOCK "/usr/new/lib/emacs/lock/"
-
-/* the name of the file !!!SuperLock!!! in the directory
- specified by PATH_LOCK. Yes, this is redundant. */
-#define PATH_SUPERLOCK "/usr/new/lib/emacs/lock/!!!SuperLock!!!"
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5c57f72..e517bb2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,7 +1,3 @@
-Sun Apr 13 07:39:08 1986 James Larus (larus at calder.berkeley.edu)
-
- * Installed mh-e (v 3.3c).
-
Sat Apr 12 19:29:26 1986 Richard M. Stallman (rms at prep)
* replace.el (perform-replace):
@@ -54,11 +50,6 @@ Mon Mar 31 12:39:55 1986 Richard M. Stallman (rms at prep)
* man.el: fix stupid error in arg to file-name-all-completions.
-Sun Mar 30 14:42:26 1986 Paul Rubin (phr at calder.berkeley.edu)
-
- * mh-e.el:
- Replace with improved version, by [email protected].
-
Fri Mar 28 23:28:16 1986 Richard M. Stallman (rms at prep)
* info.el (Info-tagify):
diff --git a/lisp/mh-e.el b/lisp/mh-e.el
index f0da19e..37834cc 100644
--- a/lisp/mh-e.el
+++ b/lisp/mh-e.el
@@ -1,11 +1,11 @@
-;;; mh-e.el (Version: 3.3c for GNU Emacs Version 17 and MH.5 and MH.6)
+;;; mh-e.el (Version: 3.2 for GNU Emacs Version 17)
-;;; Copyright (C) James Larus ([email protected], ucbvax!larus), 1985
+;;; Copyright (C) 1985 Free Software Foundation
+;;; Author James Larus, [email protected], ucbvax!larus
;;; Please send suggestions and corrections to the above address.
;;;
;;; This file contains mh-e, a GNU Emacs front end to the MH mail system.
-
;; GNU Emacs is distributed in the hope that it will be useful,
;; but without any warranty. No author or distributor
;; accepts responsibility to anyone for the consequences of using it
@@ -35,8 +35,8 @@
;;; Set for local environment:
;;;* These are now in paths.el.
-;;;(defvar mh-progs "/usr/new/mh/" "Directory containing MH commands")
-;;;(defvar mh-lib "/usr/new/lib/mh/" "Directory of MH library")
+;(defvar mh-progs "/usr/new/mh/" "Directory containing MH commands")
+;(defvar mh-lib "/usr/new/lib/mh/" "Directory of MH library")
;;; Mode hooks:
@@ -78,8 +78,7 @@ as it is inserted in an outgoing letter.")
(defvar mh-rejected-letter-start "^ ----- Unsent message follows -----$"
"Regexp specifying the beginning of the wrapper around a letter returned
by the mail system.")
-(defvar mh-good-msg-regexp "^....[^D^]"
- "Regexp specifiying the scan lines that are 'good' messages")
+
;;; Global variables:
@@ -90,7 +89,7 @@ by the mail system.")
(defvar mh-pick-mode-map (make-sparse-keymap) "Keymap for searching folder.")
(defvar mh-folder-list nil "List of folder names for completion.")
-;;; Macros and generic functions:
+;;; Macros:
(defmacro push (v l)
(list 'setq l (list 'cons v l)))
@@ -110,11 +109,6 @@ by the mail system.")
(defmacro when (pred &rest body)
(list 'cond (cons pred body)))
-(defun mapc (func list)
- (while list
- (funcall func (car list))
- (setq list (cdr list))))
-
;;; Entry points:
@@ -146,17 +140,15 @@ different conventions from the usual mail system."
;;; User executable mh-e commands:
-
(defun mh-answer (&optional arg)
- "Answer a letter. If given a non-nil ARGUMENT, then include the current
-message in the reply."
+ "Answer a letter. If given an argument, then include the current message
+in the reply."
(interactive "P")
(let ((msg-filename (mh-msg-filename))
(msg (mh-get-msg-num t))
(minibuffer-help-form
"from => Sender\n to => Sender and primary recipients\n cc => Sender and all recipients")
- (folder mh-current-folder)
- (show-buffer mh-show-buffer))
+ (folder mh-current-folder))
(let ((reply-to (completing-read
"Reply to whom: " '(("from") ("to") ("cc")) nil t)))
(message "Composing a reply...")
@@ -168,7 +160,8 @@ message in the reply."
((equal reply-to "to")
(apply 'mh-exec-cmd
(nconc
- (list "repl" "-build" mh-current-folder msg "-cc" "to")
+ (list "repl" "-build" mh-current-folder msg "-cc" "to"
+ "-nocc" "me")
(if arg (list "-filter" "mhl.reply")))))
((equal reply-to "cc")
(apply 'mh-exec-cmd
@@ -190,55 +183,46 @@ message in the reply."
(cc (mh-get-field "Cc:")))
(goto-char (point-min))
(re-search-forward "^$" (point-max) nil)
- (if (not arg)
- (mh-display-msg msg msg-filename show-buffer))
- (mh-add-msg-to-seq msg "answered" t)
+ (when (not arg)
+ (switch-to-buffer-other-window "*message*")
+ (erase-buffer)
+ (if (file-exists-p msg-filename)
+ (insert-file-contents msg-filename)
+ (error "File %s does not exist" msg-filename))
+ (set-buffer-modified-p nil)
+ (goto-char (point-min))
+ (re-search-forward "^$\\|^-*$")
+ (recenter 0))
(message "Composing a reply...done")
(mh-compose-and-send-mail "" folder to subject cc "-" "Replied:")))))
-(defun my-apply-command-to-seq (command)
- "Applies the next command to all messages in a sequence to be prompted for."
- (interactive "k")
- (funcall (key-binding command) (mh-read-seq "Apply to" mh-narrowed-to-seq)))
-
-
-(defun mh-copy-msg (&optional seq)
- "Copy specified message(s) to another folder without deleting them.
-Optional argument is a SEQUENCE name to copy."
+(defun mh-copy-msg (&optional arg)
+ "Copy specified message(s) to another folder without deleting them."
(interactive "P")
- (let ((msgs (if seq seq (mh-get-msg-num t))))
- (mh-exec-cmd "refile" msgs "-link" "-src" mh-current-folder
- (mh-prompt-for-folder "Copy to" "" t))
- (if seq
+ (let ((msgs (if arg
+ (mh-seq-to-msgs (mh-read-seq "Copy"))
+ (mh-get-msg-num t))))
+ (mh-exec-cmd-no-wait "refile" msgs "-link" "-src"
+ mh-current-folder
+ (mh-prompt-for-folder "Copy to" "" t))
+ (if arg
(mh-notate-seq msgs ?C mh-cmd-note)
(mh-notate ?C mh-cmd-note))))
-(defun mh-delete-msg (&optional seq)
- "Marks the specified message(s) for later deletion. Optional argument is a
-SEQUENCE name to delete."
- (interactive "P")
- (if seq
- (mh-map-to-seq-msgs 'mh-delete-a-msg seq)
- (mh-delete-a-msg))
- (mh-next-msg))
-
-
-(defun mh-delete-msg-from-seq (&optional arg)
- "Deletes a message from a sequence or, if optional ARG is non-nil, deletes
-the sequence."
+(defun mh-delete-msg (&optional arg)
+ "Marks the specified message(s) for later deletion."
(interactive "P")
(if arg
- (mh-remove-seq (mh-read-seq "Delete"))
- (mh-remove-msg-from-seq (mh-get-msg-num t) (mh-read-seq "Delete from")))
+ (mh-map-over-seq 'mh-delete-a-msg (mh-read-seq "Delete"))
+ (mh-delete-a-msg))
(mh-next-msg))
(defun mh-execute-commands ()
"Process outstanding delete and move commands."
(interactive)
- (if mh-narrowed-to-seq (mh-widen))
(save-excursion
(mh-process-commands mh-current-folder))
(delete-other-windows)
@@ -263,44 +247,28 @@ the sequence."
(let ((mh-invisible-headers "^Date:\\|^Received:\\|^Message-Id:\\|^From:"))
(mh-clean-msg-header (point-min)))
(goto-char (point-min))
- (switch-to-buffer mh-current-folder)
(mh-compose-and-send-mail "" mh-current-folder (mh-get-field "To")
(mh-get-field "From") (mh-get-field "cc"))))
-(defun mh-forward (&optional seq)
- "Forward a letter. Optional argument is a SEQUENCE of messages to forward."
- (interactive "P")
- (let ((to (read-string "To: "))
- (cc (read-string "Cc: "))
- (msg-filename (mh-msg-filename))
- (msg (if seq seq (mh-get-msg-num t)))
+(defun mh-forward (to cc subject)
+ "Forward a letter."
+ (interactive "sTo: \nsCc: \nsSubject: ")
+ (let ((msg-filename (mh-msg-filename))
+ (msg (mh-get-msg-num t))
(folder mh-current-folder))
(cond ((or (not (file-exists-p (format "%sdraft" mh-user-path)))
(y-or-n-p "The file 'draft' exists. Discard it? "))
(mh-exec-cmd "forw" "-build" mh-current-folder msg)
(mh-read-draft)
- (mh-insert-fields "To:" to "Cc:" cc)
- (set-buffer-modified-p nil))
+ (mh-insert-fields "To:" to "Subject:" subject "Cc:" cc))
(t
(mh-read-draft)))
(goto-char (point-min))
(re-search-forward "^------- Forwarded Message")
(previous-line 1)
- (narrow-to-region (point) (point-max))
- (let* ((subject (save-excursion (mh-get-field "From:")))
- (trim (string-match "<" subject))
- (forw-subject (save-excursion (mh-get-field "Subject:"))))
- (if trim
- (setq subject (substring subject 0 (1- trim))))
- (widen)
- (save-excursion
- (mh-insert-fields "Subject:" (format "[%s: %s]" subject forw-subject)))
- (delete-other-windows)
- (if seq
- (mh-add-msg-list-to-seq (mh-seq-to-msgs seq) "forwarded" t)
- (mh-add-msg-to-seq msg "forwarded" t))
- (mh-compose-and-send-mail "" folder to subject cc "F" "Forwarded:"))))
+ (delete-other-windows)
+ (mh-compose-and-send-mail "" folder to subject cc "F" "Forwarded-To:")))
(defun mh-goto-msg (number &optional no-error-if-no-message)
@@ -322,23 +290,39 @@ ARG is t. Return non-nil if cursor is at message."
(defun mh-inc-folder ()
"inc(orporate) new mail into inbox."
(interactive)
- (pop-to-buffer "+inbox")
+ (switch-to-buffer "+inbox")
(if (or (not (boundp 'mh-current-folder)) (null mh-current-folder))
(mh-make-folder "+inbox"))
(if (mh-get-new-mail)
(mh-show)))
+(defun mh-indicate-seq (&optional arg)
+ "Add the specified message(s) to a sequence."
+ (interactive "P")
+ (let ((new-seq (mh-char-to-seq last-input-char))
+ (old-seq (if (looking-at "^[0-9a-z]")
+ (mh-char-to-seq (char-after (point))))))
+ (if old-seq
+ (if arg
+ (mh-remove-seq old-seq)
+ (mh-remove-msg-from-seq (mh-get-msg-num t) old-seq)))
+ (if (and (not arg)
+ (or (not old-seq) (not (equal new-seq old-seq))))
+ (mh-add-msg-to-seq (mh-get-msg-num t) new-seq)))
+ (mh-next-msg))
+
+
(defun mh-kill-folder ()
"Removes the current folder."
(interactive)
(if (yes-or-no-p (format "Remove folder %s? " mh-current-folder))
- (let ((folder mh-current-folder))
+ (let ((buffer mh-current-folder))
(switch-to-buffer-other-window " *mh-temp*")
- (mh-exec-cmd "rmf" "-nointeractive" folder)
- (mh-remove-folder-from-folder-list folder)
+ (mh-exec-cmd "rmf" buffer)
+ (mh-remove-folder-from-folder-list buffer)
(message "Folder removed")
- (kill-buffer folder))
+ (kill-buffer buffer))
(message "Folder not removed")))
@@ -353,76 +337,27 @@ ARG is t. Return non-nil if cursor is at message."
(message "listing folders...done"))
-(defun mh-msg-is-in-seq ()
- "Displays the sequences that the current messages is in."
- (interactive)
- (let ((msg (mh-get-msg-num t))
- (l mh-seq-list)
- (seqs ""))
- (while l
- (if (memq msg (cdar l))
- (setq seqs (format "%s %s" (symbol-name (caar l)) seqs)))
- (setq l (cdr l)))
- (message "Message %d is in sequences: %s" msg seqs)))
-
-
-(defun mh-move-msg (&optional seq)
- "Move specified message(s) to another folder. Optional argument is a
-SEQUENCE of messages to refile."
+(defun mh-move-msg (&optional arg)
+ "Move specified message(s) to another folder."
(interactive "P")
- (setq mh-last-destination
- (cons 'move (intern (mh-prompt-for-folder "Destination" "" t))))
- (if seq
- (mh-map-to-seq-msgs 'mh-move-a-msg seq (cdr mh-last-destination))
- (mh-move-a-msg (cdr mh-last-destination)))
- (mh-next-msg))
-
-
-(defun mh-move-or-write-again ()
- "Move or write the current message to same folder or file as the last move
-or write."
- (interactive)
- (if (null mh-last-destination)
- (error "No previous move"))
- (cond ((eq (car mh-last-destination) 'move)
- (mh-move-a-msg (cdr mh-last-destination))
- (message "Destination folder: %s" (cdr mh-last-destination)))
- (t
- (mh-write-msg-to-file (cdr mh-last-destination))
- (message "Destination: %s" (cdr mh-last-destination))))
- (sit-for 3)
+ (setq mh-last-destination (mh-prompt-for-folder "Destination" "" t))
+ (if arg
+ (mh-map-over-seq 'mh-move-a-msg (mh-read-seq "Move"))
+ (mh-move-a-msg))
(mh-next-msg))
-(defun mh-narrow-to-seq ()
- "Restrict the display of the current folder to the messages in the sequence
-to be prompted for. Use \\[mh-widen] to undo this command."
- (interactive "")
- (let ((seq (mh-read-seq "Narrow to"))
- (eob (point-max))
- (buffer-read-only nil))
- (cond ((mh-seq-to-msgs seq)
- (mh-copy-seq-to-point seq eob)
- (narrow-to-region eob (point-max))
- (setq mode-line-format (mh-make-mode-line (symbol-name seq)))
- (recenter)
- (setq mh-narrowed-to-seq seq))
- (t
- (error "No messages in sequence `%s'" (symbol-name seq))))))
-
-
(defun mh-next-line (&optional arg)
"Move to next undeleted message in window and display body if summary
flag set."
(interactive "p")
(forward-line (if arg arg 1))
(setq mh-next-direction 'forward)
- (cond ((re-search-forward mh-good-msg-regexp nil 0 arg)
+ (cond ((re-search-forward "^....[^D^]" nil 0 arg)
(beginning-of-line)
(mh-maybe-show))
(t
(forward-line -1)
- (sit-for 2)
(message "No more messages"))))
@@ -459,7 +394,7 @@ flag set."
"Move to previous message in window and display body if summary flag set."
(interactive "p")
(setq mh-next-direction 'backward)
- (if (not (re-search-backward mh-good-msg-regexp nil 0 arg))
+ (if (not (re-search-backward "^....[^D^]" nil 0 arg))
(message "Beginning of messages")
(mh-maybe-show)))
@@ -474,56 +409,26 @@ flag set."
(other-window -1))))
-(defun mh-print-msg (&optional seq)
- "Print specified message(s) on a line printer. Optional argument is a
-SEQUENCE of messages to print."
+(defun mh-print-msg (&optional arg)
+ "Print specified message(s) on a line printer."
(interactive "P")
- (let ((msgs (if seq
- (reverse (mh-seq-to-msgs seq))
+ (let ((msgs (if arg
+ (reverse (mh-seq-to-msgs (mh-read-seq "Print")))
(list (mh-get-msg-num t)))))
(message "printing message...")
- (call-process shell-file-name nil 0 nil "-c"
- (if seq
- (format "(scan -clear %s ; %smhl -nobell -clear %s) | %s"
- (mapconcat (function (lambda (msg) msg)) msgs " ")
- mh-lib
- (mh-msg-filenames msgs mh-folder-filename)
- (format mh-lpr-command-format
- (if seq
- "Mail"
- (format "%s/%d" mh-current-folder
- (mh-get-msg-num t)))))
- (format "%smhl -nobell -clear %s | %s"
- mh-lib
- (mh-msg-filenames msgs mh-folder-filename)
- (format mh-lpr-command-format
- (if seq
- "Mail"
- (format "%s/%d" mh-current-folder
- (mh-get-msg-num t)))))))
- (if seq
- (mh-notate-seq msgs ?P mh-cmd-note)
- (mh-notate ?P mh-cmd-note))
- (mh-add-msg-list-to-seq msgs 'printed t)
+ (call-process "/bin/sh" nil 0 nil "-c"
+ (format "%smhl -nobell -clear %s | %s" mh-lib
+ (mh-msg-filenames msgs mh-folder-filename)
+ (format mh-lpr-command-format
+ (if arg
+ "Mail"
+ (format "%s/%d" mh-current-folder
+ (mh-get-msg-num t))))))
(message "printing message...done")))
-(defun mh-put-msg-in-seq (&optional arg)
- "Add a message to a sequence or, if optional ARG is non-nil, add the
-messages from a sequence to another sequence."
- (interactive "P")
- (if arg
- (mh-add-msg-list-to-seq (mh-seq-to-msgs
- (mh-read-seq "Add messages from"))
- (mh-read-seq "to"))
- (mh-add-msg-to-seq (mh-get-msg-num t) (mh-read-seq "Add to")))
- (mh-next-msg))
-
-
(defun mh-rescan-folder (&optional arg)
- "Rescan a folder after optionally processing the outstanding commands. If
-the optional argument is non-nil, then prompt for the range of messages to
-display, otherwise assume the whole buffer."
+ "Optionally process commands in current folder and (re)scan it."
(interactive "P")
(if (and (or mh-delete-list mh-move-list)
(y-or-n-p "Process commands? "))
@@ -535,42 +440,43 @@ display, otherwise assume the whole buffer."
(defun mh-redistribute (to cc)
"Redistribute a letter."
- (interactive "sRedist-To: \nsRedist-Cc: ")
+ (interactive "sTo: \nsCc: ")
(let ((msg-filename (mh-msg-filename))
(msg (mh-get-msg-num t))
(folder mh-current-folder))
- (save-window-excursion
- (mh-read-draft)
- (when (or (zerop (buffer-size))
- (not (y-or-n-p
- "The file 'draft' exists. Redistribute old version? ")))
- (erase-buffer)
- (insert-file-contents msg-filename))
- (re-search-forward "^$\\|^---")
+ (mh-read-draft)
+ (delete-other-windows)
+ (when (or (zerop (buffer-size))
+ (not (y-or-n-p
+ "The file 'draft' exists. Redistribute old version? ")))
+ (erase-buffer)
+ (insert-file-contents msg-filename)
+ (goto-char (point-min))
(insert "Resent-To: " to "\n")
(if (not (equal cc ""))
- (insert "Resent-cc: " cc "\n"))
- (let ((mh-invisible-headers "^Message-Id:\\|^Received:\\|Return-Path:"))
- (mh-clean-msg-header (point-min)))
- (save-buffer)
- (message "Redistributing...")
- (call-process "/bin/sh" nil 0 nil "-c"
- (format "mhdist=1 mhaltmsg=%s %s/send -push %s/draft"
- msg-filename mh-progs mh-user-path))
- (mh-annotate-msg msg folder "R"
- "-component" "Resent:"
- "-text" (format "\"%s %s\"" to cc))
- (message "Redistributing...done"))))
+ (insert "Resent-cc: " cc "\n")))
+ (mh-compose-and-send-mail "-dist" folder to (mh-get-field "Subject:") cc
+ "F" "Distributed-to:")))
+
+
+(defun mh-move-again ()
+ "Move specified message to same folder as last move."
+ (interactive)
+ (if (null mh-last-destination)
+ (error "No previous move"))
+ (mh-move-a-msg)
+ (message "Destination folder: %s" mh-last-destination)
+ (mh-next-msg))
(defun mh-write-msg-to-file (file)
"Append the current message to the end of a file."
(interactive "FSave message in file: ")
- (setq mh-last-destination (cons 'write file))
- (call-process shell-file-name nil 0 nil "-c"
- (format "cat %s >> %s " (mh-msg-filename) file)))
-
+ (let ((msg-filename (mh-msg-filename)))
+ (call-process "/bin/csh" nil 0 nil "-c"
+ (format "cat %s >> %s " msg-filename file))))
+
(defun mh-search-folder ()
"Search the current folder for messages matching a pattern."
(interactive)
@@ -599,7 +505,6 @@ display, otherwise assume the whole buffer."
(insert-file-contents (format "%scomponents" mh-lib))
(error "Can't find components")))
(mh-insert-fields "To:" to "Subject:" subject "Cc:" cc)
- (set-buffer-modified-p nil)
(goto-char (point-max))
(message "Composing a message...done"))
(mh-compose-and-send-mail "" folder to subject cc)))
@@ -610,10 +515,30 @@ display, otherwise assume the whole buffer."
(interactive)
(setq mh-summarize nil)
(setq mode-name "Mh-Show")
- (let ((msg-num (mh-get-msg-num t))
+ (let ((msgn (mh-get-msg-num t))
+ (msg-filename (mh-msg-filename))
(folder mh-current-folder))
- (mh-display-msg msg-num (mh-msg-filename) mh-show-buffer)
-
+ (if (not (file-exists-p msg-filename))
+ (error "Message %d does not exist." msgn))
+ (switch-to-buffer mh-show-buffer)
+ (erase-buffer)
+ (unlock-buffer)
+ (if mh-use-mhl
+ (mh-exec-lib-cmd-output "mhl" "-nobell" msg-filename)
+ (insert-file-contents msg-filename))
+ (setq buffer-file-name msg-filename)
+ (goto-char (point-min))
+ (cond (mh-clean-message-header
+ (mh-clean-msg-header (point-min))
+ (goto-char (point-min)))
+ (t
+ (let ((case-fold-search t))
+ (re-search-forward "^To:\\|^From:\\|^Subject:\\|^Date:" nil t)
+ (beginning-of-line)
+ (recenter 0))))
+ (set-buffer-modified-p nil)
+ (setq mode-line-format
+ (concat "{%b} %[%p of " folder "/" msgn "%] %M"))
;; These contortions are to force the summary line to be the top window.
(switch-to-buffer-other-window folder)
(delete-other-windows)
@@ -621,12 +546,14 @@ display, otherwise assume the whole buffer."
(switch-to-buffer-other-window folder)
(shrink-window (- (window-height) mh-summary-height))
(recenter 1)
- (push msg-num mh-seen-list)))
+ ;; Remove from unseen seq.
+ (mh-exec-cmd-no-wait "mark" mh-current-folder msgn "-seq" "unseen"
+ "-delete" "-nolist")))
-(defun mh-sort-folder ()
+(defun mh-sort-folder (&optional arg)
"Sort the messages in the current folder by date."
- (interactive "")
+ (interactive "P")
(mh-process-commands mh-current-folder)
(setq mh-next-direction 'forward)
(message "sorting folder...")
@@ -635,6 +562,14 @@ display, otherwise assume the whole buffer."
(mh-scan-folder mh-current-folder "all"))
+(defun mh-summary ()
+ "Show a summary of mh-e commands."
+ (interactive)
+ (message
+"Next Prev Go Del ^ ! Copy Undo . Toggle Ans Forw Redist Send List Execute")
+ (sit-for 5))
+
+
(defun mh-toggle-summarize ()
"Turn the summary mode of displaying messages on or off."
(interactive)
@@ -642,45 +577,30 @@ display, otherwise assume the whole buffer."
(cond (mh-summarize
(delete-other-windows)
(setq mode-name "Mh-Summarize")
- (recenter (/ (window-height) 2)))
+ (recenter))
(t
(setq mode-name "Mh-Show")
(mh-show))))
-(defun mh-undo (&optional seq)
- "Undo the deletion or move of the specified message(s). Optional argument
-is a name of a sequence of messages to apply undo to."
+(defun mh-undo (&optional arg)
+ "Undo the deletion or move of the specified message(s)."
(interactive "P")
(cond ((looking-at "^....D")
- (cond (seq
- (mapc (function (lambda (msg)
- (setq mh-delete-list
- (delq msg mh-delete-list))
- (mh-remove-msg-from-seq msg 'deleted)))
- (mh-seq-to-msgs seq))
- (mh-notate-seq seq ? mh-cmd-note))
- (t
- (let ((msg (mh-get-msg-num t)))
- (setq mh-delete-list (delq msg mh-delete-list))
- (mh-remove-msg-from-seq msg 'deleted)
- (mh-notate ? mh-cmd-note)))))
-
- ((looking-at "^....\\^")
- (cond (seq
- (mapc (function (lambda (msg)
- (mapc (function
- (lambda (dest)
- (mh-remove-msg-from-seq msg dest)))
- mh-move-list)))
- (mh-seq-to-msgs seq))
- (mh-notate-seq seq ? mh-cmd-note))
- (t
- (let ((msg (mh-get-msg-num t)))
- (mapc (function (lambda (dest)
- (mh-remove-msg-from-seq msg dest)))
- mh-move-list)
- (mh-notate ? mh-cmd-note)))))
+ (let ((msgs (if arg (mh-read-seq "Undelete") (mh-get-msg-num t))))
+ (setq mh-delete-list (delq msgs mh-delete-list))
+ (if arg
+ (mh-notate-seq msgs ? mh-cmd-note)
+ (mh-notate ? mh-cmd-note))))
+
+ ((looking-at "^....^")
+ (let ((msgs (if arg (mh-read-seq "Unmove") (mh-get-msg-num t))))
+ (mapcar
+ (function (lambda (move) (setcdr move (delq msgs (cdr move)))))
+ mh-move-list)
+ (if arg
+ (mh-notate-seq msgs ? mh-cmd-note)
+ (mh-notate ? mh-cmd-note))))
(t nil)))
@@ -699,78 +619,39 @@ is a name of a sequence of messages to apply undo to."
(defun mh-visit-folder (&optional arg)
- "Visit a new folder. If optional argument is non-nil, then prompt for the
-range of messages, otherwise scan the whole buffer."
+ "Visit a new folder."
(interactive "p")
(let ((folder (mh-prompt-for-folder "Visit" "" t))
(range (if arg (read-string "Range [all]? ") "all")))
(mh-scan-folder folder (if (equal range "") "all" range))
(delete-other-windows)))
-
-(defun mh-widen ()
- "Remove restrictions from the current folder, thereby showing all messages."
- (interactive "")
- (let ((buffer-read-only nil))
- (delete-region (point-min) (point-max))
- (widen)
- (setq mode-line-format (mh-make-mode-line)))
- (setq mh-narrowed-to-seq nil))
-
;;; Support routines.
(defun mh-delete-a-msg ()
"Delete the message pointed to by the cursor."
- (let ((msg (mh-get-msg-num t)))
- (if (looking-at "....\\^")
- (error "Message %d already moved. Undo move before deleting." msg))
- (push msg mh-delete-list)
- (mh-add-msg-to-seq msg 'deleted t)
- (mh-notate ?D mh-cmd-note)))
+ (if (looking-at "....^")
+ (error "Message %d already moved. Undo move before deleting."