Commit 0518b057 authored by Leo Liu's avatar Leo Liu
Browse files

* subr.el (process-live-p): Return nil for non-process.

* progmodes/sh-script.el (sh-shell-process):
* progmodes/octave.el (inferior-octave-process-live-p):
* progmodes/gdb-mi.el (gdb-delchar-or-quit)
(gdb-inferior-io-sentinel):
* emacs-lock.el (emacs-lock-live-process-p): All uses changed.

Fixes: debbugs:16023
parent 3adc9c6d
2013-12-02 Leo Liu <sdl.web@gmail.com>
* subr.el (process-live-p): Return nil for non-process. (Bug#16023)
* progmodes/sh-script.el (sh-shell-process):
* progmodes/octave.el (inferior-octave-process-live-p):
* progmodes/gdb-mi.el (gdb-delchar-or-quit)
(gdb-inferior-io-sentinel):
* emacs-lock.el (emacs-lock-live-process-p): All uses changed.
2013-12-02 Dmitry Gutov <dgutov@yandex.ru>
* vc/log-edit.el (log-edit-kill-buffer): Move the use of
......
......@@ -109,8 +109,7 @@ Internal use only.")
(defun emacs-lock-live-process-p (buffer-or-name)
"Return t if BUFFER-OR-NAME is associated with a live process."
(let ((proc (get-buffer-process buffer-or-name)))
(and proc (process-live-p proc))))
(process-live-p (get-buffer-process buffer-or-name)))
(defun emacs-lock--can-auto-unlock (action)
"Return t if the current buffer can auto-unlock for ACTION.
......
......@@ -981,7 +981,8 @@ no input, and GDB is waiting for input."
(eq gud-minor-mode 'gdbmi))
(error "Not in a GDB-MI buffer"))
(let ((proc (get-buffer-process gud-comint-buffer)))
(if (and (eobp) proc (process-live-p proc)
(if (and (eobp)
(process-live-p proc)
(not gud-running)
(= (point) (marker-position (process-mark proc))))
;; Sending an EOF does not work with GDB-MI; submit an
......@@ -1584,9 +1585,8 @@ this trigger is subscribed to `gdb-buf-publisher' and called with
;; read from the pty, and stops listening to it. If the gdb
;; process is still running, remove the pty, make a new one, and
;; pass it to gdb.
(let ((gdb-proc (get-buffer-process gud-comint-buffer))
(io-buffer (process-buffer proc)))
(when (and gdb-proc (process-live-p gdb-proc)
(let ((io-buffer (process-buffer proc)))
(when (and (process-live-p (get-buffer-process gud-comint-buffer))
(buffer-live-p io-buffer))
;; `comint-exec' deletes the original process as a side effect.
(comint-exec io-buffer "gdb-inferior" nil nil nil)
......
......@@ -700,7 +700,7 @@ in the Inferior Octave buffer.")
(declare-function compilation-forget-errors "compile" ())
(defun inferior-octave-process-live-p ()
(and inferior-octave-process (process-live-p inferior-octave-process)))
(process-live-p inferior-octave-process))
(define-derived-mode inferior-octave-mode comint-mode "Inferior Octave"
"Major mode for interacting with an inferior Octave process."
......
......@@ -1478,7 +1478,7 @@ frequently editing existing scripts with different styles.")
(defun sh-shell-process (force)
"Get a shell process for interaction.
If FORCE is non-nil and no process found, create one."
(if (and sh-shell-process (process-live-p sh-shell-process))
(if (process-live-p sh-shell-process)
sh-shell-process
(setq sh-shell-process
(let ((found nil) proc
......
......@@ -1885,9 +1885,11 @@ Signal an error if the program returns with a non-zero exit status."
(defun process-live-p (process)
"Returns non-nil if PROCESS is alive.
A process is considered alive if its status is `run', `open',
`listen', `connect' or `stop'."
(memq (process-status process)
'(run open listen connect stop)))
`listen', `connect' or `stop'. Value is nil if PROCESS is not a
process."
(and (processp process)
(memq (process-status process)
'(run open listen connect stop))))
;; compatibility
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment