all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arun Persaud <apersaud@lbl.gov>
To: Bastien <bzg@altern.org>
Cc: 13634@debbugs.gnu.org
Subject: bug#13634: 24.2; trailing whitespace in calendar (enhancement)
Date: Wed, 06 Feb 2013 10:43:35 -0800	[thread overview]
Message-ID: <5112A457.9050601@lbl.gov> (raw)
In-Reply-To: <878v719yy3.fsf@bzg.ath.cx>

[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]

On 02/06/2013 08:41 AM, Bastien wrote:
> Hi Arun,
> 
> Arun Persaud <apersaud@lbl.gov> writes:
> 
>> I like to show trailing white spaces in my buffers using
>>
>> (setq-default show-trailing-whitespace t)
>>
>> in my .emacs file. Since I have this enabled, I noticed
>> that the calendar (M-x calendar) has a lot of empty white space at the
>> end of the line. It would be nice if those could be removed before
>> displaying the calendar.
> 
> Can you make a patch for this?  It should be small enough so that we
> can apply it quickly.
> 
> Thanks,
> 

Here is a simple patch that seems to run on my computer, but I never
really looked at the calendar code before, so I'm not sure if this is
the right way of doing this.

The patch calls delete-trailing-whitespace for the current line when
advancing a line (via calendar-ensure-newline) and also removes the
whitespace for the last line when inserting a month into the buffer.
Removing the trailing whitespace doesn't seem to mess up the formatting,
since calendar-insert-at-column seems to be used when adding text which
fills the line with spaces in case it's needed before adding the text.

cheers
	
Arun

[-- Attachment #2: remove-trailing-whitespace-in-calendar.diff --]
[-- Type: text/x-patch, Size: 846 bytes --]

--- calendar.el	2013-02-06 10:28:54.679401343 -0800
+++ calendar.el.new	2013-02-06 10:28:25.738455568 -0800
@@ -1417,6 +1417,7 @@
 
 (defun calendar-ensure-newline ()
   "Move to the next line, adding a newline if necessary."
+  (delete-trailing-whitespace  (line-beginning-position) (line-end-position) )
   (or (zerop (forward-line 1))
       (insert "\n")))
 
@@ -1499,7 +1500,8 @@
                 (/= day last))
        (calendar-ensure-newline)
        (setq day (1+ day))              ; first day of next week
-       (calendar-insert-at-column indent calendar-intermonth-text trunc)))))
+       (calendar-insert-at-column indent calendar-intermonth-text trunc)))
+   (delete-trailing-whitespace  (line-beginning-position) (line-end-position))))
 
 (defun calendar-redraw ()
   "Redraw the calendar display, if `calendar-buffer' is live."

      parent reply	other threads:[~2013-02-06 18:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06  2:54 bug#13634: 24.2; trailing whitespace in calendar (enhancement) Arun Persaud
2013-02-06 16:41 ` Bastien
2013-02-06 16:56   ` Glenn Morris
2013-02-06 17:37     ` Bastien
2013-02-06 17:56       ` Drew Adams
2013-02-06 18:03       ` Glenn Morris
2013-02-06 18:38         ` Eli Zaretskii
2013-02-06 18:52           ` Arun Persaud
2013-02-06 19:06             ` Drew Adams
2013-02-06 19:06           ` Drew Adams
2013-02-06 18:49         ` Bastien
2013-02-06 19:19       ` Stefan Monnier
2013-02-06 19:22         ` Drew Adams
2013-02-06 19:32           ` Drew Adams
2013-02-06 18:43   ` Arun Persaud [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5112A457.9050601@lbl.gov \
    --to=apersaud@lbl.gov \
    --cc=13634@debbugs.gnu.org \
    --cc=bzg@altern.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.