File:  [Research Unix] / researchv9 / cmd / emacs / macros / shell
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:59 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv9-SUN3_old, researchv9-SUN3, HEAD
researchv9-SUN3(old)

�edits the shell command file [MACRO]

  Shell command execution macros for Version 4.4 and later

	Joe Steffen and Bill Paulson

	This set of macros allows convenient execution of shell commands
 inside emacs.  Shell commands are kept in a "hidden" file
 named $HOME/.commands.  Use � to edit or move the line pointer in
 this file.  Exit from M-E by ^Z.  M-C displays the current line in
 this file in case you forget.  M-N and M-P move the cursor down and up,
 respectively, in the file and display the current line.  They take an
 argument just like ^N and ^P.  These commands make it easy to switch
 between several command lines without using the M-E macro.
	M-^E will execute the current line in the command file.  If the
 first character of the line is not '!', then any
 output will be captured in .exec just like using �.  On return
 from execution, the current buffer will be displayed in the top window,
 and .exec will be displayed in the lower window.  The shell output can
 then be examined as a regular buffer.
	If the first character of the line is '!', the output will be 
 displayed on the screen  as the command(s) are being executed
 just like using �.  This allows you to abort a program that is in an
 infinite loop, or to enter program input interactively.  Entering 'n'
 in place of a space when you get the "Continue?" prompt will execute the
 ^Xs macro described later.
	Note that the command line can contain multiple commands separated
 by semicolons.  Since emacs allows a line to be several hundred
 characters long, entire shell scripts can be executed.
	Note also that you can use � while editing the command buffer
 with �.  Thus you can test the command line and quickly change it if
 it contains an error.

B		save current buffer name
<$HOME/.commands
		change to command file
	recursively edit the command file
		return to original buffer

�displays the current line in shell command file [MACRO]
B			save this buffer name
<$HOME/.commands
			get the command file
��		save commands line
1>		pull original buffer name to top of stack
			return to the original buffer
0@		display the commands line

�displays (arg'th) next line in shell command file [MACRO]
B			save this buffer name
<$HOME/.commands
			get the command file
1		move to next line
��		save commands line
1>		pull original buffer name to top of stack
			return to the original buffer
0@		display the commands line

�displays (arg'th) previous line in shell command file [MACRO]
B			save this buffer name
<$HOME/.commands
			get the command file
1		move to previous line
��		save commands line
1>		pull original buffer name to top of stack
			return to the original buffer
0@		display the commands line

�executes current line in shell command file [MACRO]
0<Executing Commands
0		indicate that execution is in progress
B			save this buffer name
<filename=
+F		prepend "filename=<filename>;" to command
+<; 
<$HOME/.commands
			get the command file
!�		if the first char in the current line is a "!"
	�!			skip over the !
		12�-	prepend the filename assignment
			save the commands line
		12�-	restore comand line
		�		mark file updated
		1>	pull original buffer name to top of stack
				restore buffer
		<usilent
		�0
	turn off usilent mode (save old value)
		�		execute the line
		<usilent
		
	restore old usilent mode value
		!�-<Continue?
			�ns�	execute the shell if 'n' is entered
		�			otherwise exit
	�		if the first char is a $
	�$			skip over the $
		12�-	prepend the filename assignment
			save the commands line
		12�-	restore command line
		�		mark file updated
		1>	pull original buffer name to top of stack
				restore buffer
		<usilent
		�0
	turn off usilent mode (save old value)
		�		execute the commands line & save the output
		<usilent
		
	restore old usilent mode value
		1		ensure one window mode
		<.exec
		20	display .exec in lower window
		�		mark it as updated to prevent junk file
				switch to the top window
	�
	��	else
		12�-	prepend the filename assignment
			save the commands line
		12�-	restore command line
		�		mark file updated
		>		pull original buffer name to top of stack
				restore buffer
		0>	duplicate commands line
		0@	display commands line
		�		execute the commands line & save the output
		1		ensure one window mode
		<.exec
		20	display .exec in lower window
		�		mark it as updated to prevent junk file
				switch to the top window
	�
�			endif
			return to the original buffer

sescapes to the shell (enter ^D to exit) [MACRO]

	Joe Steffen, Version 4.0

	This macro executes the shell interactively
	instead of prompting for each command.  This allows cd
	commands to stay in effect and allows you to see the results of
	several commands.  The prompt is changed to 'emacs' to remind you
	that you are still within emacs.  Enter ^D instead of a null line to
	return to emacs.
<usilent
�0
	turn off usilent mode (save old value)
<export PS1; PS1='emacs ' exec ${SHELL:-/bin/sh} -i
�		execute the shell interactively with a different prompt
<usilent

	restore old usilent mode value


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.