Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Custom backspace delete in mini-buffer

41 views
Skip to first unread message

TheLonelyStar

unread,
Aug 7, 2008, 7:14:51 PM8/7/08
to Help-gn...@gnu.org

Hi,

I have defined a custom backspace delete function:
(defun delete-with-closing-bracket-back (arg)
(interactive "*p")
;;Check if point is not the minimum
(if (not (= (point) (point-min)))
(progn
(backward-char)
(if
(looking-at "\\({[\n \t]*}\\|\\[[\n \t]*\\]\\|\([\n \t]*\)\\|\"[\n
\t]*\"\\)")
(delete-region (match-beginning 0) (match-end 0))
;;else
(forward-char)
(c-hungry-delete-backwards)
))
;;else
(delete-backward-char 1)
))
(define-key global-map [(backspace)] 'delete-with-closing-bracket-back)

It works fine, but there is a problem. When I am in i-search mode, pressing
backspace deletes the last character in the window, not in the i-search
mini-buffer.

I do not know much about elisp. The function above I just "stole" together.
What can I do?

Thanks!
Nathan
--
View this message in context: http://www.nabble.com/Custom-backspace-delete-in-mini-buffer-tp18881785p18881785.html
Sent from the Emacs - Help mailing list archive at Nabble.com.

Drew Adams

unread,
Aug 7, 2008, 7:33:56 PM8/7/08
to TheLonelyStar, Help-gn...@gnu.org
> It works fine, but there is a problem. When I am in i-search
> mode, pressing backspace deletes the last character in the
> window, not in the i-search mini-buffer.
>
> I do not know much about elisp. The function above I just
> "stole" together. What can I do?

I don't have time to look at this now - hopefully someone else will help you.

But here's one piece of info that might help a little: isearch does not use the
minibuffer (for normal searching); it uses the echo area. It reads your input
events without using the minibuffer, and it echoes your keys to the echo area in
an incremental way.

Lennart Borgman (gmail)

unread,
Aug 7, 2008, 8:10:09 PM8/7/08
to Drew Adams, Help-gn...@gnu.org

I am not sure and I have no idea why it should be needed, but try this

(define-key isearch-mode-map [backspace] 'isearch-delete-char)

TheLonelyStar

unread,
Aug 8, 2008, 4:22:50 AM8/8/08
to Help-gn...@gnu.org

Well, it works! Thanks!
--
View this message in context: http://www.nabble.com/Custom-backspace-delete-in-mini-buffer-tp18881785p18887783.html

0 new messages