emacs中的工具栏按钮如何工作?

时间:2015-01-29 12:33:31

标签: emacs elisp emacs24 dot-emacs

我在emacs中添加工具栏按钮时遇到问题。 我可以使用eval-buffer运行它,但不能运行我的.emacs。当我用eval-buffer添加它时,我的按钮在滚动后离开我的工具栏。

;;; 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!"
              ))

我也试图像这样添加挂钩,但这不起作用。

(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!"
              ))
))

1 个答案:

答案 0 :(得分:0)

您好我发现添加工具栏按钮的简单解决方案“拼写”是/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")