Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Previous: Shell Mode, Up: Shell


41.4 Shell Prompts

A prompt is text output by a program to show that it is ready to accept new user input. Normally, Comint mode (and thus Shell mode) considers the prompt to be any text output by a program at the beginning of an input line. However, if the variable comint-use-prompt-regexp is non-nil, then Comint mode uses a regular expression to recognize prompts. In Shell mode, shell-prompt-pattern specifies the regular expression.

The value of comint-use-prompt-regexp also affects many motion and paragraph commands. If the value is non-nil, the general Emacs motion commands behave as they normally do in buffers without special text properties. However, if the value is nil, the default, then Comint mode divides the buffer into two types of “fields” (ranges of consecutive characters having the same field text property): input and output. Prompts are part of the output. Most Emacs motion commands do not cross field boundaries, unless they move over multiple lines. For instance, when point is in input on the same line as a prompt, C-a puts point at the beginning of the input if comint-use-prompt-regexp is nil and at the beginning of the line otherwise.

In Shell mode, only shell prompts start new paragraphs. Thus, a paragraph consists of a prompt and the input and output that follow it. However, if comint-use-prompt-regexp is nil, the default, most paragraph commands do not cross field boundaries. This means that prompts, ranges of input, and ranges of non-prompt output behave mostly like separate paragraphs; with this setting, numeric arguments to most paragraph commands yield essentially undefined behavior. For the purpose of finding paragraph boundaries, Shell mode uses shell-prompt-pattern, regardless of comint-use-prompt-regexp.


 
 
  Published under the terms of the GNU General Public License Design by Interspire