0

i have a problem to add a tool-bar button in emacs. I can run it with eval-buffer but not with my .emacs. When i add it with eval-buffer my button leave my toolbar after a scroll.

;;; Code: 
(defun omar-hotel ()
  "another nonce menu function"
  (interactive)
  (message "hotel, motel, holiday inn"))


 (define-key-after global-map [tool-bar omar-button]
          '(menu-item "Hotel" omar-hotel
              :image (image :type xpm :file "/usr/share/emacs/23.4/etc/images/jump-to.xpm")
              :help "OMG Omar!"
              ))

i also tried to add-hook like that but that's doesn't works.

(add-hook 'after-init-hook
      (lambda ()
        (define-key-after global-map [tool-bar omar-button]
          '(menu-item "Hotel" omar-hotel
              :image (image :type xpm :file "/usr/share/emacs/23.4/etc/images/jump-to.xpm")
              :help "OMG Omar!"
              ))
))
user1990
  • 536
  • 3
  • 13

1 Answers1

0

Hi i found a simple solution to add a toolbar button "spell" is the image in /usr/share/emacs/23.4/etc/images/

(defun omar-hotel ()
 "another nonce menu function"
 (interactive)
 (message "hotel, motel, holiday inn"))

(tool-bar-add-item "spell" 'omar-hotel
           'omar-hotel
           :help   "Run fonction omar-hotel")
user1990
  • 536
  • 3
  • 13