GNU bug report logs - #14780
Regression: C-n doesn't go to next line under simple circumstances

Previous Next

Package: emacs;

Reported by: Barry OReilly <gundaetiapo <at> gmail.com>

Date: Wed, 3 Jul 2013 16:04:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14780 in the body.
You can then email your comments to 14780 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Wed, 03 Jul 2013 16:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Barry OReilly <gundaetiapo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 03 Jul 2013 16:04:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Barry OReilly <gundaetiapo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Regression: C-n doesn't go to next line under simple circumstances
Date: Wed, 3 Jul 2013 12:03:15 -0400
[Message part 1 (text/plain, inline)]
Let cant-next-line.el have file contents:

  (tool-bar-mode 0)
  (global-whitespace-mode 1)
  (set-face-attribute 'default nil :height 80)
  (setq scroll-margin 4)
  (setq scroll-conservatively 101)

Open up the attached cant-next-line.txt by:

  emacs -Q --load cant-next-line.el cant-next-line.txt

Move point to be immediately before the 'h' of "here". Try to reach the '-'
character at the end of the file using C-n. You can't. If I move point to
the beginning of line containing "here", then I can.

I checked emacs-24.3 and could not reproduce this, so it is a regression.

I witnessed this with latest trunk 68068a328a854998a0071f4714cbacdfed36fcc1
and for commit 20899d085afe62520113b5acbfe3dbba57823dc9 (Jun 5) which I use
day to day (because the commit immediately following broke Evil in a
critical way).

---

In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.10.4)
 of 2013-06-18 on psd15
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
System Description:    Red Hat Enterprise Linux Client release 5.4 (Tikanga)

Configured using:
 `configure
 --prefix=/redacted/user/boreilly/sw/emacs-install-trunk-20899d085afe62520113b5acbfe3dbba57823dc9
 --with-gif=no'

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Text

Minor modes in effect:
  global-whitespace-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r t <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort nadvice gnus-util mail-extr emacsbug message format-spec
rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils disp-table whitespace time-date
tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)
[Message part 2 (text/html, inline)]
[cant-next-line.txt (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Fri, 19 Jul 2013 18:39:02 GMT) Full text and rfc822 format available.

Message #8 received at 14780 <at> debbugs.gnu.org (full text, mbox):

From: Barry OReilly <gundaetiapo <at> gmail.com>
To: 14780 <at> debbugs.gnu.org
Subject: Re: bug#14780: Acknowledgement (Regression: C-n doesn't go to next
 line under simple circumstances)
Date: Fri, 19 Jul 2013 14:37:57 -0400
Git bisected the repo at Savannah to:

15cdf9527f5a78a5ea9aa0ba3fee8d7b84c3acf9 is the first bad commit
commit 15cdf9527f5a78a5ea9aa0ba3fee8d7b84c3acf9
Author: Eli Zaretskii <eliz <at> gnu.org>
Date:   Mon Dec 3 22:48:12 2012 +0200

    Fix bug #13055 with cursor positioning inside scroll-margin.

     src/xdisp.c (redisplay_window): If the cursor is visible, but inside
     the scroll margin, move point outside the margin.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Fri, 19 Jul 2013 19:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 14780 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Barry OReilly <gundaetiapo <at> gmail.com>
Cc: 14780 <at> debbugs.gnu.org
Subject: Re: bug#14780: Acknowledgement (Regression: C-n doesn't go to next
 line	under simple circumstances)
Date: Fri, 19 Jul 2013 22:14:28 +0300
> Date: Fri, 19 Jul 2013 14:37:57 -0400
> From: Barry OReilly <gundaetiapo <at> gmail.com>
> 
> Git bisected the repo at Savannah to:
> 
> 15cdf9527f5a78a5ea9aa0ba3fee8d7b84c3acf9 is the first bad commit
> commit 15cdf9527f5a78a5ea9aa0ba3fee8d7b84c3acf9
> Author: Eli Zaretskii <eliz <at> gnu.org>
> Date:   Mon Dec 3 22:48:12 2012 +0200
> 
>     Fix bug #13055 with cursor positioning inside scroll-margin.
> 
>      src/xdisp.c (redisplay_window): If the cursor is visible, but inside
>      the scroll margin, move point outside the margin.

I cannot reproduce the bug on my system.  Unless I don't understand
what you mean by "cannot reach the '-' character".  I can reach every
line in the buffer by using C-n, using your recipe (or what I
understand of it).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Fri, 19 Jul 2013 19:54:01 GMT) Full text and rfc822 format available.

Message #14 received at 14780 <at> debbugs.gnu.org (full text, mbox):

From: Barry OReilly <gundaetiapo <at> gmail.com>
To: 14780 <at> debbugs.gnu.org
Subject: Re: bug#14780: Acknowledgement (Regression: C-n doesn't go to next
 line under simple circumstances)
Date: Fri, 19 Jul 2013 15:53:35 -0400
Use this /tmp/cant-next-line.el to automate a little more.

(tool-bar-mode 0)
(global-whitespace-mode 1)
(set-face-attribute 'default nil :height 80)
(setq scroll-margin 4)
(setq scroll-conservatively 101)
(add-hook 'emacs-startup-hook (lambda ()
                                (re-search-forward "here")
                                (trace-redisplay)
                                ;; Doesn't reproduce it, have to C-n manually
                                ;; (run-at-time "1 sec" 1 (lambda ()
                                ;;
(call-interactively 'next-line)))
                                ))

Reproduction won't happen if you:
  - resize the window
  - use M-x next-line instead of C-n
  - press and hold C-n
  - navigate in ways other than prescribed

I can see it everytime I follow the recipe.

Here is the trace-redisplay resulting from:
  ./src/emacs -r -Q --load /tmp/cant-next-line.el /tmp/cant-next-line.txt
  Then C-n 5 times

redisplay_internal 0
0x110d9a0 (cant-next-line.txt): same window start
0x110d9a0 (cant-next-line.txt): 1
0x110d9a0 (cant-next-line.txt): same window start
0x110d9a0 (cant-next-line.txt): 1
redisplay_preserve_echo_area (8)
redisplay_internal 0
redisplay_internal 0
0x110d9a0 (cant-next-line.txt): cursor movement
0x110d9a0 (cant-next-line.txt): try_scrolling
redisplay_internal 0
0x110d9a0 (cant-next-line.txt): forced window start
redisplay_preserve_echo_area (7)
redisplay_internal 0
redisplay_internal 0
0x110d9a0 (cant-next-line.txt): forced window start
redisplay_preserve_echo_area (7)
redisplay_internal 0
redisplay_internal 0
0x110d9a0 (cant-next-line.txt): forced window start
redisplay_preserve_echo_area (7)
redisplay_internal 0
redisplay_internal 0
0x110d9a0 (cant-next-line.txt): forced window start
redisplay_preserve_echo_area (7)
redisplay_internal 0
redisplay_preserve_echo_area (8)
redisplay_internal 0
redisplay_preserve_echo_area (8)
redisplay_internal 0




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Fri, 19 Jul 2013 20:31:01 GMT) Full text and rfc822 format available.

Message #17 received at 14780 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Barry OReilly <gundaetiapo <at> gmail.com>
Cc: 14780 <at> debbugs.gnu.org
Subject: Re: bug#14780: Regression: C-n doesn't go to next line	under simple
 circumstances
Date: Fri, 19 Jul 2013 23:30:29 +0300
> Date: Fri, 19 Jul 2013 15:53:35 -0400
> From: Barry OReilly <gundaetiapo <at> gmail.com>
> 
> Use this /tmp/cant-next-line.el to automate a little more.
> 
> (tool-bar-mode 0)
> (global-whitespace-mode 1)
> (set-face-attribute 'default nil :height 80)
> (setq scroll-margin 4)
> (setq scroll-conservatively 101)
> (add-hook 'emacs-startup-hook (lambda ()
>                                 (re-search-forward "here")
>                                 (trace-redisplay)
>                                 ;; Doesn't reproduce it, have to C-n manually
>                                 ;; (run-at-time "1 sec" 1 (lambda ()
>                                 ;;
> (call-interactively 'next-line)))
>                                 ))
> 
> Reproduction won't happen if you:
>   - resize the window
>   - use M-x next-line instead of C-n
>   - press and hold C-n
>   - navigate in ways other than prescribed
> 
> I can see it everytime I follow the recipe.
> 
> Here is the trace-redisplay resulting from:
>   ./src/emacs -r -Q --load /tmp/cant-next-line.el /tmp/cant-next-line.txt

I get 'Search failed: "here"'.

Are you using a recent trunk?  I'm using today's trunk.

> redisplay_internal 0
> 0x110d9a0 (cant-next-line.txt): same window start
> 0x110d9a0 (cant-next-line.txt): 1
> 0x110d9a0 (cant-next-line.txt): same window start
> 0x110d9a0 (cant-next-line.txt): 1
> redisplay_preserve_echo_area (8)
> redisplay_internal 0
> redisplay_internal 0
> 0x110d9a0 (cant-next-line.txt): cursor movement
> 0x110d9a0 (cant-next-line.txt): try_scrolling
> redisplay_internal 0
> 0x110d9a0 (cant-next-line.txt): forced window start
> redisplay_preserve_echo_area (7)
> redisplay_internal 0
> redisplay_internal 0
> 0x110d9a0 (cant-next-line.txt): forced window start
> redisplay_preserve_echo_area (7)
> redisplay_internal 0
> redisplay_internal 0
> 0x110d9a0 (cant-next-line.txt): forced window start
> redisplay_preserve_echo_area (7)
> redisplay_internal 0
> redisplay_internal 0
> 0x110d9a0 (cant-next-line.txt): forced window start
> redisplay_preserve_echo_area (7)
> redisplay_internal 0
> redisplay_preserve_echo_area (8)
> redisplay_internal 0
> redisplay_preserve_echo_area (8)
> redisplay_internal 0

I see nothing extraordinary here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Fri, 19 Jul 2013 20:38:02 GMT) Full text and rfc822 format available.

Message #20 received at 14780 <at> debbugs.gnu.org (full text, mbox):

From: Barry OReilly <gundaetiapo <at> gmail.com>
To: 14780 <at> debbugs.gnu.org
Subject: Re: bug#14780: Regression: C-n doesn't go to next line under simple
 circumstances
Date: Fri, 19 Jul 2013 16:37:30 -0400
> I get 'Search failed: "here"'.

Are you using the cant-next-line.txt attached to the bug report? It
clearly contains "here".

> Are you using a recent trunk?  I'm using today's trunk.

I'm using:
  commit 3961bd5799169d6e24e151a8fc06d637c348eb93
  Author: Paul Eggert <eggert <at> cs.ucla.edu>
  Date:   Fri Jul 19 11:09:23 2013 -0700




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Sat, 20 Jul 2013 06:43:01 GMT) Full text and rfc822 format available.

Message #23 received at 14780 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Barry OReilly <gundaetiapo <at> gmail.com>
Cc: 14780 <at> debbugs.gnu.org
Subject: Re: bug#14780: Regression: C-n doesn't go to next line under
 simple	circumstances
Date: Sat, 20 Jul 2013 09:42:03 +0300
> Date: Fri, 19 Jul 2013 16:37:30 -0400
> From: Barry OReilly <gundaetiapo <at> gmail.com>
> 
> > I get 'Search failed: "here"'.
> 
> Are you using the cant-next-line.txt attached to the bug report?

Yes.

> It clearly contains "here".

Maybe Emacs searches for it before it visits the file?

> > Are you using a recent trunk?  I'm using today's trunk.
> 
> I'm using:
>   commit 3961bd5799169d6e24e151a8fc06d637c348eb93
>   Author: Paul Eggert <eggert <at> cs.ucla.edu>
>   Date:   Fri Jul 19 11:09:23 2013 -0700

Strange.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Sat, 20 Jul 2013 08:34:02 GMT) Full text and rfc822 format available.

Message #26 received at 14780 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: gundaetiapo <at> gmail.com
Cc: 14780 <at> debbugs.gnu.org
Subject: Re: bug#14780: Regression: C-n doesn't go to next line
 under	simple	circumstances
Date: Sat, 20 Jul 2013 11:33:07 +0300
Does the following fix the problem for you?

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2013-07-16 21:35:45 +0000
+++ src/xdisp.c	2013-07-20 08:21:36 +0000
@@ -15592,7 +15592,8 @@ redisplay_window (Lisp_Object window, in
 	     Move it back to a fully-visible line.  */
 	  new_vpos = window_box_height (w);
 	}
-      else if (w->cursor.vpos >=0)
+      else if (w->cursor.vpos >=0
+	       && PT >= BEGV && PT < ZV)
 	{
 	  /* Some people insist on not letting point enter the scroll
 	     margin, even though this part handles windows that didn't
@@ -15619,7 +15620,16 @@ redisplay_window (Lisp_Object window, in
 	      if (header_line)
 		window_height += CURRENT_HEADER_LINE_HEIGHT (w);
 	      if (w->cursor.y >= window_height - pixel_margin)
-		new_vpos = window_height - pixel_margin;
+		{
+		  struct text_pos pos;
+
+		  SET_TEXT_POS (pos, PT, PT_BYTE);
+		  start_display (&it, w, pos);
+		  it.current_y = it.vpos = 0;
+		  move_it_to (&it, ZV, -1, -1, -1, MOVE_TO_POS);
+		  if (it.vpos > margin)
+		    new_vpos = window_height - pixel_margin;
+		}
 	    }
 	}
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Sat, 20 Jul 2013 09:12:01 GMT) Full text and rfc822 format available.

Message #29 received at 14780 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: gundaetiapo <at> gmail.com
Cc: 14780 <at> debbugs.gnu.org
Subject: Re: bug#14780: Regression: C-n doesn't go to next
 line	under	simple	circumstances
Date: Sat, 20 Jul 2013 12:09:32 +0300
> Date: Sat, 20 Jul 2013 11:33:07 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 14780 <at> debbugs.gnu.org
> 
> Does the following fix the problem for you?

Sorry, that change had a bug.  Please try this instead:

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2013-07-16 21:35:45 +0000
+++ src/xdisp.c	2013-07-20 09:05:11 +0000
@@ -15608,10 +15608,11 @@ redisplay_window (Lisp_Object window, in
 	     the Y coordinate of the _next_ row, see the definition of
 	     MATRIX_ROW_BOTTOM_Y.  */
 	  if (w->cursor.vpos < margin + header_line)
-	    new_vpos
-	      = pixel_margin + (header_line
-				? CURRENT_HEADER_LINE_HEIGHT (w)
-				: 0) + frame_line_height;
+	    {
+	      w->cursor.vpos = -1;
+	      clear_glyph_matrix (w->desired_matrix);
+	      goto try_to_scroll;
+	    }
 	  else
 	    {
 	      int window_height = window_box_height (w);
@@ -15619,7 +15620,11 @@ redisplay_window (Lisp_Object window, in
 	      if (header_line)
 		window_height += CURRENT_HEADER_LINE_HEIGHT (w);
 	      if (w->cursor.y >= window_height - pixel_margin)
-		new_vpos = window_height - pixel_margin;
+		{
+		  w->cursor.vpos = -1;
+		  clear_glyph_matrix (w->desired_matrix);
+		  goto try_to_scroll;
+		}
 	    }
 	}
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14780; Package emacs. (Mon, 22 Jul 2013 20:38:03 GMT) Full text and rfc822 format available.

Message #32 received at 14780 <at> debbugs.gnu.org (full text, mbox):

From: Barry OReilly <gundaetiapo <at> gmail.com>
Cc: 14780 <at> debbugs.gnu.org
Subject: Re: bug#14780: Regression: C-n doesn't go to next line under simple
 circumstances
Date: Mon, 22 Jul 2013 16:37:49 -0400
On Sat, Jul 20, 2013 at 5:09 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> Sorry, that change had a bug.  Please try this instead:

That fixes the issue. Thanks.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Wed, 24 Jul 2013 17:39:02 GMT) Full text and rfc822 format available.

Notification sent to Barry OReilly <gundaetiapo <at> gmail.com>:
bug acknowledged by developer. (Wed, 24 Jul 2013 17:39:02 GMT) Full text and rfc822 format available.

Message #37 received at 14780-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Barry OReilly <gundaetiapo <at> gmail.com>
Cc: 14780-done <at> debbugs.gnu.org
Subject: Re: bug#14780: Regression: C-n doesn't go to next line under
 simple	circumstances
Date: Wed, 24 Jul 2013 20:38:12 +0300
> Date: Mon, 22 Jul 2013 16:37:49 -0400
> From: Barry OReilly <gundaetiapo <at> gmail.com>
> Cc: 14780 <at> debbugs.gnu.org
> 
> On Sat, Jul 20, 2013 at 5:09 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > Sorry, that change had a bug.  Please try this instead:
> 
> That fixes the issue. Thanks.

Thanks, committed as trunk revision 113532.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 22 Aug 2013 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 257 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.