From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Rose Subject: Re: Pretty org-entities in org-mode buffers Date: Wed, 05 May 2010 23:48:03 +0200 Message-ID: <87hbmm58bw.fsf@gmx.de> References: <87zl0e2ue7.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O9mRx-0006Fm-0M for emacs-orgmode@gnu.org; Wed, 05 May 2010 17:48:13 -0400 Received: from [140.186.70.92] (port=51881 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9mRv-0006En-F3 for emacs-orgmode@gnu.org; Wed, 05 May 2010 17:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O9mRt-0001YQ-Pi for emacs-orgmode@gnu.org; Wed, 05 May 2010 17:48:11 -0400 Received: from mail.gmx.net ([213.165.64.20]:40319) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1O9mRt-0001Xs-4i for emacs-orgmode@gnu.org; Wed, 05 May 2010 17:48:09 -0400 In-Reply-To: <87zl0e2ue7.fsf@gmail.com> (Eric Schulte's message of "Wed, 05 May 2010 10:19:44 -0600") 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: Eric Schulte Cc: Org Mode "Eric Schulte" writes: > Hi, > > Recently I've been making use of org-entites for exporting my greek/math > heavy class notes to HTML. I'm really loving the results. > > This morning I've started playing around with the below function > `org-pretty-entities', which is adapted from Phil Hagelberg's > `pretty-lambdas'[1]. Calling this function in an org-mode buffer will > have the effect of fontifying all org-entities text strings as the > character which they represent, so \Delta is replaced with =CE=94, \lambda > with =CE=BB, \in with =E2=88=88, and so forth. > > I've just started playing with this, and I make no guarantees as to it's > safety or utility, but I was very pleasantly surprised by the simplicity > of the function, and how nice it's been to see my special characters > appear in org-mode buffers as I type. > > #+begin_src emacs-lisp :results silent > (defun org-pretty-entities () > (interactive) > (font-lock-add-keywords > nil (mapcar > (lambda (el) > (list > (concat "(?\\(" (regexp-quote "\\") (nth 0 el) "[\s]" "\\)") > `(0 (progn (compose-region (match-beginning 1) (- (match-end= 1) 1) > ,(nth 6 el)) nil)))) > org-entities))) >=20=20=20 > (org-pretty-entities) > #+end_src > > To try this out, just evaluate the above code block inside of an > org-mode buffer, then starting typing out org-entities. > > Hope others find this useful. Wow :-) :results beautiful Sebastian