From: Oliver Scholz <alkibiades@gmx.de>
Subject: DWIM for the TAB key
Date: Wed, 16 Feb 2005 02:42:04 +0100 [thread overview]
Message-ID: <87y8dp1dsj.fsf@ID-87814.user.uni-berlin.de> (raw)
Reading a thread on emacs-devel, I thought that maybe others would
also like what I have been using for quite a while:
(defun egoge-tab-dwim ()
"Indent or complete depending on the context.
If point is at the beginning of a line or if all characters
between point and the beginning of the line are whitespace
characters, indent that line. Otherwise complete the symbol at
point."
(interactive)
(if (or (bolp)
(save-excursion (backward-char 1)
(looking-at "[[:blank:]]")))
(indent-according-to-mode)
(if (memq major-mode '(emacs-lisp-mode
lisp-interaction-mode
inferior-emacs-lisp-mode))
(lisp-complete-symbol)
(complete-symbol))))
(define-key global-map [tab] 'egoge-tab-dwim)
Oliver
--
28 Pluviôse an 213 de la Révolution
Liberté, Egalité, Fraternité!
next reply other threads:[~2005-02-16 1:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-16 1:42 Oliver Scholz [this message]
2005-02-16 2:03 ` DWIM for the TAB key Oliver Scholz
2005-02-16 17:16 ` rbielaws
2005-02-17 13:16 ` Oliver Scholz
2005-02-17 14:40 ` Thien-Thi Nguyen
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=87y8dp1dsj.fsf@ID-87814.user.uni-berlin.de \
--to=alkibiades@gmx.de \
/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).