diff options
| author | Martin Rudalics | 2011-06-17 10:45:37 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2011-06-17 10:45:37 +0200 |
| commit | d1067961b16f71cb0d9c2f3ff59d34ea5854b76e (patch) | |
| tree | 4f277c2be182eaaeaee0511a305fcbe1fffdd98a | |
| parent | dbad4f694d92d446c8b4eeb383afd13017ab76da (diff) | |
| download | emacs-d1067961b16f71cb0d9c2f3ff59d34ea5854b76e.tar.gz emacs-d1067961b16f71cb0d9c2f3ff59d34ea5854b76e.zip | |
Fix handling of old `display-buffer' options (bug#8851) (bug#8856).
* window.el (display-buffer-normalize-specifiers-1): Don't
check pop-up-frames for 'unset initialization.
(display-buffer-normalize-specifiers-2): Major rewrite using
special-display-p and same-window-p (Bug#8851) and (Bug#8856).
(pop-up-frames, display-buffer-reuse-frames)
(display-buffer-mark-dedicated): Don't initialize to 'unset.
Suggested by David Engster <deng@randomsample.de>.
(even-window-heights): Initialize to 'unset.
(display-buffer-alist-set): Handle new 'unset initializations.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/window.el | 198 |
2 files changed, 61 insertions, 146 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0ea97860bfe..b55f15a389d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -2,6 +2,15 @@ | |||
| 2 | 2 | ||
| 3 | * window.el (same-window-p): Fix two typos introduced when | 3 | * window.el (same-window-p): Fix two typos introduced when |
| 4 | adding with-no-warnings. | 4 | adding with-no-warnings. |
| 5 | (display-buffer-normalize-specifiers-1): Don't check | ||
| 6 | pop-up-frames for 'unset initialization. | ||
| 7 | (display-buffer-normalize-specifiers-2): Major rewrite using | ||
| 8 | special-display-p and same-window-p (Bug#8851) and (Bug#8856). | ||
| 9 | (pop-up-frames, display-buffer-reuse-frames) | ||
| 10 | (display-buffer-mark-dedicated): Don't initialize to 'unset. | ||
| 11 | Suggested by David Engster <deng@randomsample.de>. | ||
| 12 | (even-window-heights): Initialize to 'unset. | ||
| 13 | (display-buffer-alist-set): Handle new 'unset initializations. | ||
| 5 | 14 | ||
| 6 | 2011-06-16 Martin Rudalics <rudalics@gmx.at> | 15 | 2011-06-16 Martin Rudalics <rudalics@gmx.at> |
| 7 | 16 | ||
diff --git a/lisp/window.el b/lisp/window.el index 0372a2f13f1..07835e29b0d 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -4954,7 +4954,7 @@ SPECIFIERS is the SPECIFIERS argument of `display-buffer'." | |||
| 4954 | (setq entry (assq specifiers display-buffer-macro-specifiers))) | 4954 | (setq entry (assq specifiers display-buffer-macro-specifiers))) |
| 4955 | ;; A macro specifier. | 4955 | ;; A macro specifier. |
| 4956 | (cdr entry)) | 4956 | (cdr entry)) |
| 4957 | ((with-no-warnings (memq pop-up-frames '(nil unset))) | 4957 | ((with-no-warnings (not pop-up-frames)) |
| 4958 | ;; Pop up a new window. | 4958 | ;; Pop up a new window. |
| 4959 | (cdr (assq 'other-window display-buffer-macro-specifiers))) | 4959 | (cdr (assq 'other-window display-buffer-macro-specifiers))) |
| 4960 | (t | 4960 | (t |
| @@ -4971,8 +4971,13 @@ options." | |||
| 4971 | specifiers) | 4971 | specifiers) |
| 4972 | ;; Disable warnings, there are too many obsolete options here. | 4972 | ;; Disable warnings, there are too many obsolete options here. |
| 4973 | (with-no-warnings | 4973 | (with-no-warnings |
| 4974 | ;; `even-window-heights', unless nil or unset. | ||
| 4975 | (unless (memq even-window-heights '(nil unset)) | ||
| 4976 | (setq specifiers | ||
| 4977 | (cons (cons 'reuse-window-even-sizes t) specifiers))) | ||
| 4978 | |||
| 4974 | ;; `display-buffer-mark-dedicated' | 4979 | ;; `display-buffer-mark-dedicated' |
| 4975 | (unless (memq display-buffer-mark-dedicated '(nil unset)) | 4980 | (when display-buffer-mark-dedicated |
| 4976 | (setq specifiers | 4981 | (setq specifiers |
| 4977 | (cons (cons 'dedicate display-buffer-mark-dedicated) | 4982 | (cons (cons 'dedicate display-buffer-mark-dedicated) |
| 4978 | specifiers))) | 4983 | specifiers))) |
| @@ -5004,10 +5009,21 @@ options." | |||
| 5004 | (cons 'largest fun) (cons 'lru fun)) | 5009 | (cons 'largest fun) (cons 'lru fun)) |
| 5005 | specifiers)))) | 5010 | specifiers)))) |
| 5006 | 5011 | ||
| 5007 | ;; `pop-up-frame' group. Anything is added here iff | 5012 | ;; `special-display-p' group. |
| 5008 | ;; `pop-up-frames' is neither nil nor unset (we ignore the problem | 5013 | (when special-display-function |
| 5009 | ;; that callers usually don't care about graphic-only). | 5014 | ;; `special-display-p' returns either t or a list of frame |
| 5010 | (unless (memq pop-up-frames '(nil unset)) | 5015 | ;; parameters to pass to `special-display-function'. |
| 5016 | (let ((pars (special-display-p buffer-name))) | ||
| 5017 | (when pars | ||
| 5018 | (setq specifiers | ||
| 5019 | (cons (list 'fun-with-args special-display-function | ||
| 5020 | (when (listp pars) pars)) | ||
| 5021 | specifiers))))) | ||
| 5022 | |||
| 5023 | ;; `pop-up-frame' group. Add things if `pop-up-frames' is non-nil | ||
| 5024 | ;; (we ignore the problem that callers usually don't care about | ||
| 5025 | ;; graphic-only). | ||
| 5026 | (when pop-up-frames | ||
| 5011 | ;; `pop-up-frame-function'. If `pop-up-frame-function' uses the | 5027 | ;; `pop-up-frame-function'. If `pop-up-frame-function' uses the |
| 5012 | ;; now obsolete `pop-up-frame-alist' it will continue to do so. | 5028 | ;; now obsolete `pop-up-frame-alist' it will continue to do so. |
| 5013 | (setq specifiers | 5029 | (setq specifiers |
| @@ -5017,139 +5033,34 @@ options." | |||
| 5017 | (setq specifiers | 5033 | (setq specifiers |
| 5018 | (cons (list 'pop-up-frame pop-up-frames) specifiers))) | 5034 | (cons (list 'pop-up-frame pop-up-frames) specifiers))) |
| 5019 | 5035 | ||
| 5020 | ;; `special-display-regexps' | 5036 | ;; `same-window-p' group. |
| 5021 | (dolist (entry special-display-regexps) | 5037 | (when (same-window-p buffer-name) |
| 5022 | (cond | 5038 | ;; Try to reuse the same (selected) window. |
| 5023 | ((stringp entry) | 5039 | (setq specifiers |
| 5024 | ;; Plain string. | 5040 | (cons (list 'reuse-window 'same nil nil) |
| 5025 | (when (string-match-p entry buffer-name) | 5041 | specifiers))) |
| 5026 | (setq specifiers | ||
| 5027 | (cons | ||
| 5028 | (list 'fun-with-args special-display-function | ||
| 5029 | special-display-frame-alist) | ||
| 5030 | specifiers)))) | ||
| 5031 | ((consp entry) | ||
| 5032 | (let ((name (car entry)) | ||
| 5033 | (rest (cdr entry))) | ||
| 5034 | (cond | ||
| 5035 | ((not (string-match-p name buffer-name))) | ||
| 5036 | ((functionp (car rest)) | ||
| 5037 | ;; A function. | ||
| 5038 | (setq specifiers | ||
| 5039 | (cons (list 'fun-with-args (car rest) (cadr rest)) | ||
| 5040 | specifiers))) | ||
| 5041 | ((listp rest) | ||
| 5042 | ;; A list of parameters. | ||
| 5043 | (cond | ||
| 5044 | ((assq 'same-window rest) | ||
| 5045 | (setq specifiers | ||
| 5046 | (cons (list 'reuse-window 'same) specifiers)) | ||
| 5047 | (setq specifiers | ||
| 5048 | (cons (list 'reuse-window-dedicated 'weak) | ||
| 5049 | specifiers))) | ||
| 5050 | ((assq 'same-frame rest) | ||
| 5051 | (setq specifiers | ||
| 5052 | (setq specifiers | ||
| 5053 | (cons (list 'same-frame) specifiers)))) | ||
| 5054 | (t | ||
| 5055 | (setq specifiers | ||
| 5056 | (cons (list 'fun-with-args special-display-function | ||
| 5057 | special-display-frame-alist) | ||
| 5058 | specifiers)))))))))) | ||
| 5059 | |||
| 5060 | ;; `special-display-buffer-names' | ||
| 5061 | (dolist (entry special-display-buffer-names) | ||
| 5062 | (cond | ||
| 5063 | ((stringp entry) | ||
| 5064 | ;; Plain string. | ||
| 5065 | (when (string-equal entry buffer-name) | ||
| 5066 | (setq specifiers | ||
| 5067 | (cons | ||
| 5068 | (list 'fun-with-args special-display-function | ||
| 5069 | special-display-frame-alist) | ||
| 5070 | specifiers)))) | ||
| 5071 | ((consp entry) | ||
| 5072 | (let ((name (car entry)) | ||
| 5073 | (rest (cdr entry))) | ||
| 5074 | (cond | ||
| 5075 | ((not (string-equal name buffer-name))) | ||
| 5076 | ((functionp (car rest)) | ||
| 5077 | ;; A function. | ||
| 5078 | (setq specifiers | ||
| 5079 | (cons (list 'fun-with-args (car rest) (cadr rest)) | ||
| 5080 | specifiers))) | ||
| 5081 | ((listp rest) | ||
| 5082 | ;; A list of parameters. | ||
| 5083 | (cond | ||
| 5084 | ((assq 'same-window rest) | ||
| 5085 | (setq specifiers | ||
| 5086 | (cons (list 'reuse-window 'same) specifiers)) | ||
| 5087 | (setq specifiers | ||
| 5088 | (cons (list 'reuse-window-dedicated 'weak) | ||
| 5089 | specifiers))) | ||
| 5090 | ((assq 'same-frame rest) | ||
| 5091 | (setq specifiers | ||
| 5092 | (setq specifiers | ||
| 5093 | (cons (list 'same-frame) specifiers)))) | ||
| 5094 | (t | ||
| 5095 | (setq specifiers | ||
| 5096 | (cons (list 'fun-with-args special-display-function | ||
| 5097 | special-display-frame-alist) | ||
| 5098 | specifiers)))))))))) | ||
| 5099 | |||
| 5100 | ;; `same-window-regexps' | ||
| 5101 | (dolist (entry same-window-regexps) | ||
| 5102 | (cond | ||
| 5103 | ((stringp entry) | ||
| 5104 | (when (string-match-p entry buffer-name) | ||
| 5105 | (setq specifiers | ||
| 5106 | (cons (list 'reuse-window 'same) specifiers)))) | ||
| 5107 | ((consp entry) | ||
| 5108 | (when (string-match-p (car entry) buffer-name) | ||
| 5109 | (setq specifiers | ||
| 5110 | (cons (list 'reuse-window 'same) specifiers)))))) | ||
| 5111 | |||
| 5112 | ;; `same-window-buffer-names' | ||
| 5113 | (dolist (entry same-window-buffer-names) | ||
| 5114 | (cond | ||
| 5115 | ((stringp entry) | ||
| 5116 | (when (string-equal entry buffer-name) | ||
| 5117 | (setq specifiers | ||
| 5118 | (cons (list 'reuse-window 'same) specifiers)))) | ||
| 5119 | ((consp entry) | ||
| 5120 | (when (string-equal (car entry) buffer-name) | ||
| 5121 | (setq specifiers | ||
| 5122 | (cons (list 'reuse-window 'same) specifiers)))))) | ||
| 5123 | 5042 | ||
| 5124 | ;; `pop-up-windows' and `pop-up-frames' nil means means we | 5043 | ;; `pop-up-windows' and `pop-up-frames' both nil means means we |
| 5125 | ;; are supposed to reuse any window (unless we find one showing | 5044 | ;; are supposed to reuse any window (unless we find one showing |
| 5126 | ;; the same buffer already). | 5045 | ;; the same buffer already). |
| 5127 | 5046 | (unless (or pop-up-windows pop-up-frames) | |
| 5128 | ;; This clause is needed because Emacs 23 options can be used to | ||
| 5129 | ;; suppress a certain behavior while `display-buffer-alist' can be | ||
| 5130 | ;; only used to enforce some behavior. | ||
| 5131 | (when (and (not pop-up-windows) (memq pop-up-frames '(nil unset))) | ||
| 5132 | ;; `even-window-heights' | ||
| 5133 | (when even-window-heights | ||
| 5134 | (setq specifiers | ||
| 5135 | (cons (cons 'reuse-window-even-sizes t) specifiers))) | ||
| 5136 | ;; `reuse-window' showing any buffer on same frame. | 5047 | ;; `reuse-window' showing any buffer on same frame. |
| 5137 | (setq specifiers | 5048 | (setq specifiers |
| 5138 | (cons (list 'reuse-window nil nil nil) | 5049 | (cons (list 'reuse-window nil nil nil) |
| 5139 | specifiers))) | 5050 | specifiers))) |
| 5140 | 5051 | ||
| 5141 | ;; `display-buffer-reuse-frames' or `pop-up-frames' set means we | 5052 | ;; `display-buffer-reuse-frames' or `pop-up-frames' non-nil means |
| 5142 | ;; are supposed to reuse a window showing the same buffer. | 5053 | ;; we are supposed to reuse a window showing the same buffer on |
| 5143 | (unless (and (memq display-buffer-reuse-frames '(nil unset)) | 5054 | ;; another frame. |
| 5144 | (memq pop-up-frames '(nil unset))) | 5055 | (when (or display-buffer-reuse-frames pop-up-frames) |
| 5145 | ;; `even-window-heights' | ||
| 5146 | (when even-window-heights | ||
| 5147 | (setq specifiers | ||
| 5148 | (cons (cons 'reuse-window-even-sizes t) specifiers))) | ||
| 5149 | ;; `reuse-window' showing same buffer on visible frame. | 5056 | ;; `reuse-window' showing same buffer on visible frame. |
| 5150 | (setq specifiers | 5057 | (setq specifiers |
| 5151 | (cons (list 'reuse-window nil 'same 0) | 5058 | (cons (list 'reuse-window nil 'same 0) specifiers))) |
| 5152 | specifiers))) | 5059 | |
| 5060 | ;; Prepend "reuse window on same frame if showing the buffer | ||
| 5061 | ;; already" specifier. | ||
| 5062 | (setq specifiers (cons (list 'reuse-window nil 'same nil) | ||
| 5063 | specifiers)) | ||
| 5153 | 5064 | ||
| 5154 | specifiers))) | 5065 | specifiers))) |
| 5155 | 5066 | ||
| @@ -5937,32 +5848,28 @@ frame. The default value calls `make-frame' with the argument | |||
| 5937 | 'pop-up-frame-function | 5848 | 'pop-up-frame-function |
| 5938 | "use 2nd arg of `display-buffer' instead." "24.1") | 5849 | "use 2nd arg of `display-buffer' instead." "24.1") |
| 5939 | 5850 | ||
| 5940 | (defcustom pop-up-frames 'unset ; nil | 5851 | (defcustom pop-up-frames nil |
| 5941 | "Whether `display-buffer' should make a separate frame. | 5852 | "Whether `display-buffer' should make a separate frame. |
| 5942 | If nil, never make a separate frame. | 5853 | If nil, never make a separate frame. |
| 5943 | If the value is `graphic-only', make a separate frame | 5854 | If the value is `graphic-only', make a separate frame |
| 5944 | on graphic displays only. | 5855 | on graphic displays only. |
| 5945 | If this is the symbol unset, the option was not set and is | ||
| 5946 | ignored. | ||
| 5947 | Any other non-nil value means always make a separate frame." | 5856 | Any other non-nil value means always make a separate frame." |
| 5948 | :type '(choice | 5857 | :type '(choice |
| 5949 | (const :tag "Unset" unset) | ||
| 5950 | (const :tag "Never" nil) | 5858 | (const :tag "Never" nil) |
| 5951 | (const :tag "On graphic displays only" graphic-only) | 5859 | (const :tag "On graphic displays only" graphic-only) |
| 5952 | (const :tag "Always" t)) | 5860 | (const :tag "Always" t)) |
| 5953 | :version "24.1" | ||
| 5954 | :group 'windows | 5861 | :group 'windows |
| 5955 | :group 'frames) | 5862 | :group 'frames) |
| 5956 | (make-obsolete-variable | 5863 | (make-obsolete-variable |
| 5957 | 'pop-up-frames | 5864 | 'pop-up-frames |
| 5958 | "use 2nd arg of `display-buffer' instead." "24.1") | 5865 | "use 2nd arg of `display-buffer' instead." "24.1") |
| 5959 | 5866 | ||
| 5960 | (defcustom display-buffer-reuse-frames 'unset ; nil | 5867 | (defcustom display-buffer-reuse-frames nil |
| 5961 | "Set and non-nil means `display-buffer' should reuse frames. | 5868 | "Set and non-nil means `display-buffer' should reuse frames. |
| 5962 | If the buffer in question is already displayed in a frame, raise | 5869 | If the buffer in question is already displayed in a frame, raise |
| 5963 | that frame." | 5870 | that frame." |
| 5964 | :type 'boolean | 5871 | :type 'boolean |
| 5965 | :version "24.1" | 5872 | :version "21.1" |
| 5966 | :group 'windows | 5873 | :group 'windows |
| 5967 | :group 'frames) | 5874 | :group 'frames) |
| 5968 | (make-obsolete-variable | 5875 | (make-obsolete-variable |
| @@ -6033,20 +5940,20 @@ is nil, `display-buffer' cannot split windows horizontally." | |||
| 6033 | 'split-width-threshold | 5940 | 'split-width-threshold |
| 6034 | "use 2nd arg of `display-buffer' instead." "24.1") | 5941 | "use 2nd arg of `display-buffer' instead." "24.1") |
| 6035 | 5942 | ||
| 6036 | (defcustom even-window-heights t | 5943 | (defcustom even-window-heights 'unset ; t |
| 6037 | "If non-nil `display-buffer' will try to even window heights. | 5944 | "If set and non-nil `display-buffer' will try to even window heights. |
| 6038 | Otherwise `display-buffer' will leave the window configuration | 5945 | Otherwise `display-buffer' will leave the window configuration |
| 6039 | alone. Heights are evened only when `display-buffer' reuses a | 5946 | alone. Heights are evened only when `display-buffer' reuses a |
| 6040 | window that appears above or below the selected window." | 5947 | window that appears above or below the selected window." |
| 6041 | :type 'boolean | 5948 | :type 'boolean |
| 6042 | :version "23.1" | 5949 | :version "24.1" |
| 6043 | :group 'windows) | 5950 | :group 'windows) |
| 6044 | (make-obsolete-variable | 5951 | (make-obsolete-variable |
| 6045 | 'even-window-heights | 5952 | 'even-window-heights |
| 6046 | "use 2nd arg of `display-buffer' instead." "24.1") | 5953 | "use 2nd arg of `display-buffer' instead." "24.1") |
| 6047 | 5954 | ||
| 6048 | (defvar display-buffer-mark-dedicated 'unset ; nil | 5955 | (defvar display-buffer-mark-dedicated nil |
| 6049 | "Set and non-nil means `display-buffer' marks the windows it creates as dedicated. | 5956 | "Non-nil means `display-buffer' marks the windows it creates as dedicated. |
| 6050 | The actual non-nil value of this variable will be copied to the | 5957 | The actual non-nil value of this variable will be copied to the |
| 6051 | `window-dedicated-p' flag.") | 5958 | `window-dedicated-p' flag.") |
| 6052 | (make-obsolete-variable | 5959 | (make-obsolete-variable |
| @@ -6223,7 +6130,7 @@ value of `display-buffer-alist'." | |||
| 6223 | nil | 6130 | nil |
| 6224 | (list | 6131 | (list |
| 6225 | 'pop-up-frame | 6132 | 'pop-up-frame |
| 6226 | (unless (memq pop-up-frames '(nil unset)) | 6133 | (when pop-up-frames |
| 6227 | (list 'pop-up-frame pop-up-frames)) | 6134 | (list 'pop-up-frame pop-up-frames)) |
| 6228 | (when pop-up-frame-function | 6135 | (when pop-up-frame-function |
| 6229 | (cons 'pop-up-frame-function pop-up-frame-function)) | 6136 | (cons 'pop-up-frame-function pop-up-frame-function)) |
| @@ -6359,17 +6266,16 @@ value of `display-buffer-alist'." | |||
| 6359 | (list | 6266 | (list |
| 6360 | 'reuse-window | 6267 | 'reuse-window |
| 6361 | (list 'reuse-window nil 'same | 6268 | (list 'reuse-window nil 'same |
| 6362 | (unless (and (memq display-buffer-reuse-frames '(nil unset)) | 6269 | (when (or display-buffer-reuse-frames pop-up-frames) |
| 6363 | (memq pop-up-frames '(nil unset))) | ||
| 6364 | ;; "0" (all visible and iconified frames) is hardcoded in | 6270 | ;; "0" (all visible and iconified frames) is hardcoded in |
| 6365 | ;; Emacs 23. | 6271 | ;; Emacs 23. |
| 6366 | 0)) | 6272 | 0)) |
| 6367 | (when even-window-heights | 6273 | (unless (memq even-window-heights '(nil unset)) |
| 6368 | (cons 'reuse-window-even-sizes t))) | 6274 | (cons 'reuse-window-even-sizes t))) |
| 6369 | no-custom) | 6275 | no-custom) |
| 6370 | 6276 | ||
| 6371 | ;; `display-buffer-mark-dedicated' | 6277 | ;; `display-buffer-mark-dedicated' |
| 6372 | (unless (memq display-buffer-mark-dedicated '(nil unset)) | 6278 | (when display-buffer-mark-dedicated |
| 6373 | (display-buffer-alist-add | 6279 | (display-buffer-alist-add |
| 6374 | nil | 6280 | nil |
| 6375 | (list | 6281 | (list |