From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "rbielaws@i1.net" Newsgroups: gmane.emacs.help Subject: Re: DWIM for the TAB key Date: 16 Feb 2005 09:16:40 -0800 Organization: http://groups.google.com Message-ID: <1108574200.675325.257850@f14g2000cwb.googlegroups.com> References: <87y8dp1dsj.fsf@ID-87814.user.uni-berlin.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1108574333 29034 80.91.229.6 (16 Feb 2005 17:18:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 16 Feb 2005 17:18:53 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 16 18:18:47 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1D1Sp5-0001Ov-00 for ; Wed, 16 Feb 2005 18:18:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D1T54-0002kZ-Aj for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Feb 2005 12:35:18 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-NNTP-Posting-Host: 198.74.20.75 Original-X-Trace: posting.google.com 1108574205 20655 127.0.0.1 (16 Feb 2005 17:16:45 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 16 Feb 2005 17:16:45 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=198.74.20.75; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:128601 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 Xref: main.gmane.org gmane.emacs.help:24132 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24132 Oliver Scholz wrote: > 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) This code doesn't seem to do what the comments say it should. > (if (or (bolp) > (save-excursion (backward-char 1) > (looking-at "[[:blank:]]"))) (if (save-excursion (skip-syntax-backward "-") (bolp)) > (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=F4se an 213 de la R=E9volution > Libert=E9, Egalit=E9, Fraternit=E9!