Commit 0962f376 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/epa-file.el (epa-file-insert-file-contents): Ensure we insert text

in current-buffer.

Fixes: debbugs:16029
parent 29bacfa9
2013-12-02 Stefan Monnier <monnier@iro.umontreal.ca>
* epa-file.el (epa-file-insert-file-contents): Ensure we insert text
in current-buffer (bug#16029).
2013-12-02 Helmut Eller <eller.helmut@gmail.com> 2013-12-02 Helmut Eller <eller.helmut@gmail.com>
* emacs-lisp/debug.el (debugger-toggle-locals): New command. * emacs-lisp/debug.el (debugger-toggle-locals): New command.
......
...@@ -132,6 +132,7 @@ encryption is used." ...@@ -132,6 +132,7 @@ encryption is used."
(error))) (error)))
(local-file (or local-copy file)) (local-file (or local-copy file))
(context (epg-make-context)) (context (epg-make-context))
(buf (current-buffer))
string length entry) string length entry)
(if visit (if visit
(setq buffer-file-name file)) (setq buffer-file-name file))
...@@ -157,16 +158,16 @@ encryption is used." ...@@ -157,16 +158,16 @@ encryption is used."
;; where `find-file-not-found-functions' are called in ;; where `find-file-not-found-functions' are called in
;; `find-file-noselect-1'. ;; `find-file-noselect-1'.
(when (file-exists-p local-file) (when (file-exists-p local-file)
(make-local-variable 'epa-file-error) (setq-local epa-file-error error)
(setq epa-file-error error)
(add-hook 'find-file-not-found-functions (add-hook 'find-file-not-found-functions
'epa-file--find-file-not-found-function 'epa-file--find-file-not-found-function
nil t)) nil t))
(signal 'file-error (signal 'file-error
(cons "Opening input file" (cdr error))))) (cons "Opening input file" (cdr error)))))
(make-local-variable 'epa-file-encrypt-to) (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)!
(setq epa-file-encrypt-to (setq-local epa-file-encrypt-to
(mapcar #'car (epg-context-result-for context 'encrypted-to))) (mapcar #'car (epg-context-result-for
context 'encrypted-to)))
(if (or beg end) (if (or beg end)
(setq string (substring string (or beg 0) end))) (setq string (substring string (or beg 0) end)))
(save-excursion (save-excursion
...@@ -268,14 +269,13 @@ If no one is selected, symmetric encryption will be performed. " ...@@ -268,14 +269,13 @@ If no one is selected, symmetric encryption will be performed. "
(defun epa-file-select-keys () (defun epa-file-select-keys ()
"Select recipients for encryption." "Select recipients for encryption."
(interactive) (interactive)
(make-local-variable 'epa-file-encrypt-to) (setq-local epa-file-encrypt-to
(setq epa-file-encrypt-to (mapcar
(mapcar (lambda (key)
(lambda (key) (epg-sub-key-id (car (epg-key-sub-key-list key))))
(epg-sub-key-id (car (epg-key-sub-key-list key)))) (epa-select-keys
(epa-select-keys (epg-make-context)
(epg-make-context) "Select recipients for encryption.
"Select recipients for encryption.
If no one is selected, symmetric encryption will be performed. ")))) If no one is selected, symmetric encryption will be performed. "))))
;;;###autoload ;;;###autoload
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment