Re: [O] SOLVED: source code block language 'makefile' and listings package

2014-07-11 Thread Rainer M Krug


Envoyé de mon iPhone

> Le 8 juil. 2014 à 14:40, Nick Dokos  a écrit :
> 
> Rainer M Krug  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
> 
> 


Re: [O] SOLVED: source code block language 'makefile' and listings package

2014-07-10 Thread Nick Dokos
Rainer M Krug  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




Re: [O] SOLVED: source code block language 'makefile' and listings package

2014-07-10 Thread Thorsten Jolitz
Rainer M Krug  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




Re: [O] SOLVED: source code block language 'makefile' and listings package

2014-07-09 Thread Rainer M Krug
Nick Dokos  writes:

> Rainer M Krug  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:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


pgpHOJOujzKFw.pgp
Description: PGP signature


Re: [O] SOLVED: source code block language 'makefile' and listings package

2014-07-08 Thread Thomas S. Dye
Aloha Rainer,

Rainer M Krug  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



Re: [O] SOLVED: source code block language 'makefile' and listings package

2014-07-08 Thread Nick Dokos
Rainer M Krug  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