Newer
Older
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
;;; crypt.el --- code for handling all sorts of compressed and encrypted files
;; Author: Lawrence R. Dodd <dodd@roebling.poly.edu>
;; Rod Whitby <rwhitby@research.canon.oz.au>
;; Kyle E. Jones <kyle@uunet.uu.net>
;; Maintainer: Lawrence R. Dodd <dodd@roebling.poly.edu>
;; Created: crypt.el in 1988, crypt++.el on 18 Jan 1993
;; Version: 2.83
;; Date: 1994/03/31 12:30:17
;; Keywords: extensions
;;; Copyright (C) 1994 Lawrence R. Dodd
;;; Copyright (C) 1993 Lawrence R. Dodd and Rod Whitby
;;; Copyright (C) 1988, 1989, 1990 Kyle E. Jones
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Synched up with: Not in FSF.
;;; Commentary:
;;; NOTE: Apparently not being maintained by the author, who now
;;; uses jka-compr.el. --ben (1/26/96)
;;; Included patch (1/26/96)
;;; Please see notes on INSTALLATION and USAGE on the pages below.
;;; LCD Archive Entry:
;;; crypt++|Rod Whitby and Lawrence R. Dodd|dodd@roebling.poly.edu|
;;; Code for handling all sorts of compressed and encrypted files.|
;;; 1994/03/31 12:30:17|2.83|~/misc/crypt++.el.Z|
;;; AVAILABLE:
;;;
;;; via anonymous ftp to roebling.poly.edu [128.238.5.31] in
;;; /pub/lisp/crypt++.el.gz
;;;
;;; via anonymous ftp to archive.cis.ohio-state.edu [128.146.8.52] in
;;; /pub/gnu/emacs/elisp-archive/misc/crypt++.el.Z
;;; BUG REPORTS
;;;
;;; Type M-x crypt-submit-report to generate a bug report template or put your
;;; cursor at the end of this line and type C-x C-e: (crypt-submit-report)
;;;
;;; Please note that this bug-report facility (crypt-submit-report) uses Barry
;;; Warsaw's reporter.el which is part of GNU Emacs v19 and bundled with many
;;; other packages. If needed, you can obtain a copy of reporter.el at
;;; /roebling.poly.edu:/pub/reporter.el or the elisp-archive. In fact,
;;; crypt-submit-report will attempt to ange-ftp a copy for you from roebling
;;; if you do not have one accessible.
;;; Lawrence R. Dodd <dodd@roebling.poly.edu>
;;; Polytechnic University
;;; Brooklyn, New York USA
;;; VERSION:
;;;
;;; Version: 2.83
;;; Ident: crypt++.el,v 2.82 1994/03/31 12:30:17 dodd Exp
;;; Date: 1994/03/31 12:30:17
;;; INSTALLATION:
;;;
;;; To use this package, simply put it in a file called "crypt.el" in a Lisp
;;; directory known to Emacs (see `load-path'), byte-compile it (you may get a
;;; warning saying that the function reporter-submit-bug-report is not known
;;; to be defined -- ignore it), and put the line:
;;;
;;; (require 'crypt)
;;;
;;; in your ~/.emacs file or in the file default.el in the ../lisp directory
;;; of the Emacs distribution. Do not bother trying to autoload this file;
;;; this package uses find-file and write-file hooks and thus should be loaded
;;; the first time you visit any sort of file. Any package loaded after this
;;; one that appends something to `write-file-hooks' will not be executed
;;; because this package writes out the file. Other packages that append to
;;; `write-file-hooks' should either be modified to prepend to that hook or be
;;; loaded before this one (preferably the former).
;;; NOTE: encryption users should set `crypt-encryption-type' to one of the
;;; values in `crypt-encryption-alist' (see USAGE below).
;;; SEE ALSO: /roebling.poly.edu:/pub/crypt++-fnf.el for file-not-found
;;; support for GNU Emacs.
;;; SPECIAL NOTES:
;;;
;;; If crypt is dumped with the emacs executable, or if it has already been
;;; loaded in an emacs session, then modifying the variables used in building
;;; the encryption and encoding tables will have no effect until these tables
;;; are rebuilt. This may be done with `M-x crypt-rebuild-tables'. See USAGE
;;; below to determine variables for which this is needed. For example,
;;; post-load changes to `crypt-encryption-file-extension' or
;;; `crypt-freeze-vs-fortran' can be incorporated into the encryption table
;;; via `M-x crypt-rebuild-tables'. Similarly, post-load changes to
;;; `crypt-bind-insert-file' are handled with `M-x crypt-bind-insert-file'.
;;; USAGE:
;;;
;;; By default, intended to be transparent. User-defined variables
;;;
;;; controlling ENCRYPTION are
;;;
;;; crypt-encryption-type
;;; crypt-encryption-file-extension
;;; crypt-never-ever-decrypt
;;; crypt-auto-write-buffer-encrypted
;;; crypt-confirm-password
;;; crypt-encrypted-disable-auto-save
;;; crypt-encryption-alist
;;;
;;; controlling ENCODING are
;;;
;;; crypt-auto-decode-buffer
;;; crypt-auto-write-buffer
;;; crypt-query-if-interactive
;;; crypt-no-extension-implies-plain
;;; crypt-freeze-vs-fortran
;;; crypt-compact-vs-C++
;;; crypt-ignored-filenames
;;; crypt-default-encoding
;;; crypt-encoded-disable-auto-save
;;; crypt-encoding-alist
;;;
;;; controlling file insertion are
;;;
;;; crypt-bind-insert-file
;;; crypt-auto-decode-insert
;;;
;;; To find out more about these variables, load this file, put your cursor at
;;; the end of any of the variable names, and hit C-h v [RET].
;;;
;;; NOTE: encryption users should set `crypt-encryption-type' to one of the
;;; values in `crypt-encryption-alist'
;;;
;;; Although rarely needed, the following functions may be called interactively
;;;
;;; (crypt-encoded-mode)
;;; (crypt-encode-region)
;;; (crypt-encrypted-mode)
;;; (crypt-encrypt-region)
;;; (crypt-set-encryption-key)
;;; (crypt-rebuild-tables)
;;; (crypt-insert-file)
;;; (crypt-bind-insert-file)
;;; (crypt-submit-report)
;;;
;;; To find out more about these functions, load this file, put your cursor
;;; inside any of the `()' of the above lines, and hit C-h f [RET].
;;; NOTES ON INTERFACES WITH OTHER PROGRAMS AND PACKAGES:
;;;
;;; GZIP: the environment variable GZIP of gzip can cause an error if it
;;; contains `--verbose' because standard output messages will be appended to
;;; gzip'ed files. This corrupts the files. The cleanest solution is to pass
;;; the `--quiet' switch in `crypt-encoding-alist' to override this. use gzip
;;; version 1.0.4 or higher from prep.ai.mit.edu:/pub/gnu
;;;
;;; TAR-MODE: works properly with version 1.28 (or higher) with v19 emacs.
;;; DESCRIPTION:
;;;
;;; The basic purpose of this package of Lisp functions is to recognize
;;; automatically encrypted and encoded (i.e., compressed) files when they are
;;; first visited or written. The BUFFER corresponding to the file is decoded
;;; and/or decrypted before it is presented to the user. The file itself is
;;; unchanged on the disk. When the buffer is subsequently saved to disk, a
;;; hook function re-encodes the buffer before the actual disk write takes
;;; place.
;;;
;;; This package recognizes all sorts of compressed files by a magic number at
;;; the beginning of these files but uses a heuristic to detect encrypted
;;; files. If you are asked for an encryption key for a file that is in fact
;;; not encrypted, just hit RET and the file will be accepted as is, and the
;;; crypt minor mode will not be entered.
;;;
;;; Other types of encoding programs may be added to this package by using the
;;; variable `crypt-encoding-alist' which contains a table of encoding
;;; programs such as compress, gzip (GNU zip), freeze, and compact.
;;;
;;; This new extended version of crypt now monitors the filename extensions of
;;; buffers that are written out using write-file (C-x C-w). If the filename
;;; extension matches one of the extensions listed in `crypt-encoding-alist,'
;;; then this package will write the file out using the corresponding encoding
;;; (compression) method. This is done whether or not the buffer originated
;;; from a previously encoded (compressed) file.
;;;
;;; Thus, if the user is editing a file that may or may not have been encoded
;;; originally (e.g., foobar.Z or foobar) and decides to write it to a
;;; different file (e.g., barfoo or barfoo.z or barfoo.C). This package will
;;; examine the filename extension and write the buffer in plain format or an
;;; alternate encoding (compression) format by searching through the entries
;;; in the table of encoding methods `crypt-encoding-alist.' This change in
;;; encoding state is done automatically if the variable
;;; `crypt-auto-write-buffer' is t otherwise the user is asked.
;;; TO DO/KNOWN BUGS/HELP WANTED/APPLY WITHIN:
;;;
;;; All Users/hackers out there are strongly encouraged to pursue any of these
;;; matters further (especially those that concern encryption and decryption!).
;;; It is important to future programmers and modifiers of crypt++.el to know
;;; about its perceived limitations. Since necessity drives invention, users
;;; who find any of the following features of crypt++.el annoying are asked to
;;; make suggestions and send patches (again, especially those that concern
;;; encryption and decryption!).
;;;
;;; * currently crypt++ assumes that if a file is both encrypted and encoded
;;; (i.e., compressed) that the order in which it was done was encryption
;;; first _then_ compression. As has been pointed by many people compression
;;; following encryption is useless since the encrypted file is basically
;;; random. On the other hand, many agree that doing encryption _following_
;;; compression is better since it makes it harder to crack the encryption.
;;; We would like to make the ordering of these two user-configurable or if
;;; nothing else change the order.
;;;
;;; Having read the above however, Francois Pinard <pinard@iro.umontreal.ca>
;;; writes that encryption following compression may not be harder to crack
;;; since "the fact that the first few uncrypted bytes are expected (the
;;; compress signature) facilitates a serious attempt at uncrypting."
;;; jwz agrees with Francois.
;;;
;;; * get write-region and append-to-file to handle encoded and encrypted
;;; files. There is an interesting low-level encoding package by Jay Adams
;;; <jka@ece.cmu.edu> called jka-compr.el that might address some of these
;;; issues. We encourage hackers out there to come up with crypt++ versions
;;; of write-region and append-to-file. The difficulty is creating versions
;;; that mimic the originals as closely as possible.
;;;
;;; * instead of using call-process-region (which can fail badly if the region
;;; is large and there's not much room in /tmp), write the region to a temp
;;; file (with a customisable location) and use call-process directly.
;;;
;;; * users have mentioned trouble using crypt++ and hilit simultaneously since
;;; the functions in write-file-hook for both write the file to disk and
;;; return t. A possible solution is to have one of them write to a
;;; scratch buffer instead of to disk and return nil and then allow the
;;; other to do its work on the scratch buffer and write it to disk. Thanks
;;; to Wayne Folta <folta@cs.UMD.EDU> and Amir J Katz <amir@matis.ingr.com>.
;;; It would be nice to have another way in emacs to have an
;;; after-write-file-hook and a before-write-file-hook of some sort.
;;; Lucid Emacs has an after-write-file-hook. Recent versions of hilit19.el
;;; do not automatically attach to `write-file-hooks' and return t.
;;; However, the general problem of multiple packages returning t still
;;; remains. dos-mode.el and crypt.el also conflict.
;;;
;;; * another possible source of trouble is with encryption (and encoding)
;;; programs sticking verbose output into buffers prior to being written to
;;; disk. This was definitely occurring with gzip because of --verbose in
;;; the GZIP environment variable and is solved/hidden with the --quiet
;;; switch. However, I suspect that some encryption problems out there are
;;; capable of similar things so the user should be careful.
;;;
;;; * integrating crypt++ with a backgrounding package such as Olin Shivers'
;;; `background.el' might be useful too. thanks to Mark Borges
;;; <mdb@noaacrd.Colorado.EDU> for suggesting this.
;;;
;;; * Performing M-x crypt-encode-buffer or M-x crypt-encrypt-buffer and then
;;; saving the file would possibly cause errors. It is better to toggle
;;; `crypt-encoded-mode' (or `crypt-encrypted-mode') and simply save the
;;; file. It is for this reason that `crypt-encode-buffer' and
;;; `crypt-encrypt-buffer' are not interactive.
;;;
;;; * use plists instead of alists replacing calls to `nth' with `get'
;;;
;;; * merge encryption code completely into encoding code making encryption
;;; just a special case of encoding.
;;; Change log:
;;;
;;; 1.1 - original version of crypt.el
;;; 1.2 -
;;; jwz: works with tar-mode.el
;;; jwz: applied patch from piet, merged with Lawrence Dodd's gzip version
;;; 1.3 -
;;; lrd: fixed compress-magic-regexp
;;; 1.4, 1.5, 1.6 -
;;; lrd: write-file compresses or gzips based on file extension
;;; 2.1 -
;;; lrd: merged with Rod Whitby's table-driven version (major upgrade)
;;; 2.2 -
;;; rjw: Changed file name to crypt++.el, so archie and lispdir can find it.
;;; 2.3 -
;;; rjw: Separated the hook additions and minor mode alist additions.
;;; 2.4 -
;;; rjw: Fixed the interactive form for crypt-buffer.
;;; 2.5 -
;;; lrd: doc mods, changed GNU free software notice (was out of date), added
;;; anonymous ftp information
;;; 2.6 -
;;; lrd: added back in definition of `buffer' in defun crypt-buffer caused
;;; an error when trying to read encrypted file; modified check for minor
;;; mode alist addition; added gzip magic number warning
;;; 2.7 - [posted to gnu.emacs.sources]
;;; lrd: added `TO DO' and `KNOW BUGS' section to header
;;; 2.8 -
;;; lrd: added note about updating to v 1.24 of tar-mode.el
;;; Thanks to Mark Borges <mdb@noaacrd.Colorado.EDU>
;;; 2.9 -
;;; lrd: moved query about `crypt-freeze-vs-fortran' out of defvar for
;;; `crypt-encoding-alist,' an erroneous value of nil was being stuck into
;;; alist when user set `crypt-freeze-vs-fortran' was nil, doc mod.
;;; Thanks to Mark Borges <mdb@noaacrd.Colorado.EDU>
;;; 2.10 -
;;; rjw: moved query about `crypt-freeze-vs-fortran' back into defvar for
;;; `crypt-encoding-alist,' - used append to ignore the erroneous nil.
;;; 2.11 -
;;; rjw: fixed a bug in my fix :-(
;;; 2.12 -
;;; rjw: Defvar crypt-magic-regexp and crypt-magic-regexp-inverse and
;;; allow either a regexp or an elisp expression.
;;; Suggested by Franc,ois Pinard <pinard@iro.umontreal.ca>.
;;; 2.13 -
;;; lrd: added in info on lispdir.el, doc mods and some puttering while
;;; looking over rjw's v 2.12 mods.
;;; 2.14 -
;;; lrd: doc mod - trivial huh? switched `compact' and `gzip' in
;;; `crypt-encoding-alist' - want gzip near top
;;; 2.15 -
;;; lrd: added in LCD Archive Entry and modified comments on tar-mode.el
;;; since the version at the elisp-archive now works with crypt++.el
;;; 2.16 -
;;; lrd: provide `crypt' as well as `crypt++' allowing something like `ln -s
;;; crypt++.el crypt.el' to be meaningful
;;; Suggested (by|as) Per Abrahamsen <amanda@iesd.auc.dk>
;;; 2.17 -
;;; lrd: clarified bug report procedure, added fancy pseudo-graphics, added
;;; to the `TO DO' list, put RCS tags in LCD Archive entry
;;; 2.18 - [posted to gnu.emacs.sources]
;;; lrd: included pointer to elisp archive in crypt-version description,
;;; changed "Decode buffer %s? " to "Decode %s? " in crypt-find-file-hook
;;; to be more general (mainly for crypt-insert-file)
;;; 2.19 -
;;; rjw: Added the crypt-compact-vs-C++ switch to distinguish compacted and
;;; C++ files.
;;; 2.20 -
;;; lrd: (1) modified interactive form of crypt-buffer. (2) made search
;;; case-insensitive in crypt-submit-report. (3) modified encoded-mode and
;;; crypt-mode so that buffer-modified is not unconditionally set to nil
;;; when the mode is not changed. Thanks to Gerd Hillebrand
;;; <ggh@cs.brown.edu> for suggesting (2) and (3).
;;; 2.21 -
;;; rjw: Added an entry to the TODO list about the hazards of using
;;; call-process-region on a large region and not much room in /tmp
;;; (David Carlisle <carlisle@computer-science.manchester.ac.uk>).
;;; 2.22 -
;;; lrd: allow write-file-hooks to contain functions as well as lists.
;;; Contributed by Ken Laprade <laprade@trantor.harris-atd.com>.
;;; 2.23 -
;;; lrd: made crypt-submit-report list values of more user-defined variables
;;; 2.24 -
;;; lrd: pass the -q switch to gzip to thwart the possibility of a --verbose
;;; in the GZIP environment variable
;;; 2.25 -
;;; lrd: added some more to the TO DO list, clarified some things, also
;;; untabified the entire file (I got tired of the control I's)
;;; 2.26 -
;;; lrd: use the long-named options for GNU zip (self-documenting)
;;; 2.27 -
;;; lrd: included observation by Francois Pinard <pinard@iro.umontreal.ca>
;;; and worked on text in TO DO/KNOWN BUGS list
;;; 2.28 -
;;; lrd: added two new variables in (crypt-submit-report) to the list stuck
;;; at the bottom of the mail message; changed the comments regarding the
;;; user-defined variables. added in default values in user defined
;;; variables. added to and removed stuff to the `TO DO' list.
;;;
;;; (encoded-mode):
;;; added in code to remove any auto-save-files that may have been formed
;;; before becoming an encoded buffer (for example a plain file saved to
;;; disk encoded had orphan auto-save-files left behind). turning off
;;; auto-save-mode disables the creation of auto-save-files, but it also
;;; disables the possibility of these being removed when the buffer is
;;; saved.
;;;
;;; (crypt-region):
;;; now call the encryption and decryption program directly instead of
;;; through the shell. this is more secure since the shell will expose the
;;; password (key). thanks to Jon Cargille <jcargill@cs.wisc.edu>. defined
;;; two new variables `crypt-decryption-args' and `crypt-encryption-args' to
;;; take the arguments separately. removed (let ((opoint)...)) construct
;;; this was a throw back to some old dead code and was not being used.
;;; 2.29 -
;;; lrd: added three new variables in (crypt-submit-report); added to the
;;; `TO DO' list.
;;;
;;; (encode-region,encode-buffer,encoded-mode): fixed interactive forms -
;;; the conversion to table version had eliminated some of the interactive
;;; features of these. thanks to Kimball Collins <kpc@ptolemy.arc.nasa.gov>
;;; for point this out. new interactive form uses functions
;;; `crypt-get-encoding-type' and `crypt-symbol-alist-to-table' and variable
;;; `crypt-default-encoding' to generate completion list of encoding types.
;;;
;;; (crypt-write-file-hook): two new user-defined variables
;;; `crypt-query-if-interactive' and `crypt-no-extension-implies-plain' and
;;; the buffer-local variable `buffer-interactive-mode' are used to help
;;; determined whether or not plain output is really desired for files
;;; without a compression file-name extension. the default behavior is the
;;; same as before.
;;; 2.30 -
;;; lrd: added test for user-defined variable `crypt-never-ever-decrypt'
;;; when finding a file. some users may never wish to decrypt files
;;; and like to edit binary files. thanks to Nelson Minar
;;; <nelson@reed.edu>. added to doc-strings of
;;; `crypt-magic-regexp[-inverse]' -- these can be set to nil[t] and
;;; accomplish the same thing as setting `crypt-never-ever-decrypt' to t
;;; 2.31 -
;;; rjw: Updated the comments in the encryption check section.
;;; 2.32 - [posted to gnu.emacs.sources]
;;; lrd: added warning about `crypt-(de|en)cryption-program'; doc mod.
;;; 2.33 -
;;; lrd: if `crypt-(de|en)cryption-args' are nil then don't pass any
;;; arguments to (de|en)cryption program, nil is the default instead of
;;; "". Thanks to Joe Ilacqua <spike@world.std.com>, David J. Schur
;;; <djs@idm.com>, Peter Nuth <nuth@ai.mit.edu>, and Greg Larson
;;; <glarson@bnr.ca>. `-q' exists in gzip 1.0.3 but not `--quiet' changed
;;; GZIP NOTE. Thanks to Chris Moore <moore@src.bae.co.uk>.
;;; 2.34 -
;;; lrd: allow `crypt-(de|en)cryption-args' to be a list of strings -- more
;;; robust. query for password (key), if none is set, when writing out file
;;; for which `buffer-save-encrypted' is t. Thanks to John Interrante
;;; <interran@uluru.Stanford.EDU>. (crypt-write-file-hook): check filename
;;; extension against regexp `crypt-encryption-file-extension' and query for
;;; encryption, unless `crypt-auto-write-buffer-encrypted' is t (don't
;;; bother doing reverse check, encrypted to plain, not a common request).
;;; (crypt-mode): delete auto-save files (cf., encoded-mode), may exist now.
;;; (read-string-no-echo): applied patch from Piet van Oostrum
;;; <piet@cs.ruu.nl> -- set `cursor-in-echo-area' _after_ setting buffer
;;; (this was screwing up gnews).
;;; 2.35 -
;;; lrd: doc mod
;;; 2.36 -
;;; lrd: fixed typo, added RMAIL note.
;;; 2.37 - [posted to gnu.emacs.sources]
;;; lrd:
;;; (crypt-write-file-hook): search user-defined list
;;; `crypt-ignored-filenames' for possible match with `buffer-filename'
;;; before attempting conversion from compressed to plain format; useful for
;;; compressed incoming mail files (e.g., RMAIL, INBOX).
;;;
;;; (crypt-mode): query for key if not set already; need to switch order of
;;; recovering key and toggling crypt-mode in crypt-find-file-hook (thanks
;;; to Piet van Oostrum <piet@cs.ruu.nl>).
;;;
;;; (crypt-buffer) and (encode-buffer): remove interactive form; use
;;; (crypt-mode) and (encoded-mode) instead so encryption and compression
;;; are done at the very end; leave interactive form in (crypt-region) and
;;; (encode-region) may still be used.
;;;
;;; (set-encryption-key): remove from `command-history' if called
;;; interactively - thanks to George M. Georgiou
;;; <georgiou@silicon.csci.csusb.edu>.
;;; 2.38 -
;;; lrd: added `crypt-' prefix to `(read-string-no-echo)' and `(save-point)'
;;; changed file extension for gzip files to `.z' _or_ `.gz' (future release
;;; of gzip with use later extension by default and so this should be
;;; changed to just `.gz' someday).
;;; 2.39 -
;;; lrd: doc mod. added in patch from jwz - `(crypt-read-string-no-echo)' is
;;; more secure, put property 'permanent-local on buffer-locals works for
;;; Lucid Emacs and doesn't harm v18 emacs, change `buffer-interactive-mode'
;;; to `buffer-interactive-encoded-mode.'
;;; 2.40 -
;;; lrd: put property 'preserved in case kill-fix.el is being used.
;;; 2.41 -
;;; lrd: all functions and variables now start with `crypt-', moved REVISION
;;; HISTORY to bottom of header, interactive version of
;;; `(crypt-encrypt-region)' clearer, `(crypt-read-string-no-echo)' now
;;; echos `.'
;;; 2.42 -
;;; lrd: (crypt-check-extension-for-encoding): broke out of
;;; `(crypt-write-file-hook)'. setting user variables
;;; `crypt-compact-vs-C++' and `crypt-freeze-vs-fortran' to nil no longer
;;; completely disables the reading compact'ed and frozen files but just
;;; disables the use of the file-extension tricks of
;;; `(crypt-check-extension-for-encoding).' (crypt-encode-region): allow
;;; for a single line message from encoding program at top of region; if it
;;; is there, then remove it; kludge for `compact' program.
;;; 2.43 -
;;; lrd: (crypt-encode-region): generalize the clean up procedure; add
;;; element to `crypt-encoding-alist' and introduce new function
;;; `(crypt-encoding-cleanup-regexp)' to extract a compression specific
;;; regexp for erroneous message or lisp expression for cleanup.
;;; 2.44 -
;;; lrd: new element for `crypt-encoding-alist' handles whether or not
;;; file-name extension tricks may be play with encoding method; compact and
;;; freeze values default to `crypt-compact-vs-C++' and
;;; `crypt-freeze-vs-fortran' (thanks to rjw);
;;; (crypt-encoding-extension-tricks): new defun to handle this;
;;; (crypt-check-extension-for-encoding): monitors "tricks" entry of
;;; `crypt-encoding-alist' and adjust the bag of tricks it can apply.
;;; 2.45 -
;;; lrd: (crypt-encode-region): delete entire match of cleanup regexp by
;;; requiring newlines in GARBAGE-REGEXP-OR-LISPEXP. (crypt-submit-report):
;;; use Warsaw's reporter.el.
;;; 2.46 -
;;; lrd: (crypt-find-file-hook, crypt-write-file-hook): cleaned, documented,
;;; and replaced occurrences of `(cond (C BODY))' with `(if C BODY)';
;;; changed `crypt-magic-regexp' to `crypt-encryption-magic-regexp' and
;;; `crypt-magic-regexp-inverse' to `crypt-encryption-magic-regexp-inverse'
;;; for consistency with other variable names. new user-defined variable
;;; `crypt-encryption-minor-mode-name' instead of always "Crypt". grouped
;;; all encryption variables together.
;;; 2.47 -
;;; lrd: somewhat major change - put program-specific encryption variables
;;; into a single table `crypt-encryption-alist' and let the variable
;;; `crypt-encryption-type' define the appropriate entry to use; new
;;; user-defined variable `crypt-confirm-password,' thanks to Jeff Clark
;;; <jclark@src.honeywell.com>. (crypt-submit-report): improved error
;;; handling, thanks to baw. (crypt-write-file-hook): fixed bug with
;;; `crypt-encoding-extension-tricks'
;;; 2.48 -
;;; lrd: added dummy argument to `crypt-encoding-alist' and
;;; `crypt-encryption-alist' and merged all defuns that work on their
;;; elements into defuns that all start with `crypt-get-' and look through
;;; both lists. simplifies some of code and closer to treating encryption
;;; as a special case of encoding; crypt-minor-mode-alist: replaced (nth *)
;;; with `(crypt-get-minor-mode)' call; (crypt-encode-region): allow
;;; arguments to be list of strings; renamed (crypt-get-encoding-type) to
;;; (crypt-read-encoding-type) for clarity.
;;; 2.49 - [posted to gnu.emacs.sources]
;;; lrd: (crypt-encode-region): ignore `args' if set to t
;;; 2.50 -
;;; lrd: (crypt-write-file-hook): in v19 we need to call `backup-buffer'
;;; ourselves -- we write out the file and return t so `basic-save-buffer'
;;; does not do it; also call `set-file-modes'
;;; 2.51 -
;;; lrd: some `defvar's are now `defconst's and tar-mode note was changed.
;;; 2.52 -
;;; lrd: make doc strings conform to GNU standards.
;;; 2.53 -
;;; lrd: made header conform to GNU Conventional Headers standard.
;;; 2.54 -
;;; lrd: `crypt-encryption-file-extension', `crypt-freeze-vs-fortran',
;;; `crypt-compact-vs-C++', `crypt-encryption-magic-regexp', and
;;; `crypt-encryption-magic-regexp-inverse' are used in defining the tables
;;; `crypt-encoding-alist' and `crypt-encryption-alist' and so need to be set
;;; _before_ loading crypt++. use `add-hook' if it is available.
;;; 2.55 -
;;; lrd: new interactive function `crypt-insert-file' mimics `insert-file'
;;; but attempts to decode or decrypt before insertion; bound `C-x i' if
;;; `crypt-bind-insert-file' is non-nil. comment out doc-strings from
;;; internal subroutines, saves space.
;;; 2.56 -
;;; tfb: change the definitions of crypt-{encoding,encryption}-alist, to
;;; call the functions crypt-make-{encoding,encryption}-alist resp.
;;; Added crypt-reinit which regenerates these variables from their
;;; functions, thus allowing this stuff to be preloaded even if people
;;; set things in their init files.
;;; Tim Bradshaw <tim.bradshaw@mid-heidelberg.de>
;;; 2.57 -
;;; lrd: untabify; remove duplicate entry in `crypt-make-encoding-alist';
;;; change name of `crypt-make-*-alist' to `crypt-build-*-alist' and
;;; `crypt-reinit' to `crypt-rebuild-tables'; (crypt-read-string-no-echo):
;;; change local variable `form' to `help-form' so it is defined;
;;; `crypt-encryption-alist' and `crypt-encoding-alist' must be defined with
;;; `defconst' since we wish crypt++ to initialize these variables
;;; unconditionally; modify INSTALLATION section to reflect these changes.
;;; 2.58 -
;;; lrd: doc mod.
;;; 2.59 - [posted to gnu.emacs.sources]
;;; lrd: (crypt-bind-insert-file): new function for changing "C-x i" in
;;; initialization file or interactively.
;;; 2.60 -
;;; lrd: add `crypt-rebuild-tables' and `crypt-bind-insert-file' to
;;; `after-init-hook' in GNU emacs v19 and to `term-setup-hook' in Lucid
;;; emacs. Change INSTALLATION notes.
;;; 2.61 - [posted to gnu.emacs.sources]
;;; lrd: Doc mod. Clean up the installation of minor mode indicators.
;;; 2.62 - [posted to gnu.emacs.sources]
;;; lrd: installed patch from stig@hackvan.com to simplify crypt-get-* defuns
;;; (now defmacros). Don't add to `term-setup-hook' unless no
;;; `after-init-hook' _and_ definitely running v19, otherwise Rod gets an
;;; error at home :-<. Don't assume C-x i had `insert-file' bound to it:
;;; store old binding in `crypt-old-binding' before overwriting and use in
;;; function `crypt-bind-insert-file.'
;;; 2.63 -
;;; lrd: (crypt-encode-buffer, crypt-encode-region, crypt-encrypt-buffer,
;;; crypt-encrypt-region): changed argument list putting optional buffer
;;; last and making default action to encode or encrypt. (crypt-encoded-p,
;;; crypt-encrypted-p): new functions that do the actual testing of file
;;; contents. (crypt-find-file): uses these new functions.
;;; (crypt-rebuild-minor-modes-alist): new function to rebuild
;;; `minor-mode-alist' called by function crypt-rebuild-tables.
;;; (crypt-build-minor-mode-alist): new function called by
;;; `crypt-minor-mode-alist' to create itself. `crypt-minor-mode-encrypted'
;;; removed because defined in function crypt-build-minor-mode-alist.
;;; 2.64 -
;;; lrd: (crypt-find-file-hook): temporarily remove the encrytion file
;;; extension to help determine the major mode, just like is done with the
;;; encoding file extension. In order for this to work properly the file
;;; extension in `crypt-encryption-file-extension' and
;;; `crypt-encryption-alist' needs to be inside a pair of \\( \\).
;;; 2.65 -
;;; lrd: (crypt-find-file-hook): move determination of key, password, into
;;; (crypt-encrypted-p).
;;; 2.66 -
;;; lrd: (crypt-set-encryption-key): improve prompt string for encryption
;;; key.
;;; 2.67 -
;;; lrd: (crypt-write-file-hook): make check for encryption file-name
;;; extension case-sensitive.
;;; 2.68 -
;;; lrd: fixed check for previous addition to `minor-mode-alist' -- was not
;;; working. Check for an `add-hook' function; if one does not exist then
;;; use a copy of one from GNU Emacs 19. When using `add-hook' to append to
;;; the `write-file-hooks' make sure that the version accepts the optional
;;; APPEND argument -- v19's does but the one in the elisp archive by Dan
;;; LaLiberte <liberte@cs.uiuc.edu> does not append. This causes problems.
;;; Thanks to Francesco Potorti` <pot@fly.CNUCE.CNR.IT> for pointing this
;;; out.
;;; 2.69 - [posted to gnu.emacs.sources]
;;; lrd: doc mod with regards `after-init-hook' and Lucid Emacs. Add
;;; pointer to crypt++-fnf.el for people who might be interested.
;;; 2.70 -
;;; lrd: narrow conditions under which crypt-encryption-magic-regexp
;;; matches. Thanks to Philippe Michel <michel@thomson-lcr.fr> and Francois
;;; Pinard <pinard@iro.umontreal.ca> for helping explain this with regards
;;; to ISO/Latin-1.
;;; 2.71 -
;;; lrd: applied patches from Darrin Jewell <jewell@bdi.com> for DOS to UNIX
;;; support. DOS entry added to crypt-build-encoding-alist.
;;; (crypt-dos-to-unix-region, crypt-unix-to-dos-region): New
;;; functions. (crypt-dos-has-ctrl-z): New buffer-local variable.
;;; (crypt-encode-region): allow for encoding and decoding programs to be
;;; elisp expressions. If they are then apply them directly to region.
;;; Point out that crypt++.el conflicts with dos-mode.el.
;;; 2.72 -
;;; lrd: The limit for the regular expression search done by
;;; `crypt-encrypted-p' is extended to 100 by default. The enlargement of
;;; search field is needed because of previous reduction in size of regexp
;;; being searched for. (crypt-magic-search-limit): New variable defining
;;; this new limit. (crypt-encrypted-p): Uses it and cleaned up. Doc mod.
;;; Thanks to Philippe Michel <michel@thomson-lcr.fr>, Francois Pinard
;;; <pinard@iro.umontreal.ca>, and Dave Goldberg <dsg@blackbird.mitre.org>.
;;; 2.73 - [posted to gnu.emacs.sources]
;;; lrd: Apply patch from Kevin Rodgers <kevin@traffic.den.mmc.com> that
;;; uses more verbose messages and capitals. Doc mod.
;;; 2.74 -
;;; lrd: Untabify. (crypt-encrypted-p): Check value of
;;; `crypt-never-ever-decrypt' before anything else.
;;; 2.75 -
;;; lrd: (crypt-version): Remove call to `substring'.
;;; 2.76 -
;;; lrd: (crypt-encryption-magic-regexp-inverse): Add in regexp that will
;;; match ksh `.sh_history' files so that they are not interpreted as
;;; encrypted files. Thanks to Francesco Potorti` <pot@fly.CNUCE.CNR.IT>.
;;; 2.77 - [posted to gnu.emacs.sources]
;;; lrd: (crypt-bind-insert-file): Use substitute-key-definition to bind
;;; crypt-insert-file to whatever key insert-file is bound to (not
;;; necessarily C-x i). Call crypt-bind-insert-file directly in
;;; file. Variable crypt-bind-insert-file: Doc mod. Remove
;;; crypt-old-binding. Replace `M-x foobar' in doc strings with
;;; `\\[foobar]'.
;;; 2.78 -
;;; lrd: (crypt-auto-write-answer-local): New internal variable. Holds
;;; answer to query about file-extension tricks question per buffer. Thanks
;;; to George Forman <forman@cs.washington.edu>. Remove Rod from list of
;;; maintainers...he's busy enough. Merge multiple setq forms into single
;;; setq forms.
;;; 2.79 -
;;; lrd: (crypt-y-or-n-p): New internal function for querying. Tests the
;;; internal variable crypt-auto-write-answer-local to ensure single query.
;;; (crypt-check-extension-for-encoding): Replace all occurrences of queries
;;; involving y-or-no-p constructs with crypt-y-or-n-p.
;;; 2.80 - [posted to gnu.emacs.sources]
;;; lrd: (crypt-set-encryption-key): Shorten interactive prompt. Change
;;; documentation.
;;; 2.81 -
;;; lrd: (crypt-variable-list): Add shell and path variables.
;;; (crypt-confirm-password): Fix spelling error in doc.
;;; 2.82 -
;;; lrd: Applied patch from Noah Friedman <friedman@prep.ai.mit.edu>.
;;; (crypt-encoded-disable-auto-save, crypt-encrypted-disable-auto-save):
;;; New user-defined variables. (crypt-encoded-mode, crypt-encrypted-mode):
;;; Use them.
;;; 2.83 -
;;; hniksic: Added custom.
;;; Code:
;;;; User definable variables.
(progn
(defgroup crypt nil
"Handling compressed and encrypted files."
:group 'compression)
)
(defcustom crypt-encryption-type 'crypt
"*Method of encryption. Must be an element of `crypt-encryption-alist.'
If you change this after crypt++ is loaded then do \\[crypt-rebuild-tables]."
:type 'symbol
:group 'crypt)
(defcustom crypt-encryption-file-extension nil
"*Regexp for extension of files encrypted with `crypt-encryption-type.'
Should be of the form \"\\\\(\\\\.foo\\\\)$\". nil says use default values in
`crypt-encryption-alist.' If you change this after crypt++ is loaded then do
\\[crypt-rebuild-tables]."
:type 'regexp
:group 'crypt)
(defcustom crypt-never-ever-decrypt nil
"*t says never attempt to decrypt a buffer."
:type 'boolean
:group 'crypt)
(defcustom crypt-auto-write-buffer-encrypted nil
"*t says files with `crypt-encryption-alist' file extension auto-encrypted.
nil says query. See `crypt-auto-write-buffer.'"
:type 'boolean
:group 'crypt)
(defcustom crypt-confirm-password nil
"*t says confirm new passwords and when writing a newly encrypted buffer."
:type 'boolean
:group 'crypt)
(defcustom crypt-encoded-disable-auto-save t
"*If t, turn off auto-save-mode for buffers which are encoded.
If non-nil but not t, then no message is displayed.
The default is t is because there isn't any way to tell emacs to encode the
autosave file, so the autosave would be in a different format from the
original. The disadvantage of turning off autosaves is that any work you
do in that buffer will be completely lost if the changes are not explicitly
saved.
It is probably best to set this variable to nil and use buffer-local
variables in files for which you don't actually care about autosaves.
Unencoded recovery data is better than none at all."
:type '(choice (const :tag "on" t)
(const :tag "off" nil)
(const :tag "no message" other))
:group 'crypt)
(defcustom crypt-encrypted-disable-auto-save t
"*If t, turn off auto-save-mode for buffers which are encrypted.
If non-nil but not t, then no message is displayed.
The default is t is because there isn't any way to tell emacs to encrypt
the autosave file, so the autosave would be in cleartext form. The
disadvantage of turning off autosaves is that any work you do in that
buffer will be completely lost if the changes are not explicitly saved.
You might consider setting this variable to nil and use buffer-local
variables in files for which security is more important than data
recovery."
:type '(choice (const :tag "on" t)
(const :tag "off" nil)
(const :tag "no message" other))
:group 'crypt)
;;; ENCRYPTION
;;; Encrypted files have no magic number, so we have to hack a way of
;;; determining when a buffer should be decrypted. we do this only buffers
;;; that match a MAGIC-REGEXP very close to beginning of buffer and that do
;;; _NOT_ match a MAGIC-REGEXP-INVERSE.
;;;
;;; Currently MAGIC-REGEXP matches non-ASCII characters and
;;; MAGIC-REGEXP-INVERSE will match Sun OS, 4.x BSD, and Ultrix executable
;;; magic numbers, so binaries can still be edited (heh) without headaches.
(defconst crypt-encryption-magic-regexp "[\000\200-\237]"
"Regexp that must be found very close to beginning of encrypted buffer.
This is intended to be an internal variable \(not user-visible\). If you
change this after crypt++ is loaded then do \\[crypt-rebuild-tables].")
(defconst crypt-encryption-magic-regexp-inverse
"\\`\201\001\\|^\\(..\\)?\\([\007\010\013]\001\\|\001[\007\010\013]\\)"
"Regexp that must *not* be found very close to beginning of encrypted buffer.
This is intended to be an internal variable \(not user-visible\). If you
change this after crypt++ is loaded then do \\[crypt-rebuild-tables].")
(defconst crypt-magic-search-limit 100
"Limit of regular expression search used to recognize encrypted files.
Maximum position in file for presence of `crypt-encryption-magic-regexp' and
absence of `crypt-encryption-magic-regexp-inverse'.")
(defun crypt-build-encryption-alist ()
;; Returns the encryption alist
(list
;; crypt
(list 'crypt
crypt-encryption-magic-regexp crypt-encryption-magic-regexp-inverse
(or crypt-encryption-file-extension "\\(\\.e\\)$")
"crypt" "crypt"
nil
nil
"Crypt"
nil
t
)
;; DES (Cipher Block Chaining - CBC) [DES' default]
(list 'des
crypt-encryption-magic-regexp crypt-encryption-magic-regexp-inverse
(or crypt-encryption-file-extension "\\(\\.des\\)$")
"des" "des"
'("-e" "-k")
'("-d" "-k")
"DES-CBC"
nil
t
)
;; DES (Electronic Code Book - ECB)
(list 'des-ecb
crypt-encryption-magic-regexp crypt-encryption-magic-regexp-inverse
(or crypt-encryption-file-extension "\\(\\.des\\)$")
"des" "des"
'("-e" "-b" "-k")
'("-d" "-b" "-k")
"DES-ECB"
nil
t
)
;; PGP
(list 'pgp
crypt-encryption-magic-regexp crypt-encryption-magic-regexp-inverse
(or crypt-encryption-file-extension "\\(\\.pgp\\)$")
"pgp" "pgp"
'("+batchmode" "+verbose=0" "-c" "-f" "-z")
'("+batchmode" "+verbose=0" "-f" "-z")
"PGP"
nil
t
)
;; Add new elements here ...
))
(defconst crypt-encryption-alist (crypt-build-encryption-alist)
"List of elements describing the encryption methods available.
each element looks like
\(ENCRYPTION-TYPE
MAGIC-REGEXP MAGIC-REGEXP-INVERSE
FILE-EXTENSION
ENCRYPT-PROGRAM DECRYPT-PROGRAM
ENCRYPT-ARGS
DECRYPT-ARGS
MINOR-MODE
GARBAGE-REGEXP-OR-LISPEXP
FILE-EXTENSION-TRICKS
\)
ENCRYPTION-TYPE is a symbol denoting the encryption type.
MAGIC-REGEXP regexp that must match very close to the beginning of an
encrypted buffer. This may also be some elisp expression to be evaluated at
\(point-min\) that will return t for an encrypted buffer. If this is set to
nil then crypt++ will never try to decrypt a buffer. Currently set to the
internal variable `crypt-encryption-magic-regexp' which will match non-ASCII
characters.
MAGIC-REGEXP-INVERSE regexp that must _NOT_ match very close to the beginning
of an encrypted buffer. This may also be some elisp expression to be
evaluated at \(point-min\) that will return t for a NON-encrypted buffer.
If this is set to t then crypt++ will never try to decrypt a buffer.
Currently set to the internal variable `crypt-encryption-magic-regexp-inverse'
which will match Sun OS, 4.x BSD, and Ultrix executable magic numbers, so
binaries can still be edited (heh) without headaches.
FILE-EXTENSION regexp denoting the file extension usually appended the
filename of files encrypted with ENCRYPT-PROGRAM. The variable
`crypt-encryption-file-extension' will over ride the default.
ENCRYPT-PROGRAM name of executable file to be used for encryption.
DECRYPT-PROGRAM name of executable file to be used for decryption.
ENCRYPT-ARGS arguments to be passed to ENCRYPT-PROGRAM may be a string or a
list of strings or nil.
DECRYPT-ARGS arguments to be passed to DECRYPT-PROGRAM may be a string or a
list of strings or nil.
MINOR-MODE string denoting the name for the encrypted minor mode as it will
appear in the mode line.
GARBAGE-REGEXP-OR-LISPEXP dummy variable for compatibility with encoding.
FILE-EXTENSION-TRICKS is t or nil depending on whether or not tricks
converting between different encryption types can be done based on
FILE-EXTENSION; typically t.
")
;;; ENCODING
(defcustom crypt-auto-decode-buffer t
"*t says buffers visiting encoded files will be decoded automatically.
nil means to ask before doing the decoding."
:type 'boolean
:group 'crypt)
(defcustom crypt-auto-write-buffer nil
"*t says save files with `crypt-encoding-alist' file extensions as encoded.
nil says to ask before doing this encoding. Similarly, buffers originating
from encoded files to be written to files not ending in `crypt-encoding-alist'
file extensions will be written in plain format automatically. nil says to
ask before doing this decoding."
:type 'boolean
:group 'crypt)
;; This is an internal variable documented here and not in a DOCSTRING in
;; order to save memory. If this variable's value has been changed from its
;; default, then it contains the answer to the question "Write out buffer
;; foobar using `compression-type'?". This question is asked only if *plain*
;; buffer foobar is being written to disk *and* it has a provocative
;; `compression-type' file-name extension (see DOCSTRING for variable
;; crypt-auto-write-buffer). The variable is local to all buffers with a
;; default value of 'ask so if the situation described above arises, then the
;; question is asked at least once, unless the user-defined variable
;; crypt-auto-write-buffer is non-nil.
(defvar crypt-auto-write-answer-local 'ask)
(make-variable-buffer-local 'crypt-auto-write-answer-local)
(setq-default crypt-auto-write-answer-local 'ask)
(put 'crypt-auto-write-answer-local 'permanent-local t) ; for v19 Emacs
(put 'crypt-auto-write-answer-local 'preserved t) ; for kill-fix.el
(defcustom crypt-query-if-interactive t
"*t says ask when saving buffers where `crypt-encoded-mode' was toggled.
nil says that even if filename extension is plain (i.e., not listed in
`crypt-encoding-alist') buffer will be written in an encoded format without
asking.
This variable is designed for users that edit a plain file (with plain
extension) and then toggle `(crypt-encoded-mode)' and do not wish to be
queried every time that they save the buffer.
NOTE: if `(crypt-encoded-mode)' was not called interactively (the usual
scenario) then the value of this variable has no effect on how the buffer is
written to disk. In such a case `crypt-no-extension-implies-plain' is then
the relevant variable."
:type 'boolean
:group 'crypt)
(defcustom crypt-no-extension-implies-plain t
"*t says file extensions not in `crypt-encoding-alist' may be written plain.
if `crypt-auto-write-buffer' is also t then any file ending in a plain
extension is written in plain format automatically, otherwise query user.
nil says user works with encoded (compressed) files without file extensions
and will not be queried each time they save these files.
NOTE: (1) this does not effect find-file (C-x C-f) since that works with a
magic regexp. (2) there is no way to distinguish between write-file and
save-buffer so nil will mean that neither will query."
:type 'boolean
:group 'crypt)
(defcustom crypt-freeze-vs-fortran t
"*t says `.F' file extension denotes a frozen file not a Fortran file.
If you change this variable after crypt++ has been loaded then do
\\[crypt-rebuild-tables]."
:type 'boolean
:group 'crypt)
(defcustom crypt-compact-vs-C++ nil
"*t says `.C' file extension denotes a compacted file not a C++ file.
If you change this variable after crypt++ has been loaded then do
\\[crypt-rebuild-tables]."
:type 'boolean
:group 'crypt)
(defcustom crypt-ignored-filenames nil
"*List of regexp filenames for which encoded to plain conversion is not done.
A filename with a plain extension, in encoded format, that is matched by one of
these elements will be saved in encoded format without a query for conversion to
plain format.
This variable is provided for users that want to compress their incoming mail
for RMAIL and VM which look for files `RMAIL' and `INBOX,' respectively, to
store incoming mail. For example, the gzip extensions on `RMAIL.gz' and
`INBOX.gz' can be removed, this variable set to '\(\"INBOX$\" \"RMAIL$\"\) and
no query about conversion to plain format will be made."
:type '(repeat regexp)
:group 'crypt)
(defcustom crypt-default-encoding "gzip"