1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 07:16:23 -05:00

Avoid using numbered macroes if key binding is not needed.

This commit is contained in:
Renaud 2019-06-22 14:03:15 +08:00
parent 0244154e8e
commit 71548b9ec6
4 changed files with 161 additions and 15 deletions

View File

@ -1,8 +1,8 @@
## blindmaz.cmd -- solve maze by walking a left-handed blind mouse ## blindmaz.cmd -- solve maze by walking a left-handed blind mouse
#7 set $seed #7 set $seed
execute-file maze.cmd #execute-file maze.cmd
#execute-file floodmaz.cmd execute-file floodmaz.cmd
set %x 2 set %x 2
set %y $curline set %y $curline
end-of-line end-of-line
@ -19,7 +19,7 @@ set %DY3 -1
set %dotc &asc "." set %dotc &asc "."
12 store-macro store-procedure probe
set %OX &ind &cat "%DX" %nD set %OX &ind &cat "%DX" %nD
set %OY &ind &cat "%DY" %nD set %OY &ind &cat "%DY" %nD
set %nx &add %x %OX set %nx &add %x %OX
@ -50,13 +50,13 @@ set %dotc &asc "."
set %D 0 # looking EAST set %D 0 # looking EAST
!while &les %x %stopcol !while &les %x %stopcol
set %nD &mod &add %D 3 4 # Can go left? set %nD &mod &add %D 3 4 # Can go left?
execute-macro-12 run probe
!if &seq %res FALSE !if &seq %res FALSE
set %nD %D # Can go straight? set %nD %D # Can go straight?
execute-macro-12 run probe
!if &seq %res FALSE !if &seq %res FALSE
set %nD &mod &add %D 1 4 # Can go right? set %nD &mod &add %D 1 4 # Can go right?
execute-macro-12 run probe
!if &seq %res FALSE !if &seq %res FALSE
set %D &mod &add %D 2 4 # Go back! set %D &mod &add %D 2 4 # Go back!
!endif !endif

View File

@ -1,4 +1,4 @@
; EMACS.RC / .emascrc ; EMACS.RC / .emacsrc
; ;
; Startup file for MicroEMACS 3.9 and uEmacs/PK 4.0 ; Startup file for MicroEMACS 3.9 and uEmacs/PK 4.0
; This file is executed every time the editor is entered. ; This file is executed every time the editor is entered.
@ -7,6 +7,10 @@
set $discmd "FALSE" set $discmd "FALSE"
!if &seq $progname "µEMACS"
!force execute-file &cat $HOME "/.uerc"
!else
; First, try to resolve if we are on a PC ... yes, this is a kludge ; First, try to resolve if we are on a PC ... yes, this is a kludge
!if &seq $sres "NORMAL" !if &seq $sres "NORMAL"
@ -291,4 +295,6 @@ bind-to-key newline ^J
!endif !endif
add-global-mode "utf-8" add-global-mode "utf-8"
!endif
set $discmd "TRUE" set $discmd "TRUE"

View File

@ -3,7 +3,7 @@ execute-file maze.cmd
set %thisbuf $cbufname set %thisbuf $cbufname
10 store-macro # push x y store-procedure pushxy # push x y
set %x $curcol set %x $curcol
set %y $curline set %y $curline
select-buffer stack select-buffer stack
@ -15,7 +15,7 @@ set %thisbuf $cbufname
select-buffer %thisbuf select-buffer %thisbuf
!endm !endm
11 store-macro # pop x y store-procedure popxy # pop x y
select-buffer stack select-buffer stack
beginning-of-file beginning-of-file
set %x $line set %x $line
@ -29,7 +29,7 @@ set %thisbuf $cbufname
set $curline 1 set $curline 1
set $curcol 0 set $curcol 0
execute-macro-10 #push stop position run pushxy #push stop position
set %x 1 set %x 1
set $curline 4 set $curline 4
set $curcol %x set $curcol %x
@ -41,23 +41,23 @@ set %NC &asc "█"
set %ll $curline set %ll $curline
set $curcol &add %cc 1 set $curcol &add %cc 1
!if &equ $curchar %OC !if &equ $curchar %OC
execute-macro-10 run pushxy
!endif !endif
set $curcol &add %cc -1 set $curcol &add %cc -1
!if &equ $curchar %OC !if &equ $curchar %OC
execute-macro-10 run pushxy
!endif !endif
set $curline &add %ll 1 set $curline &add %ll 1
set $curcol %cc set $curcol %cc
!if &equ $curchar %OC !if &equ $curchar %OC
execute-macro-10 run pushxy
!endif !endif
set $curline &add %ll -1 set $curline &add %ll -1
set $curcol %cc set $curcol %cc
!if &equ $curchar %OC !if &equ $curchar %OC
execute-macro-10 run pushxy
!endif !endif
execute-macro-11 run popxy
!endwhile !endwhile
set $curline 3 set $curline 3
set $curcol 1 set $curcol 1

140
ue.rc Normal file
View File

@ -0,0 +1,140 @@
# UE.RC
#
# Startup file for µEMACS 4.2
# This file is executed every time the editor is entered.
# If you want to keep compatibility with em (uEmacs/PK) or me (Micro-EMACS)
# cp emacs.rc ~/.emacsrc
# cp ue.rc ~/.uerc
# otherwise
# cp ue.rc ~/.emacsrc
set $discmd "FALSE"
set $tab 4
; Help facility
40 store-macro
set $discmd "FALSE"
!if &not &seq $cbufname "emacs.hlp"
write-message "(Loading Help)"
!force help
!force 8 resize-window
bind-to-key execute-macro-39 FN5
bind-to-key execute-macro-38 FN6
beginning-of-line
2 forward-character
1 redraw-display
save-window
set %hlpupdn "<Prev Scrn> / <Next Scrn>"
set %hlphelp "<Help>"
run helponhelp
!else
set %hlpcode &lef $line 2
!if &seq %hlpcode ".."
set %hlptopic &mid $line 4 99
end-of-line
!force search-forward %hlptopic
beginning-of-line
2 forward-character
1 redraw-display
run helponhelp
!else
bind-to-key previous-page FN5
bind-to-key next-page FN6
!force restore-window
!force delete-window
clear-message-line
!endif
!endif
set $discmd "TRUE"
!endm
bind-to-key execute-macro-40 M-?
bind-to-key execute-macro-40 FNh
; Help on Help
store-procedure helponhelp
!if &seq &rig $line 5 "INDEX"
write-message &cat "Select topic from list and press " %hlphelp
!else
write-message &cat "Use " &cat %hlpupdn &cat " to scan help file -- " &cat %hlphelp " to toggle help window"
!endif
!endm
; Previous help page
39 store-macro
!if &seq $cbufname "emacs.hlp"
beginning-of-line
!force search-reverse "=>"
2 forward-character
1 redraw-display
run helponhelp
!else
previous-page
!endif
!endm
; Next help page
38 store-macro
!if &seq $cbufname "emacs.hlp"
beginning-of-line
2 forward-character
!force search-forward "=>"
1 redraw-display
run helponhelp
!else
next-page
!endif
!endm
; Set up auto CMODE
37 store-macro
!if &seq &mid $cfname 1 7 "/tmp/Re"
add-mode "wrap"
!return
!endif
!if &gre &sin $cfname "/.ed" 0
add-mode "wrap"
!return
!endif
!if &gre &sin $cfname "/.let" 0
add-mode "wrap"
!return
!endif
!if &gre &sin $cfname "/.art" 0
add-mode "wrap"
!return
!endif
!if &gre &sin $cfname "/nn." 0
add-mode "wrap"
!return
!endif
set %rctmp &sin $cfname "."
!if &equ %rctmp 0
!return
!endif
set %rctmp &mid $cfname &add %rctmp 1 5
!if &or &seq %rctmp "c" &seq %rctmp "h"
add-mode "cmode"
!endif
!if &or &seq %rctmp "txt" &or &seq %rctmp "doc" &or &seq %rctmp "tmp" &seq %rctmp "tex"
add-mode "wrap"
!endif
!endm
bind-to-key execute-macro-37 M-FNR
; Make cut-paste easier in window systems
bind-to-key newline ^J
!if &or &gre &sin $LANG "UTF-8" 0 &gre &sin $LANG "utf8" 0
add-global-mode "utf-8"
!endif
set $discmd "TRUE"