1

I'm considering switching back from flycheck to flymake after the Emacs 26 rewrite. One thing that bothers me about flymake is how much room on the mode line it takes up. It has a string Flymake plus the results. It seems like a silly thing but this is 10% of the mode line on an 80-char frame, just for a name! I have lots of important info I'd like to see on my mode line so I try to remove things that aren't helpful to me--I know what minor modes etc. are enabled in my buffers, since I configured them! Personally I'd prefer to not see a name at all, just the results, or at most F or FM.

I could use diminish to get rid of the mode line info completely but of course I don't want that: I want to be able to see the state of my buffer.

I took a look at flymake.el and the flymake--mode-line-format defun and it doesn't seem like this string is configurable, or easy to change at all.

Anyone have any thoughts about this?

Drew
  • 29,895
  • 7
  • 74
  • 104
MadScientist
  • 92,819
  • 9
  • 109
  • 136

1 Answers1

5

You'd need to redefine flymake--mode-line-format function. It should probably be more customizable, but it's not. Possibly the least intrusive way to do it is to define :filter-return advice on that function to transform the output.

(defun flymake--transform-mode-line-format (ret)
  "Change the output of `flymake--mode-line-format'."
  (setf (seq-elt (car ret) 1) " FM")
  ret)
(advice-add #'flymake--mode-line-format
            :filter-return #'flymake--transform-mode-line-format)
jpkotta
  • 9,237
  • 3
  • 29
  • 34
  • Oh interesting. It's been a while since I used advice; last time I don't think it had a `filter-return` capability. Thanks! – MadScientist Dec 20 '18 at 16:38
  • Could you please explain the magic behind `(setf (seq-elt (car ret) 1) " FM")`? I don't understand why this doesn't look like a simple "replace 'Flymake' with 'FM'", what else is going on here? – Andy May 02 '20 at 04:02
  • `flymake--mode-line-format` is a function that returns a cons whose car is a list. The 2nd element of that list is " Flymake". The `setf` sets that element to " FM". Look at the source for `flymake--mode-line-format`. `((:propertize " Flymake" ...` -> `((:propertize " FM"...`. – jpkotta May 04 '20 at 00:39