[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About prog-prettify-symbols
From: |
Ted Zlatanov |
Subject: |
Re: About prog-prettify-symbols |
Date: |
Sun, 16 Jun 2013 06:02:11 -0400 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (darwin) |
On Thu, 13 Jun 2013 17:09:00 +0200 Tassilo Horn <address@hidden> wrote:
TH> Hi all,
TH> I have some issues with `prog-prettify-symbols'.
TH> 1. I'd like to get it working with clojure-mode [fn:1]. In clojure,
TH> `fn' is what `lambda' is in elisp or common lisp.
...
TH> So what makes clojure-mode so special that it gets messed up? One
TH> difference I can see is that c-mode and emacs-lisp-mode derive from
TH> prog-mode directly, whereas in clojure-mode there's
TH> ;; For compatibility with Emacs < 24, derive conditionally
TH> (defalias 'clojure-parent-mode
TH> (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
TH> ;;;###autoload
TH> (define-derived-mode clojure-mode clojure-parent-mode "Clojure"
TH> ...)
TH> But then I've tried to make it derive from prog-mode directly, and
TH> it's still messed up in the same respects.
I don't know how to fix this, sorry. I looked at the code and can't see
where `clojure-mode' font-locking diverges from the other modes I tested.
TH> 2. Would it be possible to make prettification a bit more flexible? For
TH> example, in clojure I'd like to display also (defn ...) as (deƒ ...),
TH> but currently it seems I can only "replace" a fixed symbol with a
TH> single character. I think, it would be better if
TH> `prog-prettify-symbols-alist' would have the form
TH> ((REGEX GROUP CHAR) ...)
TH> so that I could have an alist like
TH> (("de\\(fn\\)" 1 ?ƒ)
TH> ("fn" 0 ?ƒ))
TH> to show (fn ...) as (ƒ ...) and (defn ...) as (deƒ ...).
Juanma requested something similar, a string instead of a single
character. The string is much simpler than using the match data, you'd
just give "deƒ" as the replacement. I think mixing match data into the
prettification rule makes it less user-friendly even though it's
certainly more powerful.
Ted