From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Cycling visibility of blocks Date: Sun, 24 May 2009 15:58:06 -0700 Message-ID: References: <87skiuryr2.fsf@selenimh.orion.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M8Me0-0006FX-Kh for emacs-orgmode@gnu.org; Sun, 24 May 2009 18:58:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M8Mdw-0006FL-5h for emacs-orgmode@gnu.org; Sun, 24 May 2009 18:58:16 -0400 Received: from [199.232.76.173] (port=33020 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M8Mdw-0006FI-27 for emacs-orgmode@gnu.org; Sun, 24 May 2009 18:58:12 -0400 Received: from mail-pz0-f175.google.com ([209.85.222.175]:33558) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M8Mdv-0006z6-Hg for emacs-orgmode@gnu.org; Sun, 24 May 2009 18:58:11 -0400 Received: by pzk5 with SMTP id 5so3012695pzk.14 for ; Sun, 24 May 2009 15:58:10 -0700 (PDT) In-Reply-To: <87skiuryr2.fsf@selenimh.orion.org> (emacs-orgmode@gnu.org's message of "Sun, 24 May 2009 23:12:49 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Hi, The attached file should implement this feature, just load the file and then press tab while at the beginning of a source block. Note that it requires a newish version of org-mode which includes the `org-tab-first-hook' variable. Maybe this would make sense for all org blocks, not just src blocks? Cheers -- Eric --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=org-block-hide.el Content-Transfer-Encoding: quoted-printable ;;; org-block-hide --- hide src blocks in org-mode files (defvar org-block-hide-src-block-regexp "#\\+begin_src \\(.+\\)[ \t]*\\([ \= t]+\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_src") (defun org-block-hide-ui-src-block-cycle-maybe () (let ((case-fold-search t)) (if (save-excursion (beginning-of-line 1) (looking-at org-block-hide-src-block-regexp)) (progn (call-interactively 'org-block-hide-ui-src-block-cycle) t) ;; to signal that we took action nil))) ;; to signal that we did not (defun org-block-hide-ui-src-block-cycle () "Cycle the visibility of the current source code block" (interactive) ;; should really do this once in an (org-mode hook) (add-to-invisibility-spec '(org-block-hide-ui . t)) (message "trying out source block") (save-excursion (beginning-of-line) (if (re-search-forward org-block-hide-src-block-regexp nil t) (let ((start (- (match-beginning 4) 1)) ;; beginning of body (end (match-end 0))) ;; end of entire body (if (memq t (mapcar (lambda (overlay) (eq (overlay-get overlay 'invisible) 'org-b= lock-hide-ui)) (overlays-at start))) (remove-overlays start end 'invisible 'org-block-hide-ui) (overlay-put (make-overlay start end) 'invisible 'org-block-hid= e-ui))) (error "not looking at a source block")))) ;; org-tab-after-check-for-cycling-hook (add-hook 'org-tab-first-hook 'org-block-hide-ui-src-block-cycle-maybe) --=-=-= emacs-orgmode@gnu.org writes: > Hello, > > I perhaps have missed it in the manual, but, would it be possible to > cycle visibility in blocks like in the example below ? > > #+BEGIN_something > blah blah blah > blah > blah blah > and so much blah yet to come > #+END_something > > becomes > > #+BEGIN_something > ... > #+END_something > > It could help when you have those big BEGIN_SRC getting in the way. > > Thanks. --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--