]> code.delx.au - gnu-emacs/commitdiff
* subr.el (process-live-p): Return nil for non-process.
authorLeo Liu <sdl.web@gmail.com>
Mon, 2 Dec 2013 07:13:01 +0000 (15:13 +0800)
committerLeo Liu <sdl.web@gmail.com>
Mon, 2 Dec 2013 07:13:01 +0000 (15:13 +0800)
* 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
lisp/ChangeLog
lisp/emacs-lock.el
lisp/progmodes/gdb-mi.el
lisp/progmodes/octave.el
lisp/progmodes/sh-script.el
lisp/subr.el

index b943b3c5fa88087177caaa8ab121edd3b08bcc70..df5766586974d3475b80da688e1ea3e05de89c6f 100644 (file)
@@ -1,3 +1,13 @@
+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
index ac12c149b0152cb2922f1c264dc6c5e91a57a8fe..f1fa9316c8201c9cdef8bb02d4b8fa1735590dc6 100644 (file)
@@ -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.
index 4b0a012e5383165d28acc0767c901bb33cca84f9..224def858957177145942909baf58a4043d88fcf 100644 (file)
@@ -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)
index 5e79e6627d8b6582bbae98b78acdbce335f46d18..7b9d7c97f856e4f60cab121ea66cec4a3b33898d 100644 (file)
@@ -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."
index 3ac0868414bf3f74129e37a3f164445949c5cadc..c270d433e76168349d8ec0552b079d1dd57539fb 100644 (file)
@@ -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
index b22c719f01060e6006c097df4a3d17ec01bf08af..6b1e99f337cbdab7646d511933da199982105e38 100644 (file)
@@ -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