From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Zeller Subject: Re: Re: org-style folding for a .emacs Date: Tue, 14 Jul 2009 20:12:23 -0700 Message-ID: <87iqhu63mw.fsf@zeller.michaelzeller.com> References: <87bpnonpvb.fsf@zeller.michaelzeller.com> <87tz1ftr6f.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQuwC-0006s5-Sb for emacs-orgmode@gnu.org; Tue, 14 Jul 2009 23:13:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQuw7-0006rK-DS for emacs-orgmode@gnu.org; Tue, 14 Jul 2009 23:13:43 -0400 Received: from [199.232.76.173] (port=47700 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQuw7-0006rH-7e for emacs-orgmode@gnu.org; Tue, 14 Jul 2009 23:13:39 -0400 Received: from mail-px0-f193.google.com ([209.85.216.193]:52090) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MQuw6-0001SE-TH for emacs-orgmode@gnu.org; Tue, 14 Jul 2009 23:13:39 -0400 Received: by pxi31 with SMTP id 31so2630248pxi.14 for ; Tue, 14 Jul 2009 20:13:37 -0700 (PDT) In-Reply-To: <87tz1ftr6f.fsf@mundaneum.com> (=?utf-8?Q?=22S=C3=A9bastien?= Vauban"'s message of "Tue, 14 Jul 2009 13:55:20 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: emacs-orgmode@gnu.org Seb, > Though, is there a way to get the font used for org-levels in the Emacs c= onfig > file? That would really greatly improve the readability, then! Try changing th-outline-minor-mode-init to: (defun th-outline-minor-mode-init () (interactive) (setq outline-regexp (th-outline-regexp)) ;; highlight the headings ;; see http://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.= html ;; use M-x customize-apropos face to customize faces ;; to find the corresponding face for each outline level see org-faces.el (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,\\} = \\(.*\\)"))) (font-lock-add-keywords nil `((,heading-1-regexp 1 font-lock-function-name-face t) (,heading-2-regexp 1 font-lock-variable-name-face t) (,heading-3-regexp 1 font-lock-keyword-face t))))) That should atleast highlight the first three headings properly and make it more readable. I'm not quite sure how to make it cycle through the 8 colors like org-mode does. Hope that helps, ~Michael Zeller S=C3=A9bastien Vauban writes: > Hello Michael, > >>> Does anyone have a recipe for easy org-style folding of an elisp file? = I'd >>> like to divide my .emacs into segments to make it easier to oversee and >>> navigate. > > I asked myself this question a couple of days ago. Telepathy. For real. > Good it has been asked, and answered. > > In my case, I am very interested as well by the literate programming appr= oach. > But I will comment on this later. > > >> In summary, add the following to your ~/.emacs.el: >> >> (defun th-outline-regexp () >> "Calculate the outline regexp for the current mode." >> (let ((comment-starter (replace-regexp-in-string >> "[[:space:]]+" "" comment-start))) >> (when (string=3D comment-start ";") >> (setq comment-starter ";;")) >> (concat "^" comment-starter "\\*+"))) >> >> (defun th-outline-minor-mode-init () >> (interactive) >> (setq outline-regexp (th-outline-regexp))) >> >> (add-hook 'outline-minor-mode-hook >> 'th-outline-minor-mode-init) >> >> and add the following as the top line of your ~/.emacs.el: >> >> ; -*- mode: emacs-lisp; mode: outline-minor; -*- >> >> Now you can add ;;* and ;;**, etc as headings in your .emacs.el and >> cycle using M-tab, M-left and M-right will collapse or expand all >> headings respectively. I am guessing you mean to make segments such as >> ;;* SHORTCUTS and ;;* VARIABLES, this will do that, but not too much >> more. > > Done. > > Though, is there a way to get the font used for org-levels in the Emacs c= onfig > file? That would really greatly improve the readability, then! > > Best regards, > Seb