From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.bugs Subject: bug#21480: 25.0.50; Frame width gets set to 16 pixels wider than the provided width in the args Date: Mon, 14 Sep 2015 17:13:49 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113ce6c40544ec051fbb8d24 X-Trace: ger.gmane.org 1442265370 5691 80.91.229.3 (14 Sep 2015 21:16:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Sep 2015 21:16:10 +0000 (UTC) To: 21480@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 14 23:16:00 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zbb6U-0003iU-1z for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Sep 2015 23:15:58 +0200 Original-Received: from localhost ([::1]:43588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbb6T-0001A7-Ji for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Sep 2015 17:15:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbb5d-0000La-Kk for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2015 17:15:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zbb5b-00033I-RT for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2015 17:15:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40187) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbb5b-00032x-OY for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2015 17:15:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zbb5a-0002QJ-Uq for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2015 17:15:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Sep 2015 21:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21480 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: "bug-gnu-emacs@gnu.org" Original-Received: via spool by submit@debbugs.gnu.org id=B.14422652799266 (code B ref -1); Mon, 14 Sep 2015 21:15:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Sep 2015 21:14:39 +0000 Original-Received: from localhost ([127.0.0.1]:60630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zbb5C-0002PN-7p for submit@debbugs.gnu.org; Mon, 14 Sep 2015 17:14:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44663) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zbb59-0002PE-ID for submit@debbugs.gnu.org; Mon, 14 Sep 2015 17:14:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zbb57-0002nQ-Vw for submit@debbugs.gnu.org; Mon, 14 Sep 2015 17:14:35 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbb57-0002nH-Sq for submit@debbugs.gnu.org; Mon, 14 Sep 2015 17:14:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbb56-00008C-0A for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2015 17:14:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zbb54-0002mJ-6P for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2015 17:14:31 -0400 Original-Received: from mail-oi0-x232.google.com ([2607:f8b0:4003:c06::232]:33538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbb53-0002mB-LI for bug-gnu-emacs@gnu.org; Mon, 14 Sep 2015 17:14:30 -0400 Original-Received: by oixx17 with SMTP id x17so84287813oix.0 for ; Mon, 14 Sep 2015 14:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=VV9rEXbeSYuECRNv1zdMIWr63vsWje/x7BUKsioxHgY=; b=KRRmuriOqhGJrUePl40qv0Uwg5B92GFdMUZl8qQ+4qRmSB4pZqtBx+02ew1uQ1Z1IH NG/WEPRRTpnGIvddykMIFaQ1geXRZ29tMffMdVbce04RBMITKB9G8pNRjHTUIORBpQk2 R7xld148Yu2Ei1oVdGpBQmqVUsRUseuDHoGWdhYdDgFuEbd8Ieos6kW/YqrUlnYY9Mrr 5a+VxbXJf/klxnKa/VXrOCFeW+iuJBqzsAQvc/IkAB8PwJ5nGWqFQqK7srKIz/f73Y3o GCiFDUwwap0lh9mwWbNkxHogb/sBVYp/MKWFfhUq2jj/Vywn0Zz+zltF5savD1WMr4jt d3Nw== X-Received: by 10.202.173.77 with SMTP id w74mr13205670oie.128.1442265268827; Mon, 14 Sep 2015 14:14:28 -0700 (PDT) Original-Received: by 10.202.172.205 with HTTP; Mon, 14 Sep 2015 14:13:49 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106558 Archived-At: --001a113ce6c40544ec051fbb8d24 Content-Type: text/plain; charset=UTF-8 Hi, I have been using a hack to deal with this bug for over a year now. I believe I am seeing this problem ever since I starting understanding more and more of elisp, around emacs 24.3. Problem: - I save the frame width using `frame-pixel-width' to a defvar. - I then set the frame size using `set-frame-size' with that defvar as one of the args - I notice that the frame had got wider! When I do a readback using `frame-pixel-width', it is exactly 16 pixels wider than expected. I have seen this problem on emacsen built earlier on RHEL 5 and now on RHEL 6 too. Evaluate the below code in the scratch buffer in an emacs -Q session. Then when you keep on hitting F2, you will see that the frame keeps on getting wider. Now if you uncomment the line with the "<-- HACK" comment, reeval the code and then keep on hitting F2, the frame width will stay the same (which was the end goal of the below code). (defvar bkp--frame-height-px nil) (defvar bkp--frame-width-px nil) (defun modi/toggle-menu-bar () "Toggle the menu bar. Also restore the original frame size when disabling the menu bar." (interactive) (let ((frame-resize-pixelwise t)) ;; If the menu bar is hidden currently, take a backup of the frame height. (when (null menu-bar-mode) (setq bkp--frame-height-px (frame-pixel-height)) (setq bkp--frame-width-px (frame-pixel-width)) ;; ;; `frame-pixel-width' is returning a value higher by 16 pixels compared ;; ;; to that set using `set-frame-size'. So the below adjustment has to be made. ;; (setq bkp--frame-width-px (- (frame-pixel-width) 16))) ; <-- HACK (menu-bar-mode 'toggle) ;; Restore frame size if menu bar is hidden after toggle (when (null menu-bar-mode) (set-frame-size nil bkp--frame-width-px bkp--frame-height-px :pixelwise)))) (global-set-key (kbd "") #'modi/toggle-menu-bar) ----------------------------------------------------------------------------------------------------- In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23) of 2015-09-14 Repository revision: 1ee47d477ddb9c567eaf63154f78fad5d5826b78 Windowing system distributor 'The X.Org Foundation', version 11.0.60900000 System Description: Red Hat Enterprise Linux Workstation release 6.6 (Santiago) Configured using: 'configure --prefix=/home/kmodi/usr_local/apps/6/emacs/master 'CPPFLAGS=-fgnu89-inline -I/home/kmodi/usr_local/6/include -I/usr/include/freetype2 -I/usr/include' 'LDFLAGS=-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK2 X11 Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=none locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Mark activated next-line: End of buffer Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message dired format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu mail-prsvr mail-utils edmacro kmacro cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 82449 9769) (symbols 48 19499 0) (miscs 40 49 185) (strings 32 13474 4382) (string-bytes 1 404277) (vectors 16 10887) (vector-slots 8 418983 6570) (floats 8 131 201) (intervals 56 356 10) (buffers 976 11) (heap 1024 30054 843)) -- Kaushal Modi --001a113ce6c40544ec051fbb8d24 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

=
I have been using a hack to d= eal with this bug for over a year now. I believe I am seeing this problem e= ver since I starting understanding more and more of elisp, around emacs 24.= 3.

Problem:=C2=A0
- I save the frame width using `frame-pixel-width' to a defvar.=
- I then set the frame size u= sing `set-frame-size' with that defvar as one of the args
- I notice that the frame had got wider! Wh= en I do a readback using `frame-pixel-width', it is exactly 16 pixels w= ider than expected.

=
I have seen this problem on emacsen= built earlier on RHEL 5 and now on RHEL 6 too.

Evaluat= e the below code in the scratch buffer in an emacs -Q session. Then when yo= u keep on hitting F2, you will see that the frame keeps on getting wider.= =C2=A0

Now if you uncomment the line = with the "<-- HACK" comment, reeval the code and then keep on = hitting F2, the frame width will stay the same (which was the end goal of t= he below code).



(defvar bkp--frame-height-px nil)
(defvar bkp--frame-width-px nil)

(defun modi/toggle-menu-bar ()
=C2=A0 "Toggle the menu bar.
Also restore the original frame size when disabli= ng the menu bar."
=C2=A0 (interactiv= e)
=C2=A0 (let ((frame-resize-pixelwise t= ))
=C2=A0 =C2=A0 ;; If the menu bar is hi= dden currently, take a backup of the frame height.
=C2=A0 =C2=A0 (when (null menu-bar-mode)
=C2=A0 =C2=A0 =C2=A0 (setq bkp--frame-height-px (frame-pixel-heig= ht))
=C2=A0 =C2=A0 =C2=A0 (setq bkp--fram= e-width-px =C2=A0(frame-pixel-width))
=C2=A0 =C2=A0 =C2=A0 ;; ;; `frame-pixel= -width' is returning a value higher by 16 pixels compared
=C2=A0 =C2=A0 =C2=A0 ;; ;; to that set using `set-fram= e-size'. So the below adjustment has to be made.
=C2=A0 =C2=A0 =C2=A0 ;; (setq bkp--frame-width-px =C2=A0(- (fra= me-pixel-width) 16))) ; <-- HACK

<= /div>
=C2=A0 =C2=A0 (menu-bar-mode 'toggle)=
=C2=A0 =C2=A0 ;; Restore frame size if m= enu bar is hidden after toggle
=C2=A0 =C2= =A0 (when (null menu-bar-mode)
=C2=A0 =C2= =A0 =C2=A0 (set-frame-size nil bkp--frame-width-px bkp--frame-height-px :pi= xelwise))))

(global-set-key (kbd "<f2>") #'modi/toggle-me= nu-bar)



------------------------------------------------------------------= -----------------------------------

<= /div>

In GNU Em= acs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
=
=C2=A0of 2015-09-14
Repository revision: 1ee47d477ddb= 9c567eaf63154f78fad5d5826b78
Windowing system distributor = 'The X.Org Foundation', version 11.0.60900000
Syst= em Description: Red Hat E= nterprise Linux Workstation release 6.6 (Santiago)

<= /font>
Configured using:
=C2=A0'configure --= prefix=3D/home/kmodi/usr_local/apps/6/emacs/master
=C2= =A0'CPPFLAGS=3D-fgnu89-inline -I/home/kmodi/usr_local/6/include<= /div>
=C2=A0-I/usr/include/freetype2 -I/usr/include'
=C2=A0'LDFLAGS=3D-L/home/kmodi/usr_local/6/lib
=C2= =A0-L/home/kmodi/usr_local/6/lib64''

Configured features:
XPM JPEG TIFF GIF PNG RSVG I= MAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSE= LINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCRO= LL_BARS GTK2 X11

Important settings:=
=C2=A0 value of $LANG: en_US.UTF-8
=C2= =A0 value of $XMODIFIERS: @im=3Dnone
=C2=A0 locale-coding-= system: utf-8-unix

Major mode: Lisp = Interaction

Minor modes in effect:<= /font>
=C2=A0 tooltip-mode: t
=C2=A0 global-eldo= c-mode: t
=C2=A0 electric-indent-mode: t
= =C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-shado= w-mode: t
=C2=A0 global-font-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-e= ncryption-mode: t
=C2=A0 auto-compression-mode: t
=C2=A0 line-number-mode: t
=C2=A0 transient-mark-= mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark activated
next-line: End of buffer

Load-path shadows:
None= found.

Features:
(= shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc223= 1
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045= ietf-drums
mm-util help-fns help-mode easymenu mail-prsv= r mail-utils edmacro kmacro
cl-loaddefs pcase cl-lib time= -date mule-util tooltip eldoc electric
uniquify ediff-hook= vc-hooks lisp-float-type mwheel x-win
term/common-win x-d= nd tool-bar dnd fontset image regexp-opt fringe
tabulated-= list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf= -8-lang
misc-lang vietnamese tibetan thai tai-viet lao kor= ean japanese eucjp-ms
<= font face=3D"trebuchet ms, sans-serif">cp51932 hebrew greek romanian slovak= czech european ethiopic indian
cyrillic chinese charscrip= t case-table epa-hook jka-cmpr-hook help
simple abbrev min= ibuffer cl-preloaded nadvice loaddefs button faces
cus-f= ace macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquot= e
dbusbind inotify dynamic-setting system-font-setting fon= t-render-setting
move-toolbar gtk x-toolkit x multi-tty ma= ke-network-process emacs)

Memory inf= ormation:
((conses 16 82449 9769)
=C2= =A0(symbols 48 19499 0)
=C2=A0(miscs 40 49 185)
=C2=A0(strings 32 13474 4382)
=C2=A0(string-bytes 1= 404277)
=C2=A0(vectors 16 10887)
=C2= =A0(vector-slots 8 418983 6570)
=C2=A0(floats 8 131 201)
=C2=A0(intervals 56 356 10)
=C2=A0(buffers= 976 11)
=C2=A0(heap 1024 30054 843))


--
Kaushal Modi
--001a113ce6c40544ec051fbb8d24--