# HG changeset patch # User Luc Teirlinck # Date 1114557077 0 # Node ID 1cd2d4d601faba8fb97c8440bb7961d2e38859aa # Parent 0c656a4bd81b5f344619365fb4986a07a779b5c4 (comint-prompt-regexp, comint-get-old-input) (comint-use-prompt-regexp) (comint-use-prompt-regexp-instead-of-fields) (comint-replace-by-expanded-history, comint-send-input) (comint-output-filter, comint-get-old-input-default) (comint-line-beginning-position, comint-bol, comint-show-output) (comint-backward-matching-input, comint-forward-matching-input) (comint-next-prompt, comint-previous-prompt): Rename `comint-use-prompt-regexp-instead-of-fields' to `comint-use-prompt-regexp'. Keep old name as alias and declare obsolete. (comint-use-prompt-regexp): Shorten first line of doc string. diff -r 0c656a4bd81b -r 1cd2d4d601fa lisp/comint.el --- a/lisp/comint.el Tue Apr 26 22:42:28 2005 +0000 +++ b/lisp/comint.el Tue Apr 26 23:11:17 2005 +0000 @@ -159,7 +159,7 @@ Defaults to \"^\", the null string at BOL. This variable is only used if the variable -`comint-use-prompt-regexp-instead-of-fields' is non-nil. +`comint-use-prompt-regexp' is non-nil. Good choices: Canonical Lisp: \"^[^> \\n]*>+:? *\" (Lucid, franz, kcl, T, cscheme, oaklisp) @@ -353,7 +353,7 @@ default is `comint-get-old-input-default', which either grabs the current input field or grabs the current line and strips off leading text matching `comint-prompt-regexp', depending on the value of -`comint-use-prompt-regexp-instead-of-fields'.") +`comint-use-prompt-regexp'.") (defvar comint-dynamic-complete-functions '(comint-replace-by-expanded-history comint-dynamic-complete-filename) @@ -406,8 +406,8 @@ ;; Note: If it is decided to purge comint-prompt-regexp from the source ;; entirely, searching for uses of this variable will help to identify ;; places that need attention. -(defcustom comint-use-prompt-regexp-instead-of-fields nil - "*If non-nil, use `comint-prompt-regexp' to distinguish prompts from user-input. +(defcustom comint-use-prompt-regexp nil + "*If non-nil, use `comint-prompt-regexp' to recognize prompts. If nil, then program output and user-input are given different `field' properties, which Emacs commands can use to distinguish them (in particular, common movement commands such as begining-of-line respect @@ -415,6 +415,13 @@ :type 'boolean :group 'comint) +;; Autoload is necessary for Custom to recognize old alias. +;;;###autoload +(defvaralias 'comint-use-prompt-regexp-instead-of-fields + 'comint-use-prompt-regexp) +(make-obsolete-variable 'comint-use-prompt-regexp-instead-of-fields + 'comint-use-prompt-regexp "22.1") + (defcustom comint-mode-hook '(turn-on-font-lock) "Hook run upon entry to `comint-mode'. This is run before the process is cranked up." @@ -1150,7 +1157,7 @@ Returns t if successful." (interactive) (if (and comint-input-autoexpand - (if comint-use-prompt-regexp-instead-of-fields + (if comint-use-prompt-regexp ;; Use comint-prompt-regexp (save-excursion (beginning-of-line) @@ -1419,10 +1426,10 @@ If the interpreter is the csh, `comint-get-old-input' is the default: - If `comint-use-prompt-regexp-instead-of-fields' is nil, then + If `comint-use-prompt-regexp' is nil, then either return the current input field, if point is on an input field, or the current line, if point is on an output field. - If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then + If `comint-use-prompt-regexp' is non-nil, then return the current line with any initial string matching the regexp `comint-prompt-regexp' removed. `comint-input-filter-functions' monitors input for \"cd\", \"pushd\", and @@ -1487,14 +1494,14 @@ font-lock-face comint-highlight-input mouse-face highlight help-echo "mouse-2: insert after prompt as new input")) - (unless comint-use-prompt-regexp-instead-of-fields + (unless comint-use-prompt-regexp ;; Give old user input a field property of `input', to ;; distinguish it from both process output and unsent ;; input. The terminating newline is put into a special ;; `boundary' field to make cursor movement between input ;; and output fields smoother. (put-text-property beg end 'field 'input))) - (unless (or no-newline comint-use-prompt-regexp-instead-of-fields) + (unless (or no-newline comint-use-prompt-regexp) ;; Cover the terminating newline (add-text-properties end (1+ end) '(rear-nonsticky t @@ -1708,7 +1715,7 @@ (goto-char (process-mark process)) ; in case a filter moved it - (unless comint-use-prompt-regexp-instead-of-fields + (unless comint-use-prompt-regexp (let ((inhibit-read-only t) (inhibit-modification-hooks t)) (add-text-properties comint-last-output-start (point) @@ -1844,10 +1851,10 @@ (defun comint-get-old-input-default () "Default for `comint-get-old-input'. -If `comint-use-prompt-regexp-instead-of-fields' is nil, then either +If `comint-use-prompt-regexp' is nil, then either return the current input field, if point is on an input field, or the current line, if point is on an output field. -If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then return +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))) @@ -1880,10 +1887,10 @@ (defun comint-line-beginning-position () "Return the buffer position of the beginning of the line, after any prompt. -If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then the -prompt skip is done by skipping text matching the regular expression -`comint-prompt-regexp', a buffer local variable." - (if comint-use-prompt-regexp-instead-of-fields +If `comint-use-prompt-regexp' is non-nil, then the prompt skip is done by +skipping text matching the regular expression `comint-prompt-regexp', +a buffer local variable." + (if comint-use-prompt-regexp ;; Use comint-prompt-regexp (save-excursion (beginning-of-line) @@ -1901,9 +1908,9 @@ (defun comint-bol (&optional arg) "Go to the beginning of line, then skip past the prompt, if any. If prefix argument is given (\\[universal-argument]) the prompt is not skipped. -If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then the -prompt skip is done by skipping text matching the regular expression -`comint-prompt-regexp', a buffer local variable." +If `comint-use-prompt-regexp' is non-nil, then the prompt skip is done +by skipping text matching the regular expression `comint-prompt-regexp', +a buffer local variable." (interactive "P") (if arg ;; Unlike `beginning-of-line', forward-line ignores field boundaries @@ -2034,7 +2041,7 @@ (interactive) (push-mark) (let ((pos (or (marker-position comint-last-input-end) (point-max)))) - (cond (comint-use-prompt-regexp-instead-of-fields + (cond (comint-use-prompt-regexp (goto-char pos) (beginning-of-line 0) (set-window-start (selected-window) (point)) @@ -2127,13 +2134,13 @@ (defun comint-backward-matching-input (regexp n) "Search backward through buffer for input fields that match REGEXP. -If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then input -fields are identified by lines that match `comint-prompt-regexp'. +If `comint-use-prompt-regexp' is non-nil, then input fields are identified +by lines that match `comint-prompt-regexp'. With prefix argument N, search for Nth previous match. If N is negative, find the next or Nth next match." (interactive (comint-regexp-arg "Backward input matching (regexp): ")) - (if comint-use-prompt-regexp-instead-of-fields + (if comint-use-prompt-regexp ;; Use comint-prompt-regexp (let* ((re (concat comint-prompt-regexp ".*" regexp)) (pos (save-excursion (end-of-line (if (> n 0) 0 1)) @@ -2159,8 +2166,8 @@ (defun comint-forward-matching-input (regexp arg) "Search forward through buffer for input fields that match REGEXP. -If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then input -fields are identified by lines that match `comint-prompt-regexp'. +If `comint-use-prompt-regexp' is non-nil, then input fields are identified +by lines that match `comint-prompt-regexp'. With prefix argument N, search for Nth following match. If N is negative, find the previous or Nth previous match." @@ -2170,11 +2177,11 @@ (defun comint-next-prompt (n) "Move to end of Nth next prompt in the buffer. -If `comint-use-prompt-regexp-instead-of-fields' is nil, then this means -the beginning of the Nth next `input' field, otherwise, it means the Nth -occurrence of text matching `comint-prompt-regexp'." +If `comint-use-prompt-regexp' is nil, then this means the beginning of +the Nth next `input' field, otherwise, it means the Nth occurrence of +text matching `comint-prompt-regexp'." (interactive "p") - (if comint-use-prompt-regexp-instead-of-fields + (if comint-use-prompt-regexp ;; Use comint-prompt-regexp (let ((paragraph-start comint-prompt-regexp)) (end-of-line (if (> n 0) 1 0)) @@ -2207,9 +2214,9 @@ (defun comint-previous-prompt (n) "Move to end of Nth previous prompt in the buffer. -If `comint-use-prompt-regexp-instead-of-fields' is nil, then this means -the beginning of the Nth previous `input' field, otherwise, it means the Nth -occurrence of text matching `comint-prompt-regexp'." +If `comint-use-prompt-regexp' is nil, then this means the beginning of +the Nth previous `input' field, otherwise, it means the Nth occurrence of +text matching `comint-prompt-regexp'." (interactive "p") (comint-next-prompt (- n))) @@ -3022,7 +3029,7 @@ ;; appropriate magic default by examining what we think is the prompt)? ;; ;; Fixme: look for appropriate fields, rather than regexp, if -;; `comint-use-prompt-regexp-instead-of-fields' is true. +;; `comint-use-prompt-regexp' is true. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variables