bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Mon, 2 Dec 2013 07:51:59 -0800 (PST)

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'





reply via email to

[Prev in Thread] Current Thread [Next in Thread]