From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: inline source code blocks Date: Thu, 06 Mar 2014 19:22:45 -0700 Message-ID: <87iorqu4qy.fsf@gmail.com> References: <874n3bug4r.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLkT5-0000jc-Nf for emacs-orgmode@gnu.org; Thu, 06 Mar 2014 21:25:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLkSz-0006C9-40 for emacs-orgmode@gnu.org; Thu, 06 Mar 2014 21:24:59 -0500 Received: from mail-pb0-x230.google.com ([2607:f8b0:400e:c01::230]:49826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLkSy-0006Bz-Tj for emacs-orgmode@gnu.org; Thu, 06 Mar 2014 21:24:53 -0500 Received: by mail-pb0-f48.google.com with SMTP id md12so3474943pbc.7 for ; Thu, 06 Mar 2014 18:24:51 -0800 (PST) In-Reply-To: (Ilya Shlyakhter's message of "Thu, 06 Mar 2014 18:35:29 -0500") 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: Ilya Shlyakhter Cc: emacs-orgmode@gnu.org > I'm finding that Org would work well as a literate programming system > for C++, if the code block starts and ends didn't get in the way so much > during frequent switching between code and prose. > > > I use the following to make code block syntax less intrusive > > Thanks, that was helpful, didn't know about compose-region. > Still, it does not reduce the number of lines used, so a short list of > declarations interspersed with comments quickly ends up taking a lot of > vertical space. When coding it helps to be able to see many things at > once, and having many extra lines (even mostly-blank ones) makes that > difficult. > I agree that maximizing code per vertical space is important. However, keeping Org-mode parseable and editable is also important. How about the following alternative to my previous suggestion, which will eliminate the extra lines. (defun prettier-org-code-blocks () (interactive) (font-lock-add-keywords nil '(("\\(^[[:space:]]*#\\+begin_src .*[\r\n]\\)" (0 (progn (compose-region (match-beginning 1) (match-end 1) "") nil))) ("\\(^[[:space:]]*#\\+end_src[\r\n]\\)" (0 (progn (compose-region (match-beginning 1) (match-end 1) "") nil)))))) Best, > > ilya > > > -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D