;;; Code:
(defun yes-or-no-p-dialog-box (prompt)
"Ask user a yes-or-no question with a popup dialog box.
-Return t if the answer is \"yes\".
-Takes one argument, which is the string to display to ask the question."
+Return t if the answer is \"yes\", nil if \"no\". Takes one argument,
+the question string to display."
(save-selected-frame
(make-dialog-box 'question
:question prompt
The frame is made a child of this frame (defaults to the selected frame).
:properties
Additional properties of the frame, as well as `dialog-frame-plist'.
+:autosize
+ If t the frame is sized to exactly fit the widgets given by :spec.
---------------------------------------------------------------------------
'internal-make-dialog-box-exit did)
(remove-hook 'delete-dialog-box-hook
',sym))))
- (add-hook 'delete-dialog-box-hook sym)
+ (if (framep id)
+ (add-hook 'delete-frame-hook sym)
+ (add-hook 'delete-dialog-box-hook sym))
(mapc 'disable-frame frames)
(block nil
(while t
(:parent (selected-frame))
:modal
:properties
+ :autosize
:spec)
()
(flet ((create-dialog-box-frame ()
vertical-scrollbar-visible-p nil
horizontal-scrollbar-visible-p nil
unsplittable t
+ internal-border-width 8
left ,(+ fleft (- (/ fwidth 2)
(/ (* dfwidth
fontw)
2)))))))
(set-face-foreground 'modeline [default foreground] frame)
(set-face-background 'modeline [default background] frame)
+ ;; resize before mapping
+ (when cl-autosize
+ (set-frame-pixel-size
+ frame
+ (image-instance-width
+ (glyph-image-instance cl-spec
+ (frame-selected-window frame)))
+ (image-instance-height
+ (glyph-image-instance cl-spec
+ (frame-selected-window frame)))))
+ ;; somehow, even though the resizing is supposed
+ ;; to be while the frame is not visible, a
+ ;; visible resize is perceptible
(unless unmapped (make-frame-visible frame))
(let ((newbuf (generate-new-buffer " *dialog box*")))
(set-buffer-dedicated-frame newbuf frame)