Browse Source

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".
Bastien Guerry 12 years ago
parent
commit
adcc0d414b
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lisp/org-table.el

+ 2 - 1
lisp/org-table.el

@@ -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)