diff options
| author | Stefan Monnier | 2001-10-12 20:39:54 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-10-12 20:39:54 +0000 |
| commit | 7e573c4a6d106ae4408fd1d054ebb74458a7cb84 (patch) | |
| tree | bf930cd518a836c76e498aacbdbf9b3d5c241f7b | |
| parent | 32993295b900acebb2010323bdb3f7c1b6cd7d8a (diff) | |
| download | emacs-7e573c4a6d106ae4408fd1d054ebb74458a7cb84.tar.gz emacs-7e573c4a6d106ae4408fd1d054ebb74458a7cb84.zip | |
(special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
| -rw-r--r-- | lisp/frame.el | 82 |
1 files changed, 49 insertions, 33 deletions
diff --git a/lisp/frame.el b/lisp/frame.el index ffce3a83148..476aa2fca83 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -32,9 +32,9 @@ | |||
| 32 | The window system startup file should set this to its frame creation | 32 | The window system startup file should set this to its frame creation |
| 33 | function, which should take an alist of parameters as its argument.") | 33 | function, which should take an alist of parameters as its argument.") |
| 34 | 34 | ||
| 35 | ;;; The initial value given here for used to ask for a minibuffer. | 35 | ;; The initial value given here used to ask for a minibuffer. |
| 36 | ;;; But that's not necessary, because the default is to have one. | 36 | ;; But that's not necessary, because the default is to have one. |
| 37 | ;;; By not specifying it here, we let an X resource specify it. | 37 | ;; By not specifying it here, we let an X resource specify it. |
| 38 | (defcustom initial-frame-alist nil | 38 | (defcustom initial-frame-alist nil |
| 39 | "*Alist of frame parameters for creating the initial X window frame. | 39 | "*Alist of frame parameters for creating the initial X window frame. |
| 40 | You can set this in your `.emacs' file; for example, | 40 | You can set this in your `.emacs' file; for example, |
| @@ -113,17 +113,30 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args." | |||
| 113 | (if (and args (symbolp (car args))) | 113 | (if (and args (symbolp (car args))) |
| 114 | (apply (car args) buffer (cdr args)) | 114 | (apply (car args) buffer (cdr args)) |
| 115 | (let ((window (get-buffer-window buffer t))) | 115 | (let ((window (get-buffer-window buffer t))) |
| 116 | (if window | 116 | (or |
| 117 | ;; If we have a window already, make it visible. | 117 | ;; If we have a window already, make it visible. |
| 118 | (let ((frame (window-frame window))) | 118 | (when window |
| 119 | (make-frame-visible frame) | 119 | (let ((frame (window-frame window))) |
| 120 | (raise-frame frame) | 120 | (make-frame-visible frame) |
| 121 | window) | 121 | (raise-frame frame) |
| 122 | ;; If no window yet, make one in a new frame. | 122 | window)) |
| 123 | (let ((frame (make-frame (append args special-display-frame-alist)))) | 123 | ;; Reuse the current window if the user requested it. |
| 124 | (set-window-buffer (frame-selected-window frame) buffer) | 124 | (when (cdr (assq 'same-window args)) |
| 125 | (set-window-dedicated-p (frame-selected-window frame) t) | 125 | (condition-case nil |
| 126 | (frame-selected-window frame)))))) | 126 | (progn (switch-to-buffer buffer) (selected-window)) |
| 127 | (error nil))) | ||
| 128 | ;; Stay on the same frame if requested. | ||
| 129 | (when (or (cdr (assq 'same-frame args)) (cdr (assq 'same-window args))) | ||
| 130 | (let* ((pop-up-frames nil) (pop-up-windows t) | ||
| 131 | special-display-regexps special-display-buffer-names | ||
| 132 | (window (display-buffer buffer))) | ||
| 133 | ;; (set-window-dedicated-p window t) | ||
| 134 | window)) | ||
| 135 | ;; If no window yet, make one in a new frame. | ||
| 136 | (let ((frame (make-frame (append args special-display-frame-alist)))) | ||
| 137 | (set-window-buffer (frame-selected-window frame) buffer) | ||
| 138 | (set-window-dedicated-p (frame-selected-window frame) t) | ||
| 139 | (frame-selected-window frame)))))) | ||
| 127 | 140 | ||
| 128 | (defun handle-delete-frame (event) | 141 | (defun handle-delete-frame (event) |
| 129 | "Handle delete-frame events from the X server." | 142 | "Handle delete-frame events from the X server." |
| @@ -143,14 +156,14 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args." | |||
| 143 | 156 | ||
| 144 | ;;;; Arrangement of frames at startup | 157 | ;;;; Arrangement of frames at startup |
| 145 | 158 | ||
| 146 | ;;; 1) Load the window system startup file from the lisp library and read the | 159 | ;; 1) Load the window system startup file from the lisp library and read the |
| 147 | ;;; high-priority arguments (-q and the like). The window system startup | 160 | ;; high-priority arguments (-q and the like). The window system startup |
| 148 | ;;; file should create any frames specified in the window system defaults. | 161 | ;; file should create any frames specified in the window system defaults. |
| 149 | ;;; | 162 | ;; |
| 150 | ;;; 2) If no frames have been opened, we open an initial text frame. | 163 | ;; 2) If no frames have been opened, we open an initial text frame. |
| 151 | ;;; | 164 | ;; |
| 152 | ;;; 3) Once the init file is done, we apply any newly set parameters | 165 | ;; 3) Once the init file is done, we apply any newly set parameters |
| 153 | ;;; in initial-frame-alist to the frame. | 166 | ;; in initial-frame-alist to the frame. |
| 154 | 167 | ||
| 155 | ;; These are now called explicitly at the proper times, | 168 | ;; These are now called explicitly at the proper times, |
| 156 | ;; since that is easier to understand. | 169 | ;; since that is easier to understand. |
| @@ -158,7 +171,7 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args." | |||
| 158 | ;; (add-hook 'before-init-hook 'frame-initialize) | 171 | ;; (add-hook 'before-init-hook 'frame-initialize) |
| 159 | ;; (add-hook 'window-setup-hook 'frame-notice-user-settings) | 172 | ;; (add-hook 'window-setup-hook 'frame-notice-user-settings) |
| 160 | 173 | ||
| 161 | ;;; If we create the initial frame, this is it. | 174 | ;; If we create the initial frame, this is it. |
| 162 | (defvar frame-initial-frame nil) | 175 | (defvar frame-initial-frame nil) |
| 163 | 176 | ||
| 164 | ;; Record the parameters used in frame-initialize to make the initial frame. | 177 | ;; Record the parameters used in frame-initialize to make the initial frame. |
| @@ -166,9 +179,9 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args." | |||
| 166 | 179 | ||
| 167 | (defvar frame-initial-geometry-arguments nil) | 180 | (defvar frame-initial-geometry-arguments nil) |
| 168 | 181 | ||
| 169 | ;;; startup.el calls this function before loading the user's init | 182 | ;; startup.el calls this function before loading the user's init |
| 170 | ;;; file - if there is no frame with a minibuffer open now, create | 183 | ;; file - if there is no frame with a minibuffer open now, create |
| 171 | ;;; one to display messages while loading the init file. | 184 | ;; one to display messages while loading the init file. |
| 172 | (defun frame-initialize () | 185 | (defun frame-initialize () |
| 173 | "Create an initial frame if necessary." | 186 | "Create an initial frame if necessary." |
| 174 | ;; Are we actually running under a window system at all? | 187 | ;; Are we actually running under a window system at all? |
| @@ -217,9 +230,9 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args." | |||
| 217 | (defvar frame-notice-user-settings t | 230 | (defvar frame-notice-user-settings t |
| 218 | "Non-nil means function `frame-notice-user-settings' wasn't run yet.") | 231 | "Non-nil means function `frame-notice-user-settings' wasn't run yet.") |
| 219 | 232 | ||
| 220 | ;;; startup.el calls this function after loading the user's init | 233 | ;; startup.el calls this function after loading the user's init |
| 221 | ;;; file. Now default-frame-alist and initial-frame-alist contain | 234 | ;; file. Now default-frame-alist and initial-frame-alist contain |
| 222 | ;;; information to which we must react; do what needs to be done. | 235 | ;; information to which we must react; do what needs to be done. |
| 223 | (defun frame-notice-user-settings () | 236 | (defun frame-notice-user-settings () |
| 224 | "Act on user's init file settings of frame parameters. | 237 | "Act on user's init file settings of frame parameters. |
| 225 | React to settings of `default-frame-alist', `initial-frame-alist' there." | 238 | React to settings of `default-frame-alist', `initial-frame-alist' there." |
| @@ -788,6 +801,9 @@ To get the frame's current default font, use `frame-parameters'." | |||
| 788 | (list (cons 'font font-name))) | 801 | (list (cons 'font font-name))) |
| 789 | (run-hooks 'after-setting-font-hook 'after-setting-font-hooks)) | 802 | (run-hooks 'after-setting-font-hook 'after-setting-font-hooks)) |
| 790 | 803 | ||
| 804 | (defun set-frame-parameter (frame parameter value) | ||
| 805 | (modify-frame-parameters frame (list (cons parameter value)))) | ||
| 806 | |||
| 791 | (defun set-background-color (color-name) | 807 | (defun set-background-color (color-name) |
| 792 | "Set the background color of the selected frame to COLOR-NAME. | 808 | "Set the background color of the selected frame to COLOR-NAME. |
| 793 | When called interactively, prompt for the name of the color to use. | 809 | When called interactively, prompt for the name of the color to use. |
| @@ -1088,7 +1104,7 @@ left untouched. FRAME nil or omitted means use the selected frame." | |||
| 1088 | (make-obsolete 'set-screen-height 'set-frame-height) ;before 19.15 | 1104 | (make-obsolete 'set-screen-height 'set-frame-height) ;before 19.15 |
| 1089 | 1105 | ||
| 1090 | 1106 | ||
| 1091 | ;;; Highlighting trailing whitespace. | 1107 | ;; Highlighting trailing whitespace. |
| 1092 | 1108 | ||
| 1093 | (make-variable-buffer-local 'show-trailing-whitespace) | 1109 | (make-variable-buffer-local 'show-trailing-whitespace) |
| 1094 | 1110 | ||
| @@ -1103,7 +1119,7 @@ Setting this variable makes it local to the current buffer." | |||
| 1103 | 1119 | ||
| 1104 | 1120 | ||
| 1105 | 1121 | ||
| 1106 | ;;; Scrolling | 1122 | ;; Scrolling |
| 1107 | 1123 | ||
| 1108 | (defgroup scrolling nil | 1124 | (defgroup scrolling nil |
| 1109 | "Scrolling windows." | 1125 | "Scrolling windows." |
| @@ -1119,7 +1135,7 @@ point visible." | |||
| 1119 | :group 'scrolling) | 1135 | :group 'scrolling) |
| 1120 | 1136 | ||
| 1121 | 1137 | ||
| 1122 | ;;; Blinking cursor | 1138 | ;; Blinking cursor |
| 1123 | 1139 | ||
| 1124 | (defgroup cursor nil | 1140 | (defgroup cursor nil |
| 1125 | "Displaying text cursors." | 1141 | "Displaying text cursors." |
| @@ -1215,7 +1231,7 @@ itself as a pre-command hook." | |||
| 1215 | 1231 | ||
| 1216 | 1232 | ||
| 1217 | 1233 | ||
| 1218 | ;;; Hourglass pointer | 1234 | ;; Hourglass pointer |
| 1219 | 1235 | ||
| 1220 | (defcustom display-hourglass t | 1236 | (defcustom display-hourglass t |
| 1221 | "*Non-nil means show an hourglass pointer when running under a window system." | 1237 | "*Non-nil means show an hourglass pointer when running under a window system." |