From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andrew Choi Newsgroups: gmane.emacs.help Subject: Re: Different semantics for yank-pop?? Date: Sat, 14 Dec 2002 21:31:26 GMT Organization: Shaw Residential Internet Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1039901764 30210 80.91.224.249 (14 Dec 2002 21:36:04 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 14 Dec 2002 21:36:04 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18NJx3-0007qp-00 for ; Sat, 14 Dec 2002 22:36:01 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18NJwZ-00054u-08 for gnu-help-gnu-emacs@m.gmane.org; Sat, 14 Dec 2002 16:35:31 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!204.71.34.3!newsfeed.cwix.com!prodigy.com!pd2nf1so.cg.shawcable.net!residential.shaw.ca!news3.calgary.shaw.ca.POSTED!not-for-mail X-Trace-PostClient-IP: 68.144.207.94 Original-Newsgroups: gnu.emacs.help Original-Lines: 57 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-NNTP-Posting-Host: 24.71.223.147 Original-X-Complaints-To: abuse@shaw.ca Original-X-Trace: news3.calgary.shaw.ca 1039901486 24.71.223.147 (Sat, 14 Dec 2002 14:31:26 MST) Original-NNTP-Posting-Date: Sat, 14 Dec 2002 14:31:26 MST Original-Xref: shelby.stanford.edu gnu.emacs.help:108134 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:4663 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:4663 Larry Denenberg writes: > When I run emacs with "emacs --nw" from a Terminal window, yank-pop > works just like I expect it to. But when I invoke the Emacs > application from the finder (like other OS X applications) things are > screwy. The first yank-pop of a sequence seems to yank the top of the > kill ring (i.e., the same text yanked by the immediately preceding > C-y) rather than the previous entry. So, for example, C-k C-y M-y is > always a no-op, whereas I expect it to replace the rest of the line > with the previous kill. [...] I'll try to work out a more permanent fix when I can. But for the time being, putting the following in your startup file will make it behave the way you want. ;; Temporary fix for problem with yank-pop (borrowed from pc-win.el). (defcustom x-select-enable-clipboard t "Non-nil means cutting and pasting uses the clipboard. This is the default on this system, since Mac OS X does not support other types of selections." :type 'boolean :group 'killing) (defun mac-set-clipboard-data (str push) (mac-cut-function (encode-coding-string str selection-coding-system t) push)) (defun mac-get-clipboard-data () (decode-coding-string (mac-paste-function) selection-coding-system t)) (defun x-select-text (text &optional push) (if x-select-enable-clipboard (mac-set-clipboard-data text push)) (setq x-last-selected-text text)) ;;; Return the value of the current selection. ;;; Consult the selection, then the cut buffer. Treat empty strings ;;; as if they were unset. (defun x-get-selection-value () (if x-select-enable-clipboard (let ((text (mac-get-clipboard-data))) (if (string= text "") (setq text nil)) (cond ((not text) nil) ((eq text x-last-selected-text) nil) ((string= text x-last-selected-text) ;; Record the newer string, so subsequent calls can use the ;; 'eq' test. (setq x-last-selected-text text) nil) (t (setq x-last-selected-text text)))))) ;;; Arrange for the kill and yank functions to set and check the clipboard. (setq interprogram-cut-function 'x-select-text) (setq interprogram-paste-function 'x-get-selection-value)