kjones@talos.UUCP (Kyle Jones) (08/05/88)
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