From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Manheimer Newsgroups: gmane.emacs.devel Subject: Re: move-beginning-of-line misbehaves on wrapped-line invisible text - recent cvs checkout Date: Mon, 23 Jan 2006 13:17:14 -0500 Message-ID: <2cd46e7f0601231017h65e30274x18504d460d5d8042@mail.gmail.com> References: <2cd46e7f0601121612y386d057ft68324aeb352b777d@mail.gmail.com> <2cd46e7f0601220812v53945980x8d045c3df55e5f2c@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_10217_21971735.1138040234596" X-Trace: sea.gmane.org 1138047811 16938 80.91.229.2 (23 Jan 2006 20:23:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 23 Jan 2006 20:23:31 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 23 21:23:28 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F18DQ-0004ZQ-OA for ged-emacs-devel@m.gmane.org; Mon, 23 Jan 2006 21:23:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F187b-0002Y2-J0 for ged-emacs-devel@m.gmane.org; Mon, 23 Jan 2006 15:17:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F16IQ-0001y5-Rc for emacs-devel@gnu.org; Mon, 23 Jan 2006 13:20:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F16IL-0001xO-Sy for emacs-devel@gnu.org; Mon, 23 Jan 2006 13:20:04 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F16IL-0001xI-Kf for emacs-devel@gnu.org; Mon, 23 Jan 2006 13:20:01 -0500 Original-Received: from [66.249.92.203] (helo=uproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1F16N7-0007Ot-LC for emacs-devel@gnu.org; Mon, 23 Jan 2006 13:24:57 -0500 Original-Received: by uproxy.gmail.com with SMTP id u2so89201uge for ; Mon, 23 Jan 2006 10:17:15 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=s2yrqGYKPBY0Na9qVnMMKywA78jxFdvooQ/KiZbrQFSQ5piWinLF23RDQ4XRlAsD+AAVR4pqcPK/2tFoARzCFKelQ4uqaY7lKTAFJkViI0cV35CJkAGa9DG2Th/cdK/Wn9IXU2KgaKRnq/oUEU7zKPD+OWZN1Te1N2+1Oze1Hb4= Original-Received: by 10.66.252.18 with SMTP id z18mr165480ugh; Mon, 23 Jan 2006 10:17:14 -0800 (PST) Original-Received: by 10.66.220.6 with HTTP; Mon, 23 Jan 2006 10:17:14 -0800 (PST) Original-To: rms@gnu.org In-Reply-To: <2cd46e7f0601220812v53945980x8d045c3df55e5f2c@mail.gmail.com> X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:49448 Archived-At: ------=_Part_10217_21971735.1138040234596 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 1/22/06, Ken Manheimer wrote: > this works for me! ... but i've discovered what i think is a bug in rms' new move-beginning-of-line code. i'm attaching another bit of elisp to construct a demonstration. it appears that move-beginning-of-line will _sometimes_ go to the wrong place - the beginning of the buffer, in this case - if hidden text it's traversing begins with a newline. my best guess at a fix for the recent move-beginning-of-lines would be to remove the first (skip-chars-backward "^\n") - the one before the loop. that resolves both this current problem and the previous one i demonstrated. unfortunately, i can't be confident about any fix i invent, because i'm hazy about some of the contingencies move-beginning-of-line is supposed to handle - i don't know enough about fields, and am still a bit unclear about some wording in the function's docstring and rms explanation. (gmail may be preventing sending of application/octet-stream attachments, which is how it recognizes .el files, so the attachment may be omitted. if so, i'll resend with the attachment as a text file.) > On 1/19/06, Richard M. Stallman wrote: > > move-beginning-of-line is supposed to move to the beginning of the > > current _display_ line. emphasis on "display" is because i'm not > > quite clear what it means. > > > > I believe the idea is that newlines that don't really appear as such > > do not count. > > > > I don't see the problems you reported with the medium-size lines, > > but I do see the problem with the longest line. This seems to fix it. > > Does this give good results in general? > > i see none of the problems that had been showing without the patch. i > haven't exercised emacs very much with the change, but see that it's > already in CVS. i'll report if i encounter any problems with it. > thanks! > > ken > > > *** simple.el 05 Jan 2006 10:48:16 -0500 1.783 > > --- simple.el 19 Jan 2006 12:11:57 -0500 > > *************** > > *** 3734,3740 **** > > (or arg (setq arg 1)) > > (if (/=3D arg 1) > > (line-move (1- arg) t)) > > ! (beginning-of-line 1) > > (let ((orig (point))) > > (vertical-motion 0) > > (if (/=3D orig (point)) > > --- 3735,3747 ---- > > (or arg (setq arg 1)) > > (if (/=3D arg 1) > > (line-move (1- arg) t)) > > ! > > ! ;; Move to beginning-of-line, ignoring fields and invisibles. > > ! (skip-chars-backward "^\n") > > ! (while (and (not (bobp)) (line-move-invisible-p (1- (point)))) > > ! (goto-char (previous-char-property-change (1- (point)))) > > ! (skip-chars-backward "^\n")) > > ! > > (let ((orig (point))) > > (vertical-motion 0) > > (if (/=3D orig (point)) > > > ------=_Part_10217_21971735.1138040234596 Content-Type: application/octet-stream; name=overlay-prob2.el Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="overlay-prob2.el" (defvar overlay-prob-category nil "Variable for demonstrating overlay problem w/categories") (setplist 'overlay-prob-category nil) (put 'overlay-prob-category 'invisible 'outline) (defun construct-overlay-problem () (interactive) (let* ((buffer (get-buffer-create "overlay-problem")) beg offset ol) (pop-to-buffer buffer) (erase-buffer) (outline-mode) (insert "This may demonstrate a bug in move-beginning-of-line\n") (insert "(actually, previous-char-property-change). In my emacs 20.0.50\n") (insert "build (CVS as of 22Jan2006), a property change is skipped.\n") (insert "Follow these instructions for a demonstration.\n") (insert "\n") (insert "At the end of the last line, after the hidden text, do a\n") (insert "move-beginning-of-line") (insert (substitute-command-keys "(\\[move-beginning-of-line])\n\n")) (insert "In my build, the cursor goes to the beginning of the buffer.\n") (insert "\n") (insert (substitute-command-keys "Do \\[move-beginning-of-line]")) (insert " at the end of this line ") (setq beg (point)) (insert "\n some characters *including leading newline* to hide") (setq ol (make-overlay beg (point))) (overlay-put ol 'category 'overlay-prob-category))) ------=_Part_10217_21971735.1138040234596 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel ------=_Part_10217_21971735.1138040234596--