diff options
| author | Fabián Ezequiel Gallina | 2015-02-12 00:41:07 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2015-02-12 00:41:07 -0300 |
| commit | da726ad0c6177a3442a374a135f40a24945d362c (patch) | |
| tree | 9ea9a1ebe90d446b09427e7050bcd291aedb5b35 | |
| parent | 511acc77a4b0be3ed997c335f270b346a4ed0d5f (diff) | |
| download | emacs-da726ad0c6177a3442a374a135f40a24945d362c.tar.gz emacs-da726ad0c6177a3442a374a135f40a24945d362c.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 14 |
2 files changed, 16 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6c51e2aee98..b56a5d1f512 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2015-02-12 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 2 | |||
| 3 | python.el: Allow killing shell buffer if process is dead. (Bug#19823) | ||
| 4 | |||
| 5 | * progmodes/python.el (python-shell-font-lock-kill-buffer): Don't | ||
| 6 | require a running process. | ||
| 7 | (python-shell-font-lock-post-command-hook): Fontify only if the | ||
| 8 | shell process is running. | ||
| 9 | |||
| 1 | 2015-02-11 Stefan Monnier <monnier@iro.umontreal.ca> | 10 | 2015-02-11 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 11 | ||
| 3 | * hi-lock.el (hi-lock-unface-buffer): Don't call | 12 | * hi-lock.el (hi-lock-unface-buffer): Don't call |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index be747d008dd..20266097fed 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2301,12 +2301,11 @@ Signals an error if no shell buffer is available for current buffer." | |||
| 2301 | 2301 | ||
| 2302 | (defun python-shell-font-lock-kill-buffer () | 2302 | (defun python-shell-font-lock-kill-buffer () |
| 2303 | "Kill the font-lock buffer safely." | 2303 | "Kill the font-lock buffer safely." |
| 2304 | (python-shell-with-shell-buffer | 2304 | (when (and python-shell--font-lock-buffer |
| 2305 | (when (and python-shell--font-lock-buffer | 2305 | (buffer-live-p python-shell--font-lock-buffer)) |
| 2306 | (buffer-live-p python-shell--font-lock-buffer)) | 2306 | (kill-buffer python-shell--font-lock-buffer) |
| 2307 | (kill-buffer python-shell--font-lock-buffer) | 2307 | (when (derived-mode-p 'inferior-python-mode) |
| 2308 | (when (derived-mode-p 'inferior-python-mode) | 2308 | (setq python-shell--font-lock-buffer nil)))) |
| 2309 | (setq python-shell--font-lock-buffer nil))))) | ||
| 2310 | 2309 | ||
| 2311 | (defmacro python-shell-font-lock-with-font-lock-buffer (&rest body) | 2310 | (defmacro python-shell-font-lock-with-font-lock-buffer (&rest body) |
| 2312 | "Execute the forms in BODY in the font-lock buffer. | 2311 | "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." | |||
| 2357 | (defun python-shell-font-lock-post-command-hook () | 2356 | (defun python-shell-font-lock-post-command-hook () |
| 2358 | "Fontifies current line in shell buffer." | 2357 | "Fontifies current line in shell buffer." |
| 2359 | (let ((prompt-end (cdr (python-util-comint-last-prompt)))) | 2358 | (let ((prompt-end (cdr (python-util-comint-last-prompt)))) |
| 2360 | (when (and prompt-end (> (point) prompt-end)) | 2359 | (when (and prompt-end (> (point) prompt-end) |
| 2360 | (process-live-p (get-buffer-process (current-buffer)))) | ||
| 2361 | (let* ((input (buffer-substring-no-properties | 2361 | (let* ((input (buffer-substring-no-properties |
| 2362 | prompt-end (point-max))) | 2362 | prompt-end (point-max))) |
| 2363 | (start-pos prompt-end) | 2363 | (start-pos prompt-end) |