Subject: bug#4092: Toolbar problem with Cocoa port

From: CHENG Gao <[email-masked]>
Date: Sun, 09 Aug 2009 19:09:19 +0800

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

=============================================================
Starting up Emacs, when I enter anything in *scratch* buffer, it's
truncated at the top by toolbar. Please see the first attached file.

I need to trun toolbar off, and then on to make them show correctly.
Please see the second attached file.

This happens for Cocoa port of both Emacs 23.1 and HEAD.

>From system log I see dozens of error messages as

,----
| Invalid image for toolbar item
`----

Through grepping the source files I found it's in nsmenu.m in function
update_frame_tool_bar (line 1225).

It means valid_image_p check failed.
 
My image-types shows

(png gif tiff jpeg xpm xbm pbm)

and from attached files you can see toobars are in fact created
correctly.

I check tool-bar-map and below is part of it for "Visit New File...".

 (new-file menu-item "Visit New File..." find-file :enable
 (menu-bar-non-minibuffer-window-p) :help "Specify a new file's name, to
 edit the file" :image (find-image (cond ((not (display-color-p)) (quote
 ((:type pbm :file "new.pbm" :foreground "black" :background "grey75")
 (:type xbm :file "new.xbm" :foreground "black" :background "grey75")
 (:type xpm :file "low-color/new.xpm") (:type xpm :file "new.xpm"))))
 ((< (display-color-cells) 256) (quote ((:type xpm :file
 "low-color/new.xpm") (:type xpm :file "new.xpm") (:type pbm :file
 "new.pbm" :foreground "black" :background "grey75") (:type xbm :file
 "new.xbm" :foreground "black" :background "grey75")))) (t (quote
 ((:type xpm :file "new.xpm") (:type pbm :file "new.pbm" :foreground
 "black" :background "grey75") (:type xbm :file "new.xbm" :foreground
 "black" :background "grey75"))))))

Evaluation of find-image part shows:

,----
| (image :type xpm :file "/usr/local/share/emacs/23.1.50/etc/images/new.xpm")) 
`----

So it seems correct.

The first time I notice this is when I was in Gnus. I evaluated Gnus
tool bar map, and it's correct.

=============================================================

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'.
If you would like to further debug the crash, please read the file
/usr/local/share/emacs/23.1.50/etc/DEBUG for instructions.

In GNU Emacs 23.1.50.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
 of 2009-08-07 on mb.cyberhut.org
Windowing system distributor `Apple', version 10.3.949
configured using `configure  '--with-ns' '--disable-ns-self-contained''

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: Lisp Interaction

Minor modes in effect:
  display-battery-mode: t
  cua-mode: t
  display-time-mode: t
  recentf-mode: t
  global-linum-mode: t
  linum-mode: t
  auto-image-file-mode: t
  partial-completion-mode: t
  minibuffer-electric-default-mode: t
  show-paren-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
a a a a a a a a a a a a a a <menu-bar> <options> <showhide> 
<showhide-tool-bar> <menu-bar> <options> <showhide> 
<showhide-tool-bar> <menu-bar> <help-menu> <send-e
macs-bug-report>

Recent messages:
Cleaning up the recentf list...
File /Users/cg/dbg.gz removed from the recentf list
Cleaning up the recentf list...done (1 removed)
Loading /Users/cg/.emacs.d/.emacs-custom.el (source)...
Loading cua-base...done
Loading battery...done
Loading /Users/cg/.emacs.d/.emacs-custom.el (source)...done
`epa-file' already enabled
Loading /Users/cg/.emacs.d/.session...done
For information about GNU Emacs and the GNU system, type C-h C-a.