From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: how to change the headline starter * Date: Sat, 13 Aug 2011 09:16:30 -0500 Message-ID: <87pqk9pfb5.fsf@fastmail.fm> References: <1240511841.2591431310664738370.JavaMail.root@zimbra29-e5.priv.proxad.net> <874o2optjt.fsf@praet.org> <87hb6netf6.fsf@nzebook.haselwarter.org> <87hb6ml6ta.fsf@praet.org> <87zkkcu34g.fsf@gnu.org> <878vqx77at.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QsF0s-0002hV-Jf for emacs-orgmode@gnu.org; Sat, 13 Aug 2011 10:16:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QsF0r-0002aC-5S for emacs-orgmode@gnu.org; Sat, 13 Aug 2011 10:16:34 -0400 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:44884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QsF0r-0002a6-3A for emacs-orgmode@gnu.org; Sat, 13 Aug 2011 10:16:33 -0400 In-Reply-To: <878vqx77at.fsf@fastmail.fm> (Matt Lundin's message of "Sat, 13 Aug 2011 08:46:50 -0500") 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: Bastien Cc: Marcus Klemm , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Matt Lundin writes: > Bastien 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Allow-org-cycle-to-work-in-outline-buffers.patch >From 2361624ba5b6fb9a49ebfa55f0cfc7245488437e Mon Sep 17 00:00:00 2001 From: Matt Lundin 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 --=-=-=--