From 0696bec4252cd592399fdb38159972913f308aa8 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 4 Jul 2023 08:33:03 +0300 Subject: yeetube-update-info: use push-mark Use push-mark and let a variable for buffer to always switch. Replace kill-visual-line with kill-region to not mess with the kill-ring --- yeetube.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'yeetube.el') diff --git a/yeetube.el b/yeetube.el index 99f36af..52d30d9 100644 --- a/yeetube.el +++ b/yeetube.el @@ -256,24 +256,24 @@ WHERE indicates where in the buffer the update should happen. OPERATION & WHERE are required to work with 'add-variable-watcher." (when (get-buffer "*Yeetube Search*") + (push-mark) (let ((to-change (pcase symbol-name ('yeetube-player "Yeetube Player:") ('yeetube-download-directory "Download Directory:") - ('yeetube-download-audio-format "Download as audio format:")))) + ('yeetube-download-audio-format "Download as audio format:"))) + (buffer-cur (buffer-name))) (switch-to-buffer (get-buffer "*Yeetube Search*")) (setq-local buffer-read-only nil) (goto-char (point-min)) (search-forward to-change) (beginning-of-visual-line) - (kill-visual-line) + (kill-region (point) (line-end-position)) (insert (format "%s *%s*" to-change new-value)) - (goto-char (point-min)) - (search-forward yeetube-results-prefix) (setq-local buffer-read-only t) - (unless (equal (buffer-name) "*Yeetube Search*") - (switch-to-buffer (other-buffer)))))) + (switch-to-buffer buffer-cur)) + (goto-char (mark)))) ;; Variable to watch -- cgit v1.2.3