aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2014-12-06 01:55:20 +0200
committerJoão Távora2015-01-13 07:39:15 +0000
commit18a89a069c3d66ddb96e512f254f67f69d51ae22 (patch)
treec3d1de00e208bdbac364d407d3a3cd7857d506e6
parentb544ab561fcb575790c963a2eda51524fa366409 (diff)
downloademacs-18a89a069c3d66ddb96e512f254f67f69d51ae22.tar.gz
emacs-18a89a069c3d66ddb96e512f254f67f69d51ae22.zip
Better support for multi-line shell input.
* lisp/comint.el (comint-history-isearch-search) (comint-history-isearch-wrap): Use field-beginning instead of comint-line-beginning-position. (comint-send-input): Go to the end of the field instead of the end of the line to accept whole multi-line input. http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00305.html [backport from trunk]
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/comint.el10
2 files changed, 14 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8481dd1fcce..ff384a4c14d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12015-01-13 Juri Linkov <juri@linkov.net>
2
3 * comint.el (comint-history-isearch-search)
4 (comint-history-isearch-wrap): Use field-beginning instead of
5 comint-line-beginning-position.
6 (comint-send-input): Go to the end of the field instead of the end
7 of the line to accept whole multi-line input.
8 http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00305.html
9
12015-01-09 Eli Zaretskii <eliz@gnu.org> 102015-01-09 Eli Zaretskii <eliz@gnu.org>
2 11
3 * net/net-utils.el (net-utils-run-program, net-utils-run-simple): 12 * net/net-utils.el (net-utils-run-program, net-utils-run-simple):
diff --git a/lisp/comint.el b/lisp/comint.el
index 257cacb7473..cd6ecb4c2f1 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1475,7 +1475,7 @@ Intended to be added to `isearch-mode-hook' in `comint-mode'."
1475 (or 1475 (or
1476 ;; 1. First try searching in the initial comint text 1476 ;; 1. First try searching in the initial comint text
1477 (funcall search-fun string 1477 (funcall search-fun string
1478 (if isearch-forward bound (comint-line-beginning-position)) 1478 (if isearch-forward bound (field-beginning))
1479 noerror) 1479 noerror)
1480 ;; 2. If the above search fails, start putting next/prev history 1480 ;; 2. If the above search fails, start putting next/prev history
1481 ;; elements in the comint successively, and search the string 1481 ;; elements in the comint successively, and search the string
@@ -1491,7 +1491,7 @@ Intended to be added to `isearch-mode-hook' in `comint-mode'."
1491 (when (null comint-input-ring-index) 1491 (when (null comint-input-ring-index)
1492 (error "End of history; no next item")) 1492 (error "End of history; no next item"))
1493 (comint-next-input 1) 1493 (comint-next-input 1)
1494 (goto-char (comint-line-beginning-position))) 1494 (goto-char (field-beginning)))
1495 (t 1495 (t
1496 ;; Signal an error here explicitly, because 1496 ;; Signal an error here explicitly, because
1497 ;; `comint-previous-input' doesn't signal an error. 1497 ;; `comint-previous-input' doesn't signal an error.
@@ -1509,7 +1509,7 @@ Intended to be added to `isearch-mode-hook' in `comint-mode'."
1509 (unless isearch-forward 1509 (unless isearch-forward
1510 ;; For backward search, don't search 1510 ;; For backward search, don't search
1511 ;; in the comint prompt 1511 ;; in the comint prompt
1512 (comint-line-beginning-position)) 1512 (field-beginning))
1513 noerror))) 1513 noerror)))
1514 ;; Return point of the new search result 1514 ;; Return point of the new search result
1515 (point)) 1515 (point))
@@ -1557,7 +1557,7 @@ or to the last history element for a backward search."
1557 (comint-goto-input (1- (ring-length comint-input-ring))) 1557 (comint-goto-input (1- (ring-length comint-input-ring)))
1558 (comint-goto-input nil)) 1558 (comint-goto-input nil))
1559 (setq isearch-success t) 1559 (setq isearch-success t)
1560 (goto-char (if isearch-forward (comint-line-beginning-position) (point-max)))) 1560 (goto-char (if isearch-forward (field-beginning) (point-max))))
1561 1561
1562(defun comint-history-isearch-push-state () 1562(defun comint-history-isearch-push-state ()
1563 "Save a function restoring the state of input history search. 1563 "Save a function restoring the state of input history search.
@@ -1775,7 +1775,7 @@ Similarly for Soar, Scheme, etc."
1775 (widen) 1775 (widen)
1776 (let* ((pmark (process-mark proc)) 1776 (let* ((pmark (process-mark proc))
1777 (intxt (if (>= (point) (marker-position pmark)) 1777 (intxt (if (>= (point) (marker-position pmark))
1778 (progn (if comint-eol-on-send (end-of-line)) 1778 (progn (if comint-eol-on-send (goto-char (field-end)))
1779 (buffer-substring pmark (point))) 1779 (buffer-substring pmark (point)))
1780 (let ((copy (funcall comint-get-old-input))) 1780 (let ((copy (funcall comint-get-old-input)))
1781 (goto-char pmark) 1781 (goto-char pmark)