unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Trouble with cursor palcement when using registers.
@ 2002-12-27 17:00 Lars Gustafsson
  2002-12-27 17:22 ` Kevin Rodgers
  0 siblings, 1 reply; 2+ messages in thread
From: Lars Gustafsson @ 2002-12-27 17:00 UTC (permalink / raw)


I used registers to construct a paste-function. The problem is that
the cursor is always positioned before the text, which I just pasted
in. When you use the yank-function the cursor is always placed after
the text, which was just pasted in. How do I get the cursor after the
text, which was just pasted in automatically. Here is how the
paste-function is implemented:

(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 "The mark was active")
	  (transient-mark-mode 1)
	  (kill-region (region-beginning) (region-end))
	  (transient-mark-mode 0)
	  )
      ) 
    (insert-register ?a)
    (setq mark-active nil)
))

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Trouble with cursor palcement when using registers.
  2002-12-27 17:00 Trouble with cursor palcement when using registers Lars Gustafsson
@ 2002-12-27 17:22 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2002-12-27 17:22 UTC (permalink / raw)


Lars Gustafsson wrote:

> I used registers to construct a paste-function. The problem is that
> the cursor is always positioned before the text, which I just pasted
> in. When you use the yank-function the cursor is always placed after
> the text, which was just pasted in. How do I get the cursor after the
> text, which was just pasted in automatically. Here is how the
> paste-function is implemented:
> 
> (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 "The mark was active")
> 	  (transient-mark-mode 1)
> 	  (kill-region (region-beginning) (region-end))
> 	  (transient-mark-mode 0)
> 	  )
>       ) 
>     (insert-register ?a)
>     (setq mark-active nil)


C-h f insert-register


(insert-register ?a t)

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-27 17:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-27 17:00 Trouble with cursor palcement when using registers Lars Gustafsson
2002-12-27 17:22 ` Kevin Rodgers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).