From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Phillip Garland Newsgroups: gmane.emacs.bugs Subject: bug#10564: 24.0.92; octave-kill-process kills octave process without warning user Date: Thu, 19 Jan 2012 21:09:07 -0800 Message-ID: <878vl32c5o.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1327046216 20388 80.91.229.12 (20 Jan 2012 07:56:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2012 07:56:56 +0000 (UTC) To: 10564@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 20 08:56:52 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ro9L9-00049y-Kw for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jan 2012 08:56:51 +0100 Original-Received: from localhost ([::1]:58621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ro9L9-0004OI-6M for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jan 2012 02:56:51 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:49371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ro9JD-0002vU-5k for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 02:54:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ro9J9-00081t-1x for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 02:54:51 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ro9J8-00081k-VI for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 02:54:47 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Ro9KL-0005tR-NS for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 02:56:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Phillip Garland Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Jan 2012 07:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10564 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.132704611322581 (code B ref -1); Fri, 20 Jan 2012 07:56:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Jan 2012 07:55:13 +0000 Original-Received: from localhost ([127.0.0.1]:36066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ro9JY-0005s7-3q for submit@debbugs.gnu.org; Fri, 20 Jan 2012 02:55:13 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:39917) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ro6kT-0001Ig-O0 for submit@debbugs.gnu.org; Fri, 20 Jan 2012 00:10:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ro6jF-0005l4-6M for submit@debbugs.gnu.org; Fri, 20 Jan 2012 00:09:34 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:45981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ro6jF-0005l0-3U for submit@debbugs.gnu.org; Fri, 20 Jan 2012 00:09:33 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:53749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ro6jD-0001DL-NU for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 00:09:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ro6jB-0005kl-PS for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 00:09:31 -0500 Original-Received: from mail-gy0-f169.google.com ([209.85.160.169]:49492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ro6jB-0005kh-Lv for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 00:09:29 -0500 Original-Received: by ghrr14 with SMTP id r14so97537ghr.0 for ; Thu, 19 Jan 2012 21:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type; bh=9SANpRUMrIjgNvixBD/ujMjCRx6ZN1YXTf+utGeEKCU=; b=i4GJuiOEQ1vckUDLrDYwA2Wd1TPWv7nwv0A6ex4sLgd6mj2VGYZeWseSVEBPCvm1Y7 mMxCWZbIn/tOb8y2F079FYHbBVDJcnc5lSoWZAoPVDh1McpssehkMZfJ1dycq2SXTU/x Twu/MJ+hRch9A4SOnynitcGUecrnNtBcgHkuI= Original-Received: by 10.236.182.8 with SMTP id n8mr42727541yhm.26.1327036168599; Thu, 19 Jan 2012 21:09:28 -0800 (PST) Original-Received: from cradle (c-76-28-156-90.hsd1.wa.comcast.net. [76.28.156.90]) by mx.google.com with ESMTPS id j16sm5009099anm.9.2012.01.19.21.09.26 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jan 2012 21:09:27 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Fri, 20 Jan 2012 02:55:11 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Fri, 20 Jan 2012 02:56:48 -0500 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:55867 Archived-At: 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 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)