浏览代码

New function org-fit-window-to-buffer.

This function only does its job if no side-by-side
window would be affected as well.  Also, if
fit-window-to-buffer is not defined, use
shrink-window-if-larger-than-buffer instead.
Carsten Dominik 16 年之前
父节点
当前提交
c6455acf3f
共有 2 个文件被更改,包括 12 次插入0 次删除
  1. 2 0
      lisp/ChangeLog
  2. 10 0
      lisp/org-compat.el

+ 2 - 0
lisp/ChangeLog

@@ -50,6 +50,8 @@
 
 2008-10-25  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org-compat.el (org-fit-window-to-buffer): New function.
+
 	* org-agenda.el (org-format-agenda-item)
 	(org-agenda-filter-make-matcher): Make sure tags are stored and
 	compared donwcased.

+ 10 - 0
lisp/org-compat.el

@@ -150,6 +150,16 @@ that will be added to PLIST.  Returns the string that was modified."
   string)
 (put 'org-add-props 'lisp-indent-function 2)
 
+(defun org-fit-window-to-buffer (&optional window)
+  "Fit the window to the buffer, but only if it is not a side-by-side window."
+  (cond ((> (frame-width) (window-width window))
+	 ;; do nothing if another window would suffer
+	 )
+	((fboundp 'fit-window-to-buffer)
+	 (fit-window-to-buffer window))
+	((fboundp 'shrink-window-if-larger-than-buffer)
+	 (shrink-window-if-larger-than-buffer window))))
+
 ;; Region compatibility
 
 (defvar org-ignore-region nil