flexibeast / ebuku

Emacs interface to the buku Web bookmark manager.
92 stars 7 forks source link

Fix: don't modify kill-ring when opening ebuku buffer #29

Closed croissong closed 10 months ago

croissong commented 10 months ago

I noticed that whenever I copy an URL to my clipboard and then open Ebuku for the first time with ebuku and call ebuku-add-bookmark, my clipboard is empty and I need to copy the URL again. The simple fix is to use delete-region instead of kill-region, which I think is better suited in this case anyway.

This patch illustrates the current behavior when running ebuku with something in the clipboard:

diff --git a/ebuku.el b/ebuku.el
index 2394e93..93be6f3 100644
--- a/ebuku.el
+++ b/ebuku.el
@@ -655,7 +655,9 @@ Argument EXCLUDE is a string: keywords to exclude from search results."
         (let ((inhibit-read-only t))
           (ebuku--goto-line ebuku--results-start)
           (beginning-of-line)
+          (message "Before: %s"(current-kill 0 nil))
           (kill-region (point) (point-max))
+          (message "After: %s"(current-kill 0 nil))
           (cond
            ((string= "0" count)
             (insert (concat "  No results found for '" search "'.\n\n")))
*Messages* 
Before: https://github.com/flexibeast/ebuku
After: 
flexibeast commented 10 months ago

i'd been noticing this behaviour for a while myself, but hadn't yet got around to addressing it - thanks!