Skip to content

Commit

Permalink
First cut of find-hfile and implemented similar interface in dir-list
Browse files Browse the repository at this point in the history
  • Loading branch information
bjasspa committed Jan 8, 2025
1 parent e962006 commit 73e4eb2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
25 changes: 21 additions & 4 deletions microemacs/macros/hkdirlst.emf
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ set-variable .fhook-dirlst.setup-labels "|Enable filter by default|"
set-variable .fhook-dirlst.command-flag "|thbio|thbio|thbio|thbio|bio|thbio|thbio|thbio|th|thbio|thbio|thbio|thbio|thbio|thbio|th|thbio|thbio|thbio|thbio|thbio|thbio|th|thbio|h|thbio|thbio|thbio|thbio|bio|thbio|thbio|thbio|thbio|thbio|thbio|thbio|bio|thbio|thbio|thbio|thbio|h|t|"
set-variable .fhook-dirlst.command-name "|file-browser-swap-buffers|file-browser-close|dirlst-up-dir|dirlst-refresh|dirlst-refresh|file-browser-set-filter|dirlst-search|dirlst-search||dirlst-sort-list|dirlst-sort-list|dirlst-sort-list|dirlst-sort-list|dirlst-sort-list|dirlst-sort-list||dirlst-tag-toggle|dirlst-tag-mask|dirlst-tag-mask|dirlst-tag-invert|dirlst-tag-set|dirlst-tag-set||dirlst-find-file||dirlst-find-file|dirlst-find-file|dirlst-tag-open|dirlst-find-file|dirlst-find-file|dirlst-file-rename|dirlst-file-fattr|dirlst-tag-file-touch|dirlst-tag-file-copy|dirlst-tag-file-copy|dirlst-new-folder|dirlst-tag-file-delete|dirlst-tag-file-delete|dirlst-tag-file-delete|dirlst-delete-line|file-tool-menu|dirlst-tag-execute||file-tool-setup|"
set-variable .fhook-dirlst.command-nbind "||||||-1||0||5|6|4|3|2|1|||1|-1||1|-1||5||1|9||4|4||||1|0||||3||||||"
set-variable .fhook-dirlst.command-kbind "|tab|f10|backspace|l|f5|f|s|y||5|6|4|3|2|1||space|+|-|*|a|u||return||e|b|i|v|f3|r|g|o|c|m|n|d|delete|S-delete|C-k|t|x|||"
set-variable .fhook-dirlst.command-desc "|Swap Browser \HWindows|Close File Browser|Goto Parent Director\Hy|Refresh \HList||Toggle \HFilter|\HSearch for file by name|Search b\Hy order column||Sort by Name|Sort by Extension|Sort by Modified|Sort by Size|Sort by Attribute|Sort by Selected||Toggle Cur File Select|Select Files \H+|Unselect Files \H-|Invert Selection \H*|Select \HAll|\HUnselect All||O\Hpen File| (Default file tool or Edit file)|\HEdit File|\HBinary Edit File|Ed\Hit Selected Files|\HView File||\HRename File|Chan\Hge File Attributes|T\Houch Files|\HCopy Files|\HMove Files|\HNew Folder|\HDelete Files||\HTrash Files|Delete Current Line|File \HTools|E\Hxecute Command on Files| (%p for path, %f for file & %% for %)|File Tools Setup|"
set-variable .fhook-dirlst.command-kbind "|tab|f10|backspace|l|f5|f|s|w||5|6|4|3|2|1||space|+|-|*|a|u||return||e|h|i|v|f3|r|g|o|c|m|n|d|delete|S-delete|C-k|t|x|||"
set-variable .fhook-dirlst.command-desc "|Swap Browser \HWindows|Close File Browser|Goto Parent Director\Hy|Refresh \HList||Toggle \HFilter|\HSearch for file by name|Search by order column||Sort by Name|Sort by Extension|Sort by Modified|Sort by Size|Sort by Attribute|Sort by Selected||Toggle Cur File Select|Select Files \H+|Unselect Files \H-|Invert Selection \H*|Select \HAll|\HUnselect All||O\Hpen File| (Default file tool or Edit file)|\HEdit File|Find-?file|Ed\Hit Selected Files|\HView File||\HRename File|Chan\Hge File Attributes|T\Houch Files|\HCopy Files|\HMove Files|\HNew Folder|\HDelete Files||\HTrash Files|Delete Current Line|File \HTools|E\Hxecute Command on Files| (%p for path, %f for file & %% for %)|File Tools Setup|"

set-variable .fhook-dirlst.modefunc-lbl "|Not-Filtered|Filtered|"
set-variable .fhook-dirlst.modefunc-cmd "|file-browser-set-filter|file-browser-set-filter|"
Expand Down Expand Up @@ -532,13 +532,26 @@ define-macro file-browser-swap-buffers
!emacro

0 define-macro dirlst-find-file
set-variable #l3 &add 1 &div &band @# 40 4
set-variable #l3 1
!if &band @# 8
set-variable #l0 @mc5 "File load type (?/b/c/C/r/z) ? " "bCcrz" "(b)inary, (c)rypted, (C)rypted+(b/r), (r)educed bin, (z)file ? "
!if &seq #l0 "C"
set-variable #l3 &bor #l3 4
set-variable #l0 @mc5 "File load type (?/b/r) ? " "br" "(b)inary, (r)educed bin ? "
!endif
!if &seq #l0 "z"
set-variable #l3 0
!else
set-variable #l3 &bor #l3 &sin #l0 "-b-c---r"
!endif
!endif
!if &band @# 2
set-variable #l0 @1
!else
dirlst-get-current-fullname #l0
!endif
!if &lfin "|ftp://|ftps:/|ftpe:/|" &lef #l0 6
!iif &not #l3 -8 ml-write "Error: find-zfile does not support ftp files, download first."
; it is unknown whether an ftp file is a directory until loaded
; if the ftp console tool is used make it visible
!iif &and &sin "s" %ftp-flags .toolbar.open !force toolbar-make-tool-visible "*ftp-console*"
Expand Down Expand Up @@ -630,7 +643,11 @@ define-macro file-browser-swap-buffers
0 delete-buffer "*file-browser-temp*"
!iif &and &band #l1 4 &les $window-mode-line #l2 next-window
!endif
#l3 find-file #l0 @mna
!if #l3
#l3 find-file #l0 @mna
!else
find-zfile #l0 @mna
!endif
; add this file name to the file history
set-variable @h3 $buffer-fname
set-variable #l3 $buffer-bname
Expand Down
10 changes: 3 additions & 7 deletions microemacs/macros/tools.emf
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,10 @@ define-macro find-hfile
set-variable @# &bor @# 4
set-variable #l0 @mc5 "File load type (?/b/r) ? " "br" "(b)inary, (r)educed bin ? "
!endif
!if &seq #l0 "b"
&bor @# 2 find-file @mna
!elif &seq #l0 "c"
&bor @# 4 find-file @mna
!elif &seq #l0 "r"
&bor @# 8 find-file @mna
!elif &seq #l0 "z"
!if &seq #l0 "z"
find-zfile @mna
!else
&bor @# &sin #l0 "-b-c---r" find-file @mna
!endif
!emacro

Expand Down
10 changes: 5 additions & 5 deletions microemacs/macros/zfile.emf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ define-macro fhook-zfile
set-variable .fhook-zfile.name "Z-File"
set-variable .fhook-zfile.setup &reg "/history/fhook/zfile" "ghmop"
set-variable .fhook-zfile.setup-mask "eghkop"
set-variable .fhook-zfile.command-flag "|thbio|thbio|th|thbio|thbio|thbio|thbio|thbio|thbio|th|thbio|thbio|thbio|thbio|thbio|thbio|th|thbio|h|thbio|thbio|thbio|thbio|thbio|th|thbio|"
set-variable .fhook-zfile.command-name "|dirlst-search|dirlst-search||dirlst-sort-list|dirlst-sort-list|dirlst-sort-list|dirlst-sort-list|dirlst-sort-list|dirlst-sort-list||dirlst-tag-toggle|dirlst-tag-mask|dirlst-tag-mask|dirlst-tag-invert|dirlst-tag-set|dirlst-tag-set||zfile-find-file||zfile-find-file|zfile-find-file|zfile-find-file|zfile-find-file|zfile-find-file||zfile-copy-file|"
set-variable .fhook-zfile.command-nbind &spr "||0||5|6|4|%s|2|1|||1|-1||1|-1||5||1|9|33|4|3||1|" #l0
set-variable .fhook-zfile.command-kbind "|S|s||5|6|4|3|2|1||space|+|-|*|a|u||return||e|b|B|v|y||c|"
set-variable .fhook-zfile.command-desc "|Search for File|\HSearch by Name||Sort by Name|Sort by Extension|Sort by Modified|Sort by Size|Sort by Attribute|Sort by Selected||Toggle Cur File Select|Select Files \H+|Unselect Files \H-|Invert Selection \H*|Select \HAll|\HUnselect All||O\Hpen File| (Default file tool or Edit file)|\HEdit File|\HBinary Edit File|RBin Edit File|\HView File|System Open File||\HCopy Files|"
set-variable .fhook-zfile.command-flag "|thbio|thbio|th|thbio|thbio|thbio|thbio|thbio|thbio|th|thbio|thbio|thbio|thbio|thbio|thbio|th|thbio|h|thbio|thbio|thbio|thbio|th|thbio|bio|"
set-variable .fhook-zfile.command-name "|dirlst-search|dirlst-search||dirlst-sort-list|dirlst-sort-list|dirlst-sort-list|dirlst-sort-list|dirlst-sort-list|dirlst-sort-list||dirlst-tag-toggle|dirlst-tag-mask|dirlst-tag-mask|dirlst-tag-invert|dirlst-tag-set|dirlst-tag-set||zfile-find-file||zfile-find-file|zfile-find-file|zfile-find-file|zfile-find-file||zfile-copy-file|zfile-copy-file|"
set-variable .fhook-zfile.command-nbind &spr "||0||5|6|4|%s|2|1|||1|-1||1|-1||5||1|9|4|3||1|1|" #l0
set-variable .fhook-zfile.command-kbind "|s|w||5|6|4|3|2|1||space|+|-|*|a|u||return||e|b|v|y||c|x|"
set-variable .fhook-zfile.command-desc "|\HSearch for file by name|Search by order column||Sort by Name|Sort by Extension|Sort by Modified|Sort by Size|Sort by Attribute|Sort by Selected||Toggle Cur File Select|Select Files \H+|Unselect Files \H-|Invert Selection \H*|Select \HAll|\HUnselect All||O\Hpen File| (Default file tool or Edit file)|\HEdit File|\HBinary Edit File|\HView File|S\Hystem Open File||\HCopy Files||"

!if &and &sin "h" .fhook-zfile.setup &band .hilight.flags 0x02
!if &not &exist .hilight.zfile
Expand Down

0 comments on commit 73e4eb2

Please sign in to comment.