From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: [RFC] Remove Org Struct mode Date: Wed, 23 Aug 2017 10:14:17 -0500 Message-ID: <87bmn6gvue.fsf@alphapapa.net> References: <87mv6ul4u6.fsf@nicolasgoaziou.fr> <87wp5uy30w.fsf@gmx.us> <87lgmajz7v.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkXMl-0004zC-Ql for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 11:14:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dkXMh-0005th-Lk for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 11:14:47 -0400 Received: from [195.159.176.226] (port=53088 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dkXMh-0005t1-ES for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 11:14:43 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dkXMQ-0001GP-CT for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 17:14:26 +0200 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" To: emacs-orgmode@gnu.org Michael Brand writes: Hi Michael, > First thank you for taking over maintenance of outshine.el from > Thorsten Jolitz. Well, I figured it was the least I could do, since he's put so much effort into outshine, outorg, and navi-mode over the years. Be advised, although I am now the maintainer, I only comprehend a tiny fraction of them; I learn more about them when I need to fix something, which so far has hardly happened. :) > How can I collapse block-indented comments like a or b in the following?: > > ;; * Org > (defun foo () > ;; ** a > (bar) > ;; ** b > (beer)) > ;; * Calc > > orgstruct-mode supports it with orgstruct-heading-prefix-regexp set to > for example " *;;;* ". I don't think this is possible, or at least not easily. The outline-regexp variable says: 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 ‘^’. So I think you would need to modify outline-mode to do this. However, there are other ways to fold text besides outline/outline-minor-mode/outshine. You could probably do it fairly easily with the origami package. Or you could do what I do: I modify outline-regexp and outline-level so that the asterisks aren't even necessary. Instead, the heading level is set by how many semicolons there are, e.g.: ;; Regular comment ;;; Heading level 1 ;;;; Heading level 2 ... Then any comment that starts with 3 or more semicolons is indented to the left edge and becomes a collapsible heading, regardless of the indentation of the code under it. #+BEGIN_SRC elisp (defun ap/el-outline-level () (or ;; Commented outline heading (and (string-match (rx (* space) (group (one-or-more (syntax comment-start))) (one-or-more space)) (match-string 0)) (- (match-end 0) (match-beginning 0) 1)) ;; Lisp def heading ;; Add 8 (the highest standard outline level) to every keyword ;; heading (+ 8 (- (match-end 0) (match-beginning 0))))) (defun ap/el-mode-outline-hook () (setq outline-level 'ap/el-outline-level) (setq outline-regexp "\\(;;[;]\\{1,8\\} \\|\\((defun\\)\\)")) (add-hook 'emacs-lisp-mode-hook 'ap/el-mode-outline-hook) #+END_SRC It works well for me, and it doesn't even require outshine IIRC, just outline-minor-mode. I've tried to make this work in other languages too, like using the number of # characters for the outline level in shell scripts, but I failed miserably, so I use outshine for other languages. It's easier in elisp since Emacs already treats triple-semicolon comments as headings. > A bit less important for me: How can I turn off syntax highlighting of > headings, respectively generally in outshine.el? Well, the first thing that comes to mind is to unset the properties of the outline-level faces, but I'm not sure if you can do that per-buffer. So you might try removing the outline-font-lock-keywords or outline-font-lock-faces. Hope this helps. Adam