all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* binding emacs key combination to external program?
@ 2007-09-10 20:20 Roger Levy
  2007-09-10 20:59 ` Joost Kremers
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Roger Levy @ 2007-09-10 20:20 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I use a shell script to compile my LaTeX files from the command line
and turn them into PDFs in one go-around (using ps2pdf rather than
pdflatex), and I would like to bind an Emacs key combination to the
execution of this script on the buffer.  How can I do this?  I'm
having a hard time figuring it out from the manual.

Many thanks,

Roger

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

* Re: binding emacs key combination to external program?
  2007-09-10 20:20 binding emacs key combination to external program? Roger Levy
@ 2007-09-10 20:59 ` Joost Kremers
  2007-09-11 10:42   ` Roger Levy
  2007-09-10 23:55 ` Johan Lindström
  2007-09-11  6:14 ` Matthias
  2 siblings, 1 reply; 11+ messages in thread
From: Joost Kremers @ 2007-09-10 20:59 UTC (permalink / raw)
  To: help-gnu-emacs

Roger Levy wrote:
> I use a shell script to compile my LaTeX files from the command line
> and turn them into PDFs in one go-around (using ps2pdf rather than
> pdflatex), and I would like to bind an Emacs key combination to the
> execution of this script on the buffer.  How can I do this?  I'm
> having a hard time figuring it out from the manual.

you need to define a lisp function that calls your shell script on the
current buffer, and then bind your desired key combo to this function.

but more likely you should consider using AUCTeX (google for it). AUCTeX
can be customised to call your script. plus it has a gazillion other
benefits when writing latex documents.

-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

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

* Re: binding emacs key combination to external program?
  2007-09-10 20:20 binding emacs key combination to external program? Roger Levy
  2007-09-10 20:59 ` Joost Kremers
@ 2007-09-10 23:55 ` Johan Lindström
  2007-09-11  6:14 ` Matthias
  2 siblings, 0 replies; 11+ messages in thread
From: Johan Lindström @ 2007-09-10 23:55 UTC (permalink / raw)
  To: Roger Levy, help-gnu-emacs

At 21:20 2007-09-10, Roger Levy wrote:
>and I would like to bind an Emacs key combination to the
>execution of this script on the buffer.

Maybe something like this?

(defun run-latex-or-whatever ()
   "Convert the buffer to PDF"
   (interactive)
   (shell-command-to-string (format "ps2pdf %s &" (buffer-file-name)))
   (message "The buffer was converted to PDF, ain't that great?")
   )

(global-set-key (kbd "\C-c L") 'run-latex-or-whatever)


I'm a rookie though, so I look forward to be educated about more 
idiomatic/succinct/solid ways of doing this.


/J

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

* Re: binding emacs key combination to external program?
  2007-09-10 20:20 binding emacs key combination to external program? Roger Levy
  2007-09-10 20:59 ` Joost Kremers
  2007-09-10 23:55 ` Johan Lindström
@ 2007-09-11  6:14 ` Matthias
  2 siblings, 0 replies; 11+ messages in thread
From: Matthias @ 2007-09-11  6:14 UTC (permalink / raw)
  To: help-gnu-emacs

Roger Levy schrieb:
> Hi,
> 
> I use a shell script to compile my LaTeX files from the command line
> and turn them into PDFs in one go-around (using ps2pdf rather than
> pdflatex), and I would like to bind an Emacs key combination to the
> execution of this script on the buffer.  How can I do this?  I'm
> having a hard time figuring it out from the manual.
> 
> Many thanks,
> 
> Roger
> 

Most easy would be to put a Makefile in your working directory that 
defines how your shell script is called and then use emacs' compile 
command that you bind to any key for example "f9":

(global-set-key [f9] 'compile)

matthias

	

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

* Re: binding emacs key combination to external program?
  2007-09-10 20:59 ` Joost Kremers
@ 2007-09-11 10:42   ` Roger Levy
  2007-09-11 15:23     ` Peter Dyballa
                       ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Roger Levy @ 2007-09-11 10:42 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 10, 1:59 pm, Joost Kremers <joostkrem...@yahoo.com> wrote:
> Roger Levy wrote:
> > I use a shell script to compile my LaTeX files from the command line
> > and turn them into PDFs in one go-around (using ps2pdf rather than
> > pdflatex), and I would like to bind an Emacs key combination to the
> > execution of this script on the buffer.  How can I do this?  I'm
> > having a hard time figuring it out from the manual.
>
> you need to define a lisp function that calls your shell script on the
> current buffer, and then bind your desired key combo to this function.
>
> but more likely you should consider using AUCTeX (google for it). AUCTeX
> can be customised to call your script. plus it has a gazillion other
> benefits when writing latex documents.

Many thanks -- I do use AUCTeX but wasn't aware you can customize it
this way.  Would the best way to be to edit the TeX-command-list
variable?

Roger

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

* Re: binding emacs key combination to external program?
  2007-09-11 10:42   ` Roger Levy
@ 2007-09-11 15:23     ` Peter Dyballa
  2007-09-11 17:05     ` Joost Kremers
       [not found]     ` <mailman.707.1189524243.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 11+ messages in thread
From: Peter Dyballa @ 2007-09-11 15:23 UTC (permalink / raw)
  To: Roger Levy; +Cc: help-gnu-emacs


Am 11.09.2007 um 12:42 schrieb Roger Levy:

> I do use AUCTeX but wasn't aware you can customize it
> this way.  Would the best way to be to edit the TeX-command-list
> variable?

Yes. Afterwards you're able to select this command. You know that can  
you add the local variable

	%%% TeX-command-default: "script"

in the file's footer?

--
Greetings

   Pete

Wasting time is an important part of living.

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

* Re: binding emacs key combination to external program?
  2007-09-11 10:42   ` Roger Levy
  2007-09-11 15:23     ` Peter Dyballa
@ 2007-09-11 17:05     ` Joost Kremers
  2007-09-19 12:52       ` Roger Levy
       [not found]     ` <mailman.707.1189524243.18990.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 11+ messages in thread
From: Joost Kremers @ 2007-09-11 17:05 UTC (permalink / raw)
  To: help-gnu-emacs

Roger Levy wrote:
> Many thanks -- I do use AUCTeX but wasn't aware you can customize it
> this way.  Would the best way to be to edit the TeX-command-list
> variable?

yes, either directly or through M-x customize-variable RET TeX-command-list
RET.

-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

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

* Re: binding emacs key combination to external program?
  2007-09-11 17:05     ` Joost Kremers
@ 2007-09-19 12:52       ` Roger Levy
  2007-09-19 17:06         ` Joost Kremers
  0 siblings, 1 reply; 11+ messages in thread
From: Roger Levy @ 2007-09-19 12:52 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 11, 10:05 am, Joost Kremers <joostkrem...@yahoo.com> wrote:
> Roger Levy wrote:
> > Many thanks -- I do use AUCTeX but wasn't aware you can customize it
> > this way.  Would the best way to be to edit the TeX-command-list
> > variable?
>
> yes, either directly or through M-x customize-variable RET TeX-command-list
> RET.

Thanks again.  My script is called latex2pdf and takes one argument,
the name of the .tex file.
I've tried to add it by using

  M-x customize-variable RET TeX-command-list RET

and adding the following at the top of TeX-command-list:

Name: latex2pdf
Command: latex2pdf %S &
Modes: Plain TeX, LaTeX

However, after saving this modification and setting it for the current
session, C-c C-c in LaTeX mode still doesn't trigger the latex2pdf
command.  Any thoughts on what I could be doing wrong?

Many thanks once more.

Roger

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

* Re: binding emacs key combination to external program?
       [not found]     ` <mailman.707.1189524243.18990.help-gnu-emacs@gnu.org>
@ 2007-09-19 12:54       ` Roger Levy
  0 siblings, 0 replies; 11+ messages in thread
From: Roger Levy @ 2007-09-19 12:54 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 11, 8:23 am, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
> Am 11.09.2007 um 12:42 schrieb Roger Levy:
>
> > I do use AUCTeX but wasn't aware you can customize it
> > this way.  Would the best way to be to edit the TeX-command-list
> > variable?
>
> Yes. Afterwards you're able to select this command. You know that can
> you add the local variable
>
>         %%% TeX-command-default: "script"
>
> in the file's footer?

I didn't know this.  Thanks!

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

* Re: binding emacs key combination to external program?
  2007-09-19 12:52       ` Roger Levy
@ 2007-09-19 17:06         ` Joost Kremers
  2007-09-25 22:00           ` Roger Levy
  0 siblings, 1 reply; 11+ messages in thread
From: Joost Kremers @ 2007-09-19 17:06 UTC (permalink / raw)
  To: help-gnu-emacs

Roger Levy wrote:
> Name: latex2pdf
> Command: latex2pdf %S &
> Modes: Plain TeX, LaTeX
>
> However, after saving this modification and setting it for the current
> session, C-c C-c in LaTeX mode still doesn't trigger the latex2pdf
> command.  Any thoughts on what I could be doing wrong?

well, you press C-c C-c and then you still have to select the command you
want to run. so press l and then hit TAB, it will expand to latex2pdf. then
hit ENTER.

however, i don't think your command is right. first, the %S is for the
source special options. you probably want %t, which expands to the tex
file.

i also don't think you need the ampersand. instead, you need to set the
How: options, probably to TeX-run-command. that also gives you the ability
to watch the output of your command by typing C-c C-l.


-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

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

* Re: binding emacs key combination to external program?
  2007-09-19 17:06         ` Joost Kremers
@ 2007-09-25 22:00           ` Roger Levy
  0 siblings, 0 replies; 11+ messages in thread
From: Roger Levy @ 2007-09-25 22:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 19, 10:06 am, Joost Kremers <joostkrem...@yahoo.com> wrote:
> Roger Levy wrote:
> > Name: latex2pdf
> > Command: latex2pdf %S &
> > Modes: Plain TeX, LaTeX
>
> > However, after saving this modification and setting it for the current
> > session, C-c C-c in LaTeX mode still doesn't trigger the latex2pdf
> > command.  Any thoughts on what I could be doing wrong?
>
> well, you press C-c C-c and then you still have to select the command you
> want to run. so press l and then hit TAB, it will expand to latex2pdf. then
> hit ENTER.
>
> however, i don't think your command is right. first, the %S is for the
> source special options. you probably want %t, which expands to the tex
> file.
>
> i also don't think you need the ampersand. instead, you need to set the
> How: options, probably to TeX-run-command. that also gives you the ability
> to watch the output of your command by typing C-c C-l.

Thank you, that helped!

Best

Roger

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

end of thread, other threads:[~2007-09-25 22:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-10 20:20 binding emacs key combination to external program? Roger Levy
2007-09-10 20:59 ` Joost Kremers
2007-09-11 10:42   ` Roger Levy
2007-09-11 15:23     ` Peter Dyballa
2007-09-11 17:05     ` Joost Kremers
2007-09-19 12:52       ` Roger Levy
2007-09-19 17:06         ` Joost Kremers
2007-09-25 22:00           ` Roger Levy
     [not found]     ` <mailman.707.1189524243.18990.help-gnu-emacs@gnu.org>
2007-09-19 12:54       ` Roger Levy
2007-09-10 23:55 ` Johan Lindström
2007-09-11  6:14 ` Matthias

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.