comparison lisp/shell.el @ 30641:297909766bad

(shell-prompt-pattern): Doc change. (shell-backward-command): Use line-beginning-position.
author Miles Bader <miles@gnu.org>
date Mon, 07 Aug 2000 14:51:48 +0000
parents cbe304a26771
children 7c81a282d217
comparison
equal deleted inserted replaced
30640:6f943008c543 30641:297909766bad
124 (defcustom shell-prompt-pattern "^[^#$%>\n]*[#$%>] *" 124 (defcustom shell-prompt-pattern "^[^#$%>\n]*[#$%>] *"
125 "Regexp to match prompts in the inferior shell. 125 "Regexp to match prompts in the inferior shell.
126 Defaults to \"^[^#$%>\\n]*[#$%>] *\", which works pretty well. 126 Defaults to \"^[^#$%>\\n]*[#$%>] *\", which works pretty well.
127 This variable is used to initialise `comint-prompt-regexp' in the 127 This variable is used to initialise `comint-prompt-regexp' in the
128 shell buffer. 128 shell buffer.
129
130 This variable is only used if the variable
131 `comint-use-prompt-regexp-instead-of-fields' is non-nil.
129 132
130 The pattern should probably not match more than one line. If it does, 133 The pattern should probably not match more than one line. If it does,
131 Shell mode may become confused trying to distinguish prompt from input 134 Shell mode may become confused trying to distinguish prompt from input
132 on lines which don't start with a prompt. 135 on lines which don't start with a prompt.
133 136
812 (defun shell-backward-command (&optional arg) 815 (defun shell-backward-command (&optional arg)
813 "Move backward across ARG shell command(s). Does not cross lines. 816 "Move backward across ARG shell command(s). Does not cross lines.
814 See `shell-command-regexp'." 817 See `shell-command-regexp'."
815 (interactive "p") 818 (interactive "p")
816 (let ((limit (save-excursion (comint-bol nil) (point)))) 819 (let ((limit (save-excursion (comint-bol nil) (point))))
817 (if (> limit (point)) 820 (when (> limit (point))
818 (save-excursion (beginning-of-line) (setq limit (point)))) 821 (setq limit (line-beginning-position)))
819 (skip-syntax-backward " " limit) 822 (skip-syntax-backward " " limit)
820 (if (re-search-backward 823 (if (re-search-backward
821 (format "[;&|]+[\t ]*\\(%s\\)" shell-command-regexp) limit 'move arg) 824 (format "[;&|]+[\t ]*\\(%s\\)" shell-command-regexp) limit 'move arg)
822 (progn (goto-char (match-beginning 1)) 825 (progn (goto-char (match-beginning 1))
823 (skip-chars-forward ";&|"))))) 826 (skip-chars-forward ";&|")))))