Hi Carsten,
Carsten Dominik wrote:
On Sep 2, 2009, at 6:05 PM, Sébastien Vauban wrote:
Carsten Dominik wrote:
On Jul 15, 2009, at 11:12 AM, Sébastien Vauban wrote:
I'm trying to publish my `.emacs' file onto the Web, for
interested people
to come and copy stuff they find valuable. My turn to do it.
But, now, I wanna do it... and I've always an error when trying to
publish my config file: "while: Stack overflow in regexp matcher".
Sebastien has now (off-list) made it possible for me to reproduce
this
bug. Which is why it finally has been fixed.
Thank you very much. This works as expected [²]. Fan-tas-tic!
Thanks for all,
Seb
[²] The only minor thing -- this is a small detail! -- is that my
buffer
uses `outline-minor-mode' and Org-level-* titles in comments
(based on
the code of Tassilo) for enhancing the readability of any long
file
(here, my `.emacs').
While these titles are properly highlighted (other color,
bigger font)
when read under Emacs, they are not in the HTMLized version of
the
buffer.
--8<---------------cut here---------------start------------->8---
;;** --[ Environment ]---------------------
--8<---------------cut here---------------end--------------->8---
simply becomes:
--8<---------------cut here---------------start------------->8---
<span style="color: #ff0000;">;;</span>
<span style="color: #ff0000;">** --
[ Environment ]---------------------</span>
--8<---------------cut here---------------end--------------->8---
in HTML, while it should be fontified as the Org-level-1 face:
--8<---------------cut here---------------start------------->8---
(org-level-1 ((t (:foreground "cornflower blue" :weight bold
:height 1.8 :family "Arial"))))
--8<---------------cut here---------------end--------------->8---
What is the setup for getting this special fontification?
Having such a code in your `.emacs' file:
--8<---------------cut here---------------start------------->8---
;; Org-style folding for a `.emacs' (and much more)
(defun my-outline-regexp ()
"Calculate the outline regexp for the current mode."
(let ((comment-starter (replace-regexp-in-string
"[[:space:]]+" "" comment-start)))
(when (string= comment-start ";")
(setq comment-starter ";;"))
(concat comment-starter "[*]+ ")))
(defun my-outline-minor-mode-hook ()
(interactive)
(setq outline-regexp (my-outline-regexp))
;; highlight the headings
(let ((heading-1-regexp
(concat (substring outline-regexp 0 -1) "\\{1\\} \\(.*\\)"))
(heading-2-regexp
(concat (substring outline-regexp 0 -1) "\\{2\\} \\(.*\\)"))
(heading-3-regexp
(concat (substring outline-regexp 0 -1) "\\{3\\} \\(.*\\)"))
(heading-4-regexp
(concat (substring outline-regexp 0 -1) "\\{4,\\} \\(.*\
\)")))
(font-lock-add-keywords
nil
`((,heading-1-regexp 1 'org-level-1 t)
(,heading-2-regexp 1 'org-level-2 t)
(,heading-3-regexp 1 'org-level-3 t)
(,heading-4-regexp 1 'org-level-4 t)))))
(add-hook 'outline-minor-mode-hook
'my-outline-minor-mode-hook)
--8<---------------cut here---------------end--------------->8---
How do you activate it? In a mode hook?
... and adding "outline-minor" as a cookie or local variable in the
file where
you want to use the `org-level-*' titles.
In my case, I have this at the bottom of my `.emacs' file:
--8<---------------cut here---------------start------------->8---
;; This is for the sake of Emacs.
;; Local Variables:
;; coding: utf-8
;; mode: emacs-lisp
;; mode: outline-minor
;; ispell-local-dictionary: "american"
;; End:
;;; .emacs ends here
--8<---------------cut here---------------end--------------->8---
Now, you can add `;;*' and `;;**', etc. as headings in your `.emacs'
and cycle
using `M-tab', `M-left' and `M-right' will collapse or expand all
headings
respectively.
See the thread "Org-style folding for a .emacs" discussed here in
mid-July:
http://www.mail-archive.com/address@hidden/msg15439.html
Org just sets the proper mode to get the fontification, so
I do not understand why this would not work.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode