all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 16028@debbugs.gnu.org
Subject: bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code
Date: Fri, 13 Dec 2013 10:05:12 -0800 (PST)	[thread overview]
Message-ID: <be94212c-9f35-4b7b-b581-e9579c629fb1@default> (raw)
In-Reply-To: <52AB42E5.3030306@gmx.at>

>  > What solution was that?  Can you state it again, in the context of
>  > the thumb-frm.el code?  I believe I've tried everything I saw suggested
>  > here, but I'm open to a fix for my code, of course.  I've been asking
>  > for it.  The last suggestion I recall was to change the order, and I
>  > reported the problems that caused.
> 
> To thumbify
> (1) Save the current frame pixel size, font and scrollbar width.
> (2) Set the new font size.
> (3) Set the new scrollbar width.
> (4) Set the new pixel size to some calculated from the one saved in
>     (1) and the scale factor used in (2).
> 
> To dethumbify
> (5) Set the new font size to the one saved in (1).
> (6) Set the new scrollbar width to the one saved in (1).
> (7) Set the new frame pixel size to the one saved in (1).

a. I don't know how to get the frame pixel size.  Do you mean only
`frame-pixel-width'?

b. I need to allow users to specify settings for thumbified frames
(option `thumfr-frame-parameters').

c. I need to be able to record the current frame parameters and use
them to restore - for both thumbified and non-thumbified frames.
I store this info in frame parameters `thumfr-thumbnail-frame' and
`thumfr-non-thumbnail-frame'.

Perhaps you can make a concrete suggestion, since you seem to understand
what you have in mind by (1)-(7).  I do not.

But when I asked for concrete suggestions for "trying to get my code to
work properly with your new code" you replied "I'm afraid there's not
much you can do here."

The code for `thumfr-thumbify-frame' and `thumfr-dethumbify-frame' is
only 50 lines long, and (i) some of that is for stacking offsets, which
is irrelevant here, and (ii) some of it is `font-too-small' error handling,
to retry with a slightly larger font.

Here is the essential code (30 lines):

(defun thumfr-thumbify-frame (&optional frame)
  (interactive)
  (setq frame  (or frame (selected-frame)))
  (let* ((tf-params      (frame-parameter frame 'thumfr-non-thumbnail-frame))
         (non-tf-params  (cl-remove-if #'thumfr-thumfr-parameter-p
                                       (frame-parameters 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))
                 (modify-frame-parameters frame thumfr-frame-parameters))
        (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)
  (interactive)
  (setq frame  (or frame (selected-frame)))
  (let* ((non-tf-params  (frame-parameter frame 'thumfr-thumbnail-frame))
         (tf-params      (cl-remove-if #'thumfr-thumfr-parameter-p
                                       (frame-parameters frame))))
    (when non-tf-params
      (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)))))))

Helper code:

(defun thumfr-thumfr-parameter-p (parameter+value)
  (memq (car parameter+value)
        '(thumfr-thumbnail-frame thumfr-non-thumbnail-frame)))

(defcustom thumfr-frame-parameters
  '((menu-bar-lines . 0) (tool-bar-lines . 0) (scroll-bar-width . 6))
  :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)))))





  reply	other threads:[~2013-12-13 18:05 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<8dee88e8-6b12-4822-9586-e013328f2ddc@default>
     [not found] ` <<529CCE7F.3070400@gmx.at>
     [not found]   ` <<52A08780.9020405@gmx.at>
     [not found]     ` <<3df21358-48ca-4150-9f0e-aa2dbf78cbcb@default>
     [not found]       ` <<360e0ca4-7e4a-4f11-8157-c8f69e4ce913@default>
     [not found]         ` <<52A188D8.60608@gmx.at>
     [not found]           ` <<83txem1i7m.fsf@gnu.org>
2013-12-06 14:43             ` bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code Drew Adams
2013-12-06 14:56               ` martin rudalics
2013-12-06 15:29                 ` Drew Adams
2013-12-06 16:20                   ` martin rudalics
2013-12-06 16:43                     ` Drew Adams
2013-12-06 17:22                       ` martin rudalics
2013-12-06 19:04                         ` Drew Adams
2013-12-07  9:46                           ` martin rudalics
2013-12-07 20:34                             ` Drew Adams
2013-12-08  9:57                               ` martin rudalics
2013-12-08 17:31                                 ` Drew Adams
2013-12-08 17:54                                   ` martin rudalics
2013-12-09 17:14                                     ` Eli Zaretskii
2013-12-09 18:37                                       ` martin rudalics
2013-12-10  3:53                                         ` Eli Zaretskii
2013-12-10  7:52                                           ` martin rudalics
2013-12-10 14:51                                             ` Drew Adams
2013-12-10 10:31                                           ` martin rudalics
2013-12-10 10:49                                             ` martin rudalics
2013-12-10 14:50                                               ` Drew Adams
2013-12-10 15:36                                                 ` martin rudalics
2013-12-12  4:27                                                   ` Drew Adams
2013-12-12 10:17                                                     ` martin rudalics
2013-12-12 16:29                                                       ` Drew Adams
2013-12-12 18:10                                                         ` martin rudalics
2013-12-12 19:55                                                           ` Drew Adams
2013-12-13 10:13                                                             ` martin rudalics
2013-12-13 10:52                                                               ` Eli Zaretskii
2013-12-13 16:00                                                               ` Drew Adams
2013-12-13 17:24                                                                 ` martin rudalics
2013-12-13 18:05                                                                   ` Drew Adams [this message]
2013-12-13 18:23                                                                     ` martin rudalics
2013-12-12 16:38                                                       ` Eli Zaretskii
2013-12-12 18:10                                                         ` martin rudalics
2013-12-12 18:47                                                           ` Eli Zaretskii
2013-12-13 10:12                                                             ` martin rudalics
2013-12-13 10:51                                                               ` Eli Zaretskii
2013-12-14 11:22                                                                 ` martin rudalics
2013-12-14 12:04                                                                   ` Eli Zaretskii
2013-12-14 13:45                                                                     ` martin rudalics
2013-12-14 14:09                                                                       ` Eli Zaretskii
2013-12-14 17:17                                                                         ` martin rudalics
2013-12-14 17:19                                                                           ` Eli Zaretskii
2013-12-14 17:23                                                                             ` martin rudalics
2013-12-16 10:12                                                                     ` martin rudalics
2013-12-16 15:06                                                                       ` Drew Adams
2013-12-15  0:43                                                                   ` Drew Adams
2014-02-10  4:07                                                                     ` Lars Ingebrigtsen
2014-02-10  4:29                                                                       ` Drew Adams
2013-12-10 15:31                                               ` martin rudalics
2013-12-10 16:41                                               ` Eli Zaretskii
2013-12-10 16:51                                                 ` martin rudalics
2013-12-10 18:04                                                   ` Eli Zaretskii
2013-12-10 18:57                                                     ` martin rudalics
2013-12-06 18:22                     ` Eli Zaretskii
2013-12-06 18:57                       ` martin rudalics
2013-12-06 19:15                         ` Eli Zaretskii
2013-12-07  9:46                           ` martin rudalics
2013-12-07 11:15                             ` Eli Zaretskii
2013-12-07 12:25                               ` martin rudalics
2013-12-06 21:32                   ` Stefan Monnier
2013-12-02 15:51 Drew Adams
2013-12-02 15:58 ` Drew Adams
2013-12-02 18:16 ` martin rudalics
2013-12-02 19:06   ` Drew Adams
2013-12-05 14:02   ` martin rudalics
2013-12-05 16:33     ` Drew Adams
2013-12-06  5:23       ` Drew Adams
2013-12-06  8:20         ` martin rudalics
2013-12-06  8:45           ` Eli Zaretskii
2013-12-06 14:32             ` martin rudalics
2013-12-06 14:13           ` Drew Adams
2013-12-06 14:32             ` martin rudalics
2013-12-06 14:44               ` Drew Adams
2013-12-06  0:11     ` Juanma Barranquero
2013-12-06  0:18       ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be94212c-9f35-4b7b-b581-e9579c629fb1@default \
    --to=drew.adams@oracle.com \
    --cc=16028@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.