浏览代码

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 年之前
父节点
当前提交
adcc0d414b
共有 1 个文件被更改,包括 2 次插入1 次删除
  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)