emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Ilya Shlyakhter <ilya_shl@alum.mit.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: inline source code blocks
Date: Thu, 06 Mar 2014 19:22:45 -0700	[thread overview]
Message-ID: <87iorqu4qy.fsf@gmail.com> (raw)
In-Reply-To: <lfb0nj$fhf$1@ger.gmane.org> (Ilya Shlyakhter's message of "Thu, 06 Mar 2014 18:35:29 -0500")

> 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

  reply	other threads:[~2014-03-07  2:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 21:28 inline source code blocks Ilya Shlyakhter
2014-03-06 22:04 ` Eric Schulte
2014-03-06 23:35   ` Ilya Shlyakhter
2014-03-07  2:22     ` Eric Schulte [this message]
2014-03-07  2:52       ` Ilya Shlyakhter
2014-03-07  0:02   ` Ilya Shlyakhter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iorqu4qy.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ilya_shl@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).