Subject: bug#12131: 24.1; First lines of buffer disappear when changing fonts or setting frame width in Emacs 24 on Mac OS

From: Marcel Becker <[email-masked]>
Date: Fri, 3 Aug 2012 10:20:58 -0700

--text follows this line--
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

Problem: First 4 to 6 lines of the buffer are not visible and
cannot be reached when I either change the frame width in my
init file, or when I set the default font option to a different
value.

Way to reproduce: Put this line in your init.el file:

(global-linum-mode 1)
(setq linum-format " %d ")

(setq-default default-frame-alist
                '((width . 120)
                  (height . 60))))

Or change the fonts sizes to, for example, Geneva 24 using the
menu Options > Set Default Font

I do not know if the linum-mode is causing the problem, but when I start
emacs without the init file, and just set the font size, I do not see the
problem. Only after i set the width in the default frame alist I get the
first lines of the buffer to start disappearing.

Detailed Explanation:

When I set the width of the frame from my init file to a value like
120, using the default-frame-alist,
the new emacs frame gets out of the screen, and the first 4 lines
of the buffer are not visible.
After playing with the dimensions, I was able to get the problem
with the first lines to go away using a different set of dimensions
than the ones I use for windows and linux.

(defvar running-macos  (eq system-type 'darwin))

(setq-default default-frame-alist
              (if running-macos
                  '((cursor-color . "white")
                    (mouse-color . "white")
                    (foreground-color . "white")
                    (background-color . "DodgerBlue4")
                    (cursor-type . box)
                    (tool-bar-lines . 0)
                    (width . 60))
                '((cursor-color . "white")
                  (mouse-color . "white")
                  (foreground-color . "white")
                  (background-color . "DodgerBlue4")
                  (cursor-type . box)
                  (tool-bar-lines . 0)
                  (width . 120)
                  (height . 60))))

(if running-macos
    (modify-all-frames-parameters
     '((width . 50))))

A similar thing happens when changing the default fonts. The window (or
frame) resize, the first 5 to 10 lines of the buffer become unreachable
(not visible on the screen and cannot scroll up). The minibuffer height
expands to 3 to 5 lines, and the left area of the frame where I have my
line numbers widens to 5 to 10 characters instead of just 2 or 3.

Sometimes, changing the size of the window with the mouse, brings it
back to an usable state.

Sometimes, when switching between different values of font sizes using
the Optons > Set Default Font ... dialog makes the emacs window and
frame to become unresponsive and I have to kill the process using the
Mac OS process kill dialog.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/Applications/MacPorts/Emacs.app/Contents/Resources/etc/DEBUG.

In GNU Emacs 24.1.1 (x86_64-apple-darwin11.3.0, NS apple-appkit-1138.32)
 of 2012-06-15 on gamma.local
Windowing system distributor `Apple', version 10.3.1187
Configured using:
 `configure '--prefix=/opt/local' '--with-ns' '--without-x'
 '--without-dbus' 'CC=/usr/bin/clang' 'CFLAGS=-pipe -O2 -arch x86_64'
 'LDFLAGS=-L/opt/local/lib -arch x86_64'
 'CPPFLAGS=-I/opt/local/include''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: JDE

Minor modes in effect:
  display-time-mode: t
  global-ede-mode: t
  ede-minor-mode: t
  global-linum-mode: t
  linum-mode: t
  show-paren-mode: t
  recentf-mode: t
  tooltip-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> C-x 4 f <tab> <M-backspace> <M-backspace>
` ` <backspace> <backspace> <tab> <tab> m e <tab> <tab>
<tab> <tab> M a <tab> <return> C-x 1 C-x 4 f <tab>
<tab> S e <tab> <return> C-x 1 C-x 4 f <tab> <tab>
L a u n <tab> <return> C-x 1 C-x 4 f <tab> <tab> P
a <tab> <return> C-x 1 <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> C-x
4 f <tab> <tab> D <S-backspace> S e <tab> <return>
C-x 1 C-x 4 f <tab> <M-backspace> <M-backspace> <M-backspace>
<M-backspace> <M-backspace> <M-backspace> ` <backspace>
<tab> <tab> A n <tab> <tab> s r <tab> <tab> <tab> <tab>
<tab> <tab> K <tab> <return> C-x 1 <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> C-x 4 f <tab> <tab> I n <tab>
<return> C-x 4 f <tab> <tab> L a y <tab> <return> C-x
1 M-x r e m <backspace> p o r - <tab> <backspace> <backspace>
<tab> <return>

Recent messages:
Making completion list...
Setting customized JDE variables to startup values...
Making completion list...
Setting customized JDE variables to startup values...
Making completion list... [4 times]
Setting customized JDE variables to startup values...
Making completion list...
Setting customized JDE variables to startup values...
Making completion list...
Setting customized JDE variables to startup values...

Load-path shadows:
/Users/marcelbecker/Dropbox/.emacs.d/elpa/vline-1.10/vline hides
~/Dropbox/.emacs.d/icicles/vline
/Users/marcelbecker/Dropbox/.emacs.d/elpa/col-highlight-22.0/col-highlight
hides ~/Dropbox/.emacs.d/icicles/col-highlight
/Users/marcelbecker/Dropbox/.emacs.d/elpa/cygwin-mount-2001/cygwin-mount
hides /Users/marcelbecker/Dropbox/.emacs.d/el-get/cygwin-mount/cygwin-mount
/Users/marcelbecker/Dropbox/.emacs.d/elpa/col-highlight-22.0/col-highlight
hides
/Users/marcelbecker/Dropbox/.emacs.d/el-get/col-highlight/col-highlight
/Users/marcelbecker/Dropbox/.emacs.d/elpa/vline-1.10/vline hides
/Users/marcelbecker/Dropbox/.emacs.d/el-get/vline/vline
/Users/marcelbecker/Dropbox/.emacs.d/el-get/tabbar-extension/tabbar-extension
hides ~/Dropbox/.emacs.d/tabbar-extension
/Users/marcelbecker/Dropbox/.emacs.d/elpa/col-highlight-22.0/col-highlight
hides ~/Dropbox/.emacs.d/col-highlight
~/Dropbox/.emacs.d/jdee/lisp/.dir-locals hides
/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/gnus/.dir-locals

Features:
(shadow sort gnus-util mail-extr emacsbug message idna 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 mail-prsvr mail-utils ede/dired color crm debug nxml-uchnm
rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri
rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok
multi-isearch vc-dispatcher vc-svn antlr-mode ctags-update tex-fptex
tex-mik flyspell ispell time ede/linux ede/emacs ede/cpp-root
ede/speedbar ede/files ede ede/base ede/auto ede/source eieio-speedbar
eieio-custom linum paren recentf-ext recentf-buffer recentf
tabbar-extension tabbar col-highlight auctex-autoloads tex-site info
col-highlight-autoloads color-theme-buffer-local-autoloads
ctags-autoloads ctags-update-autoloads cygwin-mount-autoloads
solarized-theme-autoloads tabbar-ruler-autoloads tabbar-autoloads
vline-autoloads zenburn-theme-autoloads ensime ensime-ui
ensime-semantic-highlight ensime-doc ensime-search ensime-undo
ensime-refactor ensime-builder ensime-debug ensime-inf ensime-sbt
ensime-auto-complete ensime-config auto-complete popup hideshow pp jde
jde-annotations jde-open-source semantic/senator semantic/decorate pulse
jde-bsh jde-parse-expr etags jde-class jde-parse-class jde-import
semantic/find jde-java-font-lock jde-which-method jde-java-grammar
jde-wiz jde-complete eldoc semantic/idle jde-plugins executable
browse-url jde-gen tempo jde-run jde-jdb jde-bug jde-dbs jde-dbo regress
jde-db jde-parse sregex jde-imenu semantic/imenu imenu semantic/db-file
cedet-files semantic/db eieio-base semantic/java semantic/doc thingatpt
avl-tree semantic/sb speedbar sb-image dframe assoc semantic/sort
semantic/format ezimage semantic/tag-ls semantic/ctxt jde-compile
compile cus-edit cus-start cus-load cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
cedet jde-help jde-widgets tree-widget beanshell comint ansi-color ring
jde-custom jde-project-file jde-util arc-mode archive-mode efc wid-edit
eieio .loaddefs vline scala-mode-auto yasnippet dropdown-list derived
byte-opt warnings advice advice-preload easy-mmode edmacro kmacro el-get
help-mode easymenu view autoload help-fns bytecomp byte-compile cconv
macroexp cl package tabulated-list dired regexp-opt time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)