emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#16431: closed (24.3.50; `follow-adjust-windows' so


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#16431: closed (24.3.50; `follow-adjust-windows' sometimes fails (patch included))
Date: Thu, 16 Jan 2014 14:26:02 +0000

Your message dated Thu, 16 Jan 2014 09:25:46 -0500
with message-id <address@hidden>
and subject line Re: bug#16431: 24.3.50; `follow-adjust-windows' sometimes 
fails (patch included)
has caused the debbugs.gnu.org bug report #16431,
regarding 24.3.50; `follow-adjust-windows' sometimes fails (patch included)
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
16431: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16431
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.3.50; `follow-adjust-windows' sometimes fails (patch included) Date: Mon, 13 Jan 2014 13:13:49 +0100
The function `follow-adjust-windows' (part of follow-mode) sometimes fails. Steps to repeat:

    emacs -Q
    C-h t
    C-x 3
    C-x 3
    M-x balance-windows RET
    C-x b *scratch* RET
    Eval the following three expressions:

(require 'follow)

(let ((owin (selected-window)))
  (select-window (next-window))
  (let ((follow-mode t))
    (follow-adjust-window (selected-window) (point-min)))
  (select-window owin))

OK here, beginning of the buffer is visible.

(let ((owin (selected-window)))
  (select-window (next-window))
  (let ((follow-mode t))
    (follow-adjust-window (selected-window) (/ (point-max) 2))
  (select-window owin)))

Here, the intention is that the middle of the buffer should be visible. It's not.

This is broken in 24.3 as well as on the trunk. The function was introduced in 24.3, even though similar code was present in `follow-post-command-hook' earlier.

This is due to the fact that the function calls `(redisplay)'. However, this work on the current point, which has not been maintained. Fortunately, there seems to be an easy fix, see patch below:

1226,1232c1226,1232

<           (goto-char dest)

<           (redisplay)

<           ;; If this `redisplay' moved point, we got clobbered by a

<           ;; previous call to `set-window-start'.  Try again.

<           (when (/= (point) dest)

<             (goto-char dest)

<             (redisplay))

---

>   (let ((opoint (point)))

>     (redisplay)

>     ;; If this `redisplay' moved point, we got clobbered by a

>     ;; previous call to `set-window-start'.  Try again.

>     (when (/= (point) opoint)

>       (goto-char opoint)

>       (redisplay)))

Sincerely,
    Anders Lindgren


Ps. I'm the original author of Follow mode, even though I haven't worked on the package for many years.


In GNU Emacs 24.3.50.2 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00)
 of 2014-01-13 on macpro.lan
Repository revision: 116005 address@hidden
Windowing system distributor `Apple', version 10.3.1265
Configured using:
 `configure --with-ns'

Important settings:
  value of $LC_CTYPE: UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-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:
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <down> C-j <up> <up> <up> C-e <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> ( / SPC <C-s-268632070> <escape> 
d ( p o i n t <right> <right> <right> <right> <right> 
SPC 2 C-e <down> ) C-j <up> <up> <up> <up> <up> <up> 
<up> <up> C-e C-j <down> <down> <down> <down> <down> 
<down> C-e C-j <up> C-SPC <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <escape> 
w C-x o C-s a d j u s t C-w C-s C-s C-s C-a C-s a d 
j u s t - w C-w s-b s-b s-b s-b s-b <escape> b <escape> 
b <escape> b C-s C-w C-w C-w C-s C-s C-a C-SPC <C-s-268632070> 
<escape> C-f <escape> w C-x p C-x o C-x o <escape> 
> C-y <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <return> ( C-a C-k C-k <up> <return> 
<up> <tab> ( g t o <backspace> <backspace> o t o - 
c h a r SPC d e s t ) C-a C-x C-s C-g <down> <down> 
<escape> C-x <escape> < <up> <down> <down> <down> <down> 
<down> <right> <right> <right> <down> <down> <down> 
<down> <escape> C-x <down> <down> <down> <down> <down> 
<down> <down> <down> <escape> C-x <up> <up> <up> <up> 
<up> C-a C-SPC <down> C-w C-x C-s C-g <escape> x e 
m a c s - r e p <tab> <backspace> <tab> <backspace> 
<backspace> <s-backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> r e p o r t - b 
<tab> <return>

Recent messages:
C-x p is undefined
Mark set [2 times]
Quit
follow-adjust-window
Mark set
Beginning of buffer
#<window 3 on *scratch*> [2 times]
Mark set
Quit
<s-backspace> is undefined

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
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 misearch multi-isearch vc-bzr jka-compr find-func
pp help-fns follow debug tutorial help-mode easymenu time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode prog-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 nadvice 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
cocoa ns multi-tty emacs)


--- End Message ---
--- Begin Message --- Subject: Re: bug#16431: 24.3.50; `follow-adjust-windows' sometimes fails (patch included) Date: Thu, 16 Jan 2014 09:25:46 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
> You can close it for now and if I see the problem again, I will let you know.

Done, thanks.

> One thing still seems to be problematic -- `follow-adjust-window' only work
> properly when `win' is *selected*.

Indeed, I was tempted to add a (cl-assert (eq win (selected-window))) or
to remove the `win' argument altogether.  I didn't do it mostly because
I remembered that we're in feature freeze.

> In other words, that I would like to see is the following:

>         (let ((source-pos ....))
>           (with-current-buffer (window-buffer win)
>             (goto-char source-pos)
>             (follow-adjust-window win)))

I don't understand why you'd want to compute source-pos while outside of
(window-buffer win).

> When windows are aligned, Follow mode does not set the window start or do
> anything else to disturb the redisplay.

In my suggested approach, when windows are aligned, after each call to
redisplay-window, window-end is cheap (since it was just computed and is
hence marked as up-to-date) and since the windows are already properly
aligned you'd find that window-start does not need to be updated, which
in turn would ensure that the next redisplay-window is also cheap.

> In this scenario it would definitively help if there were a "window-only
> redisplay" or, even better, a "silent redisplay" that would calculate where
> the window would end up, but not actually draw anything. (Here, I must
> admit that my knowledge of the display engine is limited.)

My intention would be for redisplay-window to only update the matrices
(i.e. the internal representation of the rendered window) and let the
subsequent full redisplay deal with updating the display.  My
knowledge of the display engine is also limited, but I think such
a redisplay-window function should not be too hard to write.


        Stefan


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]