Function: treemacs-with-ignored-errors

treemacs-with-ignored-errors is a macro defined in treemacs-macros.el.

Signature

(treemacs-with-ignored-errors IGNORED-ERRORS &rest BODY)

Documentation

Given list of specifically IGNORED-ERRORS evaluate BODY.

IGNORED-ERRORS is a list of errors to ignore. Each element is a list whose car is the error's type, and second item is a regex to match against error messages. If any of the IGNORED-ERRORS matches, the error is suppressed and nil returned.

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-macros.el
(defmacro treemacs-with-ignored-errors (ignored-errors &rest body)
  "Given list of specifically IGNORED-ERRORS evaluate BODY.

IGNORED-ERRORS is a list of errors to ignore.  Each element is a list whose car
is the error's type, and second item is a regex to match against error messages.
If any of the IGNORED-ERRORS matches, the error is suppressed and nil returned."
  (let ((err (make-symbol "err")))
    `(condition-case-unless-debug ,err
         ,(macroexp-progn body)
       ,@(mapcar
          (lambda (ignore-spec)
            `(,(car ignore-spec)
              (unless (string-match-p ,(nth 1 ignore-spec) (error-message-string ,err))
                (signal (car ,err) (cdr ,err)))))
          ignored-errors))))