From 787dcffb3033312a719954e88d9d05aa5d15803d Mon Sep 17 00:00:00 2001 From: ueno Date: Tue, 18 Jul 2006 00:56:56 +0000 Subject: [PATCH] * epg.el (epg-process-filter-running): New variable. (epg--start): Setup epg-process-filter-running. (epg--process-filter): Allow only one status handler to run at a time. --- ChangeLog | 7 +++++++ epg.el | 39 ++++++++++++++++++++++++--------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7abc7a8..76da7f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-07-18 Daiki Ueno + + * epg.el (epg-process-filter-running): New variable. + (epg--start): Setup epg-process-filter-running. + (epg--process-filter): Allow only one status handler to run at a + time. + 2006-07-14 Daiki Ueno * epg-pgp50i.el: New file. diff --git a/epg.el b/epg.el index 599948f..82d5cb6 100644 --- a/epg.el +++ b/epg.el @@ -48,6 +48,7 @@ "An alist mapping from key ID to user ID.") (defvar epg-read-point nil) +(defvar epg-process-filter-running nil) (defvar epg-pending-status-list nil) (defvar epg-key-id nil) (defvar epg-context nil) @@ -828,6 +829,8 @@ This function is for internal use only." (with-current-buffer buffer (make-local-variable 'epg-read-point) (setq epg-read-point (point-min)) + (make-local-variable 'epg-process-filter-running) + (setq epg-process-filter-running nil) (make-local-variable 'epg-pending-status-list) (setq epg-pending-status-list nil) (make-local-variable 'epg-key-id) @@ -860,21 +863,27 @@ This function is for internal use only." (set-buffer (process-buffer process)) (goto-char (point-max)) (insert input) - (goto-char epg-read-point) - (beginning-of-line) - (while (looking-at ".*\n") ;the input line finished - (save-excursion - (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))))) - (forward-line)) - (setq epg-read-point (point))))) + (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 + (save-excursion + (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))))) + (forward-line)) + (setq epg-read-point (point))) + (setq epg-process-filter-running nil)))))) (defun epg-read-output (context) "Read the output file CONTEXT and return the content as a string." -- 1.7.10.4