aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2001-08-27 13:03:53 +0000
committerMiles Bader2001-08-27 13:03:53 +0000
commitd3b98912ef807203ed444d394b4c34181c0fb635 (patch)
treed75bb19c33d9977ff948917cec70067de4b17af2
parentc7cbaf4a0eef175aa464729b5e25e9a957763e60 (diff)
downloademacs-d3b98912ef807203ed444d394b4c34181c0fb635.tar.gz
emacs-d3b98912ef807203ed444d394b4c34181c0fb635.zip
(comint-get-old-input-default): Don't signal an error if point is not on
an input field; instead, return the current line (using `comint-bol' to skip any prompt, in case we're not using fields at all).
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/comint.el37
2 files changed, 29 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7e06c86a677..b8f10b3ea16 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12001-08-22 Miles Bader <miles@gnu.org>
2
3 * comint.el (comint-get-old-input-default): Don't signal an error
4 if point is not on an input field; instead, return the current
5 line (using `comint-bol' to skip any prompt, in case we're not
6 using fields at all).
7
8 * man.el (Man-mode-line-format): Variable removed.
9 (Man-mode): Change `mode-line-buffer-identification' instead of
10 `mode-line-format'.
11
12001-08-27 Gerd Moellmann <gerd@gnu.org> 122001-08-27 Gerd Moellmann <gerd@gnu.org>
2 13
3 * mail/sendmail.el (mail-send-hook): Remove a duplicate defcustom. 14 * mail/sendmail.el (mail-send-hook): Remove a duplicate defcustom.
diff --git a/lisp/comint.el b/lisp/comint.el
index 05caf546cd2..3b0ccfc0890 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1372,10 +1372,13 @@ The values of `comint-get-old-input', `comint-input-filter-functions', and
1372in the buffer. E.g., 1372in the buffer. E.g.,
1373 1373
1374If the interpreter is the csh, 1374If the interpreter is the csh,
1375 comint-get-old-input is the default: either return the current 1375 comint-get-old-input is the default:
1376 field, or take the current line and discard any 1376 If `comint-use-prompt-regexp-instead-of-fields' is nil, then
1377 initial string matching regexp `comint-prompt-regexp', depending 1377 either return the current input field, if point is on an input
1378 on the value of `comint-use-prompt-regexp-instead-of-fields'. 1378 field, or the current line, if point is on an output field.
1379 If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then
1380 return the current line with any initial string matching the
1381 regexp `comint-prompt-regexp' removed.
1379 comint-input-filter-functions monitors input for \"cd\", \"pushd\", and 1382 comint-input-filter-functions monitors input for \"cd\", \"pushd\", and
1380 \"popd\" commands. When it sees one, it cd's the buffer. 1383 \"popd\" commands. When it sees one, it cd's the buffer.
1381 comint-input-filter is the default: returns t if the input isn't all white 1384 comint-input-filter is the default: returns t if the input isn't all white
@@ -1753,21 +1756,17 @@ This function could be on `comint-output-filter-functions' or bound to a key."
1753 1756
1754(defun comint-get-old-input-default () 1757(defun comint-get-old-input-default ()
1755 "Default for `comint-get-old-input'. 1758 "Default for `comint-get-old-input'.
1756Returns either the current field, or the current line with any initial 1759If `comint-use-prompt-regexp-instead-of-fields' is nil, then either
1757text matching `comint-prompt-regexp' stripped off, depending on the 1760return the current input field, if point is on an input field, or the
1758value of `comint-use-prompt-regexp-instead-of-fields'." 1761current line, if point is on an output field.
1759 (if comint-use-prompt-regexp-instead-of-fields 1762If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then return
1760 (save-excursion 1763the current line with any initial string matching the regexp
1761 (beginning-of-line) 1764`comint-prompt-regexp' removed."
1762 (comint-skip-prompt) 1765 (let ((bof (field-beginning)))
1763 (let ((beg (point))) 1766 (if (eq (get-char-property bof 'field) 'input)
1764 (end-of-line) 1767 (field-string bof)
1765 (buffer-substring beg (point)))) 1768 (comint-bol)
1766 ;; Return the contents of the field at the current point. 1769 (buffer-substring (point) (line-end-position)))))
1767 (let ((pos (field-beginning (point))))
1768 (unless (eq (get-char-property pos 'field) 'input)
1769 (error "Not an input field"))
1770 (field-string pos))))
1771 1770
1772(defun comint-copy-old-input () 1771(defun comint-copy-old-input ()
1773 "Insert after prompt old input at point as new input to be edited. 1772 "Insert after prompt old input at point as new input to be edited.