--- Begin Message ---
Subject: |
24.0.92; octave-kill-process kills octave process without warning user |
Date: |
Thu, 19 Jan 2012 21:09:07 -0800 |
I recently started using octave and discovered a frustrating problem
with octave mode. It's too easy to accidently kill the inferior octave
process.
C-c C-i l executes a line of octave code from an octave buffer
C-c C-i k kills the inferior octave process (octave-kill-process)
Sometimes, when I want to execute a line of code, my finger slipped,
hitting the 'k' key instead of the 'l' key, and the octave process is
immediately killed, losing the results of my computations. Right now,
octave-kill-process kills the octave process without double-checking
with the user. It does ask if you really want to kill the inferior
octave buffer, but at that point, the process has already been killed.
Right now octave-kill-buffer is defined like this:
(defun octave-kill-process ()
"Kill inferior Octave process and its buffer."
(interactive)
(if inferior-octave-process
(progn
(process-send-string inferior-octave-process "quit;\n")
(accept-process-output inferior-octave-process)))
(if inferior-octave-buffer
(kill-buffer inferior-octave-buffer)))
There seems to me to be at least three ways to solve this
problem. octave-kill-process could just call kill-buffer and have
kill-buffer kill the octave process:
(defun octave-kill-process ()
"Kill inferior Octave process and its buffer."
(interactive)
(if inferior-octave-buffer
(kill-buffer inferior-octave-buffer)))
The disadvantage of this is that there is no way to kill the process but
retain the inferior octave buffer (if you wanted to keep a record of your
octave session).
Alternatively, octave kill-process could first query the user about
killing the process, then if they kill the process, query them about
killing the inferior octave buffer:
(defun octave-kill-process ()
"Kill inferior Octave process and its buffer."
(interactive)
(if (and inferior-octave-process
(yes-or-no-p
(format "Really kill the running Octave process? ")))
(progn
(process-send-string inferior-octave-process "quit;\n")
(accept-process-output inferior-octave-process)
(if inferior-octave-buffer
(kill-buffer inferior-octave-buffer)))))
It's a little annoying to be queried twice, first to kill the process,
second to kill the buffer, when killing both is probably the common
case, but this seems like the least worst solution to me.
Finally, octave-kill-buffer could just kill the inferior octave process
and leave the inferior octave buffer around for the user to clean up:
(defun octave-kill-process ()
"Kill inferior Octave process"
(interactive)
(if (and inferior-octave-process
(yes-or-no-p
(format "Really kill the running Octave process? ")))
(progn
(process-send-string inferior-octave-process "quit;\n")
(accept-process-output inferior-octave-process))))
Thanks!
~Phillip
In GNU Emacs 24.0.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.8)
of 2012-01-17 on cradle
Windowing system distributor `The X.Org Foundation', version 11.0.11102902
configured using `configure '--prefix=/usr/local''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Fundamental
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
M-x r e p o r t - e m a c s - b u g <return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr message format-spec rfc822 mml easymenu
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
emacsbug time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#10564: 24.0.92; octave-kill-process kills octave process without warning user |
Date: |
Fri, 22 Nov 2013 10:07:34 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9) |
Fixed in 24.4
On 2012-01-20 13:09 +0800, Phillip Garland wrote:
> I recently started using octave and discovered a frustrating problem
> with octave mode. It's too easy to accidently kill the inferior octave
> process.
Hi Phillip,
Just noticed this bug report. Should be fixed in emacs trunk and will
show up in Emacs 24.4. Sorry for the long delay.
Leo
--- End Message ---