From 05af17e50ff0af641447b14327d1744b18cfc24b Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Fri, 20 Mar 2020 09:11:02 +1000 Subject: [PATCH 1/2] Allow user to hide warnings and errors from direnv Resolves #60 --- README.rst | 16 ++++++++++++++++ direnv.el | 6 ++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 4654a53..36ca75d 100644 --- a/README.rst +++ b/README.rst @@ -159,6 +159,19 @@ the available settings are outlined below. :config (add-to-list 'direnv-non-file-modes 'foobar-mode)) +* ``warning-suppress-types`` + + this is an emacs variable with a list of warning types + which are not displayed immediately. + use it to hide error messages from ``direnv``. + example usage (with ``use-package``): + + .. code-block:: elisp + + (use-package direnv + :custom + (warning-suppress-types '((direnv)))) + troubleshooting =============== @@ -177,6 +190,9 @@ such as incorrect ``.envrc`` files you may have to open this buffer manually for inspection of the full output of the last ``direnv`` call. +to hide direnv errors such as ``.envrc is blocked``, +customize the variable ``warning-suppress-types``. + contributing ============ diff --git a/direnv.el b/direnv.el index b0c2520..908e31c 100644 --- a/direnv.el +++ b/direnv.el @@ -114,8 +114,10 @@ instead of (with-temp-buffer (unless (zerop exit-code) (insert-file-contents stderr-tempfile) - (warn "Error running direnv (exit code %d):\n%s\nOpen buffer ā€˜%s’ for full output." - exit-code (buffer-string) direnv--output-buffer-name)))))) + (display-warning 'direnv + (format-message + "Error running direnv (exit code %d):\n%s\nOpen buffer ā€˜%s’ for full output." + exit-code (buffer-string) direnv--output-buffer-name))))))) (delete-file stderr-tempfile)))) (defun direnv--file-size (name) From d12aab924cca32676cc957bae1fc03dd9a2f89b7 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Fri, 20 Mar 2020 09:44:06 +1000 Subject: [PATCH 2/2] Update README.rst with review comment --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 36ca75d..b6581dd 100644 --- a/README.rst +++ b/README.rst @@ -169,8 +169,8 @@ the available settings are outlined below. .. code-block:: elisp (use-package direnv - :custom - (warning-suppress-types '((direnv)))) + :config + (add-to-list 'warning-suppress-types '(direnv))) troubleshooting