]> code.delx.au - gnu-emacs/blobdiff - lisp/align.el
* cl-generic.el (cl-defmethod): Make docstring dynamic
[gnu-emacs] / lisp / align.el
index a7a98c28f1269e5e3a74d1e96f3fb2567cfa2ace..866aaadaf4dd380ff2662595d043182373d219dd 100644 (file)
@@ -577,7 +577,7 @@ The possible settings for `align-region-separate' are:
                     (eq '- current-prefix-arg)))))
 
     (css-declaration
-     (regexp . "^\\s-*\\w+:\\(\\s-*\\).*;")
+     (regexp . "^\\s-*\\(?:\\w-?\\)+:\\(\\s-*\\).*;")
      (group . (1))
      (modes . '(css-mode html-mode))))
   "A list describing all of the available alignment rules.
@@ -802,6 +802,9 @@ See the variable `align-exclude-rules-list' for more details.")
 (defvar align-highlight-overlays nil
   "The current overlays highlighting the text matched by a rule.")
 
+(defvar align-regexp-history nil
+  "Input history for the full user-entered regex in `align-regexp'")
+
 ;; Sample extension rule set, for vhdl-mode.  This should properly be
 ;; in vhdl-mode.el itself.
 
@@ -888,15 +891,15 @@ on the format of these lists."
       (let ((sec-first end)
            (sec-last beg))
        (align-region beg end
-                     (or exclude-rules
-                         align-mode-exclude-rules-list
-                         align-exclude-rules-list) nil
                      separator
-                     (function
-                      (lambda (b e mode)
-                        (when (and mode (listp mode))
-                          (setq sec-first (min sec-first b)
-                                sec-last  (max sec-last e))))))
+                     nil ; rules
+                      (or exclude-rules
+                         align-mode-exclude-rules-list
+                         align-exclude-rules-list)
+                      (lambda (b e mode)
+                        (when (consp mode)
+                          (setq sec-first (min sec-first b)
+                                sec-last  (max sec-last e)))))
        (if (< sec-first sec-last)
            (align-region sec-first sec-last 'entire
                          (or rules align-mode-rules-list align-rules-list)
@@ -946,7 +949,7 @@ construct a rule to pass to `align-region', which does the real work."
     (list (region-beginning) (region-end))
     (if current-prefix-arg
        (list (read-string "Complex align using regexp: "
-                          "\\(\\s-*\\)")
+                          "\\(\\s-*\\)" 'align-regexp-history)
              (string-to-number
               (read-string
                "Parenthesis group to modify (justify if negative): " "1"))
@@ -1051,7 +1054,9 @@ to be colored."
 
 ;;;###autoload
 (defun align-newline-and-indent ()
-  "A replacement function for `newline-and-indent', aligning as it goes."
+  "A replacement function for `newline-and-indent', aligning as it goes.
+The alignment is done by calling `align' on the region that was
+indented."
   (interactive)
   (let ((separate (or (if (and (symbolp align-region-separate)
                               (boundp align-region-separate))