help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DWIM for the TAB key


From: address@hidden
Subject: Re: DWIM for the TAB key
Date: 16 Feb 2005 09:16:40 -0800
User-agent: G2/0.2

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ôse an 213 de la Révolution
> Liberté, Egalité, Fraternité!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]