From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David PONCE Newsgroups: gmane.emacs.devel Subject: Perhaps a bug in line-move-1 Date: Fri, 24 Jun 2005 16:29:28 +0200 (CEST) Message-ID: <28128467.1119623368523.JavaMail.www@wwinf1518> Reply-To: david.ponce@wanadoo.fr NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1119623241 31818 80.91.229.2 (24 Jun 2005 14:27:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Jun 2005 14:27:21 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 24 16:27:16 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dlp8W-0000mp-Ei for ged-emacs-devel@m.gmane.org; Fri, 24 Jun 2005 16:26:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DlpFZ-0004Ja-5t for ged-emacs-devel@m.gmane.org; Fri, 24 Jun 2005 10:33:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DlpDA-0002ct-MX for emacs-devel@gnu.org; Fri, 24 Jun 2005 10:31:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DlpD2-0002Xe-Au for emacs-devel@gnu.org; Fri, 24 Jun 2005 10:31:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DlpD1-0002Wj-La for emacs-devel@gnu.org; Fri, 24 Jun 2005 10:31:07 -0400 Original-Received: from [193.252.23.84] (helo=smtp15.wanadoo.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DlpEz-0000yl-El for emacs-devel@gnu.org; Fri, 24 Jun 2005 10:33:09 -0400 Original-Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1502.wanadoo.fr (SMTP Server) with ESMTP id 837567000082 for ; Fri, 24 Jun 2005 16:29:28 +0200 (CEST) Original-Received: from wwinf1518 (wwinf1518 [172.22.146.62]) by mwinf1502.wanadoo.fr (SMTP Server) with ESMTP id 81C697000081 for ; Fri, 24 Jun 2005 16:29:28 +0200 (CEST) X-ME-UUID: 20050624142928531.81C697000081@mwinf1502.wanadoo.fr Original-To: emacs-devel@gnu.org X-Originating-IP: [205.167.7.18] X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-REPLYTO: |~| 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:39428 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39428 Hello, Since this change to line-move-1 in simple.el: 2005-06-23 Richard M. Stallman * simple.el (set-variable): Args renamed; doc fix. (line-move-1): When there are overlays around, use vertical-motion. When I use the up/down button to move the cursor to the previous/next line, it actually move it up/down 2 lines. I looked at the implementation and it seems that when there are overlays around the text moved over (which is the case in buffers where semantic is enabled), the code unconditionally calls forward-line, then `vertical-motion', which looks like a bug. The following patch seems to have fixed the problem. Hope it will help. Sincerely, David Index: simple.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v retrieving revision 1.733 diff -c -r1.733 simple.el *** simple.el 23 Jun 2005 21:26:31 -0000 1.733 --- simple.el 24 Jun 2005 14:11:36 -0000 *************** *** 3442,3455 **** (when (and (not done) (not (integerp selective-display)) (not (line-move-invisible-p (point)))) - ;; We avoid vertical-motion when possible - ;; because that has to fontify. - (forward-line 1) ;; If there are overlays in and around ;; the text we moved over, we need to be ;; sophisticated. (unless (overlays-in (max (1- pos-before) (point-min)) (min (1+ (point)) (point-max))) (setq line-done t))) ;; Otherwise move a more sophisticated way. ;; (What's the logic behind this code?) --- 3442,3455 ---- (when (and (not done) (not (integerp selective-display)) (not (line-move-invisible-p (point)))) ;; If there are overlays in and around ;; the text we moved over, we need to be ;; sophisticated. (unless (overlays-in (max (1- pos-before) (point-min)) (min (1+ (point)) (point-max))) + ;; We avoid vertical-motion when possible + ;; because that has to fontify. + (forward-line 1) (setq line-done t))) ;; Otherwise move a more sophisticated way. ;; (What's the logic behind this code?) *************** *** 3473,3481 **** (when (and (not done) (not (integerp selective-display)) (not (line-move-invisible-p (1- (point))))) - (forward-line -1) (unless (overlays-in (max (1- (point)) (point-min)) (min (1+ pos-before) (point-max))) (setq line-done t))) (and (not done) (not line-done) (zerop (vertical-motion -1)) --- 3473,3481 ---- (when (and (not done) (not (integerp selective-display)) (not (line-move-invisible-p (1- (point))))) (unless (overlays-in (max (1- (point)) (point-min)) (min (1+ pos-before) (point-max))) + (forward-line -1) (setq line-done t))) (and (not done) (not line-done) (zerop (vertical-motion -1))