all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.