enter image description here

how to remove the red area that i think related to trailing spaces

  • 1
    Don't unconditionally enable show-trailing-whitespace everywhere. It doesn't make any sense in buffers derived from special-mode because those aren't text you're supposed to edit. – wasamasa Jul 25 '18 at 19:44

This should do the trick:

(add-hook 'calendar-mode-hook (function (lambda () (setq show-trailing-whitespace nil))))

| improve this answer | |

CAVEAT:  Deleting the trailing whitespace may have unintended consequences; e.g., there might be a function somewhere containing a regexp to locate a date and that regexp might include trailing spaces "[0-9]+\s+". If a problem arises, it will be necessary to either remove this advice or deal with the functions that are at issue. Your mileage with this advice may vary.

(defun my-function (month year indent)

(advice-add 'calendar-generate-month :after 'my-function)
| improve this answer | |
  • 2
    Is the problem here not that whitespace-mode is enabled for the popup (quite possibly globally)? Just turning that off should fix the problem without having to modify the contents. – rpluim Jul 25 '18 at 15:25
  • @RobertPluim -- While it is true that disabling whitespace-mode in calendar-mode buffers would make the trailing whitespace invisible to the human eye, it boils down to personal taste. whitespace-mode makes some people "happy". :) I have modified several default functions in my own custom setup because I personally cannot live with one or more final new-lines in things like dired-mode and so forth. – lawlist Jul 25 '18 at 18:44
  • I was not recommending turning it off completely, just for buffers in calendar-mode. Especially for generated buffers like calendars it makes little sense, and is less likely to cause other issues. – rpluim Jul 25 '18 at 20:16

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.