From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: [ANN] outorg.el -- reverse Org-Babel Date: Wed, 13 Feb 2013 11:54:36 +0100 Message-ID: <87mwv8xz4j.fsf@gmail.com> References: <87mwvabeuk.fsf@gmail.com> <86r4kmffqc.fsf@iro.umontreal.ca> <87ip5yb4xl.fsf@gmail.com> <86wquedtg1.fsf@iro.umontreal.ca> <87liat7hl1.fsf@gmail.com> <86vc9xjtcp.fsf@iro.umontreal.ca> <87ehgl5ibs.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5ZzP-0003aC-GL for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 05:55:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5ZzK-0000IO-I2 for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 05:54:59 -0500 Received: from plane.gmane.org ([80.91.229.3]:36501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5ZzK-0000Hz-Bp for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 05:54:54 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1U5Zzc-0005AN-4U for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 11:55:12 +0100 Received: from g231106230.adsl.alicedsl.de ([92.231.106.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Feb 2013 11:55:12 +0100 Received: from tjolitz by g231106230.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Feb 2013 11:55:12 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Bastien writes: Hi Bastien, > Note that both your libraries (supporting some Org syntax in > comments) are a perfect match for Christopher recent chance > in master, which allows a more powerful orgstruct-mode in > those files -- with folding etc. If you didn't, have a look: > > C-h v orgstruct-heading-prefix-regexp RET for equivalence with outline-minor-mode, one would need ,-------------------------------- | orgstruct-heading-prefix-regexp | orgstruct-heading-prefix-level `-------------------------------- just like: ,------------------------------------------------------------------------------- | outline-regexp is a variable defined in `outline.el'. | | Regular expression to match the beginning of a heading. | Any line whose beginning matches this regexp is considered to start a heading. | Note that Outline mode only checks this regexp at the start of a line, | so the regexp need not (and usually does not) start with `^'. | The recommended way to set this is with a Local Variables: list | in the file it applies to. See also `outline-heading-end-regexp'. `------------------------------------------------------------------------------- ,---------------------------------------------------------------------------- | outline-level is a variable defined in `outline.el'. | | *Function of no args to compute a header's nesting level in an outline. | It can assume point is at the beginning of a header line and that the match | data reflects the `outline-regexp'. `---------------------------------------------------------------------------- on the other hand: ,--------------------------------------------------------- | (define-derived-mode org-mode outline-mode "Org" | [...] | (org-set-local 'outline-regexp org-outline-regexp) | (org-set-local 'outline-level 'org-outline-level) ...) `--------------------------------------------------------- I'm not sure if I really understand orgstruct-mode, but it seems to me that when orgstruct-mode is active in a (e.g. elisp) buffer, all outline functions and vars are available, and so are org-outline-regexp and org-outline-level. Then a library like outorg could use outline functionality in its functions and it would work no matter if the buffer is in outline-minor-mode or in orgstruct-mode. The only change necesary would be to set outline-regexp and outline-level conditionally on the minor-mode active. Or why not use outline-regexp and outline-level directly, like org.el does in some places: ,--------------------------------------------------------------------------- | 6624: (if (re-search-forward (concat "^" outline-regexp) nil t) `--------------------------------------------------------------------------- ,----------------------------------------------------- | 36 matches for "[^-]outline-level" in buffer: org.el `----------------------------------------------------- I'm not really sure how much of Org-mode and Outline is available when orgstruct is loaded, and if and why there is a need for 'orgstruct-heading-prefix-regexp' - couldn't orgstruct just set a buffer-local 'outline-regexp' instead? Some enlightment is welcome. -- cheers, Thorsten