emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114050: * lisp/epg.el (epg--process-filter): Use wi


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r114050: * lisp/epg.el (epg--process-filter): Use with-current-buffer, save-excursion
Date: Wed, 28 Aug 2013 19:28:34 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114050
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-08-28 15:28:30 -0400
message:
  * lisp/epg.el (epg--process-filter): Use with-current-buffer, save-excursion
  and dynamic let binding.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/epg.el                    epg.el-20091113204419-o5vbwnq5f7feedwu-8560
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-08-28 19:26:18 +0000
+++ b/lisp/ChangeLog    2013-08-28 19:28:30 +0000
@@ -1,5 +1,8 @@
 2013-08-28  Stefan Monnier  <address@hidden>
 
+       * epg.el (epg--process-filter): Use with-current-buffer, save-excursion
+       and dynamic let binding.
+
        * vc/smerge-mode.el: Remove redundant :group args.
 
        * emacs-lisp/package.el (package-activate-1): Don't add unnecessarily

=== modified file 'lisp/epg.el'
--- a/lisp/epg.el       2013-08-09 21:22:44 +0000
+++ b/lisp/epg.el       2013-08-28 19:28:30 +0000
@@ -1278,37 +1278,34 @@
 
 (defun epg--process-filter (process input)
   (if epg-debug
-      (save-excursion
-       (unless epg-debug-buffer
-         (setq epg-debug-buffer (generate-new-buffer " *epg-debug*")))
-       (set-buffer epg-debug-buffer)
+      (with-current-buffer
+          (or epg-debug-buffer
+              (setq epg-debug-buffer (generate-new-buffer " *epg-debug*")))
        (goto-char (point-max))
        (insert input)))
   (if (buffer-live-p (process-buffer process))
       (with-current-buffer (process-buffer process)
-       (goto-char (point-max))
-       (insert input)
-       (unless epg-process-filter-running
-         (unwind-protect
-             (progn
-               (setq epg-process-filter-running t)
-               (goto-char epg-read-point)
-               (beginning-of-line)
-               (while (looking-at ".*\n") ;the input line finished
-                 (if (looking-at "\\[GNUPG:] \\([A-Z_]+\\) ?\\(.*\\)")
-                     (let* ((status (match-string 1))
-                            (string (match-string 2))
-                            (symbol (intern-soft (concat "epg--status-"
-                                                         status))))
-                       (if (member status epg-pending-status-list)
-                           (setq epg-pending-status-list nil))
-                       (if (and symbol
-                                (fboundp symbol))
-                           (funcall symbol epg-context string))
-                       (setq epg-last-status (cons status string))))
-                 (forward-line)
-                 (setq epg-read-point (point))))
-           (setq epg-process-filter-running nil))))))
+        (save-excursion
+          (goto-char (point-max))
+          (insert input)
+          (unless epg-process-filter-running
+            (let ((epg-process-filter-running t))
+              (goto-char epg-read-point)
+              (beginning-of-line)
+              (while (looking-at ".*\n") ;the input line finished
+                (if (looking-at "\\[GNUPG:] \\([A-Z_]+\\) ?\\(.*\\)")
+                    (let* ((status (match-string 1))
+                           (string (match-string 2))
+                           (symbol (intern-soft (concat "epg--status-"
+                                                        status))))
+                      (if (member status epg-pending-status-list)
+                          (setq epg-pending-status-list nil))
+                      (if (and symbol
+                               (fboundp symbol))
+                          (funcall symbol epg-context string))
+                      (setq epg-last-status (cons status string))))
+                (forward-line)
+                (setq epg-read-point (point)))))))))
 
 (defun epg-read-output (context)
   "Read the output file CONTEXT and return the content as a string."


reply via email to

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