unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Doug Lewan <dougl@shubertticketing.com>
To: Jannis <bt_jannis@yahoo.de>,
	"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: shortcut for align-regexp
Date: Wed, 17 Apr 2013 13:20:02 +0000	[thread overview]
Message-ID: <155DEC68569B714B86C2C7075F5EDA9828F0BBBC@DAKIYA1.pegasus.local> (raw)
In-Reply-To: <516E9710.7040209@yahoo.de>

The command align-regexp is written to prompt you for a regular expression if you use it interactively.

The following code does what you describe you want.

    (defun my-common-align (begin end)
      "Align text in the region on '=' and '<-'."
      (interactive "r")
      (let ((common-align-regexp "\\(?:=\\|<-\\)"))
	(align-regexp begin end common-align-regexp)))
    (global-set-key "\C-a" 'my-common-align)

The choice of key is yours, but `C-a' is move-beginning-of-line almost everywhere. I might recommend `C-c a' instead.

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

If the majority of cooking accidents happen in the kitchen, then why don't we just cook in other rooms?


-----Original Message-----
From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On Behalf Of Jannis
Sent: Wednesday, 2013 April 17 08:35
To: help-gnu-emacs@gnu.org
Subject: shortcut for align-regexp

Hi emacs users,


this most probably is a beginners question ... googeling however yielded 
now exlanation suitable for my emacs experience.

I would love to bind single key combination (like C-a) to the 
align-regexp command and use = and <- as alignment regexpressions. How 
would I do this?

Without this I always have to type:

M-align-regexp RET <- RET


Thanks a lot
Jannis




      reply	other threads:[~2013-04-17 13:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-17 12:35 shortcut for align-regexp Jannis
2013-04-17 13:20 ` Doug Lewan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=155DEC68569B714B86C2C7075F5EDA9828F0BBBC@DAKIYA1.pegasus.local \
    --to=dougl@shubertticketing.com \
    --cc=bt_jannis@yahoo.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).