emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] how to change the headline starter *


From: Matt Lundin
Subject: Re: [O] how to change the headline starter *
Date: Sat, 13 Aug 2011 09:16:30 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Matt Lundin <address@hidden> writes:

> Bastien <address@hidden> writes:
>
>> Attached is a patch that replaces instances of outline-regexp 
>> by org-outline-regexp.  It also introduces more harmonization.
>>
>> I'd be interesed in hearing about feedback.
>
> What is the primary reason to use a hard-coded org-outline-regexp and
> org-outline-regexp-bol instead of the buffer local outline-regexp? Is it
> to clear up any confusion about whether the header regexp can be
> customized? One of the negative effects is (as reported in another post)
> that one can no longer use org-global-cycle in other modes (e.g.,
> Auctex).

On further investigation, I can see very easily how much this cleans up
the code. Sorry for the noise!

> Perhaps for the relevant functions (e.g., org-overview) we could
> construct org-outline-regexp-bol from the a bound version of
> org-outline-regexp (i.e., one that uses the buffer local value of
> outline-regexp). 

> At the moment, this FAQ is obsolete:

> http://orgmode.org/worg/org-faq.html#use-visibility-cycling-in-outline-mode

I think the best approach here is to hard-code org-outline-regexp and
org-outline-regexp-bol (as you have done) but to make it more flexible
in the *few* instances where one would like to use visibility functions
in outline-mode. I've attached a simple patch that restores global
cycling in outline-mode buffers. 

I hope had a wonderful vacation!

Best,
Matt

>From 2361624ba5b6fb9a49ebfa55f0cfc7245488437e Mon Sep 17 00:00:00 2001
From: Matt Lundin <address@hidden>
Date: Sat, 13 Aug 2011 09:10:58 -0500
Subject: [PATCH] Allow org-cycle to work in outline buffers.

* lisp/org.el: (org-overview): Bind value of org-outline-regexp-bol
  locally, so as to use the value of org-outline-regexp, which is in
  turn locally bound to outline-regexp.
---
 lisp/org.el |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e407e81..ee5397c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6234,12 +6234,13 @@ of the first headline in the buffer.  This is 
important, because if the
 first headline is not level one, then (hide-sublevels 1) gives confusing
 results."
   (interactive)
-  (let ((level (save-excursion
-                (goto-char (point-min))
-                (if (re-search-forward org-outline-regexp-bol nil t)
-                    (progn
-                      (goto-char (match-beginning 0))
-                      (funcall outline-level))))))
+  (let* ((org-outline-regexp-bol (concat "^" org-outline-regexp))
+        (level (save-excursion
+                 (goto-char (point-min))
+                 (if (re-search-forward org-outline-regexp-bol nil t)
+                     (progn
+                       (goto-char (match-beginning 0))
+                       (funcall outline-level))))))
     (and level (hide-sublevels level))))
 
 (defun org-content (&optional arg)
-- 
1.7.6


reply via email to

[Prev in Thread] Current Thread [Next in Thread]