[Top][All Lists]

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

suppressing epa's error buffer

From: Robert Pluim
Subject: suppressing epa's error buffer
Date: Fri, 08 Nov 2019 22:38:41 +0100

If the user cancels the epa decryption, epa pops up an obnoxious error
buffer, thus defeating any ignore-errors wrapping. The best solution
Iʼve come up with is

    modified   lisp/epa.el
    @@ -180,6 +180,7 @@ epa-list-keys-arguments
     (defvar epa-info-buffer nil)
     (defvar epa-error-buffer nil)
     (defvar epa-last-coding-system-specified nil)
    +(defvar epa-suppress-error-buffer nil)

     (defvar epa-key-list-mode-map
       (let ((keymap (make-sparse-keymap))
    @@ -578,7 +579,8 @@ epa-display-info
         (message "%s" info)))

     (defun epa-display-error (context)
    -  (unless (equal (epg-context-error-output context) "")
    +  (unless (or (equal (epg-context-error-output context) "")
    +              epa-suppress-error-buffer)
         (let ((buffer (get-buffer-create "*Error*")))
            (unless (and epa-error-buffer (buffer-live-p

Which then lets me do the following, but it all feels like a layering
violation. Iʼm hoping someone has a better suggestion. (I considered
'display-buffer-alist', but that feels even worse).

    modified   lisp/net/network-stream.el
    @@ -218,6 +218,8 @@ open-network-stream
                      :error        (nth 4 result))
              (car result))))))

    +(defvar epa-suppress-error-buffer)
     (defun network-stream-certificate (host service parameters)
       (let ((spec (plist-get parameters :client-certificate)))
    @@ -225,10 +227,12 @@ network-stream-certificate
           ;; Either nil or a list with a key/certificate pair.
          ((eq spec t)
    -      (let* ((auth-info
    -         (car (auth-source-search :max 1
    -                                  :host host
    -                                  :port service)))
    +      (let* ((epa-suppress-error-buffer t)
    +             (auth-info
    +              (ignore-errors
    +                (car (auth-source-search :max 1
    +                                         :host host
    +                                         :port service))))
                 (key (plist-get auth-info :key))
                 (cert (plist-get auth-info :cert)))
            (and key cert (file-readable-p key) (file-readable-p cert)

reply via email to

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