Eli Zaretskii wrote, On 11/02/2014 2:46 PM: > Please step in Edebug through epa-file-write-region, and tell which > part of the condition-case fails with file-error, and why. I see > nothing telltale in the backtrace which would suggest any ideas. Thanks. I think it fails on: line: 250 (epa-select-keys context "Select recipients for encryption. If no one is selected, symmetric encryption will be performed. " recipients) That call seems to take quite a few seconds and then execution jumps to the error part on line 257. Digging deeper with edebug, I have found the error happens in the epa-list-keys call and I can make the error happen just by calling epa-list-keys directly. I stepped through a whole lot but I couldn't work out where it happens exactly. it seems to be while its stepping through the gpg keys to produce the list. Backtrace: Debugger entered--Lisp error: (wrong-type-argument stringp nil) string-match("\"" nil 0) (while (string-match "\"" string index) (setq string (replace-match "\\\"" t t string) index (1+ (match-end 0)))) (cond ((member (aref (car lines) 0) (quote ("pub" "sec" "crt" "crs"))) (setq cert (member (aref (car lines) 0) (quote ("crt" "crs"))) keys (cons (epg-make-key (if (aref (car lines) 8) (cdr (assq ... epg-key-validity-alist)))) keys)) (epg-key-set-sub-key-list (car keys) (cons (epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car keys))))) ((member (aref (car lines) 0) (quote ("sub" "ssb"))) (epg-key-set-sub-key-list (car keys) (cons (epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car keys))))) ((equal (aref (car lines) 0) "uid") (setq string (copy-sequence (aref (car lines) 9)) index 0) (while (string-match "\"" string index) (setq string (replace-match "\\\"" t t string) index (1+ (match-end 0)))) (condition-case nil (setq string (epg--decode-coding-string (car (read-from-string (concat "\"" string "\""))) (quote utf-8))) (error (setq string (aref (car lines) 9)))) (epg-key-set-user-id-list (car keys) (cons (epg-make-user-id (if (aref (car lines) 1) (cdr (assq ... epg-key-validity-alist))) (if cert (condition-case nil (epg-dn-from-string string) (error string)) string)) (epg-key-user-id-list (car keys))))) ((equal (aref (car lines) 0) "fpr") (epg-sub-key-set-fingerprint (car (epg-key-sub-key-list (car keys))) (aref (car lines) 9))) ((equal (aref (car lines) 0) "sig") (epg-user-id-set-signature-list (car (epg-key-user-id-list (car keys))) (cons (epg-make-key-signature (if (aref (car lines) 1) (cdr (assq ... epg-key-validity-alist))) (string-to-number (aref (car lines) 3)) (aref (car lines) 4) (epg--time-from-seconds (aref (car lines) 5)) (epg--time-from-seconds (aref (car lines) 6)) (aref (car lines) 9) (string-to-number (aref (car lines) 10) 16) (eq (aref (aref ... 10) 2) 120)) (epg-user-id-signature-list (car (epg-key-user-id-list (car keys)))))))) (while lines (cond ((member (aref (car lines) 0) (quote ("pub" "sec" "crt" "crs"))) (setq cert (member (aref (car lines) 0) (quote ("crt" "crs"))) keys (cons (epg-make-key (if (aref ... 8) (cdr ...))) keys)) (epg-key-set-sub-key-list (car keys) (cons (epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car keys))))) ((member (aref (car lines) 0) (quote ("sub" "ssb"))) (epg-key-set-sub-key-list (car keys) (cons (epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car keys))))) ((equal (aref (car lines) 0) "uid") (setq string (copy-sequence (aref (car lines) 9)) index 0) (while (string-match "\"" string index) (setq string (replace-match "\\\"" t t string) index (1+ (match-end 0)))) (condition-case nil (setq string (epg--decode-coding-string (car (read-from-string ...)) (quote utf-8))) (error (setq string (aref (car lines) 9)))) (epg-key-set-user-id-list (car keys) (cons (epg-make-user-id (if (aref ... 1) (cdr ...)) (if cert (condition-case nil ... ...) string)) (epg-key-user-id-list (car keys))))) ((equal (aref (car lines) 0) "fpr") (epg-sub-key-set-fingerprint (car (epg-key-sub-key-list (car keys))) (aref (car lines) 9))) ((equal (aref (car lines) 0) "sig") (epg-user-id-set-signature-list (car (epg-key-user-id-list (car keys))) (cons (epg-make-key-signature (if (aref ... 1) (cdr ...)) (string-to-number (aref ... 3)) (aref (car lines) 4) (epg--time-from-seconds (aref ... 5)) (epg--time-from-seconds (aref ... 6)) (aref (car lines) 9) (string-to-number (aref ... 10) 16) (eq (aref ... 2) 120)) (epg-user-id-signature-list (car (epg-key-user-id-list ...))))))) (setq lines (cdr lines))) (let ((lines (epg--list-keys-1 context name mode)) keys cert pointer pointer-1 index string) (while lines (cond ((member (aref (car lines) 0) (quote ("pub" "sec" "crt" "crs"))) (setq cert (member (aref (car lines) 0) (quote ("crt" "crs"))) keys (cons (epg-make-key (if ... ...)) keys)) (epg-key-set-sub-key-list (car keys) (cons (epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car keys))))) ((member (aref (car lines) 0) (quote ("sub" "ssb"))) (epg-key-set-sub-key-list (car keys) (cons (epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car keys))))) ((equal (aref (car lines) 0) "uid") (setq string (copy-sequence (aref (car lines) 9)) index 0) (while (string-match "\"" string index) (setq string (replace-match "\\\"" t t string) index (1+ (match-end 0)))) (condition-case nil (setq string (epg--decode-coding-string (car ...) (quote utf-8))) (error (setq string (aref ... 9)))) (epg-key-set-user-id-list (car keys) (cons (epg-make-user-id (if ... ...) (if cert ... string)) (epg-key-user-id-list (car keys))))) ((equal (aref (car lines) 0) "fpr") (epg-sub-key-set-fingerprint (car (epg-key-sub-key-list (car keys))) (aref (car lines) 9))) ((equal (aref (car lines) 0) "sig") (epg-user-id-set-signature-list (car (epg-key-user-id-list (car keys))) (cons (epg-make-key-signature (if ... ...) (string-to-number ...) (aref ... 4) (epg--time-from-seconds ...) (epg--time-from-seconds ...) (aref ... 9) (string-to-number ... 16) (eq ... 120)) (epg-user-id-signature-list (car ...)))))) (setq lines (cdr lines))) (setq keys (nreverse keys) pointer keys) (while pointer (epg-key-set-sub-key-list (car pointer) (nreverse (epg-key-sub-key-list (car pointer)))) (setq pointer-1 (epg-key-set-user-id-list (car pointer) (nreverse (epg-key-user-id-list (car pointer))))) (while pointer-1 (epg-user-id-set-signature-list (car pointer-1) (nreverse (epg-user-id-signature-list (car pointer-1)))) (setq pointer-1 (cdr pointer-1))) (setq pointer (cdr pointer))) keys) epg-list-keys((epg-context . [OpenPGP "/usr/bin/gpg" nil nil nil nil nil nil nil (epg-passphrase-callback-function) nil nil nil nil nil nil nil nil]) nil nil) (epa--insert-keys (epg-list-keys context name secret)) (let ((inhibit-read-only t) buffer-read-only (point (point-min)) (context (epg-make-context epa-protocol))) (if (get-text-property point (quote epa-list-keys)) nil (setq point (next-single-property-change point (quote epa-list-keys)))) (if point (progn (delete-region point (or (next-single-property-change point (quote epa-list-keys)) (point-max))) (goto-char point))) (epa--insert-keys (epg-list-keys context name secret)) (widget-setup) (set-keymap-parent (current-local-map) widget-keymap)) epa--list-keys(nil nil) epa-list-keys(nil) #(epa-list-keys record nil) funcall(# epa-list-keys record nil) (with-no-warnings (funcall ad--addoit-function function record-flag keys)) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys))) (let ((ido-ubiquitous-next-override (ido-ubiquitous-get-command-override function))) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))) (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))) (let (ad-return-value) (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))) ad-return-value) ad-Advice-call-interactively(# epa-list-keys record nil) apply(ad-Advice-call-interactively # (epa-list-keys record nil)) call-interactively(epa-list-keys record nil) command-execute(epa-list-keys record) execute-extended-command(nil "epa-list-keys") smex-read-and-run(("eval-buffer" "epa-list-keys" "sp-next-sexp" "toggle-debug-on-error" "edebug-trace-mode" "package-list-packages" "load-file" "replace-string" "ttl" "calc" "html-mode" "grep" "dired" "whitespace-mode" "emacs-version" "org-mode" "orgtbl-mode" "set-buffer-file-coding-system" "load-library" "indent-region" "smartparens-mode" "auto-fill-mode" "customize-group" "customize-variable" "hl-line-mode" "eww" "version" "kill-rectangle" "sp-cheat-sheet" "auto-revert-tail-mode" "csv-mode" "hexl-mode" "auto-complete" "eval-expression" "org-beamer-mode" "weechat-connect" "visual-line-mode" "org-submit-bug-report" "org-table-create-or-convert-from-region" "mail" "rgrep" "shell" "sql-mode" "esk-lorem" "zap-to-char" "count-matches" "shell-command" "moz-minor-mode" "org-indent-item" "org-table-export" ...)) smex() #(smex nil nil) funcall(# smex nil nil) (with-no-warnings (funcall ad--addoit-function function record-flag keys)) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys))) (let ((ido-ubiquitous-next-override (ido-ubiquitous-get-command-override function))) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))) (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))) (let (ad-return-value) (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))) ad-return-value) ad-Advice-call-interactively(# smex nil nil) apply(ad-Advice-call-interactively # (smex nil nil)) call-interactively(smex nil nil) command-execute(smex) -- Jason Lewis http://emacstragic.net