File:  [Research Unix] / researchv9 / cmd / emacs / macros / shift
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)

�		shift marked area right or (arg != 1) left

	C. Douglas Blewett, modified by Joe Steffen

	Shift a region right or left.  An argument of != 1 shift
	left, otherwise right.  This is useful for programing in
	an indented language.
	
	The last line is shifted only if the region contains some 
	part of it.  This allows shifting a region containing the
	last line even if it does not end with a newline character.
	
12�				Mark the bottom
4�0=				Get one line number
					Goto the other end of the region
3�0=				Get the other line number
					Return to the original end of the region
|�
	�3~34	If cursor is at the top of the region
						Goto the bottom
	�
�
					The cursor is now at the bottom
					If at beginning of line
						Goto to previous line
4�0=				Get the bottom line number
					Goto the top
3�0=				Get the top line number
					Goto the bottom
5�12~43		Number of lines
5�11~51		Plus 1
^�5�12~51	Loop count times
	|�
		�1~1	Arg == 1 insert
				
		�
		� 			Delete
			!�11~64	White space
				�`		Space
					
				�
				�I	Tab
					
				�
			�
		�
	�
					Advance to next line
�
12				Goto the bottom


unix.superglobalmegacorp.com

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