Permalink
Browse files

Fix a bug where having other overlays active in the Kill Ring

buffer could stop you inserting.
  • Loading branch information...
1 parent 27f5e3e commit ca5b5d4cd2f5222c37687c894abfd4b5c46e4e59 @T-J-Teru committed with Andrew Burgess Feb 28, 2011
Showing with 19 additions and 6 deletions.
  1. +19 −6 browse-kill-ring.el
View
@@ -5,7 +5,7 @@
;; Author: Colin Walters <walters@verbum.org>
;; Maintainer: Nick Hurley <hurley@cis.ohio-state.edu>
;; 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 $
;; URL: http://freedom.cis.ohio-state.edu/~hurley/
;; URL-ja: http://www.fan.gr.jp/~ring/doc/browse-kill-ring.html
@@ -50,6 +50,12 @@
;;; 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:
;; * 24-Feb-2011: Andrew Burgess <aburgess@broadcom.com>
@@ -617,12 +623,19 @@ of the *Kill Ring*."
(browse-kill-ring-resize-window)
(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)
- (with-current-buffer buf
- (let ((overs (overlays-at pt)))
- (or (and overs
- (overlay-get (car overs) 'browse-kill-ring-target))
- (error "No kill ring item here")))))
+ (or (browse-kill-ring-current-string-1 (overlays-at pt))
+ (error "No kill ring item here")))
(defun browse-kill-ring-do-insert (buf pt)
(let ((str (browse-kill-ring-current-string buf pt)))

0 comments on commit ca5b5d4

Please sign in to comment.