org-table.el (org-table-align): Only set the window start when table alignment is performed in the selected window

* org-table.el (org-table-align): Only set the window start
when table alignment is performed in the selected window.

Thanks to Michael Brand for reporting this.

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".
This commit is contained in:
Bastien Guerry 2013-02-16 14:08:47 +01:00
parent 09ffff9cee
commit adcc0d414b
1 changed files with 2 additions and 1 deletions

View File

@ -921,7 +921,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
(org-goto-line winstartline)
(setq winstart (point-at-bol))
(org-goto-line linepos)
(set-window-start (selected-window) winstart 'noforce)
(when (eq (window-buffer (selected-window)) (current-buffer))
(set-window-start (selected-window) winstart 'noforce))
(org-table-goto-column colpos)
(and org-table-overlay-coordinates (org-table-overlay-coordinates))
(setq org-table-may-need-update nil)