From: CSBVAX::MRGATE!talos!kjones@uunet.uu.net@SMTP 4-AUG-1988 20:52 To: ARISIA::EVERHART Subj: patch #1 for crypt.el Received: from uunet.UU.NET by prep.ai.mit.edu; Thu, 4 Aug 88 15:23:26 EST Received: from talos.UUCP by uunet.UU.NET (5.59/1.14) with UUCP id AA19230; Thu, 4 Aug 88 16:45:41 EDT Message-Id: <8808042045.AA19230@uunet.UU.NET> Date: Thu, 4 Aug 88 16:43:17 edt From: talos!kjones@uunet.uu.net (Kyle Jones) To: uunet!bbncc5.arpa!unix-emacs@uunet.uu.net, uunet!prep.ai.mit.edu!info-gnu-emacs@uunet.uu.net Subject: patch #1 for crypt.el This is patch #1 for the recently posted crypt.el package for GNU Emacs. Bugs fixed: * find-file-crypt-hook assumed point would always be at beginning of buffer when invoked. This is not the case when invoked via M-x revert-buffer. (thanx to Steve Byrne) * saving encoded outlines would not work correctly if point was not at beginning of buffer. * read-string-no-echo would not accept C-j to exit the minibuffer. ------ *** crypt.el.posted Thu Aug 4 08:48:10 1988 --- crypt.el.new Thu Aug 4 11:35:45 1988 *************** *** 67,72 '(goto-char (min (point-max) save-point))))) (defun find-crypt-file-hook () (let ((buffer-file-name buffer-file-name) encrypted compressed compacted case-fold-search buffer-read-only) ;; We can reasonably assume that either compaction or compression will --- 67,74 ----- '(goto-char (min (point-max) save-point))))) (defun find-crypt-file-hook () + (save-point + (goto-char (point-min)) (let ((buffer-file-name buffer-file-name) encrypted compressed compacted case-fold-search buffer-read-only) ;; We can reasonably assume that either compaction or compression will *************** *** 97,106 ;; Now peek at the file and see if it still looks like a binary file. ;; If so, try the crypt-magic-regexp-inverse against and if it FAILS ;; we assume that this is an encrypted buffer. ! (cond ((and (not (eobp)) ! (save-excursion ! (re-search-forward "[\200-\377]" ! (+ (min (point-max) 15)) t)) (not (looking-at crypt-magic-regexp-inverse))) (if (not buffer-encryption-key) (call-interactively 'set-encryption-key)) --- 99,107 ----- ;; Now peek at the file and see if it still looks like a binary file. ;; If so, try the crypt-magic-regexp-inverse against and if it FAILS ;; we assume that this is an encrypted buffer. ! (cond ((and (not (zerop (buffer-size))) ! (re-search-forward "[\200-\377]" (min (point-max) 15) t) ! (goto-char (point-min)) (not (looking-at crypt-magic-regexp-inverse))) (if (not buffer-encryption-key) (call-interactively 'set-encryption-key)) *************** *** 120,126 (if compacted (compact-mode 1)) (if encrypted (progn (crypt-mode 1) (setq buffer-encryption-key encrypted))) ! (set-buffer-modified-p nil))))) (defun write-crypt-file-hook () (cond --- 121,127 ----- (if compacted (compact-mode 1)) (if encrypted (progn (crypt-mode 1) (setq buffer-encryption-key encrypted))) ! (set-buffer-modified-p nil)))))) (defun write-crypt-file-hook () (cond *************** *** 140,145 ;; temporarily to nil. (cond (selective-display (setq recovery-needed t) (while (search-forward "\r" nil 0) (replace-match "\n")) (setq selective-display nil))) --- 141,147 ----- ;; temporarily to nil. (cond (selective-display (setq recovery-needed t) + (goto-char (point-min)) (while (search-forward "\r" nil 0) (replace-match "\n")) (setq selective-display nil))) *************** *** 374,380 (while t (erase-buffer) (message prompt) ! (while (not (= (setq char (read-char)) ?\C-m)) (if (setq form (cdr (assq char --- 376,382 ----- (while t (erase-buffer) (message prompt) ! (while (not (memq (setq char (read-char)) '(?\C-m ?\C-j))) (if (setq form (cdr (assq char