From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Pretty org-entities in org-mode buffers Date: Sun, 16 May 2010 15:09:27 -0600 Message-ID: <87bpcfh7ug.fsf@gmail.com> 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 [140.186.70.92] (port=51203 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODl5k-0004I6-RV for emacs-orgmode@gnu.org; Sun, 16 May 2010 17:09:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ODl5g-0004Tt-Ts for emacs-orgmode@gnu.org; Sun, 16 May 2010 17:09:44 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:42877) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODl5f-0004TQ-9T for emacs-orgmode@gnu.org; Sun, 16 May 2010 17:09:40 -0400 Received: by pvg12 with SMTP id 12so1887140pvg.0 for ; Sun, 16 May 2010 14:09:37 -0700 (PDT) In-Reply-To: (Carsten Dominik's message of "Sun, 16 May 2010 07:51:26 +0200") 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: Carsten Dominik Cc: Org Mode Hi Carsten, Thanks for folding in this feature. I'm having some weird issues using the new entities display. The entities are not fontified in my org-mode buffers despite having set the org-pretty-entities variable to t. However if I search `isearch-forward-regexp' for the "\\" character in the buffer then all of the entities are displayed (e.g. \sum is replaced with =E2=88=91). Any idea why the entity display is only working during a search? Thanks -- Eric Carsten Dominik writes: > Hi everyone, > > a modified version of Eric's code is now included into Org, I just > pushed it > to the git repo. > > You can use the command `C-c C-x \' to toggle this feature. > > The variable `org-pretty-entities' determines if this mode is on by > default. > > Finally, you can use > > #+STARTUP: entitiespretty > #+STARTUP: entitiesplain > > to change things on a per-file base. > > Thanks to Eric for this great idea. > > - 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/ >> 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, \lamb= da >> 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))) >> >> (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-defuns.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