]> git.eshelyaron.com Git - emacs.git/commitdiff
Added a new feature to align.el
authorJohn Wiegley <johnw@newartisans.com>
Mon, 17 Jul 2000 06:33:36 +0000 (06:33 +0000)
committerJohn Wiegley <johnw@newartisans.com>
Mon, 17 Jul 2000 06:33:36 +0000 (06:33 +0000)
lisp/ChangeLog
lisp/align.el

index db0a82d39b2bea7144edadf7dc6dd04f72ea1251..3a746723fba9860802b36fe599c58e37070161b8 100644 (file)
@@ -1,3 +1,9 @@
+2000-07-16  John Wiegley  <johnw@gnu.org.
+
+       * lisp/align.el (align-newline-and-indent): Adding new function
+       for auto-aligning blocks of code on RET.
+       (align-region): Fixed badly formatted minibuffer message.
+
 2000-07-17  Kenichi Handa  <handa@etl.go.jp>
 
        * international/kkc.el (kkc-show-conversion-list-count): Customize
index d3195b443659c2e4a16aa6774c88ca2dc978a56f..40c3decf8f2ee43c0efe2e2f5722d6ca33c3e0fe 100644 (file)
@@ -1033,6 +1033,23 @@ to be colored."
     (setq align-highlight-overlays
          (cdr align-highlight-overlays))))
 
+;;;###autoload
+(defun align-newline-and-indent ()
+  "A replacement function for `newline-and-indent', aligning as it goes."
+  (interactive)
+  (let ((separate (or (if (symbolp align-region-separate)
+                         (symbol-value align-region-separate)
+                       align-region-separate)
+                     'entire))
+       (end (point)))
+    (call-interactively 'newline-and-indent)
+    (save-excursion
+      (forward-line -1)
+      (while (not (or (bobp)
+                     (align-new-section-p (point) end separate)))
+       (forward-line -1))
+      (align (point) end))))
+
 ;;; Internal Functions:
 
 (defun align-match-tex-pattern (regexp end &optional reverse)
@@ -1394,12 +1411,17 @@ aligner would have dealt with are."
                        ;; are, if it's a very large region being
                        ;; aligned
                        (if report
-                           (message
-                            "Aligning `%s' [rule %d of %d] (%d%%)..."
-                            (symbol-name (car rule))
-                            rule-index rule-count
-                            (/ (* (- (point) real-beg) 100)
-                               (- end-mark real-beg))))
+                           (let ((name (symbol-name (car rule))))
+                             (if name
+                                 (message
+                                  "Aligning `%s' (rule %d of %d) %d%%..."
+                                  rule-index rule-count
+                                  (/ (* (- (point) real-beg) 100)
+                                     (- end-mark real-beg)))
+                               (message
+                                "Aligning %d%%..."
+                                (/ (* (- (point) real-beg) 100)
+                                   (- end-mark real-beg))))))
 
                        ;; if the search ended us on the beginning of
                        ;; the next line, move back to the end of the