From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: DWIM for the TAB key Date: Wed, 16 Feb 2005 02:42:04 +0100 Message-ID: <87y8dp1dsj.fsf@ID-87814.user.uni-berlin.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1108518289 14899 80.91.229.2 (16 Feb 2005 01:44:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 16 Feb 2005 01:44:49 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 16 02:44:49 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D1EEq-00057C-8k for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Feb 2005 02:44:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D1EUg-0007FH-UP for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Feb 2005 21:00:46 -0500 Original-Newsgroups: gnu.emacs.help X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6; Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:PrPDxgusqbJ9YPeAzQiMPpRcvpI= Original-NNTP-Posting-Host: 84.58.12.159 Original-X-Trace: 16 Feb 2005 02:42:56 +0100, 84.58.12.159 Original-Lines: 26 Original-X-Complaints-To: abuse@arcor-ip.de Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor-ip.de!news.arcor-ip.de!84.58.12.159 Original-Xref: shelby.stanford.edu gnu.emacs.help:128589 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: main.gmane.org gmane.emacs.help:24120 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24120 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é!