Malabarba / aggressive-indent-mode

Emacs minor mode that keeps your code always indented. More reliable than electric-indent-mode.
850 stars 36 forks source link

Fix #146 - Make suppress messages Emacs 28 compatible #148

Open KaratasFurkan opened 3 years ago

KaratasFurkan commented 3 years ago

Fix #146.

cl-letfdoes not suppress message function in Emacs 28 for some reason. I suspect that (symbol-function 'message) returns gnus/message.elc. This PR fix this with another approach.

Here is one more approach that uses advice system:

(defmacro with-suppress-messages (&rest body)
  "Suppress messages during evaluation of BODY."
  (advice-add 'message :override 'ignore)
  `(let ((return (progn ,@body)))
     (advice-remove 'message 'ignore)
     return))

(with-suppress-messages
 (ignore-errors (aggressive-indent...)))

but I think changing related variables temporarily like in the PR is much cleaner.

JasonKDarby commented 2 years ago

Until this proper fix is implemented I've been using this approach: (setq aggressive-indent-region-function #'(lambda (x y) (let ((inhibit-message t)) (indent-region x y))))) in case anybody was looking for something easy as a stop gap.