From: Stefan Monnier Date: Mon, 2 Dec 2013 19:05:47 +0000 (-0500) Subject: * lisp/epa-file.el (epa-file-insert-file-contents): Ensure we insert text X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~582 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0962f37640aee079ebd881588faff61d8f6da622;p=emacs.git * lisp/epa-file.el (epa-file-insert-file-contents): Ensure we insert text in current-buffer. Fixes: debbugs:16029 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a105723fb15..103b733f533 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-12-02 Stefan Monnier + + * epa-file.el (epa-file-insert-file-contents): Ensure we insert text + in current-buffer (bug#16029). + 2013-12-02 Helmut Eller * emacs-lisp/debug.el (debugger-toggle-locals): New command. diff --git a/lisp/epa-file.el b/lisp/epa-file.el index e3a91ac7c25..60412344595 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -132,6 +132,7 @@ encryption is used." (error))) (local-file (or local-copy file)) (context (epg-make-context)) + (buf (current-buffer)) string length entry) (if visit (setq buffer-file-name file)) @@ -157,16 +158,16 @@ encryption is used." ;; where `find-file-not-found-functions' are called in ;; `find-file-noselect-1'. (when (file-exists-p local-file) - (make-local-variable 'epa-file-error) - (setq epa-file-error error) + (setq-local epa-file-error error) (add-hook 'find-file-not-found-functions 'epa-file--find-file-not-found-function nil t)) (signal 'file-error (cons "Opening input file" (cdr error))))) - (make-local-variable 'epa-file-encrypt-to) - (setq epa-file-encrypt-to - (mapcar #'car (epg-context-result-for context 'encrypted-to))) + (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)! + (setq-local epa-file-encrypt-to + (mapcar #'car (epg-context-result-for + context 'encrypted-to))) (if (or beg end) (setq string (substring string (or beg 0) end))) (save-excursion @@ -268,14 +269,13 @@ If no one is selected, symmetric encryption will be performed. " (defun epa-file-select-keys () "Select recipients for encryption." (interactive) - (make-local-variable 'epa-file-encrypt-to) - (setq epa-file-encrypt-to - (mapcar - (lambda (key) - (epg-sub-key-id (car (epg-key-sub-key-list key)))) - (epa-select-keys - (epg-make-context) - "Select recipients for encryption. + (setq-local epa-file-encrypt-to + (mapcar + (lambda (key) + (epg-sub-key-id (car (epg-key-sub-key-list key)))) + (epa-select-keys + (epg-make-context) + "Select recipients for encryption. If no one is selected, symmetric encryption will be performed. ")))) ;;;###autoload