From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: save-excursion doesn't always work Date: 15 Dec 2002 11:37:28 +0100 Organization: T-Online Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <1a52e3d.0212142138.2f5aed8@posting.google.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1039948880 976 80.91.224.249 (15 Dec 2002 10:41:20 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 15 Dec 2002 10:41:20 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18NWD0-0000Fb-00 for ; Sun, 15 Dec 2002 11:41:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18NWCH-0005Wt-04 for gnu-help-gnu-emacs@m.gmane.org; Sun, 15 Dec 2002 05:40:33 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-X-Trace: news.t-online.com 1039948649 06 10531 dSx6EjkTSvA0BH 021215 10:37:29 Original-X-Complaints-To: abuse@t-online.com X-Sender: 520018396234-0001@t-dialin.net X-Face: 2FEFf>]>q>2iw=B6,xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN;i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-Xref: shelby.stanford.edu gnu.emacs.help:108144 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:4673 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:4673 ittay@qlusters.com (Ittay Freiman) writes: > i found this behavior while using auctex. to recreate, create a new > buffer for a tex document, with auctex as the mode > (LaTeX-mode). type in the first line 'this is a test'. > > go down one line. '(point)' should return 16. now evaluate > '(save-excursion (LaTeX-fill-region-as-paragraph 1 16 t))'. nothing > actually changes in the buffer, Wrong. A lot changes in the buffer. Place some text property on the space in question: it will be gone afterwards. AUCTeX in the process of filling deletes sequences of spaces completely, then reinserts a single one. Whether you were before or in or after such a deleted space before the operation. you'll end up on the same side of the reinserted space afterwards. > but the cursor jumps to point 15. you can repeat this with the same > results. > > can someone please tell me what is going on? also, if i write a > function that uses LaTeX-fill-region-as-paragraph, how can i return > the cursor to its original place (i'm currently using markers, > however, putting the cursor inside the filled region creates weird > behaviors) You can't, for the above reason. AUCTeX's filling modes would have to be rewritten so that instead of deleting all spaces and reinserting one space, AUCTeX would delete all spaces except one. I think Emacs' default filling by now does something like that. If you volunteer in trying to port the relevant portions, I will check them into the AUCTeX code base: the current behavior is a nuisance for other reasons as well. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum