comparison lisp/epa-file.el @ 100456:e4798aef9a53

* epa-file.el (epa-file-insert-file-contents): Set buffer-file-name before decrypting a file.
author Daiki Ueno <ueno@unixuser.org>
date Wed, 17 Dec 2008 02:33:12 +0000
parents 4dfef179eed3
children a9dc0e7c3f2b
comparison
equal deleted inserted replaced
100455:61a8da68221a 100456:e4798aef9a53
108 (epa-file-run-real-handler #'file-local-copy (list file)) 108 (epa-file-run-real-handler #'file-local-copy (list file))
109 (error))) 109 (error)))
110 (local-file (or local-copy file)) 110 (local-file (or local-copy file))
111 (context (epg-make-context)) 111 (context (epg-make-context))
112 string length entry) 112 string length entry)
113 (if visit
114 (setq buffer-file-name file))
113 (epg-context-set-passphrase-callback 115 (epg-context-set-passphrase-callback
114 context 116 context
115 (cons #'epa-file-passphrase-callback-function 117 (cons #'epa-file-passphrase-callback-function
116 local-file)) 118 local-file))
117 (epg-context-set-progress-callback context 119 (epg-context-set-progress-callback context
137 (narrow-to-region (point) (point)) 139 (narrow-to-region (point) (point))
138 (epa-file-decode-and-insert string file visit beg end replace) 140 (epa-file-decode-and-insert string file visit beg end replace)
139 (setq length (- (point-max) (point-min)))) 141 (setq length (- (point-max) (point-min))))
140 (if replace 142 (if replace
141 (delete-region (point) (point-max))) 143 (delete-region (point) (point-max)))
142 (when visit 144 (if visit
143 (setq buffer-file-name file) 145 (set-visited-file-modtime))))
144 (set-visited-file-modtime))))
145 (if (and local-copy 146 (if (and local-copy
146 (file-exists-p local-copy)) 147 (file-exists-p local-copy))
147 (delete-file local-copy))) 148 (delete-file local-copy)))
148 (list file length))) 149 (list file length)))
149 (put 'insert-file-contents 'epa-file 'epa-file-insert-file-contents) 150 (put 'insert-file-contents 'epa-file 'epa-file-insert-file-contents)