emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115353: * lisp/epa-file.el (epa-file-insert-file-co


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r115353: * lisp/epa-file.el (epa-file-insert-file-contents): Ensure we insert text
Date: Mon, 02 Dec 2013 19:05:52 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115353
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16029
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2013-12-02 14:05:47 -0500
message:
  * lisp/epa-file.el (epa-file-insert-file-contents): Ensure we insert text
  in current-buffer.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/epa-file.el               epafile.el-20091113204419-o5vbwnq5f7feedwu-8554
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-02 14:45:22 +0000
+++ b/lisp/ChangeLog    2013-12-02 19:05:47 +0000
@@ -1,3 +1,8 @@
+2013-12-02  Stefan Monnier  <address@hidden>
+
+       * epa-file.el (epa-file-insert-file-contents): Ensure we insert text
+       in current-buffer (bug#16029).
+
 2013-12-02  Helmut Eller  <address@hidden>
 
        * emacs-lisp/debug.el (debugger-toggle-locals): New command.

=== modified file 'lisp/epa-file.el'
--- a/lisp/epa-file.el  2013-10-28 08:04:48 +0000
+++ b/lisp/epa-file.el  2013-12-02 19:05:47 +0000
@@ -132,6 +132,7 @@
            (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 @@
             ;; 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 @@
 (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]