emacs-devel
[Top][All Lists]
Advanced

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

Re: Usability suggestion : completion for M-:


From: paul r
Subject: Re: Usability suggestion : completion for M-:
Date: Mon, 17 Mar 2008 10:32:00 +0100

2008/3/17, Stefan Monnier <address@hidden>:

> For what it's worth, I'm a bit annoyed by Emacs's inconsistent use of
>  TAB: in minibuffers, TAB behaves like in terminals to mean "complete",
>  where in normal buffers it usually means "indent".

As a person relatively new to emacs, I can remember that those various
uses of TAB made my first steps a bit more difficult. Now in my
config, TAB is rebound for almost every mode I use, see below.

>  I have used for many years commands that do both bound to TAB: typically
>  my TAB first tries to indent, and if the indentation code didn't make any
>  change then TAB tries to complete.

I'm really surprised to see how many people here have done their own
implementation of this behaviour. FWIW, here is mine, fairly naive,
but functional.

(defun indent-for-tab-or-expand (expand-fct)
  "Indent line if not yet, otherwise call parameter function."
  (interactive)
  (let ((ppos (point)))
    (indent-for-tab-command)
    (if (and (looking-at "$") (not (looking-back "^\\s-*")) (eq ppos (point)))
        (call-interactively expand-fct))))

(defun indent-for-tab-or-dabbrev-expand ()
  "Indent line if not yet, otherwise call dabbrev-expand."
  (interactive)
  (indent-for-tab-or-expand 'dabbrev-expand))

(defun indent-for-tab-or-hippie-expand ()
  "Indent line if not yet, otherwise call hippie-expand."
  (interactive)
  (indent-for-tab-or-expand 'hippie-expand))


regards,

-- paul




reply via email to

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