emacs-devel
[Top][All Lists]
Advanced

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

RE: by default, point should not enter the minibuffer prompt


From: Drew Adams
Subject: RE: by default, point should not enter the minibuffer prompt
Date: Wed, 8 Oct 2008 09:34:08 -0700

> > The problem is that you are using `forward-line'.  It is a
> > low-level function that does not do any sort of checking.
> > Emacs commands intended for user use (C-a, C-p, etc) should
> > act correctly and avoid the prompt.
> 
> Got it. I'll change my minibuffer C-a command to DTRT. Thx.

A little help please.

I tried simply binding `minibuffer-prompt-properties' so that it included
`point-entered minibuffer-avoid-prompt' during my `C-a', but that had no effect.

When is `minibuffer-prompt-properties' examined? Is it too late once the
minibuffer is activated and a minibuffer key is hit?

Simple test:

(defun beg-line ()
  (interactive)
  (let ((minibuffer-prompt-properties
         (append '(point-entered minibuffer-avoid-prompt)
                   minibuffer-prompt-properties)))
    (forward-line -1)))

(define-key minibuffer-local-completion-map "\C-a" 'beg-line)

The binding has no effect - doesn't prevent C-a from moving to the prompt
beginning. This code is not really what I'd use, but it's a simplified version.
My code needs to use `forward-line', in any case. I'm just ignorant of how to
prevent point from moving into the prompt.

I grepped the Lisp Emacs files for `minibuffer-prompt-properties', but there is
no real use of it, beyond initialization. I looked at the C source code in
cmds.c for `beginning-of-line', but I don't see (understand) how it's done.
What's the secret? ;-)

If it can't be done by simply binding `minibuffer-prompt-properties', what is
the way to go? Do I need to explicitly move to `minibuffer-prompt-end', or is
there a simple, elegant way to DTRT here.

I'm not really familiar with fields and such. Suggestions appreciated. Thx.






reply via email to

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