[Top][All Lists]

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

RE: clear minibuffer text wehn open a file

From: Drew Adams
Subject: RE: clear minibuffer text wehn open a file
Date: Tue, 8 Apr 2014 08:50:19 -0700 (PDT)

> when load file I want to clear minibuffer text without killing to ring.
> I use this code:
> global-set-key [(control ?7)] 'tl-delete-line)
> (defun tl-delete-line()
> (interactive)
> (beginning-of-line)
> (kill-line)
> (insert "/vobs/aaa/DV"))
> I use kill-line which add to the ring.I want to clear the line without
> saving to ring. Is is possible ?

1. If you want to do something only in the minibuffer, then bind the
key only in minibuffer keymaps, not in the global map.

2. Function `delete-minibuffer-contents' erases the minibuffer contents.

3. If you didn't care about inserting "/vobs/aaa/DV" you could even
just bind `delete-minibuffer-contents', since it is a command:

(define-key minibuffer-local-must-match-map
            "\M-k" 'delete-minibuffer-contents)
(define-key minibuffer-local-completion-map
            "\M-k" 'delete-minibuffer-contents)

(There are some more minibuffer keymaps.  Which you use can depend
on your Emacs version.)

reply via email to

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