From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gregor Kappler Subject: adapted org-flag-drawer to hide newlines of consecutive drawers to save lines Date: Tue, 12 Nov 2013 16:47:14 +0100 Message-ID: <87iovx7hbx.fsf@univie.ac.at> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgGEF-0003HT-Br for emacs-orgmode@gnu.org; Tue, 12 Nov 2013 10:50:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VgGE8-0007mD-1z for emacs-orgmode@gnu.org; Tue, 12 Nov 2013 10:50:11 -0500 Received: from mout.gmx.net ([212.227.17.21]:57218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgGE7-0007h5-Pd for emacs-orgmode@gnu.org; Tue, 12 Nov 2013 10:50:04 -0500 Received: from localhost ([84.113.167.110]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0MCLQ1-1VpN1s2oxV-0097mF for ; Tue, 12 Nov 2013 16:50:01 +0100 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: emacs-orgmode@gnu.org Often several consecutive drawers follow the headline in my setup. Maybe this code to hide newlines after drawers is of some use. When drawers are hidden this wastes three lines of screen real estate : * heading : :LOGBOOK:... : :CLOCK:... : :PROPERTIES:... per line. I adapted org-flag-drawer to hide the newlines as well if another drawer is following: : * heading : :LOGBOOK:...:CLOCK:...:PROPERTIES:... This lead to a much denser editing experience. Maybe this is not the best way to do this. But this trick caused no troubles for me during the last months. All the best! Gregor #+BEGIN_SRC emacs-lisp (defun org-flag-drawer (flag) "When FLAG is non-nil, hide the drawer we are within, including the newline at end of a drawer, yet only if another drawer is following. If FLAG is nil, make drawer it visible." (save-excursion (beginning-of-line 1) (when (looking-at "^[ \t]*:[a-zA-Z][a-zA-Z0-9]*:") (let ((b (match-end 0)) (selective-display-ellipses nil)) (if (re-search-forward "^[ \t]*:END:" (save-excursion (outline-next-heading) (point)) t) (outline-flag-region b (save-excursion (forward-line) (if (looking-at org-drawer-regexp) (point-at-bol) (match-end 0))) flag) (error ":END: line missing at position %s in buffer %s" b (buffer-name))))))) #+END_SRC Refererences -- org.el::org-cycle-hide-drawers --