logo       

Trouble with cursor palcement when using registers.: msg#00862

emacs.help

Subject: Trouble with cursor palcement when using registers.

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)
))


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise