all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Make button
@ 2010-04-06 13:17 Joel J. Adamson
  0 siblings, 0 replies; 2+ messages in thread
From: Joel J. Adamson @ 2010-04-06 13:17 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]

Hello There,

I use Makefiles to manage many kinds of projects, and would like to have
a "Make button" on the toolbar so that when I'm using the mouse I can
save my file and then just hit the button without confirming
compile-command.  The idea is to have a button available whenever
there's a Makefile in the current directory.

I wrote the following according to what I read in the Elisp manual:

;; attempt to make a "Make" button appear in every buffer where the
;; default directory has a Makefile; perhaps cedet has something like this
;; 
(define-key global-map [tool-bar make] 
  '(menu-item "Make"
	      compile 
	     :visible t
	     :help "Run make"
	     :enable (file-exists-p (concat default-directory "Makefile"))
	     :image (image :file "refresh.png")))

After I evaluate this, the screen blinks (the frame is redrawn), but no
new button appears.  What am I missing?  Is there any much easier way (a
la easymenu) to do this?

GNU Emacs 23.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.18.6) of
2010-01-14 on x86-06.phx2.fedoraproject.org

Thanks,

Joel

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

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

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Make Button
@ 2010-05-03 14:20 Joel J. Adamson
  0 siblings, 0 replies; 2+ messages in thread
From: Joel J. Adamson @ 2010-05-03 14:20 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]

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 #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-03 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-03 14:20 Make Button Joel J. Adamson
  -- strict thread matches above, loose matches on Subject: below --
2010-04-06 13:17 Make button Joel J. Adamson

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.