emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Bastien <bzg@altern.org>
Cc: Marcus Klemm <marcus.klemm@googlemail.com>, emacs-orgmode@gnu.org
Subject: Re: how to change the headline starter *
Date: Sat, 13 Aug 2011 09:16:30 -0500	[thread overview]
Message-ID: <87pqk9pfb5.fsf@fastmail.fm> (raw)
In-Reply-To: <878vqx77at.fsf@fastmail.fm> (Matt Lundin's message of "Sat, 13 Aug 2011 08:46:50 -0500")

[-- Attachment #1: Type: text/plain, Size: 1433 bytes --]

Matt Lundin <mdl@imapmail.org> writes:

> Bastien <bzg@altern.org> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-org-cycle-to-work-in-outline-buffers.patch --]
[-- Type: text/x-patch, Size: 1346 bytes --]

From 2361624ba5b6fb9a49ebfa55f0cfc7245488437e Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
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	other threads:[~2011-08-13 14:16 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1728286333.2576351310650722865.JavaMail.root@zimbra29-e5.priv.proxad.net>
2011-07-14 13:53 ` how to change the headline starter * harven
2011-07-14 15:47   ` Bastien
2011-07-14 17:32     ` harven
2011-07-14 18:01       ` Nick Dokos
2011-07-16  2:05         ` Carsten Dominik
2011-07-16  6:20           ` harven
2011-07-16 10:33             ` Bastien
2011-07-16 10:31           ` Bastien
2011-07-19  5:16             ` Carsten Dominik
2011-07-25 21:33               ` Bastien
2011-07-14 19:10       ` Pieter Praet
2011-07-15 10:21         ` Philipp Haselwarter
2011-07-15 10:40           ` Jambunathan K
2011-07-16 12:59           ` Pieter Praet
2011-07-17  8:08             ` Aankhen
2011-07-17  9:59               ` Christian Moe
2011-07-17 14:53             ` Marcus Klemm
2011-07-17 19:19               ` Bastien
2011-07-17 19:43                 ` Achim Gratz
2011-07-18  8:16                   ` Bastien
2011-08-13 13:46                 ` Matt Lundin
2011-08-13 14:16                   ` Matt Lundin [this message]
2011-08-16 16:40                     ` Bastien
2011-07-15 11:30         ` Memnon Anon
2011-07-15 10:49       ` Bastien
2011-07-15 18:19         ` Achim Gratz
2011-07-15 21:04           ` harven
2011-07-15 21:55             ` harven
2011-07-16 11:12             ` Bastien
2011-07-16 11:08           ` Bastien
2011-07-15 11:03       ` Bastien
2011-07-14 19:28     ` Philipp Haselwarter
2011-07-15 10:52       ` Nicolas Goaziou
2011-07-15 11:30         ` Memnon Anon
2011-07-15 11:51           ` Bastien
2011-07-15 11:50         ` Bastien
2011-07-15 12:08           ` Nicolas Goaziou
2011-07-16 11:22             ` Bastien
2011-07-15 10:56       ` Bastien
2011-07-25 10:12         ` org-icons package (was: how to change the headline starter *) Renzo Been
2011-07-27 15:50           ` org-icons package Bastien
2011-06-11 18:58 how to change the headline starter * harven
2011-06-13 20:32 ` Darlan Cavalcante Moreira
2011-07-02  9:48   ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pqk9pfb5.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=marcus.klemm@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).