[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add a new tool-bar item in emacs
From: |
hrmadhu |
Subject: |
Re: Add a new tool-bar item in emacs |
Date: |
9 Jun 2006 09:23:17 -0700 |
User-agent: |
G2/0.2 |
(tool-bar-add-item "texshop" 'compile-if-latex-or-bibtex-file
'compile-if-latex-or-bibtex-file :help "Run pdflatex" )
seems to work.
YMMV
~Madhu.
hrmadhu@gmail.com wrote:
> Hello:,
> I'm using GNU Emacs 22.0.50.1 (powerpc-apple-darwin8.5.0) of
> 2006-03-22 on G5.local from
> http://homepage.mac.com/zenitani/emacs-e.html
> I'm trying to add a new button to the toolbar that will call
> pdflatex when I hit it. The code I have so far is at the end of this
> email.
> It displays the button with the appropriate icon on the toolbar,
> but when I click the button all i see in the message window is
> "tool-bar-". If I click it again, then the message buffer says "
> <tool-bar> <tool-bar> is undefined."
> I believe this has something to do with the tool-bar-map, but I am
> sure. I could use some help with this.
> Thanks.
> ~Madhu.
>
>
> ---------------
> code in .emacs:
>
>
> (defun compile-if-latex-or-bibtex-file ()
> (interactive)
> (setq thefilename
> ( file-name-sans-versions buffer-file-name) )
> (if (and (equal (file-name-extension thefilename) "tex")
> (file-regular-p thefilename))
> (save-window-excursion
> (save-excursion
> (shell-command (concat "pdflatex -interaction=nonstopmode
> -dEmbedAllFonts=true " thefilename " & ")) () ) ) )
> (if (and (equal (file-name-extension thefilename) ".bib")
> (file-regular-p thefilename))
> (save-window-excursion
> (save-excursion
> (shell-command (concat "bibtex " thefilename " & ")) () ) ))
> )
> (tool-bar-add-item "texshop" '(compile-if-latex-or-bibtex-file) nil
> :help "Run pdflatex" )