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:52:33 -0700

> > I'll change my minibuffer C-a command to DTRT. Thx.
> 
> If you just use the default C-a binding (move-beginning-of-line), it
> should work correctly.

Not a possibility. If I wanted the default C-a I never would have written a
different command. ;-)

The command I want moves to bol (modulo the prompt) the first time, but to bol
of the previous line if repeated. And it respects the N prefix arg (like
`beginning-of-line').

It's not important, but here is the command, so you get the idea:

;; Bound to `C-a' in minibuffer and in *Completions*.
(defun icicle-beginning-of-line+ (&optional n)
  "Move cursor to beginning of current line or next line if repeated.
This is the similar to `beginning-of-line', but:
1. With arg N, the direction is the opposite: this command moves
   backward, not forward, N lines.
2. If called interactively with no prefix arg:
      If the previous command was also `beginning-of-line+', then move
      to the beginning of the previous line.  Else, move to the
      beginning of the current line.
   Otherwise, move to the beginning of the Nth previous line (Nth next
      line if N<0).  Command `beginning-of-line', by contrast, moves to
      the beginning of the (N-1)th next line."
  (interactive
   (list (if current-prefix-arg
             (prefix-numeric-value current-prefix-arg)
           0)))
  (unless n (setq n  0)) ; non-interactive with no arg
  (let ((minibuffer-prompt-properties ; Unfortunately, has no effect
         (append '(point-entered minibuffer-avoid-prompt)
                 minibuffer-prompt-properties)))
    (if (and (eq this-command last-command)
             (not current-prefix-arg))
        (forward-line -1)
      (forward-line (- n)))))

C-e in the minibuffer and *Completions* works similarly but it moves down when
repeated, not up.





reply via email to

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