help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make Button


From: Joel J. Adamson
Subject: Make Button
Date: Mon, 03 May 2010 10:20:02 -0400

Hello,

I am trying to define a globally available "make button" in the
toolbar.  The button should  appear (ideally) when there is a Makefile
in the default-directory, or (sub-optimally) at all times.  It would
also be great if I could put it in the appropriate place in the toolbar,
somewhere after editing buttons, but before configuration or help
buttons.

The following code produces a button at the extreme left of the tool bar:


;; attempt to make a "Make" button appear in every buffer where the
;; default directory has a Makefile; perhaps cedet has something like
;; this
;;
(defun unconditional-compile nil
  (interactive)
  (compile compile-command t))

(define-key global-map [tool-bar make] 
  '(menu-item "Make"
              unconditional-compile
             :help "Run make"
             :enable t
             :image (image :type xpm :file "refresh.xpm")))
(define-key global-map [tool-bar C-make] 'compile)

This works (i.e. runs make in the current directory without prompting
me), but then the button disappears.  Sometimes the button stays
visible, but I get a message in the echo area saying that "<tool-bar>
<make> is undefined."  The one with the C-modifier also works, but with
the same after-effects.  Third, even right after evaluating the above
code, switching to another major mode (e.g. dired) renders the button
invisible.

So first, how do I get this button to stay visible and keep working?
Then, how do I get this button all the time (in every major mode)?

Thanks,

Joel
-- 
Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill

FSF Member #8164
http://www.unc.edu/~adamsonj

Attachment: pgpXD36xso4bp.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]