我尝试在工具栏中添加一个按钮,但这不起作用。 怎么做,我检查Emacs维基,我一无所获。 我使用了emacs 24.3.1。 显示工具栏但不显示我的新项目。
我可以使用eval-buffer运行它,但不能运行我的.emacs或者找到另一个解决方案来解决它。 当我用eval-buffer添加它时,我的按钮在滚动后离开我的工具栏。
(defun omar-hotel ()
"another nonce menu function"
(interactive)
(message "hotel, motel, holiday inn"))
(define-key global-map [tool-bar omar-button]
'(menu-item "Hotel" omar-hotel
:image (image :type xpm :file "/usr/share/emacs/24.3/etc/images/jump-to.xpm")
)
)
答案 0 :(得分:2)
您好我找到了一个简单的解决方案来添加工具栏按钮"拼写"是/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")
答案 1 :(得分:1)
您的代码有效,但您需要在工具栏处于活动状态后执行它。
如果您将代码添加到.emacs中,那么您的问题就应该消失了:
(add-hook 'after-init-hook
(lambda ()
(define-key global-map [tool-bar omar-button]
'(menu-item "Hotel" omar-hotel
:image (image :type xpm :file "/usr/share/emacs/24.3/etc/images/jump-to.xpm")
))))