From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Embedding org-syntax in program source Date: Tue, 13 Apr 2010 12:12:27 -0400 Message-ID: <8739yzuyac.fsf@stats.ox.ac.uk> References: 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 1O1ik9-0002BM-40 for emacs-orgmode@gnu.org; Tue, 13 Apr 2010 12:13:41 -0400 Received: from [140.186.70.92] (port=42802 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1ik6-00027c-Jz for emacs-orgmode@gnu.org; Tue, 13 Apr 2010 12:13:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O1ij1-00080Y-17 for emacs-orgmode@gnu.org; Tue, 13 Apr 2010 12:12:33 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:61058) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1ij0-00080M-OS for emacs-orgmode@gnu.org; Tue, 13 Apr 2010 12:12:30 -0400 In-Reply-To: (LanX's message of "Tue, 13 Apr 2010 12:32:43 +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: LanX Cc: emacs-orgmode@gnu.org LanX writes: > Hi > > is there a way to make org-mode ignore "comment" characters at the beginn= ing of > a line? > > Such that > ;* Head > > or > #** Subhead > > work in elisp or perl? Hi Rolf, Short answer: yes. There are a bunch of good solutions out there, but it would really benefit from someone putting together a summary tutorial on Worg. There are basically two types of solution: org-mode with tangling, and use of outline-minor-mode (with some org machinery) in pure code files. > I know of org-babel, but the code produced is no legal Lisp/Perl code > anymore... So first let me double-check that you are aware of org-babel-tangle? That generates legal code from the org file. For example, I would really recommend trying the org-mode route for an emacs configuration file. There's support specifically for that (http://orgmode.org/worg/org-contrib/babel/intro.php#literate-programming and scroll down to Emacs Initialization with Org-babel) I'm the secondary author of org-babel, but I don't intend to come across as a myopic tangling zealot here. For new projects now I do tend to use org-mode with tangling, but outline-minor-mode is still absolutely essential to me for working on existing code in traditional format (as well as large fragments of code held within org files). Check out this thread from last year. The key post is this one from Michael Zeller and subsequent ones by Seb Vauban. Ignore all mention of org-babel in this thread as there has been 9 months of active development since then. http://article.gmane.org/gmane.emacs.orgmode/15427/match=3Dorg+style+folding Personally I'm still using a fairly simple outline-minor-mode setup. For what it's worth, here is my o-m-m config, but I've had this for ages now and it needs revisiting. This will make elisp fold at ;;; as well as at all top-level lisp forms. But the regexps below haven't been carefully thought about. (defun dan/set-up-outline-minor-mode (local-outline-regexp) (set (make-local-variable 'outline-regexp) local-outline-regexp) (outline-minor-mode t) (org-overview) (org-content)) (add-hook 'outline-minor-mode-hook (lambda () (define-key outline-minor-mode-map [(control tab)] 'org-cycle) (define-key outline-minor-mode-map [(backtab)] 'org-global-cycle))) (add-hook 'emacs-lisp-mode-hook (lambda () (dan/set-up-outline-minor-mode "\\((\\|;;;\\)"))) (add-hook 'python-mode-hook (lambda () (dan/set-up-outline-minor-mode "\\( *def \\|if \\|clas= s \\|##\\)"))) (add-hook 'bibtex-mode-hook (lambda () (dan/set-up-outline-minor-mode "@"))) (add-hook 'ess-mode-hook (lambda ()=20 (unless (eq noweb-code-mode 'R-mode) (dan/set-up-outline-minor-mode "[a-zA-Z._[\"][a-zA-Z._0-9[\"]= * *<- *function")))) I think this topic can be confusing. E.g. what about Carsten's outline-magic.el ?? Is there a role for that? Like I say this would be a good topic for a Worg page. Dan > > Thanks > =C2=A0 Rolf > _______________________________________________ > 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