emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: "Sébastien Vauban" <wxhgmqzgwmuf@spammotel.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: Error "while: Stack overflow in regexp matcher"
Date: Thu, 3 Sep 2009 10:02:41 +0200	[thread overview]
Message-ID: <7C74C9BF-ED75-42B8-9B4C-3B03C6918295@gmail.com> (raw)
In-Reply-To: <87d468sbto.fsf@mundaneum.com>

Hi Sebastien,

I see.

Well, Org does not *visit* the file, so these variables are
not evaluated. Also, the argument of the #+include line determines
the major mode, not the local variable setting.

You can hack your way through this by adding a function
to org-src-mode-hook that will scan for

    mode: outline-minor

and turn it on if found.

I guess I could also consider to fully *visit* an include file,
to work around these restrictions.  The main reason why I am not
doing this right now is because the exact same mechanism is used for
inline examples and include files, and it would be significant
work to change this.....

- Carsten

On Sep 3, 2009, at 9:54 AM, Sébastien Vauban wrote:

> 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/emacs-orgmode@gnu.org/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.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2009-09-03  8:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15  9:12 Error "while: Stack overflow in regexp matcher" Sébastien Vauban
2009-07-15 10:54 ` Giovanni Ridolfi
2009-07-15 11:54   ` Sébastien Vauban
2009-07-29  9:28     ` Sébastien Vauban
2009-07-29  9:49       ` Bastien
2009-07-29 11:13         ` Sébastien Vauban
2009-08-20  8:35       ` Sébastien Vauban
2009-08-20 13:48         ` Bastien
2009-08-31 10:26 ` Carsten Dominik
2009-09-01  0:28   ` Bernt Hansen
2009-09-02 16:05   ` Sébastien Vauban
2009-09-03  6:51     ` Carsten Dominik
2009-09-03  7:54       ` Sébastien Vauban
2009-09-03  8:02         ` Carsten Dominik [this message]
2009-09-03 12:17           ` Sébastien Vauban

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7C74C9BF-ED75-42B8-9B4C-3B03C6918295@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=wxhgmqzgwmuf@spammotel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).