🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #1338

Re: insertion point after a paste

#1338
From: Andreas Schwab
Date: Tue, 09 Jun 1992 14:43
48 lines
2374 bytes
In article <6261@charon.cwi.nl>, rekers@cwi.nl (Jan Rekers) writes:
|> Would anybody know how I can get Epoch to move its insertion point
|> (the cursor) after a mouse paste to the point just after the inserted text?
|> That would in most cases allow me to type on after an insertion.
|> 
|> Say, I have the following text in my buffer:
|> 	aap noot mies
|> Now, if I paste the contents of the mouse buffer, say ``jan '', by clicking
|> the middle mouse button just before ``noot'', Epoch leaves me in the 
|> following situation:
|> 	aap jan noot mies
|> 	    ^
|> while I would like it to be:
|> 	aap jan noot mies
|> 	        ^
|> 
|> Thanks in advance,
|> 
|> Jan Rekers (Jan.Rekers@cwi.nl) Centrum voor Wiskunde en Informatica (CWI)
|>                         P.O. Box 4079, 1009 AB Amsterdam, The Netherlands

Replace `mouse::paste-cut-buffer' (see epoch-lisp/mouse.el) with the
following function:

(defun paste-cut-buffer (arg)
  "Retrieve text from appropriate selection, or X cut-buffer if none"
  (let ((buff (nth 1 arg)))
    (when (and buff (bufferp buff))
      (mouse::set-point arg)
      (undo-boundary)
      (goto-char (car arg))
      ;; get text from selection PRIMARY
      ;; insert text once it's there.
      (let ((text
	     (epoch::convert-selection mouse::selection-atom
				       "STRING" "PROPERTY")))
	;; Make sure string isn't ""
	(if (and (stringp text) (> (length text) 0))
	    ;; selection is owned and has a value
	    (insert text)
	  ;; grab cut-buffer instead
	  (insert (get-cut-buffer)))))))

(global-set-mouse mouse-middle mouse-down 'paste-cut-buffer)

--
Andreas Schwab
schwab@ls5.informatik.uni-dortmund.de
Technical Details
Message-ID: <112g25INNjn1@fbi-news.Informatik.Uni-Dortmund.DE>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!Informatik.Uni-Dortmund.DE!mouton!schwab
References: <6261@charon.cwi.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc7ee,cbef6bb534288990
X-Google-Attributes: gidfc7ee,public
X-Google-ArrivalTime: 1992-06-09 02:28:48 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!Informatik.Uni-Dortmund.DE!mouton!schwab
From: schwab@mouton.informatik.uni-dortmund.de (Andreas Schwab)
Newsgroups: gnu.epoch.misc
Subject: Re: insertion point after a paste
Date: 9 Jun 1992 14:43:17 GMT
Organization: University of Dortmund, Germany
Lines: 48
Distribution: world
Message-ID: <112g25INNjn1@fbi-news.Informatik.Uni-Dortmund.DE>
References: <6261@charon.cwi.nl>
Reply-To: schwab@ls5.informatik.uni-dortmund.de
NNTP-Posting-Host: mouton