Make emacs-bookmark.zsh work on older versions of zsh

This commit is contained in:
Alexander Rosenberg 2025-02-17 01:10:03 -08:00
parent 7c85a1d3ee
commit b5c3ea0edb
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 4 additions and 4 deletions

View File

@ -151,7 +151,7 @@ function bm {
if (( ${#__bm_res} != 0 )) && [[ -e "${bm_loc}" ]]; then if (( ${#__bm_res} != 0 )) && [[ -e "${bm_loc}" ]]; then
if [[ -d "${target}" ]]; then if [[ -d "${target}" ]]; then
cd "${target}" cd "${target}"
(( "${BM_CWD_LS:-0}" )) && ls || true [[ "${BM_CWD_LS}" == 'true' ]] && ls || true
elif [[ -e "${bm_loc}" ]]; then elif [[ -e "${bm_loc}" ]]; then
let offset="${__bm_res[2]}" let offset="${__bm_res[2]}"
local rowcol=(${(0)"$(__bm_offset_to_row_col "${bm_loc}" "${offset}")"}) local rowcol=(${(0)"$(__bm_offset_to_row_col "${bm_loc}" "${offset}")"})
@ -289,7 +289,7 @@ compdef _bmrm bmrm
function __bm_precmd_hook { function __bm_precmd_hook {
# Auto reload # Auto reload
if (( "${BM_AUTO_RELOAD:-0}" )) && if [[ "${BM_AUTO_RELOAD}" == 'true' ]] &&
(( ${__bm_last_read_time} < "$(zstat +mtime "${BM_BOOKMARK_PATH}")" )); then (( ${__bm_last_read_time} < "$(zstat +mtime "${BM_BOOKMARK_PATH}")" )); then
__bm_update_bookmark_list __bm_update_bookmark_list
fi fi

View File

@ -272,9 +272,9 @@ fi
# Bookmarks # Bookmarks
if cmd_exists emacs; then 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_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" source "${ZSH_CONFIG_DIR}/emacs-bookmark.zsh"
fi fi