unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16028: 24.3.50; Latest build completely breaks my thumnail frames code
@ 2013-12-02 15:51 Drew Adams
  2013-12-02 15:58 ` Drew Adams
  2013-12-02 18:16 ` martin rudalics
  0 siblings, 2 replies; 76+ messages in thread
From: Drew Adams @ 2013-12-02 15:51 UTC (permalink / raw)
  To: 16028

I cannot use the latest Emacs build at all.  I extensively use thumbnail
frames, which are tiny frames, fully functional, made by shrinking the
frame's font size.  FWIW, this is very important to me.

The code is here:
http://www.emacswiki.org/emacs-en/download/thumb-frm.el
http://www.emacswiki.org/emacs-en/download/frame-cmds.el
http://www.emacswiki.org/emacs-en/download/frame-fns.el

The code is simple.  But presumably you need not examine it.  Just
please, ASAP, restore the link between font size and frame size.

Now, when I hit C-z to thumbify a frame, the font is shrunk, but the
frame is not shrunk accordingly.

The core of the code is this:

(defun enlarge-font (&optional increment frame)
  "Increase size of font in FRAME by INCREMENT.
Interactively, INCREMENT is given by the prefix argument.
Optional FRAME parameter defaults to current frame."
  (interactive "p")
  (setq frame  (or frame  (selected-frame)))
  (let ((fontname  (cdr (assq 'font (frame-parameters frame))))
        (count     enlarge-font-tries))
    (setq fontname  (enlarged-font-name fontname frame increment))
    (while (and (not (x-list-fonts fontname))
                (wholenump (setq count  (1- count))))
      (setq fontname  (enlarged-font-name fontname frame increment)))
    (unless (x-list-fonts fontname) (error "Cannot change font size"))
    (modify-frame-parameters frame (list (cons 'font fontname)))
    ;; Update faces that want a bold or italic version of the default font.
    (when (< emacs-major-version 21) (frame-update-faces frame))))

(defun enlarged-font-name (fontname frame increment)
  "FONTNAME, after enlarging font size of FRAME by INCREMENT.
FONTNAME is the font of FRAME."
  (when (query-fontset fontname)
    (let ((ascii  (assq 'ascii (aref (fontset-info fontname frame) 2))))
      (when ascii (setq fontname  (nth 2 ascii)))))
  (let ((xlfd-fields  (x-decompose-font-name fontname)))
    (unless xlfd-fields (error "Cannot decompose font name"))
    (let ((new-size  (+ (string-to-number
                         (aref xlfd-fields xlfd-regexp-pixelsize-subnum))
                        increment)))
      (unless (> new-size 0) (signal 'font-too-small (list new-size)))
      (aset xlfd-fields xlfd-regexp-pixelsize-subnum
            (number-to-string new-size)))
    ;; Set point size & width to "*", so frame width adjusts to new font
    (aset xlfd-fields xlfd-regexp-pointsize-subnum "*")
    (aset xlfd-fields xlfd-regexp-avgwidth-subnum "*")
    (x-compose-font-name xlfd-fields)))

Though not needed to see the problem, here is the thumbify code that
makes use of `enlarge-font':

(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) ; No-op if already a thumbnail.
      (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) ; In `frame-cmds.el'.
            (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)))))))    

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-12-01 on ODIEONE
Bzr revision: 115342 eggert@cs.ucla.edu-20131201223313-xvgrjlk0r9aiakes
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3' CPPFLAGS=-Ic:/Devel/emacs/include
 LDFLAGS=-Lc:/Devel/emacs/lib'





^ permalink raw reply	[flat|nested] 76+ messages in thread

end of thread, other threads:[~2014-02-10  4:29 UTC | newest]

Thread overview: 76+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).