From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Arun Persaud Newsgroups: gmane.emacs.bugs Subject: bug#13634: 24.2; trailing whitespace in calendar (enhancement) Date: Wed, 06 Feb 2013 10:43:35 -0800 Message-ID: <5112A457.9050601@lbl.gov> References: <5111C601.5060001@lbl.gov> <878v719yy3.fsf@bzg.ath.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010800060308050607000201" X-Trace: ger.gmane.org 1360176233 31434 80.91.229.3 (6 Feb 2013 18:43:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Feb 2013 18:43:53 +0000 (UTC) Cc: 13634@debbugs.gnu.org To: Bastien Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 06 19:44:13 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U39yb-0000xh-KE for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Feb 2013 19:44:09 +0100 Original-Received: from localhost ([::1]:37611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U39yI-00031T-Dr for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Feb 2013 13:43:50 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U39yE-00031A-RW for bug-gnu-emacs@gnu.org; Wed, 06 Feb 2013 13:43:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U39yD-0007Bs-4B for bug-gnu-emacs@gnu.org; Wed, 06 Feb 2013 13:43:46 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U39yD-0007Bk-1x for bug-gnu-emacs@gnu.org; Wed, 06 Feb 2013 13:43:45 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U39zS-0005It-2x for bug-gnu-emacs@gnu.org; Wed, 06 Feb 2013 13:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Arun Persaud Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Feb 2013 18:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13634 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13634-submit@debbugs.gnu.org id=B13634.136017630020367 (code B ref 13634); Wed, 06 Feb 2013 18:45:02 +0000 Original-Received: (at 13634) by debbugs.gnu.org; 6 Feb 2013 18:45:00 +0000 Original-Received: from localhost ([127.0.0.1]:39722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U39zQ-0005IS-CQ for submit@debbugs.gnu.org; Wed, 06 Feb 2013 13:45:00 -0500 Original-Received: from fe1.lbl.gov ([128.3.41.133]:26405) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U39zN-0005IK-Ok for 13634@debbugs.gnu.org; Wed, 06 Feb 2013 13:44:58 -0500 X-Ironport-SBRS: 2.6 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlsDAC+jElHRVdxHfmdsb2JhbABFwEoWDgEBCwkMCBQngh8BAQV4ARALGAkWDwkDAgECASIBBQEcBg0BBQIBAYgNngqeQJFZA4hmhi2MfokAP4RC X-IronPort-AV: E=Sophos;i="4.84,617,1355126400"; d="diff'?scan'208";a="8657245" Original-Received: from mail-pa0-f71.google.com ([209.85.220.71]) by fe1.lbl.gov with ESMTP; 06 Feb 2013 10:43:39 -0800 Original-Received: by mail-pa0-f71.google.com with SMTP id kp6so1382707pab.2 for <13634@debbugs.gnu.org>; Wed, 06 Feb 2013 10:43:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-received:message-id:date:from:user-agent:mime-version :to:cc:subject:references:in-reply-to:x-enigmail-version :content-type:x-gm-message-state; bh=GxyT9emUYisz74D0l2scr7u7fbiM7q9MOnpzibyQoZ8=; b=dZeQDK8XbyI6w0D9NKXVl5IRjL6Rhw9FxV97xxyQOmzMNmF4V+mxst0nmhv+PKZ0OW HeVdpqJQRiOF5n6HYCJH7KIvwIzI9ESVF7/RVQm4WZwjQSqlB6P8wAkxAz6+Rtk1q7zi gz6PaXtJBTfghzAwflSUYNBaC/T5WaW220tWFYLg2vN6mQ7rXEoNLwmee6xK9IZPpk8r HB6tah1HcUFBkbLrDDHLZNuv+CqdV5K+z3JjAeqgIJoacJGss+uN401S84RrqWWwLpT9 7UAhD97Omt7NzYS+DbMwS66dhoqBGSdklmkYzpFlgu3y6uCCGucvYLZSif/lfNfNuwYR mjFQ== X-Received: by 10.66.78.1 with SMTP id x1mr78368231paw.2.1360176219172; Wed, 06 Feb 2013 10:43:39 -0800 (PST) X-Received: by 10.66.78.1 with SMTP id x1mr78368210paw.2.1360176219003; Wed, 06 Feb 2013 10:43:39 -0800 (PST) Original-Received: from [128.3.132.170] (ape.dhcp.lbl.gov. [128.3.132.170]) by mx.google.com with ESMTPS id f9sm39642123paz.12.2013.02.06.10.43.37 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Feb 2013 10:43:38 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 In-Reply-To: <878v719yy3.fsf@bzg.ath.cx> X-Enigmail-Version: 1.5 X-Gm-Message-State: ALoCoQlAB1DXYHWAzsFr9nP80ukp6u7W5s7mE4b6S9wGCsfOXM0SJmiHD/2v7lgKAIJedBNyUBCaaa0ikV+ONKS4wu83ZBY4bAqkcwyXCa/vvENu9lkmbco2VQkE2GvcYpLOk0IwZQ4R7oMbhlfT/CIcXmIO7E422A== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:70769 Archived-At: This is a multi-part message in MIME format. --------------010800060308050607000201 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 02/06/2013 08:41 AM, Bastien wrote: > Hi Arun, > > Arun Persaud 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 --------------010800060308050607000201 Content-Type: text/x-patch; name="remove-trailing-whitespace-in-calendar.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="remove-trailing-whitespace-in-calendar.diff" --- 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." --------------010800060308050607000201--