all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Custom backspace delete in mini-buffer
@ 2008-08-07 23:14 TheLonelyStar
  2008-08-07 23:33 ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: TheLonelyStar @ 2008-08-07 23:14 UTC (permalink / raw
  To: Help-gnu-emacs


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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Custom backspace delete in mini-buffer
  2008-08-07 23:14 Custom backspace delete in mini-buffer TheLonelyStar
@ 2008-08-07 23:33 ` Drew Adams
  2008-08-08  0:10   ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2008-08-07 23:33 UTC (permalink / raw
  To: 'TheLonelyStar', Help-gnu-emacs

> 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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Custom backspace delete in mini-buffer
  2008-08-07 23:33 ` Drew Adams
@ 2008-08-08  0:10   ` Lennart Borgman (gmail)
  2008-08-08  8:22     ` TheLonelyStar
  0 siblings, 1 reply; 4+ messages in thread
From: Lennart Borgman (gmail) @ 2008-08-08  0:10 UTC (permalink / raw
  To: Drew Adams; +Cc: Help-gnu-emacs

Drew Adams wrote:
>> 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.

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)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Custom backspace delete in mini-buffer
  2008-08-08  0:10   ` Lennart Borgman (gmail)
@ 2008-08-08  8:22     ` TheLonelyStar
  0 siblings, 0 replies; 4+ messages in thread
From: TheLonelyStar @ 2008-08-08  8:22 UTC (permalink / raw
  To: Help-gnu-emacs




Lennart Borgman (gmail) wrote:
> 
> Drew Adams wrote:
>>> 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.
> 
> 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)
> 
> 

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-08  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-07 23:14 Custom backspace delete in mini-buffer TheLonelyStar
2008-08-07 23:33 ` Drew Adams
2008-08-08  0:10   ` Lennart Borgman (gmail)
2008-08-08  8:22     ` TheLonelyStar

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.