unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmx.net>
Subject: simple patch for `align.el'
Date: Sun, 24 Oct 2004 01:38:03 +0300	[thread overview]
Message-ID: <E1CLUXO-0005S7-MQ@lists.gnu.org> (raw)

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

Try typing

  a = 0;
  counter = 0;

then select this region and `M-x align' it.  The first line will have a
space followed by a tab, which is not good and is frowned upon by the
`whitespace' module.  The simple patch below fixes this.

I have to admit I didn't care to understand all the code in `align.el',
but I'm absolutely sure the patch is safe and works.


2004-10-24  Paul Pogonyshev  <pogonyshev@gmx.net>

        * align.el (align-areas): Delete whitespace before reindenting, so
        that tabs are never placed after spaces.


My mailer currently mangles tabs, so I attach the patch instead of inlining
it.

Paul



[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 775 bytes --]

--- align.el	01 Sep 2003 18:45:04 +0300	1.13
+++ align.el	24 Oct 2004 00:36:41 +0300	
@@ -1212,6 +1212,14 @@ have been aligned.  No changes will be m
 	      (cond ((< gocol 0) t)     ; don't do anything
 		    ((= cur gocol) t)   ; don't need to
 		    ((< cur gocol)      ; just add space
+		     ;; FIXME: It is stated above that "...the
+		     ;;	       whitespace to be modified was already
+		     ;;	       deleted by `align-region', all we have
+		     ;;	       to do here is indent."  However, this
+		     ;;	       doesn't seem to be true, so we first
+		     ;;	       delete the whitespace to avoid tabs
+		     ;;	       after spaces.
+		     (delete-horizontal-space t)
 		     (indent-to gocol))
 		    (t
 		     ;; This code works around an oddity in the

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

             reply	other threads:[~2004-10-23 22:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-23 22:38 Paul Pogonyshev [this message]
2004-10-24  0:17 ` simple patch for `align.el' John Wiegley
2004-10-24  7:15   ` David Kastrup

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=E1CLUXO-0005S7-MQ@lists.gnu.org \
    --to=pogonyshev@gmx.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).