mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-26 07:33:39 +00:00
Check for horizontally-split windows when shrinking a window.
So far, Org used either `fit-window-to-buffer' or `shrink-window-if-larger-than-buffer' without any further checks when displaying one of its many help and selection buffers. This can cause problems if the user has set up Emacs to split windows horizontally rather than vertically, because the window being shrunken then may be side-by-side with another window, and shrinking the height of one will also change the other. With this patch, shrinking a window always goes through the new function `org-fit-window-to-buffer' which only acts if the current window spans the whole width of the frame. Furthermore, this function also helps with compatibility, because it falls back to `shrink-window-if-larger-than-buffer' if `fit-window-to-buffer' does not exist, as is the case on older version of Emacs and XEmacs.
This commit is contained in:
parent
413d9b73b0
commit
293d3311d6
@ -1,5 +1,18 @@
|
||||
2008-11-03 Carsten Dominik <dominik@science.uva.nl>
|
||||
|
||||
* org-compat.el (org-fit-window-to-buffer): New function (not
|
||||
really, a preliminary and incomplete version was present earlier,
|
||||
but not used).
|
||||
|
||||
* org.el (org-fast-todo-selection, org-fast-tag-selection): Use
|
||||
`org-fit-window-to-buffer'.
|
||||
|
||||
* org-exp.el (org-export): Use `org-fit-window-to-buffer'.
|
||||
|
||||
* org-agenda.el (org-agenda-get-restriction-and-command)
|
||||
(org-fit-agenda-window, org-agenda-convert-date): Use
|
||||
`org-fit-window-to-buffer'.
|
||||
|
||||
* org-exp.el (org-export-as-html): Process href links through
|
||||
`org-export-html-format-href'.
|
||||
(org-export-html-format-href): New function.
|
||||
@ -117,8 +130,6 @@
|
||||
|
||||
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.
|
||||
|
@ -1585,12 +1585,11 @@ s Search for keywords C Configure custom agenda commands
|
||||
"Prefix key"))))
|
||||
prefixes))
|
||||
(goto-char (point-min))
|
||||
(when (fboundp 'fit-window-to-buffer)
|
||||
(if second-time
|
||||
(if (not (pos-visible-in-window-p (point-max)))
|
||||
(fit-window-to-buffer))
|
||||
(setq second-time t)
|
||||
(fit-window-to-buffer)))
|
||||
(if second-time
|
||||
(if (not (pos-visible-in-window-p (point-max)))
|
||||
(org-fit-window-to-buffer))
|
||||
(setq second-time t)
|
||||
(org-fit-window-to-buffer))
|
||||
(message "Press key for agenda command%s:"
|
||||
(if (or restrict-ok org-agenda-overriding-restriction)
|
||||
(if org-agenda-overriding-restriction
|
||||
@ -1989,7 +1988,7 @@ VALUE defaults to t."
|
||||
"Fit the window to the buffer size."
|
||||
(and (memq org-agenda-window-setup '(reorganize-frame))
|
||||
(fboundp 'fit-window-to-buffer)
|
||||
(fit-window-to-buffer
|
||||
(org-fit-window-to-buffer
|
||||
nil
|
||||
(floor (* (frame-height) (cdr org-agenda-window-frame-fractions)))
|
||||
(floor (* (frame-height) (car org-agenda-window-frame-fractions))))))
|
||||
@ -5498,8 +5497,7 @@ This is a command that has to be installed in `calendar-mode-map'."
|
||||
"Chinese: " (calendar-chinese-date-string date) "\n"))
|
||||
(with-output-to-temp-buffer "*Dates*"
|
||||
(princ s))
|
||||
(if (fboundp 'fit-window-to-buffer)
|
||||
(fit-window-to-buffer (get-buffer-window "*Dates*")))))
|
||||
(org-fit-window-to-buffer (get-buffer-window "*Dates*"))))
|
||||
|
||||
;;; Appointment reminders
|
||||
|
||||
|
@ -125,7 +125,7 @@ F Like \"f\", but force using dired in Emacs.
|
||||
d Delete one attachment, you will be prompted for a file name.
|
||||
D Delete all of a task's attachments. A safer way is
|
||||
to open the directory in dired and delete from there.")))
|
||||
(shrink-window-if-larger-than-buffer (get-buffer-window "*Org Attach*"))
|
||||
(org-fit-window-to-buffer (get-buffer-window "*Org Attach*"))
|
||||
(message "Select command: [acmlzoOfFdD]")
|
||||
(setq c (read-char-exclusive))
|
||||
(and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*"))))
|
||||
|
@ -204,9 +204,7 @@ of a different task.")
|
||||
(+ i (- ?A 10))) m))
|
||||
(push s sel-list)))
|
||||
org-clock-history)
|
||||
(if (fboundp 'fit-window-to-buffer)
|
||||
(fit-window-to-buffer)
|
||||
(shrink-window-if-larger-than-buffer))
|
||||
(org-fit-window-to-buffer)
|
||||
(message (or prompt "Select task for clocking:"))
|
||||
(setq rpl (read-char-exclusive))
|
||||
(cond
|
||||
|
@ -150,15 +150,21 @@ 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."
|
||||
(defun org-fit-window-to-buffer (&optional window max-height min-height
|
||||
shrink-only)
|
||||
"Fit WINDOW to the buffer, but only if it is not a side-by-side window.
|
||||
WINDOW defaults to the selected window. MAX-HEIGHT and MIN-HEIGHT are
|
||||
passed through to `fit-window-to-buffer'. If SHRINK-ONLY is set, call
|
||||
`shrink-window-if-larger-than-buffer' instead, the hight limit are
|
||||
ignored in this case."
|
||||
(cond ((> (frame-width) (window-width window))
|
||||
;; do nothing if another window would suffer
|
||||
)
|
||||
((fboundp 'fit-window-to-buffer)
|
||||
(fit-window-to-buffer window))
|
||||
((and (fboundp 'fit-window-to-buffer) (not shrink-only))
|
||||
(fit-window-to-buffer window max-height min-height))
|
||||
((fboundp 'shrink-window-if-larger-than-buffer)
|
||||
(shrink-window-if-larger-than-buffer window))))
|
||||
(shrink-window-if-larger-than-buffer window)))
|
||||
(or window (selected-window)))
|
||||
|
||||
;; Region compatibility
|
||||
|
||||
|
@ -1062,9 +1062,8 @@ value of `org-export-run-in-background'."
|
||||
(delete-other-windows)
|
||||
(with-output-to-temp-buffer "*Org Export/Publishing Help*"
|
||||
(princ help))
|
||||
(if (fboundp 'fit-window-to-buffer)
|
||||
(fit-window-to-buffer (get-buffer-window
|
||||
"*Org Export/Publishing Help*")))
|
||||
(org-fit-window-to-buffer (get-buffer-window
|
||||
"*Org Export/Publishing Help*"))
|
||||
(message "Select command: ")
|
||||
(setq r1 (read-char-exclusive)))
|
||||
(setq r2 (if (< r1 27) (+ r1 96) r1))
|
||||
|
@ -2172,7 +2172,7 @@ $1-> %s\n" orig formula form0 form))
|
||||
ev (or fmt "NONE")
|
||||
(if fmt (format fmt (string-to-number ev)) ev)))))
|
||||
(setq bw (get-buffer-window "*Substitution History*"))
|
||||
(shrink-window-if-larger-than-buffer bw)
|
||||
(org-fit-window-to-buffer bw)
|
||||
(unless (and (interactive-p) (not ndown))
|
||||
(unless (let (inhibit-redisplay)
|
||||
(y-or-n-p "Debugging Formula. Continue to next? "))
|
||||
|
13
lisp/org.el
13
lisp/org.el
@ -4429,7 +4429,7 @@ or nil."
|
||||
(error (make-indirect-buffer (current-buffer) "*org-goto*"))))
|
||||
(with-output-to-temp-buffer "*Help*"
|
||||
(princ help))
|
||||
(shrink-window-if-larger-than-buffer (get-buffer-window "*Help*"))
|
||||
(org-fit-window-to-buffer (get-buffer-window "*Help*"))
|
||||
(setq buffer-read-only nil)
|
||||
(let ((org-startup-truncated t)
|
||||
(org-startup-folded nil)
|
||||
@ -6420,7 +6420,7 @@ used as the link location instead of reading one interactively."
|
||||
(reverse org-stored-links) "\n"))))
|
||||
(let ((cw (selected-window)))
|
||||
(select-window (get-buffer-window "*Org Links*"))
|
||||
(shrink-window-if-larger-than-buffer)
|
||||
(org-fit-window-to-buffer)
|
||||
(setq truncate-lines t)
|
||||
(select-window cw))
|
||||
;; Fake a link history, containing the stored links.
|
||||
@ -8121,8 +8121,7 @@ Returns the new TODO keyword, or nil if no state change should occur."
|
||||
(setq cnt 0)))))
|
||||
(insert "\n")
|
||||
(goto-char (point-min))
|
||||
(if (and (not expert) (fboundp 'fit-window-to-buffer))
|
||||
(fit-window-to-buffer))
|
||||
(if (not expert) (org-fit-window-to-buffer))
|
||||
(message "[a-z..]:Set [SPC]:clear")
|
||||
(setq c (let ((inhibit-quit t)) (read-char-exclusive)))
|
||||
(cond
|
||||
@ -9507,8 +9506,7 @@ Returns the new tags string, or nil to not change the current settings."
|
||||
(setq ntable (nreverse ntable))
|
||||
(insert "\n")
|
||||
(goto-char (point-min))
|
||||
(if (and (not expert) (fboundp 'fit-window-to-buffer))
|
||||
(fit-window-to-buffer))
|
||||
(if (not expert) (org-fit-window-to-buffer))
|
||||
(setq rtn
|
||||
(catch 'exit
|
||||
(while t
|
||||
@ -9530,8 +9528,7 @@ Returns the new tags string, or nil to not change the current settings."
|
||||
(delete-other-windows)
|
||||
(split-window-vertically)
|
||||
(org-switch-to-buffer-other-window " *Org tags*")
|
||||
(and (fboundp 'fit-window-to-buffer)
|
||||
(fit-window-to-buffer))))
|
||||
(org-fit-window-to-buffer)))
|
||||
((or (= c ?\C-g)
|
||||
(and (= c ?q) (not (rassoc c ntable))))
|
||||
(org-detach-overlay org-tags-overlay)
|
||||
|
Loading…
Reference in New Issue
Block a user