emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

align-current suggestion


From: Kai Großjohann
Subject: align-current suggestion
Date: Wed, 18 Dec 2002 14:54:18 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.93 (i686-pc-linux-gnu)

I like to bind align to a key.  But there are two align commands that
I often use -- align-current and align.  One of them is used when I
don't specify a region, the other is used when I do specify the
region.

I use transient-mark-mode.

How about a command align-dwim that behaves like align if there is a
region, and like align-current if there isn't?

(defun align-dwim (&optional rules exclude-rules)
  "Align current alignment section or region.
This is useful in `transient-mark-mode'.  If there is a region, do
like `align' on that region, else do like `align-current'."
  (interactive)
  (if mark-active
      (align (region-beginning) (region-end) nil rules exclude-rules)
    (align-current nil nil nil rules exclude-rules)))

-- 
~/.signature is: umop ap!sdn    (Frank Nobis)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]