emacs-circe / circe

Circe, a Client for IRC in Emacs
GNU General Public License v3.0
390 stars 51 forks source link

Hide tracking in modeline if tracking-max-mode-line-entries having = 0 #379

Closed ag91 closed 3 years ago

ag91 commented 3 years ago

Solves #378 @wasamasa I never contributed to this repository before, let me know if you would like some refactoring to match your standards.

ag91 commented 3 years ago

By the way, it may interest you to see the code churn (line of codes added and deleted) of last few months: most of my code is tests luckily :) codeChurnFrom31019

ag91 commented 3 years ago

I can do that. A bit of a problem is that tracking-max-mode-line-entries can be nil and the = operator fails for that.

Do you know if there is something better than

(or (or (null tracking-max-mode-line-entries)) (= tracking-max-mode-line-entries 0)) ...)

to handle this case? I chose eq because it works for integers and I do not expect users to use 0.0 in there.

On Fri 18 Sep 2020 at 23:05, Vasilij Schneidermann notifications@github.com wrote:

@wasamasa commented on this pull request.

@@ -340,7 +340,7 @@ to be ignored." This returns a list suitable for mode-line-format'. Iftracking-max-mode-line-entries' is a positive integer, only return that many entries, ending with '+n'."

  • (if (not tracking-buffers)
  • (if (or (eq tracking-max-mode-line-entries 0) (not tracking-buffers))

Please use = for numerical comparison.

wasamasa commented 3 years ago

How about (or (and tracking-max-mode-line-entries (= tracking-max-mode-line-entries 0)) (not tracking-buffers)). And no, eq tests for object identity, so I'd expect it to fail on bignums (the core developers might have hacked around that though due to the sheer number of code misusing eq for number/character comparison).

wasamasa commented 3 years ago

Thanks!