GNU bug report logs - #2289
wishlist with fix: losing X-windows clipboard

Previous Next

Package: emacs;

Reported by: Craig Falls <cfalls <at> gmail.com>

Date: Wed, 11 Feb 2009 16:55:03 UTC

Severity: wishlist

Fixed in version 23.2

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 2289 in the body.
You can then email your comments to 2289 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2289; Package emacs. (Wed, 11 Feb 2009 16:55:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Craig Falls <cfalls <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 11 Feb 2009 16:55:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Craig Falls <cfalls <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: wishlist with fix: losing X-windows clipboard
Date: Wed, 11 Feb 2009 11:46:43 -0500
[Message part 1 (text/plain, inline)]
Symptom: User loses the contents of the X-windows clipboard when
executing a kill command.  This is inconsistent with text killed in
emacs, which is still saved in the kill-ring after subsequent kills.
(see http://osdir.com/ml/emacs.macintosh.osx/2005-11/msg00078.html for
someone else annoyed by this)

Actions to trigger: Copy text in Firefox.  Run a kill command
(e.g. kill-region) in emacs.  Run yank.  Run yank-pop.  Note that the
text copied in Firefox is nowhere to be found.

Fix: The following one-line patch seems to work, but I'm no emacs
hacker, so among other things, there's no configuration.  It just
saves the clipboard to the kill-ring before killing if yank would
result in yanking the clipboard instead of the top of the kill ring.

--- /home/cfalls/src/emacs/lisp/simple.el       2008-04-22
15:50:11.000000000 -0400
+++ /tmp/simple.el      2009-02-11 11:23:46.373880990 -0500
@@ -2705,46 +2705,47 @@
 (defun kill-new (string &optional replace yank-handler)
   "Make STRING the latest kill in the kill ring.
 Set `kill-ring-yank-pointer' to point to it.
 If `interprogram-cut-function' is non-nil, apply it to STRING.
 Optional second argument REPLACE non-nil means that STRING will replace
 the front of the kill ring, rather than being added to the list.

 Optional third arguments YANK-HANDLER controls how the STRING is later
 inserted into a buffer; see `insert-for-yank' for details.
 When a yank handler is specified, STRING must be non-empty (the yank
 handler, if non-nil, is stored as a `yank-handler' text property on
STRING).

 When the yank handler has a non-nil PARAM element, the original STRING
 argument is not used by `insert-for-yank'.  However, since Lisp code
 may access and use elements from the kill ring directly, the STRING
 argument should still be a \"useful\" string for such uses."
   (if (> (length string) 0)
       (if yank-handler
          (put-text-property 0 (length string)
                             'yank-handler yank-handler string))
     (if yank-handler
        (signal 'args-out-of-range
                (list string "yank-handler specified for empty string"))))
+  (current-kill 0)
   (if (fboundp 'menu-bar-update-yank-menu)
       (menu-bar-update-yank-menu string (and replace (car kill-ring))))
   (if (and replace kill-ring)
       (setcar kill-ring string)
     (push string kill-ring)
     (if (> (length kill-ring) kill-ring-max)
        (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)))
   (setq kill-ring-yank-pointer kill-ring)
   (if interprogram-cut-function
       (funcall interprogram-cut-function string (not replace))))

 (defun kill-append (string before-p &optional yank-handler)
   "Append STRING to the end of the latest kill in the kill ring.
 If BEFORE-P is non-nil, prepend STRING to the kill.
 Optional third argument YANK-HANDLER, if non-nil, specifies the
 yank-handler text property to be set on the combined kill ring
 string.  If the specified yank-handler arg differs from the
 yank-handler property of the latest kill string, this function
 adds the combined string to the kill ring as a new element,
 instead of replacing the last kill with it.
 If `interprogram-cut-function' is set, pass the resulting kill to it."
   (let* ((cur (car kill-ring)))
     (kill-new (if before-p (concat string cur) (concat cur string))



In GNU Emacs 23.0.60.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.8.20)
 of 2008-04-24 on nyc-qws-024
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--enable-font-backend' '--with-xft'
'--with-freetype''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t
[Message part 2 (text/html, inline)]

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2289; Package emacs. (Thu, 12 Feb 2009 02:40:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 12 Feb 2009 02:40:06 GMT) Full text and rfc822 format available.

Message #10 received at 2289 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Craig Falls <cfalls <at> gmail.com>
Cc: 2289 <at> debbugs.gnu.org
Subject: Re: bug#2289: wishlist with fix: losing X-windows clipboard
Date: Wed, 11 Feb 2009 21:33:23 -0500
severity 2289 wishlist
thanks

> Fix: The following one-line patch seems to work, but I'm no emacs
> hacker, so among other things, there's no configuration.  It just
> saves the clipboard to the kill-ring before killing if yank would
> result in yanking the clipboard instead of the top of the kill ring.

I use a similar patch myself.
And actually I tried to get it accepted, but it was turned down because
of the problems it introduces when the "current-kill" hangs (e.g. when
the holder of the selection is suspended).
We should add it together, conditional on some config var.
That will be for Emacs-23.2, tho.


        Stefan




Severity set to `wishlist' from `normal' Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> emacsbugs.donarmstrong.com. (Thu, 12 Feb 2009 02:40:07 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2289; Package emacs. (Fri, 13 Feb 2009 00:10:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Craig Falls <cfalls <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 13 Feb 2009 00:10:04 GMT) Full text and rfc822 format available.

Message #17 received at 2289 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Craig Falls <cfalls <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 2289 <at> debbugs.gnu.org
Subject: Re: bug#2289: wishlist with fix: losing X-windows clipboard
Date: Thu, 12 Feb 2009 19:04:58 -0500
[Message part 1 (text/plain, inline)]
Thanks.  I sort of feel like current-kill should time out, whether this new
option is set or not, if that's possible in emacs lisp.

On Wed, Feb 11, 2009 at 9:33 PM, Stefan Monnier <monnier <at> iro.umontreal.ca>wrote:

> severity 2289 wishlist
> thanks
>
> > Fix: The following one-line patch seems to work, but I'm no emacs
> > hacker, so among other things, there's no configuration.  It just
> > saves the clipboard to the kill-ring before killing if yank would
> > result in yanking the clipboard instead of the top of the kill ring.
>
> I use a similar patch myself.
> And actually I tried to get it accepted, but it was turned down because
> of the problems it introduces when the "current-kill" hangs (e.g. when
> the holder of the selection is suspended).
> We should add it together, conditional on some config var.
> That will be for Emacs-23.2, tho.
>
>
>        Stefan
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#2289; Package emacs. (Wed, 05 Oct 2011 05:54:01 GMT) Full text and rfc822 format available.

Message #20 received at 2289 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 2289 <at> debbugs.gnu.org
Subject: Re: bug#2289: wishlist with fix: losing X-windows clipboard
Date: Wed, 05 Oct 2011 01:53:48 -0400
found 2289 24.0.90
stop

This issue still seems to be present, despite the selection-related
changes in Emacs 24.




bug Marked as found in versions 24.0.90. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 05 Oct 2011 05:54:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#2289; Package emacs. (Wed, 05 Oct 2011 22:19:01 GMT) Full text and rfc822 format available.

Message #25 received at 2289 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Craig Falls <cfalls <at> gmail.com>, 2289 <at> debbugs.gnu.org
Subject: Re: bug#2289: wishlist with fix: losing X-windows clipboard
Date: Wed, 05 Oct 2011 18:18:47 -0400
Glenn Morris <rgm <at> gnu.org> writes:

>> Copy text in Firefox.  Run a kill command (e.g. kill-region) in
>> emacs.  Run yank.  Run yank-pop.  Note that the text copied in
>> Firefox is nowhere to be found.
>
> This issue still seems to be present, despite the selection-related
> changes in Emacs 24.

Actually, it was fixed in 23.2.  The behavior desired by the OP can now
be obtained by setting save-interprogram-paste-before-kill to t.
Closing.





bug closed, send any further explanations to 2289 <at> debbugs.gnu.org and Craig Falls <cfalls <at> gmail.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Wed, 05 Oct 2011 22:20:03 GMT) Full text and rfc822 format available.

bug No longer marked as found in versions 24.0.90. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 05 Oct 2011 22:29:01 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 23.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 05 Oct 2011 22:29:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 03 Nov 2011 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.