all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* align-current suggestion
@ 2002-12-18 13:54 Kai Großjohann
  0 siblings, 0 replies; only message in thread
From: Kai Großjohann @ 2002-12-18 13:54 UTC (permalink / raw)


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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-18 13:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-18 13:54 align-current suggestion Kai Großjohann

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.