Skip to content

Commit

Permalink
Fix a bug where having other overlays active in the Kill Ring
Browse files Browse the repository at this point in the history
buffer could stop you inserting.
  • Loading branch information
T-J-Teru authored and Andrew Burgess committed Feb 28, 2011
1 parent 27f5e3e commit ca5b5d4
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions browse-kill-ring.el
Expand Up @@ -5,7 +5,7 @@
;; Author: Colin Walters <walters@verbum.org> ;; Author: Colin Walters <walters@verbum.org>
;; Maintainer: Nick Hurley <hurley@cis.ohio-state.edu> ;; Maintainer: Nick Hurley <hurley@cis.ohio-state.edu>
;; Created: 7 Apr 2001 ;; Created: 7 Apr 2001
;; Version: 1.3b ;; Version: 1.3c
;; X-RCS: $Id: browse-kill-ring.el,v 1.2 2008/10/29 00:23:00 hurley Exp $ ;; X-RCS: $Id: browse-kill-ring.el,v 1.2 2008/10/29 00:23:00 hurley Exp $
;; URL: http://freedom.cis.ohio-state.edu/~hurley/ ;; URL: http://freedom.cis.ohio-state.edu/~hurley/
;; URL-ja: http://www.fan.gr.jp/~ring/doc/browse-kill-ring.html ;; URL-ja: http://www.fan.gr.jp/~ring/doc/browse-kill-ring.html
Expand Down Expand Up @@ -50,6 +50,12 @@


;;; Change Log: ;;; Change Log:


;; Changes from 1.3b to 1.3c:

;; * 28-Feb-2011: Andrew Burgess <aburgess@broadcom.com>
;; Fix a bug where having other overlays active in the kill ring buffer,
;; for example with show-paren-mode would block insertion.

;; Changes from 1.3a to 1.3b: ;; Changes from 1.3a to 1.3b:


;; * 24-Feb-2011: Andrew Burgess <aburgess@broadcom.com> ;; * 24-Feb-2011: Andrew Burgess <aburgess@broadcom.com>
Expand Down Expand Up @@ -617,12 +623,19 @@ of the *Kill Ring*."
(browse-kill-ring-resize-window) (browse-kill-ring-resize-window)
(browse-kill-ring-forward 0)) (browse-kill-ring-forward 0))


;; Helper function for browse-kill-ring-current-string, takes a list of
;; overlays and returns the string from the first overlay that has the
;; property. There might be more than just our overlay at this point.
(defun browse-kill-ring-current-string-1 (overs)
(if overs
(let ((str (overlay-get (car overs) 'browse-kill-ring-target)))
(if str str (browse-kill-ring-current-string-1 (cdr overs))))
nil))

;; Find the string to insert at the point by looking for the overlay.
(defun browse-kill-ring-current-string (buf pt) (defun browse-kill-ring-current-string (buf pt)
(with-current-buffer buf (or (browse-kill-ring-current-string-1 (overlays-at pt))
(let ((overs (overlays-at pt))) (error "No kill ring item here")))
(or (and overs
(overlay-get (car overs) 'browse-kill-ring-target))
(error "No kill ring item here")))))


(defun browse-kill-ring-do-insert (buf pt) (defun browse-kill-ring-do-insert (buf pt)
(let ((str (browse-kill-ring-current-string buf pt))) (let ((str (browse-kill-ring-current-string buf pt)))
Expand Down

0 comments on commit ca5b5d4

Please sign in to comment.