From 410488d3aeae877ff13c005a9c4141d1d7ec9c91 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 24 Oct 2011 22:19:17 -0400 Subject: [PATCH] * lisp/comint.el (comint-get-old-input-default): Fix use-prompt-regexp case. Fixes: debbugs:9865 --- lisp/ChangeLog | 5 +++++ lisp/comint.el | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 57b89b973f1..32e46b2c172 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-10-25 Stefan Monnier + + * comint.el (comint-get-old-input-default): Fix use-prompt-regexp case + (bug#9865). + 2011-10-24 Glenn Morris * emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix. (Bug#9819) diff --git a/lisp/comint.el b/lisp/comint.el index 591be5e2d9d..dc3cdd9fa7a 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -2151,8 +2151,10 @@ current line, if point is on an output field. If `comint-use-prompt-regexp' is non-nil, then return the current line with any initial string matching the regexp `comint-prompt-regexp' removed." - (let ((bof (field-beginning))) - (if (null (get-char-property bof 'field)) ;Not `output'. + (let (bof) + (if (and comint-use-prompt-regexp + ;; Make sure we're in an input rather than output field. + (null (get-char-property (setq bof (field-beginning)) 'field))) (field-string-no-properties bof) (comint-bol) (buffer-substring-no-properties (point) (line-end-position))))) -- 2.11.4.GIT