* More than two choices in query
@ 2009-02-07 15:01 Chetan Pandya
2009-02-07 15:21 ` Stefan Monnier
2009-02-07 20:07 ` Geoff Gole
0 siblings, 2 replies; 5+ messages in thread
From: Chetan Pandya @ 2009-02-07 15:01 UTC (permalink / raw)
To: emacs-devel
There was a question some time back if there is a way to query with more than two choices (y/n). Was there a resolution of that question or everyone who needs something like that is supposed to implement their own solution?
I start firefox with browse-url. When I try to exit emacs, it shows me active process and gives me two choices, either don't exit emacs or kill emacs and take down firefox as well. What I would like is something like "abort, retry, ignore" so that it can keep firefox running and still exit emacs. sometime C-g in a query can do what you want, but when trying to kill emacs, it is more often the wrong thing to happen.
-Chetan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: More than two choices in query
2009-02-07 15:01 More than two choices in query Chetan Pandya
@ 2009-02-07 15:21 ` Stefan Monnier
2009-02-07 19:48 ` Chetan Pandya
2009-02-07 20:07 ` Geoff Gole
1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2009-02-07 15:21 UTC (permalink / raw)
To: Chetan Pandya; +Cc: emacs-devel
> There was a question some time back if there is a way to query with
> more than two choices (y/n). Was there a resolution of that question
> or everyone who needs something like that is supposed to implement
> their own solution?
There's still no predefined function for that, AFAIK.
> I start firefox with browse-url. When I try to exit Emacs, it shows me
> active process and gives me two choices, either don't exit Emacs or
> kill Emacs and take down firefox as well.
IIUC the problem here is not really the prompt but the fact that the
C code of Emacs does not offer any way to exit Emacs without killing the
subprocesses (no way to "detach" from them). If this were possible
a simple y/n prompt would still be sufficient, where "y" means "kill the
process", "n" means "don't kill but exit nevertheless" and C-g would
mean "don't exit".
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: More than two choices in query
2009-02-07 15:21 ` Stefan Monnier
@ 2009-02-07 19:48 ` Chetan Pandya
2009-02-08 3:24 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Chetan Pandya @ 2009-02-07 19:48 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]
From: Stefan Monnier <monnier@iro.umontreal.ca>
>> There was a question some time back if there is a way to query with
>> more than two choices (y/n). Was there a resolution of that question
>> or everyone who needs something like that is supposed to implement
>> their own solution?
> There's still no predefined function for that, AFAIK.
>> I start firefox with browse-url. When I try to exit Emacs, it shows me
>> active process and gives me two choices, either don't exit Emacs or
>> kill Emacs and take down firefox as well.
> IIUC the problem here is not really the prompt but the fact that the
> C code of Emacs does not offer any way to exit Emacs without killing the
> subprocesses (no way to "detach" from them). If this were possible
> a simple y/n prompt would still be sufficient, where "y" means "kill the
> process", "n" means "don't kill but exit nevertheless" and C-g would
> mean "don't exit".
> Stefan
Here is a patch to proess.c:kill_buffer_processes that does not kill processes
not associated with a buffer.
However, this still gives a message there are active processes kill them?
If the answer is y, the firefox process is not killed.
Chetan
[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 793 bytes --]
--- process.c 29 Jan 2009 14:34:38 -0000 1.579
+++ process.c 7 Feb 2009 19:39:28 -0000
@@ -6481,7 +6481,8 @@
}
/* Kill all processes associated with `buffer'.
- If `buffer' is nil, kill all processes */
+ If `buffer' is nil, kill all processes associated with a buffer.
+ If buffer it Qt, kill all processes. */
void
kill_buffer_processes (buffer)
@@ -6493,7 +6494,9 @@
{
proc = XCDR (XCAR (tail));
if (PROCESSP (proc)
- && (NILP (buffer) || EQ (XPROCESS (proc)->buffer, buffer)))
+ && ((NILP(buffer) && !NILP (XPROCESS (proc)->buffer))
+ || (!NILP(buffer) && EQ (XPROCESS (proc)->buffer, buffer))
+ || (EQ (buffer, Qt))))
{
if (NETCONN_P (proc) || SERIALCONN_P (proc))
Fdelete_process (proc);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: More than two choices in query
2009-02-07 19:48 ` Chetan Pandya
@ 2009-02-08 3:24 ` Stefan Monnier
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2009-02-08 3:24 UTC (permalink / raw)
To: Chetan Pandya; +Cc: emacs-devel
> Here is a patch to proess.c:kill_buffer_processes that does not kill
> processes not associated with a buffer.
I think we'll want some such change, but it should wait for 23.2.
> However, this still gives a message there are active processes kill them?
> If the answer is y, the firefox process is not killed.
The code will need to be adjusted there, obviously.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: More than two choices in query
2009-02-07 15:01 More than two choices in query Chetan Pandya
2009-02-07 15:21 ` Stefan Monnier
@ 2009-02-07 20:07 ` Geoff Gole
1 sibling, 0 replies; 5+ messages in thread
From: Geoff Gole @ 2009-02-07 20:07 UTC (permalink / raw)
To: Chetan Pandya, emacs-devel, monnier
> There was a question some time back if there is a way to query with more than two choices (y/n). Was there a resolution of that question or everyone who needs something like that is supposed to implement their own solution?
>
I've done this by passing a list of one object to map-y-or-n-p and
making use of the action-alist parameter. That will still present one
yes/no question to the user, but they can take more than two actions.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-02-08 3:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-07 15:01 More than two choices in query Chetan Pandya
2009-02-07 15:21 ` Stefan Monnier
2009-02-07 19:48 ` Chetan Pandya
2009-02-08 3:24 ` Stefan Monnier
2009-02-07 20:07 ` Geoff Gole
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).