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/daleif@imf / More information: http://au.dk/en/daleif@imf ________________________________________ From: Nicolas Richard [[email protected]] Sent: 03 March 2015 16:19 To: Lars Madsen Cc: [email protected] 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. _______________________________________________ auctex mailing list [email protected] https://lists.gnu.org/mailman/listinfo/auctex
