* [babel] How to fontify blocks other than begin_src?
@ 2011-01-07 16:14 Seth Burleigh
2011-01-07 18:46 ` Eric Schulte
0 siblings, 1 reply; 5+ messages in thread
From: Seth Burleigh @ 2011-01-07 16:14 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 719 bytes --]
I would like blocks like begin_html/end_html to be fontified just like
begin_src blocks are.
I would also like to define my own source blocks for clojure (basically a
shorthand) and also have them highlighted. Heres what i have to turn on
fontifying and define a block.
(setq org-src-fontify-natively t)
;; define #+clj as start of clojure code block and #+end as end of block
(add-to-list 'org-edit-src-region-extra
'("^[ \t]*#\\+clj.*\n" "\n[ \t]*#\\+end" "clojure"))
Ive also noticed that the code block (#+clj ... #+end) doesnt fold -
however, if i define the block as begin_clj and end_clj it will fold, so im
guessing org assumes a certain block format for folding code.
Any way to do the above two things?
[-- Attachment #1.2: Type: text/html, Size: 1041 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] How to fontify blocks other than begin_src?
2011-01-07 16:14 [babel] How to fontify blocks other than begin_src? Seth Burleigh
@ 2011-01-07 18:46 ` Eric Schulte
2011-01-07 23:08 ` Seth Burleigh
2011-01-08 12:14 ` Dan Davison
0 siblings, 2 replies; 5+ messages in thread
From: Eric Schulte @ 2011-01-07 18:46 UTC (permalink / raw)
To: Seth Burleigh; +Cc: emacs-orgmode
Hi Seth,
The easiest way to fontify embedded html is most likely to wrap the html
in "#+begin_src html" code blocks.
As for defining your own clojure blocks that sounds like a risky
proposition to me. All of the code block evaluation functions are built
to use standard org-mode syntax for code blocks, e.g. "#+begin_src lang".
That said you can easily use clj as an alias for clojure in your code
blocks, use the following elisp code to add this alias to
org-src-lang-modes
#+begin_src emacs-lisp
(add-to-list 'org-src-lang-modes '("clj" . clojure))
#+end_src
Once that is done you will notice clj blocks like the one below are
fontified. Also, after pulling the latest version of Org-mode (I just
made a small change to make this possible), it is also possible to
evaluate "#+begin_src clj" blocks as though they were regular "clojure"
blocks.
#+begin_src clj
(map (partial + 1) (range 20))
#+end_src
Hope this helps -- Eric
Seth Burleigh <wburle4@gmail.com> writes:
> I would like blocks like begin_html/end_html to be fontified just like
> begin_src blocks are.
> I would also like to define my own source blocks for clojure (basically a
> shorthand) and also have them highlighted. Heres what i have to turn on
> fontifying and define a block.
>
> (setq org-src-fontify-natively t)
> ;; define #+clj as start of clojure code block and #+end as end of block
> (add-to-list 'org-edit-src-region-extra
> '("^[ \t]*#\\+clj.*\n" "\n[ \t]*#\\+end" "clojure"))
>
> Ive also noticed that the code block (#+clj ... #+end) doesnt fold -
> however, if i define the block as begin_clj and end_clj it will fold, so im
> guessing org assumes a certain block format for folding code.
>
> Any way to do the above two things?
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] How to fontify blocks other than begin_src?
2011-01-07 18:46 ` Eric Schulte
@ 2011-01-07 23:08 ` Seth Burleigh
2011-01-08 12:14 ` Dan Davison
1 sibling, 0 replies; 5+ messages in thread
From: Seth Burleigh @ 2011-01-07 23:08 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 120 bytes --]
Thanks, it does. Yep, i looked at the code, and everything was based on
begin_src - so i think i will keep it at that!
[-- Attachment #1.2: Type: text/html, Size: 129 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] How to fontify blocks other than begin_src?
2011-01-07 18:46 ` Eric Schulte
2011-01-07 23:08 ` Seth Burleigh
@ 2011-01-08 12:14 ` Dan Davison
2011-01-08 20:53 ` Eric Schulte
1 sibling, 1 reply; 5+ messages in thread
From: Dan Davison @ 2011-01-08 12:14 UTC (permalink / raw)
To: emacs-orgmode
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Hi Seth,
>
> The easiest way to fontify embedded html is most likely to wrap the html
> in "#+begin_src html" code blocks.
>
> As for defining your own clojure blocks that sounds like a risky
> proposition to me. All of the code block evaluation functions are built
> to use standard org-mode syntax for code blocks, e.g. "#+begin_src lang".
For those who are interested in changing the appearance of Org elements
for aesthetic reasons, there is Nicolas Girard's org-icons project,
https://github.com/ngirard/org-icons
which needs further work (i.e. needs to be adopted by someone) if it is
to become generally useful. It aims to provide facilities for altering
the display of arbitrary org elements, including the option of
displaying icons in place of the text. In the branch named 'dan' I
started to add support for begin_src blocks.
Dan
>
> That said you can easily use clj as an alias for clojure in your code
> blocks, use the following elisp code to add this alias to
> org-src-lang-modes
>
> #+begin_src emacs-lisp
> (add-to-list 'org-src-lang-modes '("clj" . clojure))
> #+end_src
>
> Once that is done you will notice clj blocks like the one below are
> fontified. Also, after pulling the latest version of Org-mode (I just
> made a small change to make this possible), it is also possible to
> evaluate "#+begin_src clj" blocks as though they were regular "clojure"
> blocks.
>
> #+begin_src clj
> (map (partial + 1) (range 20))
> #+end_src
>
> Hope this helps -- Eric
>
> Seth Burleigh <wburle4@gmail.com> writes:
>
>> I would like blocks like begin_html/end_html to be fontified just like
>> begin_src blocks are.
>> I would also like to define my own source blocks for clojure (basically a
>> shorthand) and also have them highlighted. Heres what i have to turn on
>> fontifying and define a block.
>>
>> (setq org-src-fontify-natively t)
>> ;; define #+clj as start of clojure code block and #+end as end of block
>> (add-to-list 'org-edit-src-region-extra
>> '("^[ \t]*#\\+clj.*\n" "\n[ \t]*#\\+end" "clojure"))
>>
>> Ive also noticed that the code block (#+clj ... #+end) doesnt fold -
>> however, if i define the block as begin_clj and end_clj it will fold, so im
>> guessing org assumes a certain block format for folding code.
>>
>> Any way to do the above two things?
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-08 21:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-07 16:14 [babel] How to fontify blocks other than begin_src? Seth Burleigh
2011-01-07 18:46 ` Eric Schulte
2011-01-07 23:08 ` Seth Burleigh
2011-01-08 12:14 ` Dan Davison
2011-01-08 20:53 ` Eric Schulte
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).