Function: align
align is an autoloaded, interactive and byte-compiled function defined
in align.el.gz.
Signature
(align BEG END &optional SEPARATE RULES EXCLUDE-RULES)
Documentation
Attempt to align a region based on a set of alignment rules.
BEG and END mark the region. If BEG and END are specifically set to
nil (this can only be done programmatically), the beginning and end of
the current alignment section will be calculated based on the location
of point, and the value of align-region-separate (or possibly each
rule's separate attribute).
If SEPARATE is non-nil, it overrides the value of
align-region-separate for all rules, except those that have their
separate attribute set.
RULES and EXCLUDE-RULES, if either is non-nil, will replace the
default rule lists defined in align-rules-list and
align-exclude-rules-list. See align-rules-list for more details
on the format of these lists.
Probably introduced at or before Emacs version 18.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/align.el.gz
;;; User Functions:
;;;###autoload
(defun align (beg end &optional separate rules exclude-rules)
"Attempt to align a region based on a set of alignment rules.
BEG and END mark the region. If BEG and END are specifically set to
nil (this can only be done programmatically), the beginning and end of
the current alignment section will be calculated based on the location
of point, and the value of `align-region-separate' (or possibly each
rule's `separate' attribute).
If SEPARATE is non-nil, it overrides the value of
`align-region-separate' for all rules, except those that have their
`separate' attribute set.
RULES and EXCLUDE-RULES, if either is non-nil, will replace the
default rule lists defined in `align-rules-list' and
`align-exclude-rules-list'. See `align-rules-list' for more details
on the format of these lists."
(interactive "r")
(let ((separator
(or separate
(if (and (symbolp align-region-separate)
(boundp align-region-separate))
(symbol-value align-region-separate)
align-region-separate)
'entire)))
(if (not (or ;(eq separator 'largest)
(and (functionp separator)
(not (funcall separator nil nil)))))
(align-region beg end separator
(or rules align-mode-rules-list align-rules-list)
(or exclude-rules align-mode-exclude-rules-list
align-exclude-rules-list))
(let ((sec-first end)
(sec-last beg))
(align-region beg end
separator
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)
(or exclude-rules align-mode-exclude-rules-list
align-exclude-rules-list)))))))