Skip to content

Commit

Permalink
adding function execute-region for macro development
Browse files Browse the repository at this point in the history
  • Loading branch information
Detlef Groth committed Nov 12, 2023
1 parent 3af2d0f commit 9ca5f7e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
14 changes: 13 additions & 1 deletion jasspa/macros/me.ehf
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ Miscellaneous Information
lslmdelete-some-buffers(2)le Delete buffers with query
lslmexecute-buffer(2)le Execute script lines from a buffer
lslmexecute-line(2)le Execute a typed in script line
lslmexecute-region(3)le Execute marked script lines
lslmfind-buffer(2)le (cDC-x bcA) Switch to a named buffer
lslminsert-file-name(2)le (cDC-x C-ycA) Insert filename into current buffer
lslmlist-buffers(2)le (cDC-x C-bcA) List all buffers and show their status
Expand Down Expand Up @@ -997,6 +998,7 @@ Miscellaneous Information
lslmexecute-kbd-macro(2)le (cDC-x ecA) Execute a keyboard macro
lslmexecute-line(2)le Execute a typed in script line
lslmexecute-named-command(2)le [cDesc xcA] Execute a named command
lslmexecute-region(3)le Execute marked script lines
lslminsert-macro(2)le Insert keyboard macro into buffer
lslmkbd-macro-query(2)le (cDC-x qcA) Query termination of keyboard macro
lslmname-kbd-macro(2)le Assign a name to the last keyboard macro
Expand Down Expand Up @@ -1949,6 +1951,7 @@ Miscellaneous Information
lslmexecute-kbd-macro(2)le (cDC-x ecA) Execute a keyboard macro
lslmexecute-line(2)le Execute a typed in script line
lslmexecute-named-command(2)le [cDesc xcA] Execute a named command
lslmexecute-region(3)le Execute marked script lines
lslmexecute-string(2)le Execute a string as a command
lslmexecute-tool(3)le Execute a user defined shell tool
lslmexit-emacs(2)le Exit MicroEmacs
Expand Down Expand Up @@ -2324,6 +2327,7 @@ Miscellaneous Information
lslmexecute-kbd-macro(2)le (cDC-x ecA) Execute a keyboard macro
lslmexecute-line(2)le Execute a typed in script line
lslmexecute-named-command(2)le [cDesc xcA] Execute a named command
lslmexecute-region(3)le Execute marked script lines
lslmexecute-string(2)le Execute a string as a command
lslmexit-emacs(2)le Exit MicroEmacs
lslmexpand-abbrev(2)le Expand an abbreviation
Expand Down Expand Up @@ -3519,6 +3523,7 @@ Miscellaneous Information
lslmexecute-kbd-macro(2)le (cDC-x ecA) Execute a keyboard macro
lslmexecute-line(2)le Execute a typed in script line
lslmexecute-named-command(2)le [cDesc xcA] Execute a named command
lslmexecute-region(3)le Execute marked script lines
lslmexecute-string(2)le Execute a string as a command
lslmexecute-tool(3)le Execute a user defined shell tool
lslmexit-emacs(2)le Exit MicroEmacs
Expand Down Expand Up @@ -14664,13 +14669,16 @@ $a
lslmset-mark(2)le, lslmcopy-region(2)le, lslm$window-mark-col(5)le, lslm$window-mark-line(5)le.
! 2 execute-buffer
! 2 execute-line
! 3 execute-region
cEcENAME cEcA


|execute-buffer
execute-buffer - Execute script lines from a buffer
|execute-line
execute-line - Execute a script line from the command line
|execute-region
execute-region - Execute marked script lines from a buffer
$a


Expand All @@ -14679,7 +14687,7 @@ $a

cDexecute-buffercA "cCbuffer-namecA"
cDexecute-linecA ["cCcommand-linecA"]

cDexecute-regioncA

cEcEDESCRIPTION cEcA

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

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

cEcESEE ALSO cEcA

Expand Down
22 changes: 22 additions & 0 deletions jasspa/macros/misc.emf
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,25 @@ define-macro write-region
delete-buffer $buffer-bname
goto-position "\x88"
!emacro

; execute-region - mark a aregion of code and the execute it
; useful in macro development
; code taken from me23
; implemented by Steven Phillips
define-macro execute-region
set-alpha-mark "a"
3 narrow-buffer
!force !force !force execute-buffer $buffer-bname
!if &set #l0 &not $status
set-alpha-mark "a"
!endif
end-of-buffer
forward-line
2 narrow-buffer ; me23 it is 2?
goto-alpha-mark "a"
!if #l0
ml-write &spr "[Error executing region in %s, line %d]" $buffer-bname $window-line
!abort
!endif

!emacro

0 comments on commit 9ca5f7e

Please sign in to comment.