From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Floyd Davidson Newsgroups: gmane.emacs.help Subject: Re: Cursor at end of region pasted in Date: Fri, 20 Feb 2004 01:34:15 -0900 Organization: __________ Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87llmykpjs.fld@barrow.com> References: <340bc066.0402200054.7e63d9c0@posting.google.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077274173 12925 80.91.224.253 (20 Feb 2004 10:49:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Feb 2004 10:49:33 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 20 11:49:26 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Au8Dl-0005XL-00 for ; Fri, 20 Feb 2004 11:49:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Au8Cu-0007zH-N7 for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Feb 2004 05:48:32 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!newshosting.com!nx01.iad01.newshosting.com!66.150.105.61.MISMATCH!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!falcon.america.net!eagle.america.net.POSTED!not-for-mail Original-Newsgroups: comp.emacs,gnu.emacs.help User-Agent: gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.0 Cancel-Lock: sha1:RLRFdxgf+FhbjwEJXsgTBsqNrDI= Original-Lines: 45 Original-NNTP-Posting-Host: 209.124.156.32 Original-X-Trace: eagle.america.net 1077273300 209.124.156.32 (Fri, 20 Feb 2004 05:35:00 EST) Original-NNTP-Posting-Date: Fri, 20 Feb 2004 05:35:00 EST Original-Xref: shelby.stanford.edu comp.emacs:83344 gnu.emacs.help:121067 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17017 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17017 lng2@spray.se (Lars Gustafsson) wrote: >Hi! >How do I get the cursor to place itself at the end of the region, >which has just been pasted in? Right now it places itself at the >beginning of the region, which has just been pasted in. This is my >function: > >(global-unset-key [(control v)]) >(global-set-key [(control v)] 'paste-and-show) ; PASTE-KEY. >(defun paste-and-show () (interactive) "Paste from register a" > (progn > (message "Region from register a pasted in") > (if (eq mark-active (not nil)) ; if-part > (progn ; then-part > (message "Markeringen var aktiv") > (transient-mark-mode 1) > (kill-region (region-beginning) (region-end)) > ;(transient-mark-mode 0) > ) > ) > (insert-register ?a) > (setq mark-active nil) >)) (global-set-key [(control v)] 'paste-and-show) ; PASTE-KEY. (defun paste-and-show () (interactive) "Paste from register a" (message "Region from register a pasted in") (when mark-active (progn (message "Markeringen var aktiv") (transient-mark-mode 1) (kill-region (region-beginning) (region-end)))) (goto-char (1+ (point))) (save-excursion (goto-char (1- (point))) (insert-register ?a)) (goto-char (1- (point))) (setq mark-active nil)) >Thanks in advance, Lars -- Floyd L. Davidson Ukpeagvik (Barrow, Alaska) floyd@barrow.com