[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] out comment every line
From: |
Lars Madsen |
Subject: |
Re: [AUCTeX] out comment every line |
Date: |
Tue, 3 Mar 2015 15:28:48 +0000 |
Nice one, thanks, one didn't know (point-marker)
(I've started Emacs macrop programming some 10 years too late ;-)
/Lars Madsen
Institut for Matematik / Department of Mathematics
Aarhus Universitet / Aarhus University
Mere info: http://au.dk/address@hidden / More information:
http://au.dk/en/address@hidden
________________________________________
From: Nicolas Richard address@hidden
Sent: 03 March 2015 16:19
To: Lars Madsen
Cc: address@hidden
Subject: Re: out comment every line
Le 03/03/2015 15:57, Lars Madsen a écrit :
> Here is a sample of what happens
Great. One solution is to use markers.
See (info "(elisp) Overview of Markers") for more information about
markers. What we need here is the following property:
| But the marker's position value can change during the life of
| the marker, and often does. Insertion and deletion of text in the
| buffer relocate the marker.
Please try the following change
> (defun mytest ()
> (interactive)
> (let (
> beg
> end
> (T 0.5)
> )
> (sit-for T)
> (re-search-forward "{" nil t)
> (sit-for T)
> (goto-char (match-beginning 0))
> (sit-for T)
> (setq beg (point))
> (sit-for T)
> (forward-sexp)
> (sit-for T)
> (setq end (point))
Use (point-marker) here.
> (sit-for T)
> (TeX-comment-region beg end)
> (sit-for T)
> (goto-char end)
> )
> )
HTH,
--
Nicolas.