all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Sam Steingold <sds@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: kill-new discards current X selection
Date: Wed, 26 Aug 2009 23:03:33 -0400	[thread overview]
Message-ID: <jwvws4q56c9.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <1f77704b0908261339y2baac531j11c6b230c28f1fd6@mail.gmail.com> (Sam Steingold's message of "Wed, 26 Aug 2009 16:39:25 -0400")

>> BTW, here's the version I use in my own local collection of hacks.
>> 
>> === modified file 'lisp/simple.el'
>> --- lisp/simple.el      2009-08-19 08:31:59 +0000
>> +++ lisp/simple.el      2009-08-21 14:24:38 +0000
>> @@ -2799,6 +2851,21 @@
>>  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."
>> +  ;; To better pretend that X-selection = head-of-kill-ring, we copy other
>> +  ;; application's X-selection to the kill-ring.  This comes in handy when
>> +  ;; you do something like:
>> +  ;; - copy a piece of text in your web-browser.
>> +  ;; - have to do some editing (including killing) before you can yank
>> +  ;;   that text.
>> +  ;; Note: this piece of code inspired from current-kill.
>> +  (let ((paste (and interprogram-paste-function
>> +                    (funcall interprogram-paste-function))))
>> +    (when paste
>> +      (let ((interprogram-cut-function nil)
>> +            (interprogram-paste-function nil))
>> +        (kill-new paste))))
> I think my version is just a little bit more transparent.

Actually, IIRC I specifically (re)used kill-new to avoid code duplication.

>> +  ;; The actual kill-new functionality.
>> +  (when (equal string (car kill-ring)) (setq replace t))

> this seems to be a separate nice feature, similar to bash
> HISTCONTROL=ignoredups.
> I think it would be a good separate addition, controlled by
> kill-ignore-duplicates

Yes, it's a separate "feature".  I can't remember which use-case this
was designed for, but I remember I added it for one particular situation
where it makes a big difference (not that it doesn't remove all
duplicates, just consecutive duplicates).


        Stefan




  reply	other threads:[~2009-08-27  3:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26 16:18 kill-new discards current X selection Sam Steingold
2009-08-26 18:41 ` Jan D.
2009-08-26 19:28 ` Stefan Monnier
2009-08-26 20:39   ` Sam Steingold
2009-08-27  3:03     ` Stefan Monnier [this message]
2009-08-26 19:36 ` David De La Harpe Golden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvws4q56c9.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=sds@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.