aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Josefsson2006-04-03 09:12:08 +0000
committerSimon Josefsson2006-04-03 09:12:08 +0000
commit7db4c10a8a23e211273498a3ea0df8223d1acb19 (patch)
tree7e26a318c47b0b689b68087adf77beb7aeb4f60a
parentfc9f8d154116dba6fd4246c86fe7db22aca3cf91 (diff)
downloademacs-7db4c10a8a23e211273498a3ea0df8223d1acb19.tar.gz
emacs-7db4c10a8a23e211273498a3ea0df8223d1acb19.zip
2006-04-03 Daiki Ueno <ueno@unixuser.org>
* pgg-gpg.el (pgg-gpg-process-filter) (pgg-gpg-wait-for-completion): Check if buffer is alive. * pgg-gpg.el (pgg-gpg-process-sentinel): Don't remove GNUPG: lines, temporary fix.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/pgg-gpg.el82
2 files changed, 50 insertions, 40 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2f7e50357b4..ccd4dba89c9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12006-04-03 Daiki Ueno <ueno@unixuser.org>
2
3 * pgg-gpg.el (pgg-gpg-process-filter)
4 (pgg-gpg-wait-for-completion): Check if buffer is alive.
5
6 * pgg-gpg.el (pgg-gpg-process-sentinel): Don't remove GNUPG:
7 lines, temporary fix.
8
12006-04-02 Dan Nicolaescu <dann@ics.uci.edu> 92006-04-02 Dan Nicolaescu <dann@ics.uci.edu>
2 10
3 * ibuf-macs.el (define-ibuffer-column): Document the new parameter. 11 * ibuf-macs.el (define-ibuffer-column): Document the new parameter.
diff --git a/lisp/pgg-gpg.el b/lisp/pgg-gpg.el
index b171929ad41..986d3f8d343 100644
--- a/lisp/pgg-gpg.el
+++ b/lisp/pgg-gpg.el
@@ -107,33 +107,34 @@
107 process)) 107 process))
108 108
109(defun pgg-gpg-process-filter (process input) 109(defun pgg-gpg-process-filter (process input)
110 (save-excursion 110 (if (buffer-live-p (process-buffer process))
111 (if pgg-gpg-debug
112 (save-excursion
113 (set-buffer (get-buffer-create " *pgg-gpg-debug*"))
114 (goto-char (point-max))
115 (insert input)))
116 (set-buffer (process-buffer process))
117 (goto-char (point-max))
118 (insert input)
119 (goto-char pgg-gpg-read-point)
120 (beginning-of-line)
121 (while (looking-at ".*\n") ;the input line is finished
122 (save-excursion 111 (save-excursion
123 (if (looking-at "\\[GNUPG:] \\([A-Z_]+\\)\\>.*") 112 (if pgg-gpg-debug
124 (let* ((status (match-string 1)) 113 (save-excursion
125 (symbol (intern-soft (concat "pgg-gpg-status-" status))) 114 (set-buffer (get-buffer-create " *pgg-gpg-debug*"))
126 (entry (member status pgg-gpg-pending-status-list))) 115 (goto-char (point-max))
127 (if entry 116 (insert input)))
128 (setq pgg-gpg-pending-status-list 117 (set-buffer (process-buffer process))
129 (delq (car entry) 118 (goto-char (point-max))
130 pgg-gpg-pending-status-list))) 119 (insert input)
131 (if (and symbol 120 (goto-char pgg-gpg-read-point)
132 (fboundp symbol)) 121 (beginning-of-line)
133 (funcall symbol process (buffer-substring (match-beginning 1) 122 (while (looking-at ".*\n") ;the input line is finished
134 (match-end 0))))))) 123 (save-excursion
135 (forward-line)) 124 (if (looking-at "\\[GNUPG:] \\([A-Z_]+\\)\\>.*")
136 (setq pgg-gpg-read-point (point)))) 125 (let* ((status (match-string 1))
126 (symbol (intern-soft (concat "pgg-gpg-status-" status)))
127 (entry (member status pgg-gpg-pending-status-list)))
128 (if entry
129 (setq pgg-gpg-pending-status-list
130 (delq (car entry)
131 pgg-gpg-pending-status-list)))
132 (if (and symbol
133 (fboundp symbol))
134 (funcall symbol process (buffer-substring (match-beginning 1)
135 (match-end 0)))))))
136 (forward-line))
137 (setq pgg-gpg-read-point (point)))))
137 138
138(defun pgg-gpg-process-sentinel (process status) 139(defun pgg-gpg-process-sentinel (process status)
139 (set-process-filter process nil) 140 (set-process-filter process nil)
@@ -145,7 +146,7 @@
145 (when (buffer-live-p (process-buffer process)) 146 (when (buffer-live-p (process-buffer process))
146 (insert-buffer-substring (process-buffer process)) 147 (insert-buffer-substring (process-buffer process))
147 (goto-char (point-min)) 148 (goto-char (point-min))
148 (delete-matching-lines "^\\[GNUPG:] ") 149 ;(delete-matching-lines "^\\[GNUPG:] ")
149 (goto-char (point-min)) 150 (goto-char (point-min))
150 (while (re-search-forward "^gpg: " nil t) 151 (while (re-search-forward "^gpg: " nil t)
151 (replace-match ""))) 152 (replace-match "")))
@@ -175,19 +176,20 @@
175 (process-send-eof process) 176 (process-send-eof process)
176 (while (eq (process-status process) 'run) 177 (while (eq (process-status process) 'run)
177 (sit-for 0.1)) 178 (sit-for 0.1))
178 (save-excursion 179 (if (buffer-live-p (process-buffer process))
179 (set-buffer (process-buffer process)) 180 (save-excursion
180 (setq status-list (copy-sequence status-list)) 181 (set-buffer (process-buffer process))
181 (let ((pointer status-list)) 182 (setq status-list (copy-sequence status-list))
182 (while pointer 183 (let ((pointer status-list))
183 (goto-char (point-min)) 184 (while pointer
184 (unless (re-search-forward 185 (goto-char (point-min))
185 (concat "^\\[GNUPG:] " (car pointer) "\\>") 186 (unless (re-search-forward
186 nil t) 187 (concat "^\\[GNUPG:] " (car pointer) "\\>")
187 (setq status-list (delq (car pointer) status-list))) 188 nil t)
188 (setq pointer (cdr pointer)))) 189 (setq status-list (delq (car pointer) status-list)))
189 (kill-buffer (process-buffer process)) 190 (setq pointer (cdr pointer))))
190 status-list)) 191 (kill-buffer (process-buffer process))
192 status-list)))
191 193
192(defun pgg-gpg-status-USERID_HINT (process line) 194(defun pgg-gpg-status-USERID_HINT (process line)
193 (if (string-match "\\`USERID_HINT \\([^ ]+\\) \\(.*\\)" line) 195 (if (string-match "\\`USERID_HINT \\([^ ]+\\) \\(.*\\)" line)