Finish fixing (hopefully) emacs-bookmark.zsh
This commit is contained in:
parent
8d3ef4b4e4
commit
db347d3f5c
@ -120,16 +120,16 @@ function bm {
|
||||
${=EDITOR} "${target}"
|
||||
else
|
||||
printf 'Bookmark exists, but trailing path doesn'"'"'t: "%s"\n' \
|
||||
"${__bm_res[3]}"
|
||||
"${(q)__bm_res[3]}"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
printf 'No such bookmark: "%s"\n' "${1}"
|
||||
printf 'No such bookmark: "%s"\n' "${(q)1}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
function _bm {
|
||||
local arg="${words[${CURRENT}]}"
|
||||
local arg="${(Q)words[${CURRENT}]}"
|
||||
if ! [[ "${arg}" == */* ]]; then
|
||||
_arguments '1::bookmark:_bookmarks'
|
||||
else
|
||||
@ -137,7 +137,7 @@ function _bm {
|
||||
if [[ -d "${__bm_res[1]}" ]]; then
|
||||
local parts=(${(s:/:)__bm_res[3]})
|
||||
local bm="${${(s:/:)${arg}}[1]}"
|
||||
local subdir="${(j:/:)parts[1,${#parts}-1]}"
|
||||
local subdir="${(j:/:)parts[1,-2]}"
|
||||
local search="${parts[${#parts}]}"
|
||||
if ((${#parts} > 0)) && [[ "${arg}" == */ ]]; then
|
||||
subdir="${subdir}/${search}"
|
||||
@ -145,7 +145,8 @@ function _bm {
|
||||
search=""
|
||||
fi
|
||||
local pre_path="${__bm_res[1]}/${subdir}/"
|
||||
local prefix="${bm}/${subdir}"
|
||||
local raw_arg="${words[${CURRENT}]}"
|
||||
local prefix="${${(s:/:)${raw_arg}}[1]}/${subdir}"
|
||||
if ! [[ -z "${subdir}" ]]; then
|
||||
prefix+='/'
|
||||
fi
|
||||
@ -182,7 +183,7 @@ function bmadd {
|
||||
esac
|
||||
__bm_update_bookmark_list
|
||||
if __bm_bookmark_location "${name}" >/dev/null; then
|
||||
printf 'Bookmark "%s" already exists. Overwrite it? [y/N] ' "${name}"
|
||||
printf 'Bookmark "%s" already exists. Overwrite it? [y/N] ' "${(q)name}"
|
||||
read -q
|
||||
let ans=${?}
|
||||
printf '\n'
|
||||
@ -198,7 +199,7 @@ function bmadd {
|
||||
(inhibit-message t))
|
||||
(bookmark-save)
|
||||
res)")"
|
||||
[[ "${res}" = 'nil' ]] && printf 'Added bookmark "%s"\n' "${name}" \
|
||||
[[ "${res}" = 'nil' ]] && printf 'Added bookmark "%s"\n' "${(q)name}" \
|
||||
|| { printf '%s\n' "${res}"; return 1 }
|
||||
__bm_update_bookmark_list
|
||||
}
|
||||
@ -220,7 +221,7 @@ function bmrm {
|
||||
__bm_update_bookmark_list
|
||||
__bm_bookmark_location "${1}" >/dev/null || \
|
||||
{ printf 'No such bookmark: "%s"\n' "${1}"; return 1 }
|
||||
printf 'Really delete "%s"? [y/N] ' "${1}"
|
||||
printf 'Really delete "%s"? [y/N] ' "${(q)1}"
|
||||
if read -q; then
|
||||
printf '\n'
|
||||
local res="$(emacsclient --eval \
|
||||
@ -228,7 +229,7 @@ function bmrm {
|
||||
(inhibit-message t))
|
||||
(bookmark-save)
|
||||
res)")"
|
||||
[[ "${res}" = 'nil' ]] && printf 'Deleted bookmark "%s"\n' "${1}" \
|
||||
[[ "${res}" = 'nil' ]] && printf 'Deleted bookmark "%s"\n' "${(q)1}" \
|
||||
|| { printf '%s\n' "${res}"; return 1 }
|
||||
else
|
||||
printf '\n'
|
||||
|
Loading…
Reference in New Issue
Block a user