Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zed-set-filename breaks zed keymap?
I was trying to get zed-set-file-name to work with my "zed -h" change,
and discovered that even with plain "zed file" after entering the file
name into read-from-minibuffer, ^X^W no longer works to exit from zed,
and a bare return DOES exit it. Apparently returning from
read-from-minibuffer does not constitute "the next command" for
purposes of zle -K restoring the keymap? Did this work at one time?
Also, it is possible to execute zed-set-file-name recursively from
inside read-from-minibuffer, which is a bit strange.
xtrace output attached in case somebody needs help finding a clue.
Just "zed /tmp/one", an existing file from a previous test:
+zed:10> setopt localoptions noksharrays
+zed:12> local var opts zed_file_name
+zed:14> integer TMOUT=0 okargs=1 fun hist bind
+zed:15> local -a expand
+zed:17> zparseopts -D -A opts f h b x:
+zed:18> fun=0
+zed:19> hist=0
+zed:20> bind=0
+zed:21> [[ '' == <-> ]]
+zed:23> (( 0 ))
+zed:28> [[ zed = fned ]]
+zed:29> [[ zed = histed ]]
+zed:30> (( hist && 1 <= 2 ))
+zed:31> (( bind ))
+zed:33> (( 1 != okargs || bind + fun + hist > 1 ))
+zed:42> local curcontext=zed:::
+zed:44> '(anon)'
+(anon):3> local -a match mbegin mend
+(anon):4> zstyle -m ':completion:zed:*' insert-tab '*'
+(anon):5> zstyle ':completion:zed:*' insert-tab yes
+zed:52> zmodload zsh/terminfo
+zed:70> zle -la __zed_pg_up __zed_pg_down
+zed:71> zle -N __zed_pg_up
+zed:72> zle -N __zed_pg_down
+zed:75> (( bind ))
+zed:75> bindkey -M zed
+zed:77> bindkey -N zed main
+zed:80> bindkey -A main zed-normal-keymap
+zed:86> zle -N __zed_init
+zed:93> bindkey -M zed '^x^w' accept-line
+zed:94> bindkey -M zed '^M' self-insert-unmeta
+zed:96> [[ 1 = 1 ]]
+zed:97> [[ -n $'\C-[[5~' ]]
+zed:97> bindkey -M zed $'\C-[[5~' __zed_pg_up
+zed:98> [[ -n $'\C-[[6~' ]]
+zed:98> bindkey -M zed $'\C-[[6~' __zed_pg_down
+zed:99> [[ -n '' ]]
+zed:100> [[ -n '' ]]
+zed:103> bindkey -M zed '^[[H' beginning-of-line
+zed:104> bindkey -M zed '^[[F' end-of-line
+zed:109> autoload -Uz zed-set-file-name
+zed:110> zle -N zed-set-file-name
+zed:112> (( bind ))
+zed:112> bindkey -M zed-vicmd
+zed:113> bindkey -N zed-vicmd vicmd
+zed:115> bindkey -M zed-vicmd ZZ accept-line
+zed:116> [[ 1 = 1 ]]
+zed:117> [[ -n $'\C-[[5~' ]]
+zed:117> bindkey -M zed-vicmd $'\C-[[5~' __zed_pg_up
+zed:118> [[ -n $'\C-[[6~' ]]
+zed:118> bindkey -M zed-vicmd $'\C-[[6~' __zed_pg_down
+zed:119> [[ -n '' ]]
+zed:120> [[ -n '' ]]
+zed:123> bindkey -M zed-vicmd '^[[H' vi-beginning-of-line
+zed:124> bindkey -M zed-vicmd '^[[F' vi-end-of-line
+zed:128> (( bind ))
+zed:131> setopt localoptions nobanghist
+zed:133> (( fun ))
+zed:143> (( hist ))
+zed:173> zed_file_name=/tmp/one
+zed:174> [[ -f /tmp/one ]]
+zed:174> var='Where does this go?'
+zed:175> vared -M zed -m zed-vicmd -i __zed_init var
+zed-set-file-name:1> emulate -L zsh
+zed-set-file-name:3> autoload -Uz read-from-minibuffer
+zed-set-file-name:5> zle -K zed-normal-keymap
+zed-set-file-name:7> local REPLY
+zed-set-file-name:8> read-from-minibuffer 'File name: '
+read-from-minibuffer:1> emulate -L zsh
+read-from-minibuffer:2> setopt extendedglob
+read-from-minibuffer:4> local opt keys
+read-from-minibuffer:5> integer stat
+read-from-minibuffer:7> getopts k: opt
+read-from-minibuffer:20> (( OPTIND > 1 ))
+read-from-minibuffer:22> local readprompt='File name: ' lbuf_init='' rbuf_init=''
+read-from-minibuffer:23> integer savelim=1 changeno=1
+read-from-minibuffer:29> '(anon)'
+(anon):1> local pretext=$'Where does this go?\n'
+(anon):3> local +h LBUFFER=''
+(anon):4> local +h RBUFFER=''
+(anon):5> local +h PREDISPLAY=$'Where does this go?\nFile name: '
+(anon):6> local +h POSTDISPLAY=''
+(anon):7> local +h -a region_highlight
+(anon):8> region_highlight=( 'P20 31 bold' )
+(anon):10> [[ -n '' ]]
+(anon):15> local NUMERIC
+(anon):16> unset NUMERIC
+(anon):17> zle split-undo
+(anon):18> UNDO_LIMIT_NO=2
+(anon):19> zle recursive-edit -K main
+(anon):20> stat=0
+(anon):21> (( stat ))
+(anon):21> REPLY=/tmp/five
+read-from-minibuffer:56> zle undo 1
+read-from-minibuffer:57> UNDO_LIMIT_NO=savelim
+read-from-minibuffer:60> return 0
+zed-set-file-name:9> zed_file_name=/tmp/five
+zed:178> print -r -- 'Where does this go? Here'
+zed:180> (( TRY_BLOCK_ERROR = 0 ))
+zed:181> break
+zed:186> return 0
Now "zed /tmp/five" (the file written above) with recursive invocation of
zed-set-file-name; note value assigned to zed_file_name:
+zed:10> setopt localoptions noksharrays
+zed:12> local var opts zed_file_name
+zed:14> integer TMOUT=0 okargs=1 fun hist bind
+zed:15> local -a expand
+zed:17> zparseopts -D -A opts f h b x:
+zed:18> fun=0
+zed:19> hist=0
+zed:20> bind=0
+zed:21> [[ '' == <-> ]]
+zed:23> (( 0 ))
+zed:28> [[ zed = fned ]]
+zed:29> [[ zed = histed ]]
+zed:30> (( hist && 1 <= 2 ))
+zed:31> (( bind ))
+zed:33> (( 1 != okargs || bind + fun + hist > 1 ))
+zed:42> local curcontext=zed:::
+zed:44> '(anon)'
+(anon):3> local -a match mbegin mend
+(anon):4> zstyle -m ':completion:zed:*' insert-tab '*'
+zed:52> zmodload zsh/terminfo
+zed:70> zle -la __zed_pg_up __zed_pg_down
+zed:75> (( bind ))
+zed:75> bindkey -M zed
+zed:112> (( bind ))
+zed:112> bindkey -M zed-vicmd
+zed:128> (( bind ))
+zed:131> setopt localoptions nobanghist
+zed:133> (( fun ))
+zed:143> (( hist ))
+zed:173> zed_file_name=/tmp/five
+zed:174> [[ -f /tmp/five ]]
+zed:174> var='Where does this go? Here'
+zed:175> vared -M zed -m zed-vicmd -i __zed_init var
+zed-set-file-name:1> emulate -L zsh
+zed-set-file-name:3> autoload -Uz read-from-minibuffer
+zed-set-file-name:5> zle -K zed-normal-keymap
+zed-set-file-name:7> local REPLY
+zed-set-file-name:8> read-from-minibuffer 'File name: '
+read-from-minibuffer:1> emulate -L zsh
+read-from-minibuffer:2> setopt extendedglob
+read-from-minibuffer:4> local opt keys
+read-from-minibuffer:5> integer stat
+read-from-minibuffer:7> getopts k: opt
+read-from-minibuffer:20> (( OPTIND > 1 ))
+read-from-minibuffer:22> local readprompt='File name: ' lbuf_init='' rbuf_init=''
+read-from-minibuffer:23> integer savelim=1 changeno=1
+read-from-minibuffer:29> '(anon)'
+(anon):1> local pretext=$'Where does this go? Here\n'
+(anon):3> local +h LBUFFER=''
+(anon):4> local +h RBUFFER=''
+(anon):5> local +h PREDISPLAY=$'Where does this go? Here\nFile name: '
+(anon):6> local +h POSTDISPLAY=''
+(anon):7> local +h -a region_highlight
+(anon):8> region_highlight=( 'P26 37 bold' )
+(anon):10> [[ -n '' ]]
+(anon):15> local NUMERIC
+(anon):16> unset NUMERIC
+(anon):17> zle split-undo
+(anon):18> UNDO_LIMIT_NO=2
+(anon):19> zle recursive-edit -K main
+zed-set-file-name:1> emulate -L zsh
+zed-set-file-name:3> autoload -Uz read-from-minibuffer
+zed-set-file-name:5> zle -K zed-normal-keymap
+zed-set-file-name:7> local REPLY
+zed-set-file-name:8> read-from-minibuffer 'File name: '
+read-from-minibuffer:1> emulate -L zsh
+read-from-minibuffer:2> setopt extendedglob
+read-from-minibuffer:4> local opt keys
+read-from-minibuffer:5> integer stat
+read-from-minibuffer:7> getopts k: opt
+read-from-minibuffer:20> (( OPTIND > 1 ))
+read-from-minibuffer:22> local readprompt='File name: ' lbuf_init='' rbuf_init=''
+read-from-minibuffer:23> integer savelim=2 changeno=15
+read-from-minibuffer:29> '(anon)'
+(anon):1> local pretext=$'Where does this go? Here\nFile name: /tmp/six\n\n'
+(anon):3> local +h LBUFFER=''
+(anon):4> local +h RBUFFER=''
+(anon):5> local +h PREDISPLAY=$'Where does this go? Here\nFile name: /tmp/six\n\nFile name: '
+(anon):6> local +h POSTDISPLAY=''
+(anon):7> local +h -a region_highlight
+(anon):8> region_highlight=( 'P47 58 bold' )
+(anon):10> [[ -n '' ]]
+(anon):15> local NUMERIC
+(anon):16> unset NUMERIC
+(anon):17> zle split-undo
+(anon):18> UNDO_LIMIT_NO=16
+(anon):19> zle recursive-edit -K main
+(anon):20> stat=0
+(anon):21> (( stat ))
+(anon):21> REPLY=/tmp/seven
+read-from-minibuffer:56> zle undo 15
+read-from-minibuffer:57> UNDO_LIMIT_NO=savelim
+read-from-minibuffer:60> return 0
+zed-set-file-name:9> zed_file_name=/tmp/seven
+(anon):20> stat=0
+(anon):21> (( stat ))
+(anon):21> REPLY=$'/tmp/six\n'
+read-from-minibuffer:56> zle undo 1
+read-from-minibuffer:57> UNDO_LIMIT_NO=savelim
+read-from-minibuffer:60> return 0
+zed-set-file-name:9> zed_file_name=$'/tmp/six\n'
+zed:178> print -r -- 'Where does this go? There'
+zed:180> (( TRY_BLOCK_ERROR = 0 ))
+zed:181> break
+zed:186> return 0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author