From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Pretty org-entities in org-mode buffers Date: Fri, 7 May 2010 09:11:30 +0200 Message-ID: References: <87zl0e2ue7.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OANib-0001yn-8P for emacs-orgmode@gnu.org; Fri, 07 May 2010 09:35:53 -0400 Received: from [140.186.70.92] (port=47582 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OANiT-0006Kb-GP for emacs-orgmode@gnu.org; Fri, 07 May 2010 09:35:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAHin-0001Q2-9Q for emacs-orgmode@gnu.org; Fri, 07 May 2010 03:13:01 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:39858) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAHim-0001PL-Bv for emacs-orgmode@gnu.org; Fri, 07 May 2010 03:11:40 -0400 Received: by wyb40 with SMTP id 40so240679wyb.0 for ; Fri, 07 May 2010 00:11:37 -0700 (PDT) In-Reply-To: <87zl0e2ue7.fsf@gmail.com> 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 Dear Eric, this is fantastic. This is kind of like X-symbol, only that I can =20 just write my trusted LaTeX macros and get all those characters. =20 Makes me think that I need to add a few more symbols that I commonly =20 use in math expressions. I am wondering if we could be a bit more generous with the regular =20 expression. For example, I would love for $\alpha=3D\beta$ to show the =20= symbols as well. Also there should be a switch for turning this on and off. I would like to integrate this code into org-entities.el. Thanks for all your contributions, which continue to make Org-mode so =20= much richer. - Carsten On May 5, 2010, at 6:19 PM, Eric Schulte wrote: > Hi, > > Recently I've been making use of org-entites for exporting my greek/=20= > 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 =20= > it's > safety or utility, but I was very pleasantly surprised by the =20 > 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]" "\=20= > \)") > `(0 (progn (compose-region (match-beginning 1) (- (match-=20= > end 1) 1) > ,(nth 6 el)) nil)))) > org-entities))) > > (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. > > Best -- Eric > > Footnotes: > [1] = http://github.com/technomancy/emacs-starter-kit/blob/master/starter-kit-de= funs.el#L135 > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten