From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: how does invisibility impact org? Date: Tue, 26 Apr 2016 13:50:38 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1av78I-0002Ce-Ik for emacs-orgmode@gnu.org; Tue, 26 Apr 2016 13:50:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1av78E-0008Se-IX for emacs-orgmode@gnu.org; Tue, 26 Apr 2016 13:50:46 -0400 Received: from mail-qk0-x235.google.com ([2607:f8b0:400d:c09::235]:32796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1av78E-0008SM-9O for emacs-orgmode@gnu.org; Tue, 26 Apr 2016 13:50:42 -0400 Received: by mail-qk0-x235.google.com with SMTP id n63so8638684qkf.0 for ; Tue, 26 Apr 2016 10:50:40 -0700 (PDT) Received: from Johns-MacBook-Air.local (KITCHIN-TIMEMACHINE.CHEME.CMU.EDU. [128.2.54.215]) by smtp.gmail.com with ESMTPSA id z62sm9200321qka.26.2016.04.26.10.50.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 10:50:39 -0700 (PDT) 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: org-mode-email Hi, I am trying to use this code to make parts of an org-file that are not a verse block invisible. That part works fine, and I can also unhide it. However, after that, I get errors like org-back-to-heading: Before first headline at position 232 in buffer selective-text.org If I say, put the cursor in a code block and try to run it or special edit it. Any ideas what is going wrong here? Thanks, (defun flatten (LIST) "flattens LIST" (cond ((atom LIST) (list LIST)) ((null (cdr LIST)) (flatten (car LIST))) (t (append (flatten (car LIST)) (flatten (cdr LIST)))))) (defun view-verse () "Hide everything but the verse blocks." (interactive) (org-cycle '(64)) (let ((p (append (list (point-min)) (flatten (org-element-map (org-element-parse-buffer) 'verse-block (lambda (vb) (list (org-element-property :begin vb) (org-element-property :end vb))))) (list (point-max))))) (add-to-invisibility-spec 'not-verse-block) (loop for start in p by 'cddr for end in (cdr p) by 'cddr do (overlay-put (make-overlay start end) 'invisible 'not-verse-block)))) (defun unhide () (interactive) (remove-from-invisibility-spec 'not-verse-block) (ov-clear 'invisibility 'not-verse-block)) -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu