Skip to content

Commit 9ca5f7e

Browse files
author
Detlef Groth
committed
adding function execute-region for macro development
1 parent 3af2d0f commit 9ca5f7e

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

jasspa/macros/me.ehf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@ Miscellaneous Information
767767
lslmdelete-some-buffers(2)le Delete buffers with query
768768
lslmexecute-buffer(2)le Execute script lines from a buffer
769769
lslmexecute-line(2)le Execute a typed in script line
770+
lslmexecute-region(3)le Execute marked script lines
770771
lslmfind-buffer(2)le (cDC-x bcA) Switch to a named buffer
771772
lslminsert-file-name(2)le (cDC-x C-ycA) Insert filename into current buffer
772773
lslmlist-buffers(2)le (cDC-x C-bcA) List all buffers and show their status
@@ -997,6 +998,7 @@ Miscellaneous Information
997998
lslmexecute-kbd-macro(2)le (cDC-x ecA) Execute a keyboard macro
998999
lslmexecute-line(2)le Execute a typed in script line
9991000
lslmexecute-named-command(2)le [cDesc xcA] Execute a named command
1001+
lslmexecute-region(3)le Execute marked script lines
10001002
lslminsert-macro(2)le Insert keyboard macro into buffer
10011003
lslmkbd-macro-query(2)le (cDC-x qcA) Query termination of keyboard macro
10021004
lslmname-kbd-macro(2)le Assign a name to the last keyboard macro
@@ -1949,6 +1951,7 @@ Miscellaneous Information
19491951
lslmexecute-kbd-macro(2)le (cDC-x ecA) Execute a keyboard macro
19501952
lslmexecute-line(2)le Execute a typed in script line
19511953
lslmexecute-named-command(2)le [cDesc xcA] Execute a named command
1954+
lslmexecute-region(3)le Execute marked script lines
19521955
lslmexecute-string(2)le Execute a string as a command
19531956
lslmexecute-tool(3)le Execute a user defined shell tool
19541957
lslmexit-emacs(2)le Exit MicroEmacs
@@ -2324,6 +2327,7 @@ Miscellaneous Information
23242327
lslmexecute-kbd-macro(2)le (cDC-x ecA) Execute a keyboard macro
23252328
lslmexecute-line(2)le Execute a typed in script line
23262329
lslmexecute-named-command(2)le [cDesc xcA] Execute a named command
2330+
lslmexecute-region(3)le Execute marked script lines
23272331
lslmexecute-string(2)le Execute a string as a command
23282332
lslmexit-emacs(2)le Exit MicroEmacs
23292333
lslmexpand-abbrev(2)le Expand an abbreviation
@@ -3519,6 +3523,7 @@ Miscellaneous Information
35193523
lslmexecute-kbd-macro(2)le (cDC-x ecA) Execute a keyboard macro
35203524
lslmexecute-line(2)le Execute a typed in script line
35213525
lslmexecute-named-command(2)le [cDesc xcA] Execute a named command
3526+
lslmexecute-region(3)le Execute marked script lines
35223527
lslmexecute-string(2)le Execute a string as a command
35233528
lslmexecute-tool(3)le Execute a user defined shell tool
35243529
lslmexit-emacs(2)le Exit MicroEmacs
@@ -14664,13 +14669,16 @@ $a
1466414669
lslmset-mark(2)le, lslmcopy-region(2)le, lslm$window-mark-col(5)le, lslm$window-mark-line(5)le.
1466514670
! 2 execute-buffer
1466614671
! 2 execute-line
14672+
! 3 execute-region
1466714673
cEcENAME cEcA
1466814674

1466914675

1467014676
|execute-buffer
1467114677
execute-buffer - Execute script lines from a buffer
1467214678
|execute-line
1467314679
execute-line - Execute a script line from the command line
14680+
|execute-region
14681+
execute-region - Execute marked script lines from a buffer
1467414682
$a
1467514683

1467614684

@@ -14679,7 +14687,7 @@ $a
1467914687

1468014688
cDexecute-buffercA "cCbuffer-namecA"
1468114689
cDexecute-linecA ["cCcommand-linecA"]
14682-
14690+
cDexecute-regioncA
1468314691

1468414692
cEcEDESCRIPTION cEcA
1468514693

@@ -14691,6 +14699,10 @@ $a
1469114699
cDexecute-linecA executes a in script line entered from the command line.
1469214700
Typically this is used in macros.
1469314701

14702+
cDexecute-regioncA executes Macro commands in a marked buffer region.
14703+
Typically this is used in macro development. Please note that all possible
14704+
narrows, hidden regions, are removed after execution, so show up again.
14705+
cDexecute-regioncA is implemented in misc.emf.
1469414706

1469514707
cEcESEE ALSO cEcA
1469614708

jasspa/macros/misc.emf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,25 @@ define-macro write-region
158158
delete-buffer $buffer-bname
159159
goto-position "\x88"
160160
!emacro
161+
162+
; execute-region - mark a aregion of code and the execute it
163+
; useful in macro development
164+
; code taken from me23
165+
; implemented by Steven Phillips
166+
define-macro execute-region
167+
set-alpha-mark "a"
168+
3 narrow-buffer
169+
!force !force !force execute-buffer $buffer-bname
170+
!if &set #l0 &not $status
171+
set-alpha-mark "a"
172+
!endif
173+
end-of-buffer
174+
forward-line
175+
2 narrow-buffer ; me23 it is 2?
176+
goto-alpha-mark "a"
177+
!if #l0
178+
ml-write &spr "[Error executing region in %s, line %d]" $buffer-bname $window-line
179+
!abort
180+
!endif
181+
182+
!emacro

0 commit comments

Comments
 (0)