1

I am on Emacs 28.0.5 and keep getting warnings about:

Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode'

Unfortunately it is for packages I don't control like lsp-mode. I would like to suppress the warning using something like (I use radian Emacs config, hence the use of use-feature for Emacs-provided packages - imagine a require 'warnings if you are more familiar with that):

(use-feature warnings
   :config
   (add-to-list 'warning-suppress-log-types '(what-to-put-here?)))

but apparently I am not passing the type that warning-suppress-log-types expects for this warning to be picked up because it keeps happening when lsp-mode loads (I won't bore you with all the incantations that I've tried in 'what-to-put-here?'. If you read the source for define-minor-mode you'll see that the way the warning is generated is perhaps non-standard, i.e., it doesn't seem to call display-warning. Do you know a way to make it stop generating this message?

I'd do a pull request to lsp-mode, but I am an outlier by using such a bleeding edge Emacs version and I don't imagine they'll want to accommodate that version in the common case.

Note: I have filed an issue with lsp-mode in the meantime.

1
  • 2
    Re: accommodating upstream Emacs changes - it is in every package author's interests to address changes in time for the next Emacs release, and/or discuss or complain about them upstream if they think something about them can be improved (similarly upstream Emacs devs rely on such feedback to improve the next release). In this case the non-keywords approach has been considered old-fashioned for many years and Emacs releases, so most likely downstream package authors should just switch to the keywords style.
    – Basil
    Apr 23 at 23:13
1

This is already fixed in 7.1 version - lsp-mode is now using the emacs new keyword syntax for minor modes.

3
  • Please elaborate. At least specify what version you mean by the "latest". The Q&A will last a long time. (Better yet, say what the fix is, if possible.)
    – Drew
    May 22 at 13:48
  • @Drew I think the fix is to Use keywords rather than deprecated positional arguments to ‘define-minor-mode’, as per the OP.
    – Basil
    May 24 at 10:27
  • 1
    @Basil: Whatever the fix is, it should be stated (summarized/described) in the answer.
    – Drew
    May 24 at 18:06
1

Well, turns out radian Emacs config provides an advice for such things:

(dolist (func '(define-minor-mode))
  (advice-add func :around #'radian--advice-silence-messages))

which you can add to your init.local.el.

Here is its definition:

(defun radian--advice-silence-messages (func &rest args)
  "Invoke FUNC with ARGS, silencing all messages. This is an `:around' advice for many different functions."
  (cl-letf (((symbol-function #'message) #'ignore))
     (apply func args)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.