Skip to content

Commit

Permalink
global: work around empty cache files by "tmux-resurrect"
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Sep 23, 2021
1 parent 500915f commit d7d2a23
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion keymap/emacs.sh
Expand Up @@ -241,7 +241,8 @@ function ble-decode/keymap:emacs/define {

function ble-decode/keymap:emacs/initialize {
local fname_keymap_cache=$_ble_base_cache/keymap.emacs
if [[ $fname_keymap_cache -nt $_ble_base/keymap/emacs.sh &&
if [[ -s $fname_keymap_cache &&
$fname_keymap_cache -nt $_ble_base/keymap/emacs.sh &&
$fname_keymap_cache -nt $_ble_base/lib/init-cmap.sh ]]; then
source "$fname_keymap_cache" && return
fi
Expand Down
3 changes: 2 additions & 1 deletion keymap/vi.sh
Expand Up @@ -7772,7 +7772,8 @@ function ble-decode/keymap:vi_cmap/define {

function ble-decode/keymap:vi/initialize {
local fname_keymap_cache=$_ble_base_cache/keymap.vi
if [[ $fname_keymap_cache -nt $_ble_base/keymap/vi.sh &&
if [[ -s $fname_keymap_cache &&
$fname_keymap_cache -nt $_ble_base/keymap/vi.sh &&
$fname_keymap_cache -nt $_ble_base/lib/init-cmap.sh ]]; then
source "$fname_keymap_cache" && return
fi
Expand Down
3 changes: 2 additions & 1 deletion keymap/vi_digraph.sh
Expand Up @@ -49,7 +49,8 @@ function ble-decode/keymap:vi_digraph/define {

function ble-decode/keymap:vi_digraph/initialize {
local fname_keymap_cache=$_ble_base_cache/keymap.vi_digraph
if [[ $fname_keymap_cache -nt $_ble_base/keymap/vi_digraph.sh &&
if [[ -s $fname_keymap_cache &&
$fname_keymap_cache -nt $_ble_base/keymap/vi_digraph.sh &&
$fname_keymap_cache -nt $_ble_base/keymap/vi_digraph.txt ]]; then
source "$fname_keymap_cache"
return
Expand Down
7 changes: 4 additions & 3 deletions src/decode.sh
Expand Up @@ -2050,7 +2050,7 @@ function ble-decode-bind/cmap/initialize {

local init=$_ble_base/lib/init-cmap.sh
local dump=$_ble_base_cache/cmap+default.$_ble_decode_kbd_ver.$TERM.dump
if [[ $dump -nt $init ]]; then
if [[ -s $dump && $dump -nt $init ]]; then
source "$dump"
else
ble-edit/info/immediate-show text 'ble.sh: generating "'"$dump"'"...'
Expand All @@ -2071,7 +2071,8 @@ function ble-decode-bind/cmap/initialize {
# 3文字以上 bind/unbind ソースの生成
local fbinder=$_ble_base_cache/cmap+default.binder-source
_ble_decode_bind_fbinder=$fbinder
if ! [[ $_ble_decode_bind_fbinder -nt $init ]]; then
if ! [[ -s $_ble_decode_bind_fbinder.bind && $_ble_decode_bind_fbinder.bind -nt $init &&
-s $_ble_decode_bind_fbinder.unbind && $_ble_decode_bind_fbinder.unbind -nt $init ]]; then
ble-edit/info/immediate-show text 'ble.sh: initializing multichar sequence binders... '
ble-decode-bind/cmap/.generate-binder-template >| "$fbinder"
binder=ble-decode-bind/cmap/.emit-bindx source "$fbinder" >| "$fbinder.bind"
Expand Down Expand Up @@ -2198,7 +2199,7 @@ function ble-decode-bind/.generate-source-to-unbind-default/.process {

function ble-decode/bind {
local file=$_ble_base_cache/ble-decode-bind.$_ble_bash.$bleopt_input_encoding.bind
[[ $file -nt $_ble_base/lib/init-bind.sh ]] || source "$_ble_base/lib/init-bind.sh"
[[ -s $file && $file -nt $_ble_base/lib/init-bind.sh ]] || source "$_ble_base/lib/init-bind.sh"

# * 一時的に 'set convert-meta off' にする。
#
Expand Down
6 changes: 3 additions & 3 deletions src/util.sh
Expand Up @@ -2735,10 +2735,10 @@ function ble-term/.initialize {
_ble_term_IFS=$' \t\n'
_ble_term_CR=$'\r'

if [[ $_ble_base/lib/init-term.sh -nt $_ble_base_cache/$TERM.term ]]; then
source "$_ble_base/lib/init-term.sh"
else
if [[ -s $_ble_base_cache/$TERM.term && $_ble_base_cache/$TERM.term -nt $_ble_base/lib/init-term.sh ]]; then
source "$_ble_base_cache/$TERM.term"
else
source "$_ble_base/lib/init-term.sh"
fi

ble/string#reserve-prototype "$_ble_term_it"
Expand Down

0 comments on commit d7d2a23

Please sign in to comment.