Skip to content

Instantly share code, notes, and snippets.

@meedstrom
Last active March 3, 2026 16:45
Show Gist options
  • Select an option

  • Save meedstrom/b31758e8c5f022e04b3a72e18155985e to your computer and use it in GitHub Desktop.

Select an option

Save meedstrom/b31758e8c5f022e04b3a72e18155985e to your computer and use it in GitHub Desktop.
Compact standalone `quiet!` macro

Here is a compact reimplementation of Doom's quiet! macro. It depends on package llama, but I challenge anyone to rewrite it with lambdas and then tell me that it was worth it.

;; -*- lexical-binding: t; -*-
(defmacro quiet! (&rest forms)
  "Eval FORMS like `progn', but muffle all messages."
  `(if init-file-debug
       (progn ,@forms)
     (let ((inhibit-message t)
           (save-silently t)
           (standard-output #'ignore))
       (cl-letf* (((symbol-function #'message) #'ignore)
                  ((symbol-function #'write-region)
                   (let ((real-write-region (symbol-function #'write-region)))
                     (##apply real-write-region %1 %2 %3 &4 (or &5 'quiet) &*)))
                  ((symbol-function #'load)
                   (let ((real-load (symbol-function #'load)))
                     (##funcall real-load %1 &2 t &4 &5))))
         ,@forms))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment