Annotation of researchv9/cmd/emacs/macros/shell, revision 1.1.1.1

1.1       root        1: �edits the shell command file [MACRO]
                      2: 
                      3:   Shell command execution macros for Version 4.4 and later
                      4: 
                      5:       Joe Steffen and Bill Paulson
                      6: 
                      7:       This set of macros allows convenient execution of shell commands
                      8:  inside emacs.  Shell commands are kept in a "hidden" file
                      9:  named $HOME/.commands.  Use � to edit or move the line pointer in
                     10:  this file.  Exit from M-E by ^Z.  M-C displays the current line in
                     11:  this file in case you forget.  M-N and M-P move the cursor down and up,
                     12:  respectively, in the file and display the current line.  They take an
                     13:  argument just like ^N and ^P.  These commands make it easy to switch
                     14:  between several command lines without using the M-E macro.
                     15:       M-^E will execute the current line in the command file.  If the
                     16:  first character of the line is not '!', then any
                     17:  output will be captured in .exec just like using �.  On return
                     18:  from execution, the current buffer will be displayed in the top window,
                     19:  and .exec will be displayed in the lower window.  The shell output can
                     20:  then be examined as a regular buffer.
                     21:       If the first character of the line is '!', the output will be 
                     22:  displayed on the screen  as the command(s) are being executed
                     23:  just like using �.  This allows you to abort a program that is in an
                     24:  infinite loop, or to enter program input interactively.  Entering 'n'
                     25:  in place of a space when you get the "Continue?" prompt will execute the
                     26:  ^Xs macro described later.
                     27:       Note that the command line can contain multiple commands separated
                     28:  by semicolons.  Since emacs allows a line to be several hundred
                     29:  characters long, entire shell scripts can be executed.
                     30:       Note also that you can use � while editing the command buffer
                     31:  with �.  Thus you can test the command line and quickly change it if
                     32:  it contains an error.
                     33: 
                     34: B            save current buffer name
                     35: <$HOME/.commands
                     36:             change to command file
                     37:   recursively edit the command file
                     38:             return to original buffer
                     39: 
                     40: �displays the current line in shell command file [MACRO]
                     41: B                    save this buffer name
                     42: <$HOME/.commands
                     43:                     get the command file
                     44: &��          save commands line
                     45: 1>          pull original buffer name to top of stack
                     46:                     return to the original buffer
                     47: 0@          display the commands line
                     48: 
                     49: �displays (arg'th) next line in shell command file [MACRO]
                     50: B                    save this buffer name
                     51: <$HOME/.commands
                     52:                     get the command file
                     53: 1          move to next line
                     54: &��          save commands line
                     55: 1>          pull original buffer name to top of stack
                     56:                     return to the original buffer
                     57: 0@          display the commands line
                     58: 
                     59: �displays (arg'th) previous line in shell command file [MACRO]
                     60: B                    save this buffer name
                     61: <$HOME/.commands
                     62:                     get the command file
                     63: 1          move to previous line
                     64: &��          save commands line
                     65: 1>          pull original buffer name to top of stack
                     66:                     return to the original buffer
                     67: 0@          display the commands line
                     68: 
                     69: �executes current line in shell command file [MACRO]
                     70: 0<Executing Commands
                     71: 0          indicate that execution is in progress
                     72: B                    save this buffer name
                     73: <filename=
                     74: +F          prepend "filename=<filename>;" to command
                     75: +<; 
                     76: <$HOME/.commands
                     77:                     get the command file
                     78: &!�                if the first char in the current line is a "!"
                     79:        �!                    skip over the !
                     80:                12�-        prepend the filename assignment
                     81:                &   save the commands line
                     82:                12�&-   restore comand line
                     83:                �              mark file updated
                     84:                1>   pull original buffer name to top of stack
                     85:                             restore buffer
                     86:                <usilent
                     87:                �0
 turn off usilent mode (save old value)
                     88:                �              execute the line
                     89:                <usilent
                     90:                
   restore old usilent mode value
                     91:                !�-<Continue?
                     92:                        �ns�  execute the shell if 'n' is entered
                     93:                �                      otherwise exit
                     94:        �              if the first char is a $
                     95:        �$                    skip over the $
                     96:                12�-        prepend the filename assignment
                     97:                &   save the commands line
                     98:                12�&-   restore command line
                     99:                �              mark file updated
                    100:                1>   pull original buffer name to top of stack
                    101:                             restore buffer
                    102:                <usilent
                    103:                �0
 turn off usilent mode (save old value)
                    104:                �              execute the commands line & save the output
                    105:                <usilent
                    106:                
   restore old usilent mode value
                    107:                1             ensure one window mode
                    108:                <.exec
                    109:                20 display .exec in lower window
                    110:                �              mark it as updated to prevent junk file
                    111:                             switch to the top window
                    112:        �
                    113:        ��     else
                    114:                12�-        prepend the filename assignment
                    115:                &    save the commands line
                    116:                12�&-    restore command line
                    117:                �              mark file updated
                    118:                >             pull original buffer name to top of stack
                    119:                             restore buffer
                    120:                0>   duplicate commands line
                    121:                0@   display commands line
                    122:                �              execute the commands line & save the output
                    123:                1             ensure one window mode
                    124:                <.exec
                    125:                20 display .exec in lower window
                    126:                �              mark it as updated to prevent junk file
                    127:                             switch to the top window
                    128:        �
                    129: �                     endif
                    130:                     return to the original buffer
                    131: 
                    132: sescapes to the shell (enter ^D to exit) [MACRO]
                    133: 
                    134:       Joe Steffen, Version 4.0
                    135: 
                    136:       This macro executes the shell interactively
                    137:       instead of prompting for each command.  This allows cd
                    138:       commands to stay in effect and allows you to see the results of
                    139:       several commands.  The prompt is changed to 'emacs' to remind you
                    140:       that you are still within emacs.  Enter ^D instead of a null line to
                    141:       return to emacs.
                    142: <usilent
                    143: �0
        turn off usilent mode (save old value)
                    144: <export PS1; PS1='emacs ' exec ${SHELL:-/bin/sh} -i
                    145: �             execute the shell interactively with a different prompt
                    146: <usilent
                    147: 
  restore old usilent mode value
                    148: 

unix.superglobalmegacorp.com

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