emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <ucecesf@ucl.ac.uk>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Pretty org-entities in org-mode buffers
Date: Fri, 07 May 2010 16:01:37 +0100	[thread overview]
Message-ID: <8739y369im.wl%ucecesf@ucl.ac.uk> (raw)
In-Reply-To: <87zl0e2ue7.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2162 bytes --]

On Wed, 05 May 2010 10:19:44 -0600, "Eric Schulte" <schulte.eric@gmail.com> 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 Δ, \lambda
> with λ, \in with ∈, 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.

Eric,

I am indeed finding this useful (as my notes are often math heavy as
well).  One question: I don't fully understand the regexp above,
especially as I would have expected a specific character after the \s,
so is it possible to make the mapping take effect if I type, say
"\alpha."?  Note the punctuation instead of a space, say.

Other than that, it works really nicely and fits in very well with the
org philosophy (e.g. links) in that the underlying representation is
still simple text.  I've added this to my org-mode-hook and so far
everything is fine.

Thanks,
eric

[-- Attachment #2: Type: text/plain, Size: 75 bytes --]

-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

  parent reply	other threads:[~2010-05-07 16:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-05 16:19 Pretty org-entities in org-mode buffers Eric Schulte
2010-05-05 21:48 ` Sebastian Rose
2010-05-07  7:11 ` Carsten Dominik
2010-05-07 15:27   ` Eric Schulte
2010-05-07 18:20     ` Eric S Fraga
2010-05-08  5:15     ` Carsten Dominik
2010-05-08  5:17     ` Carsten Dominik
2010-05-07 15:01 ` Eric S Fraga [this message]
2010-05-16  5:51 ` Carsten Dominik
2010-05-16 21:09   ` Eric Schulte
2010-05-17  8:09     ` Eric S Fraga
2010-05-17 14:28     ` Carsten Dominik
2010-05-17 14:32     ` Carsten Dominik
2010-05-17 15:01       ` Eric Schulte
2010-06-03  8:48         ` Carsten Dominik
2010-06-03 17:51           ` Eric Schulte
2010-06-03 21:50             ` Carsten Dominik
2010-06-04  8:57             ` Carsten Dominik
2010-06-04 23:42               ` Eric Schulte
2010-06-05  9:06                 ` Eric S Fraga
2010-06-05  9:18                   ` Carsten Dominik
2010-06-05 18:36   ` Daniel E. Doherty
2010-06-18 18:16     ` Raghav Kumar Gautam
2010-06-24  6:57       ` Carsten Dominik
2010-06-24 13:16         ` Raghav Kumar Gautam
2010-06-24 13:48           ` Sebastian Rose
2010-06-24 14:47             ` Raghav Kumar Gautam

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=8739y369im.wl%ucecesf@ucl.ac.uk \
    --to=ucecesf@ucl.ac.uk \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /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).