From c94d82c571a56a5b5f26b7355a492ce8ac0a49bb Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Sun, 10 Mar 2024 18:11:29 -0700 Subject: [PATCH] Fix newlines in filenames in emacs-bookmark.zsh --- emacs-bookmark.zsh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/emacs-bookmark.zsh b/emacs-bookmark.zsh index 2eeff98..720c452 100644 --- a/emacs-bookmark.zsh +++ b/emacs-bookmark.zsh @@ -26,14 +26,18 @@ function __bm_update_bookmark_list { local quoted_output case "${BM_MODE}" in 'daemon') - quoted_output=(${(z)${"$(command emacsclient --eval \ -"(let ((out)) - (dolist (entry bookmark-alist out) - (let ((path (alist-get 'filename (cdr entry) "")) - (pos (alist-get 'position (cdr entry) 1))) - (setq out (append (list (car entry) path - (expand-file-name path) pos) - out)))))")":1:-1}}) + quoted_output=(${(z)${"$(command emacs -Q --batch --eval \ +"(prin1 + (progn + (require 'server) + (server-eval-at \"server\" + '(let ((out)) + (dolist (entry bookmark-alist out) + (let ((path (alist-get 'filename (cdr entry) "")) + (pos (alist-get 'position (cdr entry) 1))) + (setq out (append (list (car entry) path + (expand-file-name path) pos) + out))))))))")":1:-1}}) ;; ''|'emacs') if ! [[ -v BM_BOOKMARK_PATH ]]; then