From b5c3ea0edbc9b6eff34fcc0d9b0d713de857480e Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Mon, 17 Feb 2025 01:10:03 -0800 Subject: [PATCH] Make emacs-bookmark.zsh work on older versions of zsh --- emacs-bookmark.zsh | 4 ++-- init.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/emacs-bookmark.zsh b/emacs-bookmark.zsh index cacba9e..636a61e 100644 --- a/emacs-bookmark.zsh +++ b/emacs-bookmark.zsh @@ -151,7 +151,7 @@ function bm { if (( ${#__bm_res} != 0 )) && [[ -e "${bm_loc}" ]]; then if [[ -d "${target}" ]]; then cd "${target}" - (( "${BM_CWD_LS:-0}" )) && ls || true + [[ "${BM_CWD_LS}" == 'true' ]] && ls || true elif [[ -e "${bm_loc}" ]]; then let offset="${__bm_res[2]}" local rowcol=(${(0)"$(__bm_offset_to_row_col "${bm_loc}" "${offset}")"}) @@ -289,7 +289,7 @@ compdef _bmrm bmrm function __bm_precmd_hook { # Auto reload - if (( "${BM_AUTO_RELOAD:-0}" )) && + if [[ "${BM_AUTO_RELOAD}" == 'true' ]] && (( ${__bm_last_read_time} < "$(zstat +mtime "${BM_BOOKMARK_PATH}")" )); then __bm_update_bookmark_list fi diff --git a/init.zsh b/init.zsh index 30e07de..a3bd3ba 100644 --- a/init.zsh +++ b/init.zsh @@ -272,9 +272,9 @@ fi # Bookmarks if cmd_exists emacs; then - [[ -v BM_CWD_LS ]] || BM_CWD_LS=1 + [[ -v BM_CWD_LS ]] || BM_CWD_LS=true [[ -v BM_MODE ]] || BM_MODE=daemon - [[ -v BM_AUTO_RELOAD ]] || BM_AUTO_RELOAD=1 + [[ -v BM_AUTO_RELOAD ]] || BM_AUTO_RELOAD=true source "${ZSH_CONFIG_DIR}/emacs-bookmark.zsh" fi