[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cursor at end of region pasted in
From: |
Floyd Davidson |
Subject: |
Re: Cursor at end of region pasted in |
Date: |
Fri, 20 Feb 2004 01:34:15 -0900 |
User-agent: |
gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.0 |
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 <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com
Re: Cursor at end of region pasted in, Johan Bockgård, 2004/02/20