emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* source code block language 'makefile' and listings package
@ 2014-07-04 15:32 Rainer M Krug
  2014-07-04 16:31 ` Thomas S. Dye
  0 siblings, 1 reply; 9+ messages in thread
From: Rainer M Krug @ 2014-07-04 15:32 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi

I used the source block language 'makefile'

#+begin_src R makefile
...
#+end_src

and now I would like top export this block to html. I am using the
listings package for this, and it supports the syntax, but the
language is called 'make', while org uses 'makefile'

Is there a way of telling the tex exporter to export 'makefile' blocks
as language 'make', or can I easily tell listings that the language
'makefile' is equal to 'make'?

Thanks,

Rainer


-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

PGP: 0x0F52F982

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

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

* Re: source code block language 'makefile' and listings package
  2014-07-04 15:32 source code block language 'makefile' and listings package Rainer M Krug
@ 2014-07-04 16:31 ` Thomas S. Dye
  2014-07-08  9:51   ` SOLVED: " Rainer M Krug
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2014-07-04 16:31 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

Aloha Rainer,

Rainer M Krug <Rainer@krugs.de> writes:

> Hi
>
> I used the source block language 'makefile'
>
> #+begin_src R makefile
> ...
> #+end_src
>
> and now I would like top export this block to html. I am using the
> listings package for this, and it supports the syntax, but the
> language is called 'make', while org uses 'makefile'
>
> Is there a way of telling the tex exporter to export 'makefile' blocks
> as language 'make', or can I easily tell listings that the language
> 'makefile' is equal to 'make'?

You can configure the listings package with the commands
\lstnewenvironment and \lstset.  There is a worked example here:

http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12-4

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

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

* SOLVED: source code block language 'makefile' and listings package
  2014-07-04 16:31 ` Thomas S. Dye
@ 2014-07-08  9:51   ` Rainer M Krug
  2014-07-08 10:00     ` Thorsten Jolitz
                       ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Rainer M Krug @ 2014-07-08  9:51 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

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

tsd@tsdye.com (Thomas S. Dye) writes:

> Aloha Rainer,
>
> Rainer M Krug <Rainer@krugs.de> writes:
>
>> Hi
>>
>> I used the source block language 'makefile'
>>
>> #+begin_src R makefile
>> ...
>> #+end_src
>>
>> and now I would like top export this block to html. I am using the
>> listings package for this, and it supports the syntax, but the
>> language is called 'make', while org uses 'makefile'
>>
>> Is there a way of telling the tex exporter to export 'makefile' blocks
>> as language 'make', or can I easily tell listings that the language
>> 'makefile' is equal to 'make'?
>
> You can configure the listings package with the commands
> \lstnewenvironment and \lstset.  There is a worked example here:
>
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12-4

Much simpler then that: I simply changed the variable
org-latex-listings-langs to include makefile:

,----
| (setq org-latex-listings-langs 
|       '((emacs-lisp "Lisp") 
|         (lisp "Lisp") 
|         (clojure "Lisp") 
|         (c "C") 
|         (cc "C++") 
|         (fortran "fortran") 
|         (perl "Perl") 
|         (cperl "Perl")
|         (python "Python")
|         (ruby "Ruby")
|         (html "HTML")
|         (xml "XML")
|         (tex "TeX")
|         (latex "[LaTeX]TeX")
|         (shell-script "bash")
|         (gnuplot "Gnuplot")
|         (ocaml "Caml")
|         (caml "Caml")
|         (sql "SQL")
|         (sqlite "sql")
|         (makefile "make")))
`----

Works perfectly.

Now if I just could figure out on how I can simply *add* the makefile to
the list without defining it completely new..

Cheers,

Rainer

>
> hth,
> Tom

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

PGP: 0x0F52F982

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

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

* Re: SOLVED: source code block language 'makefile' and listings package
  2014-07-08  9:51   ` SOLVED: " Rainer M Krug
@ 2014-07-08 10:00     ` Thorsten Jolitz
  2014-07-08 11:22     ` Nick Dokos
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Thorsten Jolitz @ 2014-07-08 10:00 UTC (permalink / raw)
  To: emacs-orgmode

Rainer M Krug <Rainer@krugs.de> writes:

> Now if I just could figure out on how I can simply *add* the makefile to
> the list without defining it completely new..

Maybe

,----[ C-h f add-to-list RET ]
| add-to-list is a compiled Lisp function in `subr.el'.
| 
| (add-to-list LIST-VAR ELEMENT &optional APPEND COMPARE-FN)
| 
| Add ELEMENT to the value of LIST-VAR if it isn't there yet.
| The test for presence of ELEMENT is done with `equal',
| or with COMPARE-FN if that's non-nil.
| If ELEMENT is added, it is added at the beginning of the list,
| unless the optional argument APPEND is non-nil, in which case
| ELEMENT is added at the end.
| 
| The return value is the new value of LIST-VAR.
| 
| If you want to use `add-to-list' on a variable that is not defined
| until a certain package is loaded, you should put the call to `add-to-list'
| into a hook function that will be run only after loading the package.
| `eval-after-load' provides one way to do this.  In some cases
| other hooks, such as major mode hooks, can do the job.
| 
| [back]
`----

?

-- 
cheers,
Thorsten

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

* Re: SOLVED: source code block language 'makefile' and listings package
  2014-07-08  9:51   ` SOLVED: " Rainer M Krug
  2014-07-08 10:00     ` Thorsten Jolitz
@ 2014-07-08 11:22     ` Nick Dokos
  2014-07-09  7:25       ` Rainer M Krug
  2014-07-08 12:40     ` Nick Dokos
  2014-07-08 16:48     ` Thomas S. Dye
  3 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2014-07-08 11:22 UTC (permalink / raw)
  To: emacs-orgmode

Rainer M Krug <Rainer@krugs.de> writes:


> Much simpler then that: I simply changed the variable
> org-latex-listings-langs to include makefile:
>
> ,----
> | (setq org-latex-listings-langs 
> |       '((emacs-lisp "Lisp") 
            ...
> |         (makefile "make")))
> `----
>
> Works perfectly.
>
> Now if I just could figure out on how I can simply *add* the makefile to
> the list without defining it completely new..
>

(setq org-latex-listings-langs
      (append org-latex-listings-langs '((makefile "make"))))

-- 
Nick

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

* Re: SOLVED: source code block language 'makefile' and listings package
  2014-07-08  9:51   ` SOLVED: " Rainer M Krug
  2014-07-08 10:00     ` Thorsten Jolitz
  2014-07-08 11:22     ` Nick Dokos
@ 2014-07-08 12:40     ` Nick Dokos
  2014-07-11  8:53       ` Rainer M Krug
  2014-07-08 16:48     ` Thomas S. Dye
  3 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2014-07-08 12:40 UTC (permalink / raw)
  To: emacs-orgmode

Rainer M Krug <Rainer@krugs.de> writes:

> Much simpler then that: I simply changed the variable
> org-latex-listings-langs to include makefile:
>
> ,----
> | (setq org-latex-listings-langs 
> |       '((emacs-lisp "Lisp") 
> |         (lisp "Lisp") 
...             
> |         (sql "SQL")
> |         (sqlite "sql")
> |         (makefile "make")))
> `----
>
> Works perfectly.
>
> Now if I just could figure out on how I can simply *add* the makefile to
> the list without defining it completely new..
>

Two methods:

this one is pretty much generic lisp:

--8<---------------cut here---------------start------------->8---
(setq org-latex-listings-langs
      (append org-latex-listings-langs '((makefile "make"))))
--8<---------------cut here---------------end--------------->8---

A slightly simpler, more idiomatic emacs-lisp way:

--8<---------------cut here---------------start------------->8---
(add-to-list 'org-latex-listings-langs '(makefile "make"))
--8<---------------cut here---------------end--------------->8---

-- 
Nick

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

* Re: SOLVED: source code block language 'makefile' and listings package
  2014-07-08  9:51   ` SOLVED: " Rainer M Krug
                       ` (2 preceding siblings ...)
  2014-07-08 12:40     ` Nick Dokos
@ 2014-07-08 16:48     ` Thomas S. Dye
  3 siblings, 0 replies; 9+ messages in thread
From: Thomas S. Dye @ 2014-07-08 16:48 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

Aloha Rainer,

Rainer M Krug <Rainer@krugs.de> writes:

>> You can configure the listings package with the commands
>> \lstnewenvironment and \lstset.  There is a worked example here:
>>
>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12-4
>
> Much simpler then that: I simply changed the variable
> org-latex-listings-langs to include makefile:
>
> ,----
> | (setq org-latex-listings-langs 
> |       '((emacs-lisp "Lisp") 
> |         (lisp "Lisp") 
> |         (clojure "Lisp") 
> |         (c "C") 
> |         (cc "C++") 
> |         (fortran "fortran") 
> |         (perl "Perl") 
> |         (cperl "Perl")
> |         (python "Python")
> |         (ruby "Ruby")
> |         (html "HTML")
> |         (xml "XML")
> |         (tex "TeX")
> |         (latex "[LaTeX]TeX")
> |         (shell-script "bash")
> |         (gnuplot "Gnuplot")
> |         (ocaml "Caml")
> |         (caml "Caml")
> |         (sql "SQL")
> |         (sqlite "sql")
> |         (makefile "make")))
> `----
>
> Works perfectly.

Nice!

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: SOLVED: source code block language 'makefile' and listings package
  2014-07-08 11:22     ` Nick Dokos
@ 2014-07-09  7:25       ` Rainer M Krug
  0 siblings, 0 replies; 9+ messages in thread
From: Rainer M Krug @ 2014-07-09  7:25 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

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

Nick Dokos <ndokos@gmail.com> writes:

> Rainer M Krug <Rainer@krugs.de> writes:
>
>
>> Much simpler then that: I simply changed the variable
>> org-latex-listings-langs to include makefile:
>>
>> ,----
>> | (setq org-latex-listings-langs 
>> |       '((emacs-lisp "Lisp") 
>             ...
>> |         (makefile "make")))
>> `----
>>
>> Works perfectly.
>>
>> Now if I just could figure out on how I can simply *add* the makefile to
>> the list without defining it completely new..
>>
>
> (setq org-latex-listings-langs
>       (append org-latex-listings-langs '((makefile "make"))))

Perfect - thanks.

I would actually suggest to add this to the default of the variable
definition.

Will submit a patch later today.

Thanks,

Rainer

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

PGP: 0x0F52F982

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

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

* Re: SOLVED: source code block language 'makefile' and listings package
  2014-07-08 12:40     ` Nick Dokos
@ 2014-07-11  8:53       ` Rainer M Krug
  0 siblings, 0 replies; 9+ messages in thread
From: Rainer M Krug @ 2014-07-11  8:53 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode@gnu.org

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



Envoyé de mon iPhone

> Le 8 juil. 2014 à 14:40, Nick Dokos <ndokos@gmail.com> a écrit :
> 
> Rainer M Krug <Rainer@krugs.de> writes:
> 
>> Much simpler then that: I simply changed the variable
>> org-latex-listings-langs to include makefile:
>> 
>> ,----
>> | (setq org-latex-listings-langs 
>> |       '((emacs-lisp "Lisp") 
>> |         (lisp "Lisp")
> ...             
>> |         (sql "SQL")
>> |         (sqlite "sql")
>> |         (makefile "make")))
>> `----
>> 
>> Works perfectly.
>> 
>> Now if I just could figure out on how I can simply *add* the makefile to
>> the list without defining it completely new..
> 
> Two methods:
> 
> this one is pretty much generic lisp:
> 
> --8<---------------cut here---------------start------------->8---
> (setq org-latex-listings-langs
>      (append org-latex-listings-langs '((makefile "make"))))
> --8<---------------cut here---------------end--------------->8---
> 
> A slightly simpler, more idiomatic emacs-lisp way:
> 
> --8<---------------cut here---------------start------------->8---
> (add-to-list 'org-latex-listings-langs '(makefile "make"))
> --8<---------------cut here---------------end--------------->8---
> 

Thanks - learned something more. 

Cheers,

Rainer 

> -- 
> Nick
> 
> 

[-- Attachment #2: Type: text/html, Size: 3343 bytes --]

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

end of thread, other threads:[~2014-07-11  8:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-04 15:32 source code block language 'makefile' and listings package Rainer M Krug
2014-07-04 16:31 ` Thomas S. Dye
2014-07-08  9:51   ` SOLVED: " Rainer M Krug
2014-07-08 10:00     ` Thorsten Jolitz
2014-07-08 11:22     ` Nick Dokos
2014-07-09  7:25       ` Rainer M Krug
2014-07-08 12:40     ` Nick Dokos
2014-07-11  8:53       ` Rainer M Krug
2014-07-08 16:48     ` Thomas S. Dye

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).