Merge remote-tracking branch 'lenormf/fix-autorestore'

This commit is contained in:
Maxime Coste 2017-03-03 21:13:53 +00:00
commit a0c301ac42

View File

@ -8,7 +8,7 @@ def autorestore-restore-buffer -docstring "Restore the backup for the current fi
buffer_dirname=$(dirname "${kak_buffile}") buffer_dirname=$(dirname "${kak_buffile}")
## Find the name of the latest backup created for the buffer that was open ## Find the name of the latest backup created for the buffer that was open
backup_path=$(ls -1t ."${kak_bufname}".kak.* | head -n 1) backup_path=$(ls -1t ."${kak_bufname}".kak.* 2>/dev/null | head -n 1)
if [ -z "${backup_path}" ]; then if [ -z "${backup_path}" ]; then
exit exit
@ -25,7 +25,7 @@ def autorestore-restore-buffer -docstring "Restore the backup for the current fi
hook -group autorestore buffer BufWritePost '${kak_buffile}' %{ hook -group autorestore buffer BufWritePost '${kak_buffile}' %{
nop %sh{ nop %sh{
if [ \"\${kak_opt_autorestore_purge_restored}\" = true ]; then if [ \"\${kak_opt_autorestore_purge_restored}\" = true ]; then
ls -1 '${buffer_dirname}'/.'${buffer_basename}'.kak.* | while read -r f; do ls -1 '${buffer_dirname}'/.'${buffer_basename}'.kak.* 2>/dev/null | while read -r f; do
rm -f \"\${f}\" rm -f \"\${f}\"
done done
fi fi
@ -45,7 +45,7 @@ def autorestore-purge-backups -docstring "Remove all the backups of the current
buffer_basename="${kak_bufname##*/}" buffer_basename="${kak_bufname##*/}"
buffer_dirname=$(dirname "${kak_bufname}") buffer_dirname=$(dirname "${kak_bufname}")
ls -1 "${buffer_dirname}"/."${buffer_basename}".kak.* | while read -r f; do ls -1 "${buffer_dirname}"/."${buffer_basename}".kak.* 2>/dev/null | while read -r f; do
rm -f "${f}" rm -f "${f}"
done done
} }