python.el: Allow killing shell buffer if process is dead.
Fixes: debbugs:19823 * lisp/progmodes/python.el (python-shell-font-lock-kill-buffer): Don't require a running process. (python-shell-font-lock-post-command-hook): Fontify only if the shell process is running.
This commit is contained in:
parent
511acc77a4
commit
da726ad0c6
2 changed files with 16 additions and 7 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2015-02-12 Fabián Ezequiel Gallina <fgallina@gnu.org>
|
||||||
|
|
||||||
|
python.el: Allow killing shell buffer if process is dead. (Bug#19823)
|
||||||
|
|
||||||
|
* progmodes/python.el (python-shell-font-lock-kill-buffer): Don't
|
||||||
|
require a running process.
|
||||||
|
(python-shell-font-lock-post-command-hook): Fontify only if the
|
||||||
|
shell process is running.
|
||||||
|
|
||||||
2015-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
|
2015-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
* hi-lock.el (hi-lock-unface-buffer): Don't call
|
* hi-lock.el (hi-lock-unface-buffer): Don't call
|
||||||
|
|
|
@ -2301,12 +2301,11 @@ Signals an error if no shell buffer is available for current buffer."
|
||||||
|
|
||||||
(defun python-shell-font-lock-kill-buffer ()
|
(defun python-shell-font-lock-kill-buffer ()
|
||||||
"Kill the font-lock buffer safely."
|
"Kill the font-lock buffer safely."
|
||||||
(python-shell-with-shell-buffer
|
(when (and python-shell--font-lock-buffer
|
||||||
(when (and python-shell--font-lock-buffer
|
(buffer-live-p python-shell--font-lock-buffer))
|
||||||
(buffer-live-p python-shell--font-lock-buffer))
|
(kill-buffer python-shell--font-lock-buffer)
|
||||||
(kill-buffer python-shell--font-lock-buffer)
|
(when (derived-mode-p 'inferior-python-mode)
|
||||||
(when (derived-mode-p 'inferior-python-mode)
|
(setq python-shell--font-lock-buffer nil))))
|
||||||
(setq python-shell--font-lock-buffer nil)))))
|
|
||||||
|
|
||||||
(defmacro python-shell-font-lock-with-font-lock-buffer (&rest body)
|
(defmacro python-shell-font-lock-with-font-lock-buffer (&rest body)
|
||||||
"Execute the forms in BODY in the font-lock buffer.
|
"Execute the forms in BODY in the font-lock buffer.
|
||||||
|
@ -2357,7 +2356,8 @@ goes wrong and syntax highlighting in the shell gets messed up."
|
||||||
(defun python-shell-font-lock-post-command-hook ()
|
(defun python-shell-font-lock-post-command-hook ()
|
||||||
"Fontifies current line in shell buffer."
|
"Fontifies current line in shell buffer."
|
||||||
(let ((prompt-end (cdr (python-util-comint-last-prompt))))
|
(let ((prompt-end (cdr (python-util-comint-last-prompt))))
|
||||||
(when (and prompt-end (> (point) prompt-end))
|
(when (and prompt-end (> (point) prompt-end)
|
||||||
|
(process-live-p (get-buffer-process (current-buffer))))
|
||||||
(let* ((input (buffer-substring-no-properties
|
(let* ((input (buffer-substring-no-properties
|
||||||
prompt-end (point-max)))
|
prompt-end (point-max)))
|
||||||
(start-pos prompt-end)
|
(start-pos prompt-end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue