unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10024: 24.0.91; save-restriction fails to restore the screen
@ 2011-11-12 11:59 Uday S Reddy
  2011-11-13  1:55 ` Johan Bockgård
  0 siblings, 1 reply; 9+ messages in thread
From: Uday S Reddy @ 2011-11-12 11:59 UTC (permalink / raw)
  To: 10024; +Cc: U.S.Reddy

In using VM, we noticed that the Emacs 24 pretest is repositioning the
cursor in the message composition window, hiding the message headers.  I
have tracked the problem down to the use of `save-restriction' and came up
with the following code.

(defun test-restriction ()
  (interactive)
  (save-restriction
    (goto-line 5)
    (narrow-to-region (point) (point-max))
    (insert "hello\n")))

To reproduce the problem, place debug-on-entry on the `test-restriction'
function.  Position the cursor on line 5 in some buffer, run
`test-restriction' and single-step through it.

You would see that "hello" is at the top of the window and the lines 1-4 are
off the screen.

I haven't found a way to reproduce the problem without the debugger, but it
happens inside VM even when no debugger is used.  So, some event is
destroying the window positioning.

Cheers,
Uday


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
d:/gnu/emacs-24.0.91/etc/DEBUG.


In GNU Emacs 24.0.91.1 (i386-mingw-nt5.1.2600)
 of 2011-10-31 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.6) --no-opt --cflags -I"D:/devel/emacs/libs/libXpm-3.5.8/include" -I"D:/devel/emacs/libs/libXpm-3.5.8/src" -I"D:/devel/emacs/libs/libpng-dev_1.4.3-1/include" -I"D:/devel/emacs/libs/zlib-dev_1.2.5-2/include" -I"D:/devel/emacs/libs/giflib-4.1.4-1/include" -I"D:/devel/emacs/libs/jpeg-6b-4/include" -I"D:/devel/emacs/libs/tiff-3.8.2-1/include" -I"D:/devel/emacs/libs/gnutls-2.10.1/include" --ldflags -L"D:/devel/emacs/libs/gnutls-2.10.1/lib"'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Mail

Minor modes in effect:
  savehist-mode: t
  show-paren-mode: t
  which-function-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
  abbrev-mode: t

Recent input:
C-s s a v e - r e s C-a C-l C-x o C-n C-n C-n C-a <escape> 
C-n <return> TAB ( i n s e r t SPC " h e l l o " ) 
<escape> C-x <switch-frame> M-x t e s t - r e s SPC 
<return> M-x t C-g C-x , M-x t e s t - r e s SPC <return> 
C-x d t e s t - r e s SPC <return> C-x , M-x t e s 
t - r e s SPC <return> d d c d c d c d c c C-x , <help-echo> 
<switch-frame> <down-mouse-1> <mouse-1> C-h f t e <backspace> 
<backspace> <return> q <switch-frame> C-x k C-g C-n 
C-n C-n C-n h e l l o C-x C-g C-x u M-x t e s t - r 
e s SPC <return> d d c d c d d c d c c c <switch-frame> 
C-x , M-x t e s t - r e s SPC <return> d d c d c d 
c d d d c c C-x c <return> C-x u C-x , M-x t e s t 
- r e s SPC <return> C-x u C-n C-n C-n C-n C-n C-e 
C-b C-b C-b C-b \ n <escape> C-x M-x t e s t - r e 
s SPC <return> C-x u C-x d t e s t - r e s SPC <return> 
M-x t e s t - r e s SPC <return> c c C-x u M-x t e 
s t - r e s t SPC <return> d d c d c d c d c c <switch-frame> 
<down-mouse-1> <mouse-movement> <mouse-1> M-x r e p 
o r t - e x <backspace> m a SPC SPC b SPC <return>

Recent messages:
Proceeding, will debug on next eval or call.
Entering debugger...
Continuing.
Entering debugger...
Proceeding, will debug on next eval or call.
Entering debugger...
Continuing.
Entering debugger...
Continuing.
Making completion list...

Load-path shadows:
d:/Home/udr/share/emacs/sml-mode hides d:/gnu/emacs-24.0.91/../site-lisp/sml-mode
d:/Home/udr/share/emacs/savehist-20+ hides d:/gnu/emacs-24.0.91/../site-lisp/savehist-20+
d:/gnu/emacs-24.0.91/../site-lisp/longlines hides d:/gnu/emacs-24.0.91/lisp/longlines
d:/gnu/vm/trunk/lisp/cus-load hides d:/gnu/emacs-24.0.91/lisp/cus-load

Features:
(shadow emacsbug multi-isearch cl-specs edebug help-mode view debug
mailalias vm-reply bbdb-hooks mail-parse rfc2231 w3m-form w3m browse-url
doc-view jka-compr dired-x mydired dired image-mode w3m-hist w3m-fb
bookmark-w3m w3m-ems wid-edit w3m-ccl ccl w3m-favicon w3m-image w3m-proc
w3m-util vm-w3m tapestry vm-sort vm-thread easymenu u-vm-color my-vm vc-bzr
etags ps-print ps-def lpr vm-save vm-ps-print vm-rfaddons vm-menu vm-window
vm-toolbar vm-folder vm-mime vm-undo vm-virtual vm-summary-faces vm-mouse
vm-page vm-minibuf vm-message vm-misc vm-macro bbdb-vm vm-summary vm-motion
vm-autoload bbdb-snarf mail-extr rfc822 bbdb-com mailabbrev vm warnings
server w3m-load bbdb-autoloads bbdb timezone vm-autoloads vm-version vm-vars
autopair easy-mmode cl myautopair savehist tex-site auto-loads telnet
movement natural-space NatSpeak sendmail rfc2047 rfc2045 ietf-drums
mail-utils auth-source eieio byte-opt bytecomp byte-compile cconv macroexp
assoc gnus-util mm-util mail-prsvr password-cache epa-file epa epg
epg-config ange-ftp comint regexp-opt ring paren echistory chistory ehelp
electric derived which-func imenu advice help-fns advice-preload edmacro
kmacro time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel dos-w32
disp-table ls-lisp w32-win w32-vars tool-bar dnd fontset image fringe
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 button faces cus-face
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
multi-tty emacs)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10024: 24.0.91; save-restriction fails to restore the screen
  2011-11-12 11:59 bug#10024: 24.0.91; save-restriction fails to restore the screen Uday S Reddy
@ 2011-11-13  1:55 ` Johan Bockgård
  2011-11-13 11:01   ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Johan Bockgård @ 2011-11-13  1:55 UTC (permalink / raw)
  To: Uday S Reddy; +Cc: 10024

Uday S Reddy <u.s.reddy@cs.bham.ac.uk> writes:

> I haven't found a way to reproduce the problem without the debugger, but it
> happens inside VM even when no debugger is used.  So, some event is
> destroying the window positioning.

    (defun test-restriction ()
      (interactive)
      (save-restriction
        (goto-line 5)
        (narrow-to-region (point) (point-max))
        (redisplay)))

But save-restriction is not meant to "restore the screen", so I don't
really see that there's a bug here.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10024: 24.0.91; save-restriction fails to restore the screen
  2011-11-13  1:55 ` Johan Bockgård
@ 2011-11-13 11:01   ` martin rudalics
  2011-11-13 11:29     ` Uday S Reddy
  0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2011-11-13 11:01 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: 10024, Uday S Reddy

 > But save-restriction is not meant to "restore the screen", so I don't
 > really see that there's a bug here.

Neither do I.  But Uday's right when he says that the behavior under the
debugger changed wrt Emacs 23.

martin





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10024: 24.0.91; save-restriction fails to restore the screen
  2011-11-13 11:01   ` martin rudalics
@ 2011-11-13 11:29     ` Uday S Reddy
  2011-11-13 12:11       ` Johan Bockgård
  0 siblings, 1 reply; 9+ messages in thread
From: Uday S Reddy @ 2011-11-13 11:29 UTC (permalink / raw)
  To: martin rudalics; +Cc: 10024, Uday S Reddy, Johan Bockgård

martin rudalics writes:

> Neither do I.  But Uday's right when he says that the behavior under
> the debugger changed wrt Emacs 23.

Yes, you guys are of course right that save-restriction shouldn't have to
restore the screen.  However, there is an outer save-excursion in the VM
code, which is not doing the job some of the time.  I am still trying to
track it down so that I can construct a simple example.  (The debugger
change is probably making it harder for me to track it down.)  Stay tuned...

Cheers,
Uday





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10024: 24.0.91; save-restriction fails to restore the screen
  2011-11-13 11:29     ` Uday S Reddy
@ 2011-11-13 12:11       ` Johan Bockgård
  2011-11-13 14:09         ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Johan Bockgård @ 2011-11-13 12:11 UTC (permalink / raw)
  To: Uday S Reddy; +Cc: 10024

Uday S Reddy <u.s.reddy@cs.bham.ac.uk> writes:

> Yes, you guys are of course right that save-restriction shouldn't have to
> restore the screen.  However, there is an outer save-excursion in the VM
> code, which is not doing the job some of the time.  I am still trying to
> track it down so that I can construct a simple example.  (The debugger
> change is probably making it harder for me to track it down.)  Stay tuned...

But save-excursion also does not restore the window. It restores point
(etc.). If a redisplay happens inside save-excursion, the window can
scroll.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10024: 24.0.91; save-restriction fails to restore the screen
  2011-11-13 12:11       ` Johan Bockgård
@ 2011-11-13 14:09         ` martin rudalics
  2011-11-13 15:06           ` Uday S Reddy
  0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2011-11-13 14:09 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: 10024, Uday S Reddy

 > But save-excursion also does not restore the window. It restores point
 > (etc.). If a redisplay happens inside save-excursion, the window can
 > scroll.

It _could_ scroll back to the initial position when, returning from the
excursion, point is off-screen.  Chances are that even the window-start
position after that is the same as before the excursion.  But there's
_no_ guarantee.  So you should restore the old position using something
like either `recenter' or `set-window-start'.

martin





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10024: 24.0.91; save-restriction fails to restore the screen
  2011-11-13 14:09         ` martin rudalics
@ 2011-11-13 15:06           ` Uday S Reddy
  2014-02-04  0:32             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Uday S Reddy @ 2011-11-13 15:06 UTC (permalink / raw)
  To: martin rudalics; +Cc: 10024, Uday S Reddy, Johan Bockgård

Thanks, Martin.  `set-window-start' does the trick.

There is no call to redisplay in the VM code.  However, problems are arising
when emacs-w3m is called to process the html message text.  In this case, it
doesn't seem to help even if I explicitly save and restore the point.

Cheers,
Uday






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10024: 24.0.91; save-restriction fails to restore the screen
  2011-11-13 15:06           ` Uday S Reddy
@ 2014-02-04  0:32             ` Lars Ingebrigtsen
  2015-12-25 23:10               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2014-02-04  0:32 UTC (permalink / raw)
  To: Uday S Reddy; +Cc: 10024, Johan Bockgård

Uday S Reddy <u.s.reddy@cs.bham.ac.uk> writes:

> Thanks, Martin.  `set-window-start' does the trick.
>
> There is no call to redisplay in the VM code.  However, problems are arising
> when emacs-w3m is called to process the html message text.  In this case, it
> doesn't seem to help even if I explicitly save and restore the point.

Is this problem still present in Emacs 24.3?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10024: 24.0.91; save-restriction fails to restore the screen
  2014-02-04  0:32             ` Lars Ingebrigtsen
@ 2015-12-25 23:10               ` Lars Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-25 23:10 UTC (permalink / raw)
  To: Uday S Reddy; +Cc: 10024, Johan Bockgård

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Uday S Reddy <u.s.reddy@cs.bham.ac.uk> writes:
>
>> Thanks, Martin.  `set-window-start' does the trick.
>>
>> There is no call to redisplay in the VM code.  However, problems are arising
>> when emacs-w3m is called to process the html message text.  In this case, it
>> doesn't seem to help even if I explicitly save and restore the point.
>
> Is this problem still present in Emacs 24.3?

More information was requested, but no response was given within a few
months, so I'm closing this bug report.  If the problem still exists,
please reopen this bug report.
-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-12-25 23:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-12 11:59 bug#10024: 24.0.91; save-restriction fails to restore the screen Uday S Reddy
2011-11-13  1:55 ` Johan Bockgård
2011-11-13 11:01   ` martin rudalics
2011-11-13 11:29     ` Uday S Reddy
2011-11-13 12:11       ` Johan Bockgård
2011-11-13 14:09         ` martin rudalics
2011-11-13 15:06           ` Uday S Reddy
2014-02-04  0:32             ` Lars Ingebrigtsen
2015-12-25 23:10               ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).