summaryrefslogtreecommitdiff
path: root/modules/show-kill-ring.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-08 17:16:29 -0500
committerCraig Jennings <c@cjennings.net>2024-04-08 17:16:29 -0500
commita55a5248bd2dae5f849476d0f7b5dcd8d91cf929 (patch)
tree834a7b012f6823b53ee2f516384b7bc4c4ec819b /modules/show-kill-ring.el
parent754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (diff)
fit and finish work
- gptel: added gptel-send-region with global keybinding - projectile: made project-switch-actions more efficient with regexp - prog-go: removed disabled code - mu4e: capture template captures region if selected - system utils: merged bury alive with other killing buffer code - org-capture: renamed *website-clipper to org-webpage-clipper - rg: auto switch to ripgrep-results window when ripgrep search completes - dashboard: remove dashboard banner custom face General - moved abbrev_defs to assets - removed gitmodules file - updated packages - fixed docstring and formatting throughout Custom-Functions - move cj/merge-list-to-list to custom-functions - add remove leading trailing whitespace function - corrected arrayify prompt Font-Config - added font point sizes in fontaine menu - make default font point size 11 Python - adding back python poetry support - added cj/python-setup method - merge python and python-mode configurations (they are the same built-in package) Show-Kill-Ring - show-kill-ring displays in another read-only buffer - show-kill-ring exits with q Elfeed - moved elfeed-feeds.org to assets - removed Wired from elfeed feeds - moved ElfeedDB to user-emacs-directory/.elfeed-db - moved elfeed-dashboard.org to assets
Diffstat (limited to 'modules/show-kill-ring.el')
-rw-r--r--modules/show-kill-ring.el25
1 files changed, 16 insertions, 9 deletions
diff --git a/modules/show-kill-ring.el b/modules/show-kill-ring.el
index fdc400ee..e6405c6d 100644
--- a/modules/show-kill-ring.el
+++ b/modules/show-kill-ring.el
@@ -1,21 +1,24 @@
;;; show-kill-ring --- Displays Previous Kill Ring Entries -*- lexical-binding: t; -*-;; Show Kill Ring
;; Stolen from Steve Yegge when he wasn't looking
-
;;; Commentary:
;; Browse items you've previously killed.
-
;;; Code:
(require 'cl-lib)
(defvar show-kill-max-item-size 1000
- "This represents the size of a \\='kill ring\\=' entry.
-A positive number means to limit the display of \\='kill-ring\\=' items to
+ "This represents the size of a \='kill ring\=' entry.
+A positive number means to limit the display of \='kill-ring\=' items to
that number of characters.")
+(defun show-kill-ring-exit ()
+ "Exit the show-kill-ring buffer."
+ (interactive)
+ (quit-window t))
+
(defun show-kill-ring ()
"Show the current contents of the kill ring in a separate buffer.
This makes it easy to figure out which prefix to pass to yank."
@@ -39,7 +42,7 @@ This makes it easy to figure out which prefix to pass to yank."
;; show each of the items in the kill ring, in order
(while temp
;; insert our little divider
- (insert (concat "\n" bar item (prin1-to-string count) " "
+ (insert (concat "\n" bar item (prin1-to-string count) " "
(if (< count 10) bar2 bar) "\n"))
;; if this is the yank pointer target, grab it
@@ -52,12 +55,16 @@ This makes it easy to figure out which prefix to pass to yank."
(setq temp (cdr temp)))
;; show info about yank item
- (show-kill-insert-footer yptr ynum)
+ (show-kill-insert-footer yptr ynum)
+
+ (use-local-map (make-sparse-keymap))
+ (local-set-key "q" 'show-kill-ring-exit)
;; show it
- (goto-char (point-min))
- (set-buffer-modified-p nil)
- (display-buffer buf)))
+ (goto-char (point-min))
+ (setq buffer-read-only t)
+ (set-buffer-modified-p nil)
+ (pop-to-buffer buf)))
(defun show-kill-insert-item (item)
"Insert an ITEM from the kill ring into the current buffer.