* How to make Ctrl-d not log off the shell?
@ 2007-05-16 0:09 mowgli
2007-05-16 3:38 ` Tyler Smith
0 siblings, 1 reply; 8+ messages in thread
From: mowgli @ 2007-05-16 0:09 UTC (permalink / raw)
To: help-gnu-emacs
How do you make pressing Ctrl-d not log off the shell and instead ask
a question like Do you really want to quit? typing y quits the shell.
Ctrl-d is something I love in emacs and it works on the shell too but
sometimes is inconvinient due to this log off thing when erasing some
characters and you accidentally keep the Ctrl-d pressed a bit more.
Regards,
mowgli
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to make Ctrl-d not log off the shell?
2007-05-16 0:09 How to make Ctrl-d not log off the shell? mowgli
@ 2007-05-16 3:38 ` Tyler Smith
2007-05-17 8:48 ` Dieter Wilhelm
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Tyler Smith @ 2007-05-16 3:38 UTC (permalink / raw)
To: help-gnu-emacs
On 2007-05-16, mowgli <knowledgeless@gmail.com> wrote:
> How do you make pressing Ctrl-d not log off the shell and instead ask
> a question like Do you really want to quit? typing y quits the shell.
>
add this to your .emacs file:
(add-hook 'comint-mode-hook
'(lambda ()
(define-key comint-mode-map "\C-d" 'delete-char)))
> Ctrl-d is something I love in emacs and it works on the shell too but
> sometimes is inconvinient due to this log off thing when erasing some
> characters and you accidentally keep the Ctrl-d pressed a bit more.
I've done that too - sometimes it's very inconvenient!
Tyler
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to make Ctrl-d not log off the shell?
2007-05-16 3:38 ` Tyler Smith
@ 2007-05-17 8:48 ` Dieter Wilhelm
[not found] ` <mailman.761.1179392245.32220.help-gnu-emacs@gnu.org>
2007-06-09 22:37 ` Stefan Monnier
2 siblings, 0 replies; 8+ messages in thread
From: Dieter Wilhelm @ 2007-05-17 8:48 UTC (permalink / raw)
To: Tyler Smith; +Cc: help-gnu-emacs
Tyler Smith <tyler.smith@mail.mcgill.ca> writes:
> On 2007-05-16, mowgli <knowledgeless@gmail.com> wrote:
>> How do you make pressing Ctrl-d not log off the shell and instead ask
>> a question like Do you really want to quit? typing y quits the shell.
>>
> (add-hook 'comint-mode-hook
> '(lambda ()
> (define-key comint-mode-map "\C-d" 'delete-char)))
This might be an alternative at least when using a bash shell or
similar:
I mitigated such a problem for terminals and for the *shell* buffer
with placing the following in my .bashrc:
export IGNOREEOF=1 # only ^D twice is exiting now
Since it prints a warning before typing the decisive (in this case
second) C-d.
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.761.1179392245.32220.help-gnu-emacs@gnu.org>]
* Re: How to make Ctrl-d not log off the shell?
[not found] ` <mailman.761.1179392245.32220.help-gnu-emacs@gnu.org>
@ 2007-05-17 19:53 ` mowgli
2007-05-18 7:17 ` Dieter Wilhelm
0 siblings, 1 reply; 8+ messages in thread
From: mowgli @ 2007-05-17 19:53 UTC (permalink / raw)
To: help-gnu-emacs
On May 17, 1:48 pm, Dieter Wilhelm <die...@duenenhof-wilhelm.de>
wrote:
> Tyler Smith <tyler.sm...@mail.mcgill.ca> writes:
> > On 2007-05-16, mowgli <knowledgel...@gmail.com> wrote:
> >> How do you make pressing Ctrl-d not log off the shell and instead ask
> >> a question like Do you really want to quit? typing y quits the shell.
>
> > (add-hook 'comint-mode-hook
> > '(lambda ()
> > (define-key comint-mode-map "\C-d" 'delete-char)))
>
> This might be an alternative at least when using a bash shell or
> similar:
>
> I mitigated such a problem for terminals and for the *shell* buffer
> with placing the following in my .bashrc:
>
> export IGNOREEOF=1 # only ^D twice is exiting now
>
> Since it prints a warning before typing the decisive (in this case
> second) C-d.
This is what I wanted. But instead of twice, it would be nice to have
5 times instead. Because whenever there's an accidental logoff it's
mostly due to many Ctrl-d presses and not just two.
Where can I find documentaion for C-d for bash?
Regards,
mowgli
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to make Ctrl-d not log off the shell?
2007-05-17 19:53 ` mowgli
@ 2007-05-18 7:17 ` Dieter Wilhelm
2007-05-22 4:37 ` Xavier Maillard
0 siblings, 1 reply; 8+ messages in thread
From: Dieter Wilhelm @ 2007-05-18 7:17 UTC (permalink / raw)
To: mowgli; +Cc: help-gnu-emacs
mowgli <knowledgeless@gmail.com> writes:
> This is what I wanted. But instead of twice, it would be nice to have
> 5 times instead. Because whenever there's an accidental logoff it's
> mostly due to many Ctrl-d presses and not just two.
>
export IGNOREEOF=5 # only ^D (C-d) five times is exiting now.
> Where can I find documentaion for C-d for bash?
in a terminal type
$ info bash
and then
C-s IGNOREEOF
Normally it should also work under the Emacs info system (with C-h i)
but on my new debian system it's not yet working.
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to make Ctrl-d not log off the shell?
2007-05-16 3:38 ` Tyler Smith
2007-05-17 8:48 ` Dieter Wilhelm
[not found] ` <mailman.761.1179392245.32220.help-gnu-emacs@gnu.org>
@ 2007-06-09 22:37 ` Stefan Monnier
2 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2007-06-09 22:37 UTC (permalink / raw)
To: help-gnu-emacs
> (add-hook 'comint-mode-hook
> '(lambda ()
> (define-key comint-mode-map "\C-d" 'delete-char)))
Better yet:
(add-hook 'comint-mode-hook
(lambda ()
(define-key comint-mode-map "\C-d" nil)))
I.e. don't say to what C-d should be bound, just leave it be whatever it is
usually bound to.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to make Ctrl-d not log off the shell?
@ 2007-05-16 6:48 martin rudalics
0 siblings, 0 replies; 8+ messages in thread
From: martin rudalics @ 2007-05-16 6:48 UTC (permalink / raw)
To: tyler.smith; +Cc: help-gnu-emacs
We could rather do
(defun comint-delchar-or-maybe-eof (arg)
"Delete ARG characters forward or send an EOF to subprocess.
Sends an EOF only if point is at the end of the buffer and there is no input."
(interactive "p")
(let ((proc (get-buffer-process (current-buffer))))
(if (and (eobp) proc (= (point) (marker-position (process-mark proc))))
(when (y-or-n-p "Really send EOF? ")
(comint-send-eof))
(delete-char arg))))
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-06-09 22:37 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-16 0:09 How to make Ctrl-d not log off the shell? mowgli
2007-05-16 3:38 ` Tyler Smith
2007-05-17 8:48 ` Dieter Wilhelm
[not found] ` <mailman.761.1179392245.32220.help-gnu-emacs@gnu.org>
2007-05-17 19:53 ` mowgli
2007-05-18 7:17 ` Dieter Wilhelm
2007-05-22 4:37 ` Xavier Maillard
2007-06-09 22:37 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2007-05-16 6:48 martin rudalics
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).