all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* simple patch for `align.el'
@ 2004-10-23 22:38 Paul Pogonyshev
  2004-10-24  0:17 ` John Wiegley
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Pogonyshev @ 2004-10-23 22:38 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-10-24  7:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-23 22:38 simple patch for `align.el' Paul Pogonyshev
2004-10-24  0:17 ` John Wiegley
2004-10-24  7:15   ` David Kastrup

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.