emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Prettier (or at least fancier) code block delimiters
Date: Tue, 21 Jan 2014 13:31:29 -0700	[thread overview]
Message-ID: <87vbxdnkke.fsf@gmail.com> (raw)

Hi,

I tried the following on a lark not thinking I'd like it.  However,
after a week or two I've yet to turn it off and I think it makes my code
block heavy Org-mode buffers somewhat more readable, so I'm sharing it
here.

    ;; -*- emacs-lisp -*-
    (defun prettier-org-code-blocks ()
      (interactive)
      (font-lock-add-keywords nil
        '(("\\(\+begin_src\\)"
           (0 (progn (compose-region (match-beginning 1) (match-end 1) ?¦)
                     nil)))
          ("\\(\+end_src\\)"
           (0 (progn (compose-region (match-beginning 1) (match-end 1) ?¦)
                     nil))))))
    (add-hook 'org-mode-hook 'prettier-org-code-blocks)

Add it to your config or evaluate in your scratch buffer, then open a
new Org-mode file with code blocks to give it a try.

Best,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

                 reply	other threads:[~2014-01-21 20:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87vbxdnkke.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).