* bug#2289: wishlist with fix: losing X-windows clipboard
@ 2009-02-11 16:46 Craig Falls
2009-02-12 2:33 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Craig Falls @ 2009-02-11 16:46 UTC (permalink / raw)
To: bug-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 3930 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 5340 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#2289: wishlist with fix: losing X-windows clipboard
2009-02-11 16:46 bug#2289: wishlist with fix: losing X-windows clipboard Craig Falls
@ 2009-02-12 2:33 ` Stefan Monnier
2009-02-12 2:40 ` Processed: " Emacs bug Tracking System
2009-02-13 0:04 ` Craig Falls
0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2009-02-12 2:33 UTC (permalink / raw)
To: Craig Falls; +Cc: 2289
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Processed: Re: bug#2289: wishlist with fix: losing X-windows clipboard
2009-02-12 2:33 ` Stefan Monnier
@ 2009-02-12 2:40 ` Emacs bug Tracking System
2009-02-13 0:04 ` Craig Falls
1 sibling, 0 replies; 6+ messages in thread
From: Emacs bug Tracking System @ 2009-02-12 2:40 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs Bugs
Processing commands for control@emacsbugs.donarmstrong.com:
> severity 2289 wishlist
bug#2289: wishlist with fix: losing X-windows clipboard
Severity set to `wishlist' from `normal'
> thanks
Stopping processing here.
Please contact me if you need assistance.
Don Armstrong
(administrator, Emacs bugs database)
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#2289: wishlist with fix: losing X-windows clipboard
2009-02-12 2:33 ` Stefan Monnier
2009-02-12 2:40 ` Processed: " Emacs bug Tracking System
@ 2009-02-13 0:04 ` Craig Falls
2011-10-05 5:53 ` Glenn Morris
1 sibling, 1 reply; 6+ messages in thread
From: Craig Falls @ 2009-02-13 0:04 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 2289
[-- Attachment #1: Type: text/plain, Size: 879 bytes --]
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@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
>
[-- Attachment #2: Type: text/html, Size: 1291 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-10-05 22:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-11 16:46 bug#2289: wishlist with fix: losing X-windows clipboard Craig Falls
2009-02-12 2:33 ` Stefan Monnier
2009-02-12 2:40 ` Processed: " Emacs bug Tracking System
2009-02-13 0:04 ` Craig Falls
2011-10-05 5:53 ` Glenn Morris
2011-10-05 22:18 ` Chong Yidong
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).