From 0fd41540d1d55bdc22ff53bd2c2801b6d2d8fd4a Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Wed, 1 Mar 2017 14:55:29 +0300 Subject: [PATCH] rc: Don't print errors when no buffer backup exist --- rc/extra/autorestore.kak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rc/extra/autorestore.kak b/rc/extra/autorestore.kak index 3c6d4720c..7bec90ee7 100644 --- a/rc/extra/autorestore.kak +++ b/rc/extra/autorestore.kak @@ -8,7 +8,7 @@ def autorestore-restore-buffer -docstring "Restore the backup for the current fi buffer_dirname=$(dirname "${kak_buffile}") ## 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 exit @@ -25,7 +25,7 @@ def autorestore-restore-buffer -docstring "Restore the backup for the current fi hook -group autorestore buffer BufWritePost '${kak_buffile}' %{ nop %sh{ 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}\" done fi @@ -45,7 +45,7 @@ def autorestore-purge-backups -docstring "Remove all the backups of the current buffer_basename="${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}" done }