comparison lisp/comint.el @ 33053:eb3d446c4a6e

(comint-replace-by-expanded-history): Don't use comint-get-old-input (we're not looking at *old* input). (comint-get-old-input-default): If using fields, signal an error when the point is not in an input field.
author Miles Bader <miles@gnu.org>
date Mon, 30 Oct 2000 06:21:13 +0000
parents ab1061464a32
children 968a0ee6275f
comparison
equal deleted inserted replaced
33052:9ec478daa468 33053:eb3d446c4a6e
1104 See `comint-magic-space' and `comint-replace-by-expanded-history-before-point'. 1104 See `comint-magic-space' and `comint-replace-by-expanded-history-before-point'.
1105 1105
1106 Returns t if successful." 1106 Returns t if successful."
1107 (interactive) 1107 (interactive)
1108 (if (and comint-input-autoexpand 1108 (if (and comint-input-autoexpand
1109 (string-match "!\\|^\\^" (funcall comint-get-old-input))
1110 (if comint-use-prompt-regexp-instead-of-fields 1109 (if comint-use-prompt-regexp-instead-of-fields
1111 ;; Use comint-prompt-regexp 1110 ;; Use comint-prompt-regexp
1112 (save-excursion (beginning-of-line) 1111 (save-excursion
1113 (looking-at comint-prompt-regexp)) 1112 (beginning-of-line)
1113 (looking-at (concat comint-prompt-regexp "!\\|\\^")))
1114 ;; Use input fields. User input that hasn't been entered 1114 ;; Use input fields. User input that hasn't been entered
1115 ;; yet, at the end of the buffer, has a nil `field' property. 1115 ;; yet, at the end of the buffer, has a nil `field' property.
1116 (null (get-char-property (point) 'field)))) 1116 (and (null (get-char-property (point) 'field))
1117 (string-match "!\\|^\\^" (field-string)))))
1117 ;; Looks like there might be history references in the command. 1118 ;; Looks like there might be history references in the command.
1118 (let ((previous-modified-tick (buffer-modified-tick))) 1119 (let ((previous-modified-tick (buffer-modified-tick)))
1119 (comint-replace-by-expanded-history-before-point silent start) 1120 (comint-replace-by-expanded-history-before-point silent start)
1120 (/= previous-modified-tick (buffer-modified-tick))))) 1121 (/= previous-modified-tick (buffer-modified-tick)))))
1121 1122
1709 (comint-skip-prompt) 1710 (comint-skip-prompt)
1710 (let ((beg (point))) 1711 (let ((beg (point)))
1711 (end-of-line) 1712 (end-of-line)
1712 (buffer-substring beg (point)))) 1713 (buffer-substring beg (point))))
1713 ;; Return the contents of the field at the current point. 1714 ;; Return the contents of the field at the current point.
1714 (field-string))) 1715 (let ((pos (field-beginning (point))))
1715 1716 (unless (eq (get-char-property pos 'field) 'input)
1717 (error "Point not in input field"))
1718 (field-string pos))))
1716 1719
1717 (defun comint-copy-old-input () 1720 (defun comint-copy-old-input ()
1718 "Insert after prompt old input at point as new input to be edited. 1721 "Insert after prompt old input at point as new input to be edited.
1719 Calls `comint-get-old-input' to get old input." 1722 Calls `comint-get-old-input' to get old input."
1720 (interactive) 1723 (interactive)