2015-01-29 9 views
0

이맥스에 툴바 버튼을 추가하는 데 문제가 있습니다. 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!" 
      )) 
)) 

답변

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