emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Follow link scrolls current buffer when table aligns
@ 2013-01-17 18:40 Michael Brand
  2013-02-16 13:13 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Brand @ 2013-01-17 18:40 UTC (permalink / raw)
  To: Org Mode; +Cc: Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]

(continued from bug-gnu-emacs@gnu.org:
“find-file-noselect scrolls current buffer”
http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-01/msg00619.html )

Hi all

On Thu, Jan 17, 2013 at 12:10 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
> I.e. use
>   M-: (add-hook 'text-mode-hook (lambda () (goto-char (point-max))))

I changed my code for the org-mode-hook accordingly to resolve the
first issue related with using end-of-buffer.

This change uncovers a second scroll issue, this time caused by
set-window-start used in org-table-align. The scroll happens in an Org
buffer under some circumstances when a link to an other Org mode
buffer with a table alignment is followed. The first time when the
target file is opened by find-file-noselect, org-table-align is called
and its set-window-start is the reason for the scroll in the original
buffer.

Minimal test to reproduce:
1) put the attached n.org and t.org into one directory
2) emacs -q
3) C-x 3
4) open n.org
5) M->, C-p, C-c C-o
The last step changes the scroll state of n.org but the return value
of window-start is expected be the same before and after.

How can org-table-align be changed that set-window-start affects only
the visited target buffer but not the original buffer which called
find-file-noselect to follow its link?

Michael

[-- Attachment #2: n.org --]
[-- Type: application/octet-stream, Size: 320 bytes --]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
[[file:t.org::*table]]

[-- Attachment #3: t.org --]
[-- Type: application/octet-stream, Size: 725 bytes --]

#+STARTUP: align
* table
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |
  | bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla |

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

* Re: Follow link scrolls current buffer when table aligns
  2013-01-17 18:40 Follow link scrolls current buffer when table aligns Michael Brand
@ 2013-02-16 13:13 ` Bastien
  2013-02-16 14:19   ` Michael Brand
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2013-02-16 13:13 UTC (permalink / raw)
  To: Michael Brand; +Cc: Org Mode, Stefan Monnier

Hi Michael,

Michael Brand <michael.ch.brand@gmail.com> writes:

> Minimal test to reproduce:
> 1) put the attached n.org and t.org into one directory
> 2) emacs -q
> 3) C-x 3
> 4) open n.org
> 5) M->, C-p, C-c C-o
> The last step changes the scroll state of n.org but the return value
> of window-start is expected be the same before and after.
>
> How can org-table-align be changed that set-window-start affects only
> the visited target buffer but not the original buffer which called
> find-file-noselect to follow its link?

I finally fixed this with this commit:

  http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=adcc0d

Here is the git commit log:

  When opening an .org file from another .org file, org-mode is
  initialized in the second one while the window is not yet selected.
  So, functions run during org-mode's initialization need to check if
  the org-mode window is the selected one before manipulating the
  "current window".

Thanks for reporting this!

-- 
 Bastien

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

* Re: Follow link scrolls current buffer when table aligns
  2013-02-16 13:13 ` Bastien
@ 2013-02-16 14:19   ` Michael Brand
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Brand @ 2013-02-16 14:19 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode

Hi Bastien

On Sat, Feb 16, 2013 at 2:13 PM, Bastien <bzg@altern.org> wrote:
> I finally fixed this with this commit:
>   http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=adcc0d

Fix confirmed.

> Thanks for reporting this!

Thank you for the nice solution.

Michael

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

end of thread, other threads:[~2013-02-16 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-17 18:40 Follow link scrolls current buffer when table aligns Michael Brand
2013-02-16 13:13 ` Bastien
2013-02-16 14:19   ` Michael Brand

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).