From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Max Mikhanosha Newsgroups: gmane.emacs.devel Subject: Re: BUG+patch: line-move-1 ignores buffer-invisibility-spec Date: Wed, 31 Aug 2011 00:28:34 -0400 Message-ID: <87pqjm19xp.wl%max@openchat.com> References: <87r5421abs.wl%max@openchat.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: dough.gmane.org 1314766023 11183 80.91.229.12 (31 Aug 2011 04:47:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 31 Aug 2011 04:47:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 31 06:47:00 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QychX-0003rg-Oe for ged-emacs-devel@m.gmane.org; Wed, 31 Aug 2011 06:47:00 +0200 Original-Received: from localhost ([::1]:34127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QychX-0008Bw-2X for ged-emacs-devel@m.gmane.org; Wed, 31 Aug 2011 00:46:59 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QychT-0008Br-Di for emacs-devel@gnu.org; Wed, 31 Aug 2011 00:46:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QychR-00025z-Tq for emacs-devel@gnu.org; Wed, 31 Aug 2011 00:46:55 -0400 Original-Received: from p84-72.acedsl.com ([66.114.84.72]:48646 helo=momoland.openchat.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QychR-00020q-Hu for emacs-devel@gnu.org; Wed, 31 Aug 2011 00:46:53 -0400 Original-Received: from momoland.openchat.com (localhost [IPv6:::1]) by momoland.openchat.com (Postfix) with ESMTP id BE885E8677 for ; Wed, 31 Aug 2011 00:28:34 -0400 (EDT) In-Reply-To: <87r5421abs.wl%max@openchat.com> User-Agent: Wanderlust/2.15.3 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?UTF-8?B?U2hpasWN?=) APEL/10.6 Emacs/23.3.50 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.114.84.72 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:143651 Archived-At: Oops please disregard this bug report. Apparently I had some really old piece of code (library called APEL) loaded, which had a definition of (invisible-p) function in it, which ignored the buffer-invisibility-spec. At Wed, 31 Aug 2011 00:20:07 -0400, Max Mikhanosha wrote: > > I had started using egg (the fancy vc-git replacement) and had noticed > that sometimes point jumps all over the place weirdly inside Egg > buffers. For example pressing down arrow on the very first change in > 500 line diff, would jump to the end of the buffer. > > After debugging it, it seems that Egg is using unique 'invisible text > property for every diff hunk text in the buffer, and sets > `buffer-invisibility-spec' to nil initially. It has the command to > show/hide diff hunks, which it accomplishes by adding/removing that > hunk's unique 'invisible property value to `buffer-invisibility-spec' > variable. > > So far so good, but I was wondering why `next-line' function sometimes > skips the text that is not hidden. After debugging it, much to my > surprise, it appears that line-move-1 function in simple.el, > completely ignores `buffer-invisibility-spec' and skips any text with > non-NIL 'invisible property. > > I had found the correct code to skip invisible text that takes > `buffer-invisibility-spec' into account in the forward-visual-line > function. > > After changing the line-move-1 invisibility code to be the same, it had > fixed my problem with point jumping erratically in Egg buffers. > > This is for Emacs 23, but Emacs 24 simple.el appears to have the same > problem. > > Patch pasted below > > === modified file 'lisp/simple.el' > *** lisp/simple.el 2011-02-17 07:43:53 +0000 > --- lisp/simple.el 2011-08-31 03:51:26 +0000 > *************** > *** 4254,4261 **** > (while (and (> arg 0) (not done)) > ;; If the following character is currently invisible, > ;; skip all characters with that same `invisible' property value. > ! (while (and (not (eobp)) (invisible-p (point))) > ! (goto-char (next-char-property-change (point)))) > ;; Move a line. > ;; We don't use `end-of-line', since we want to escape > ;; from field boundaries occurring exactly at point. > --- 4254,4272 ---- > (while (and (> arg 0) (not done)) > ;; If the following character is currently invisible, > ;; skip all characters with that same `invisible' property value. > ! (while (and (not (eobp)) > ! (let ((prop > ! (get-char-property (point) 'invisible))) > ! (if (eq buffer-invisibility-spec t) > ! prop > ! (or (memq prop buffer-invisibility-spec) > ! (assq prop buffer-invisibility-spec))))) > ! (goto-char > ! (if (get-text-property (point) 'invisible) > ! (or (next-single-property-change (point) 'invisible) > ! (point-max)) > ! (next-overlay-change (point))))) > ! > ;; Move a line. > ;; We don't use `end-of-line', since we want to escape > ;; from field boundaries occurring exactly at point. > *************** > *** 4309,4320 **** > (setq done t)))) > (unless done > (setq arg (1+ arg)) > ! (while (and ;; Don't move over previous invis lines > ! ;; if our target is the middle of this line. > ! (or (zerop (or goal-column temporary-goal-column)) > ! (< arg 0)) > ! (not (bobp)) (invisible-p (1- (point)))) > ! (goto-char (previous-char-property-change (point)))))))) > ;; This is the value the function returns. > (= arg 0)) > > --- 4320,4337 ---- > (setq done t)))) > (unless done > (setq arg (1+ arg)) > ! (while (and (not (bobp)) > ! (let ((prop > ! (get-char-property (1- (point)) 'invisible))) > ! (if (eq buffer-invisibility-spec t) > ! prop > ! (or (memq prop buffer-invisibility-spec) > ! (assq prop buffer-invisibility-spec))))) > ! (goto-char > ! (if (get-text-property (1- (point)) 'invisible) > ! (or (previous-single-property-change (point) 'invisible) > ! (point-min)) > ! (previous-overlay-change (point))))))))) > ;; This is the value the function returns. > (= arg 0)) > > *************** > *** 4352,4360 **** > (save-excursion > ;; Like end-of-line but ignores fields. > (skip-chars-forward "^\n") > ! (while (and (not (eobp)) (invisible-p (point))) > ! (goto-char (next-char-property-change (point))) > ! (skip-chars-forward "^\n")) > (point)))) > > ;; Move to the desired column. > --- 4369,4387 ---- > (save-excursion > ;; Like end-of-line but ignores fields. > (skip-chars-forward "^\n") > ! (while (and (not (eobp)) > ! (let ((prop > ! (get-char-property (point) 'invisible))) > ! (if (eq buffer-invisibility-spec t) > ! prop > ! (or (memq prop buffer-invisibility-spec) > ! (assq prop buffer-invisibility-spec))))) > ! (goto-char > ! (if (get-text-property (point) 'invisible) > ! (or (next-single-property-change (point) 'invisible) > ! (point-max)) > ! (next-overlay-change (point)))) > ! (skip-chars-forward "^\n")) > (point)))) > > ;; Move to the desired column. > > >