[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16028: 24.3.50; Latest build completely breaks my thumnail frames co
From: |
Drew Adams |
Subject: |
bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code |
Date: |
Fri, 6 Dec 2013 06:43:11 -0800 (PST) |
> Perhaps the real-life thumbnail-mode does something to restore the
> frame dimensions, thus countermanding the effect of making the font
> smaller?
This is the core code, for thumbifying & dethumbifying:
(defcustom thumfr-frame-parameters
'((menu-bar-lines . 0) (tool-bar-lines . 0) (scroll-bar-width . 6))
"*Frame parameters for thumbnail frames.
Use this to show or hide things like the menu bar, tool bar, tab bar,
and scroll bars for thumbnail frames."
:type '(repeat (cons symbol sexp))
:group 'Thumbnail-Frames
:set (lambda (sym defs)
(custom-set-default sym defs)
(dolist (frm (frame-list))
(when (and (frame-live-p frm)
(frame-parameter frm 'thumfr-thumbnail-frame))
(modify-frame-parameters frm thumfr-frame-parameters)))))
(defun thumfr-thumbify-frame (&optional frame)
"Create a thumbnail version of FRAME (default: selected frame).
Variable `thumfr-frame-parameters' is used to determine
which frame parameters (such as `menu-bar-lines') to remove."
(interactive)
(setq frame (or frame (selected-frame)))
(let* ((tf-params (frame-parameter frame 'thumfr-non-thumbnail-frame))
(non-tf-params (thumfr-remove-if #'thumfr-thumfr-parameter-p
(frame-parameters frame))))
(when thumfr-rename-when-thumbify-flag (rename-non-minibuffer-frame))
(unless (frame-parameter frame 'thumfr-thumbnail-frame)
(set-frame-parameter frame 'thumfr-thumbnail-frame non-tf-params)
(set-frame-parameter frame 'thumfr-non-thumbnail-frame nil)
(condition-case thumfr-thumbify-frame
(progn
(enlarge-font (- thumfr-font-difference) frame)
(when tf-params (modify-frame-parameters frame tf-params))
(when thumfr-next-stack-xoffset
(set-frame-position frame thumfr-next-stack-xoffset
thumfr-next-stack-yoffset)
(setq thumfr-next-stack-xoffset nil
thumfr-next-stack-yoffset nil))
(modify-frame-parameters frame thumfr-frame-parameters))
(font-too-small ; Try again, with a larger font.
(set-frame-parameter frame 'thumfr-non-thumbnail-frame tf-params)
(set-frame-parameter frame 'thumfr-thumbnail-frame nil)
(unless (> thumfr-font-difference 0)
(error (error-message-string thumfr-thumbify-frame)))
(let ((thumfr-font-difference (1- thumfr-font-difference)))
(thumfr-thumbify-frame frame)))
(error
(set-frame-parameter frame 'thumfr-non-thumbnail-frame tf-params)
(set-frame-parameter frame 'thumfr-thumbnail-frame nil)
(error (error-message-string thumfr-thumbify-frame)))))))
(defun thumfr-dethumbify-frame (&optional frame)
"Restore thumbnail FRAME to original size (default: selected frame)."
(interactive)
(setq frame (or frame (selected-frame)))
(let* ((non-tf-params (frame-parameter frame 'thumfr-thumbnail-frame))
(tf-params (thumfr-remove-if #'thumfr-thumfr-parameter-p
(frame-parameters frame))))
(when non-tf-params ; No-op if not a thumbnail.
(set-frame-parameter frame 'thumfr-non-thumbnail-frame tf-params)
(set-frame-parameter frame 'thumfr-thumbnail-frame nil)
(condition-case thumfr-dethumbify-frame
(progn
(enlarge-font thumfr-font-difference frame)
(modify-frame-parameters frame non-tf-params))
(error
(set-frame-parameter frame 'thumfr-thumbnail-frame non-tf-params)
(set-frame-parameter frame 'thumfr-non-thumbnail-frame nil)
(error (error-message-string thumfr-dethumbify-frame))))
(select-frame-set-input-focus frame)
(thumfr-only-raise-frame frame))))
(defun thumfr-thumfr-parameter-p (parameter+value)
"Return non-nil if PARAMETER+VALUE is a `thumb-frm.el' frame parameter.
PARAMETER+VALUE is a frame-parameter cons: (PARAMETER . VALUE).
This means that PARAMETER is either `thumbfr-thumbnail-frame' or
`thumbfr-non-thumbnail-frame'."
(memq (car parameter+value)
'(thumfr-thumbnail-frame thumfr-non-thumbnail-frame)))
To be clear (I was not, before; sorry), the problem is not with shrinking
and enlarging the font and having the frame size follow. For instance, my
commands `zoom-frm-out' and `zoom-frm-in' work fine in this respect.
The problem is with thumbifying (`thumfr-thumbify-frame').
Running it through the debugger, I see that the frame _is_ shrunk
correctly, along with the font, at this point in the code:
(enlarge-font (- thumfr-font-difference) frame)
...
(modify-frame-parameters frame thumfr-frame-parameters)
But if I don't go through the debugger, it does not work. And if I just
hit `c' in the debugger, instead of `d' throughout, it also does not work.
This is 100% reproducible. Dunno why stepping through the debugger would
work, and even hitting `c' for the `enlarge-font' call works, but hitting
`c' for the `condition-case' does not.
HTH.
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/02
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/02
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, martin rudalics, 2013/12/02
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/02
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, martin rudalics, 2013/12/05
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/05
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, martin rudalics, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Eli Zaretskii, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, martin rudalics, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code,
Drew Adams <=
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, martin rudalics, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, martin rudalics, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, martin rudalics, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/06
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, martin rudalics, 2013/12/07
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/07
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, martin rudalics, 2013/12/08
- bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code, Drew Adams, 2013/12/08