Just to follow up, I'm now using the following to pretty up Clojure code
in Emacs

#+begin_src emacs-lisp
  ;; symbols for some overlong function names
  (eval-after-load 'clojure-mode
    '(font-lock-add-keywords
      'clojure-mode
      (mapcar
       (lambda (pair)
         `(,(car pair)
           (0 (progn (compose-region
                      (match-beginning 0) (match-end 0)
                      ,(cadr pair))
                     nil))))
       `(("\\<fn\\>" ,(make-char 'greek-iso8859-7 107))
         ("\\<comp\\>" ?∘)
         ("\\<partial\\>" ?þ)
         ("\\<complement\\>" ?¬)))))
#+end_src

I think the results look quite nice, a small example is attached
Best -- Eric

"Eric Schulte" <schulte.e...@gmail.com> writes:

> Hi Paul,
>
> Thanks for sharing this.  It seems like the best compromise between the
> desire to keep my code brief (at least to my eyes) without wanting to
> introduce my own custom function names for global functions.
>
> If you don't mind I'd like to add this to my fork of the Emacs Starter
> Kit (will credit you as author).
>
> Best -- Eric
>
> Paul Hobbs <paul.mcdill.ho...@gmail.com> writes:
>
>> Well, for those who use emacs, you could always make it *look* like it was
>> pretty... For example:
>>
>> (eval-after-load 'clojure-mode
>>   '(font-lock-add-keywords
>>     'clojure-mode `(("\\<fn\\>"
>>      (0 (progn (compose-region
>> (match-beginning 0) (match-end 0)
>> ,(make-char 'greek-iso8859-7 107)) ;; a lambda
>>        nil)))
>>     ("\\<comp\\>"
>>      (0
>>       (progn (compose-region
>>       (match-beginning 0) (match-end 0)
>>       "∘ ")
>>      nil)))
>>     ("\\<partial\\>"
>>      (0
>>       (progn (compose-region
>>       (match-beginning 0) (match-end 0)
>>       "𝒫 ")))))))
>>
>> On Mon, Nov 15, 2010 at 5:19 PM, Cyrus Harmon <cyrushar...@gmail.com> wrote:
>>
>>>
>>> I think the minimal character count for composition and partial functions
>>> in haskell are some of the reasons that haskell code is so impenetrable to
>>> non-haskell hackers. Feel free to rig up crazy unicode characters to any
>>> identifier you want in your own code, just don't ask me to read or debug any
>>> of it.
>>>
>>> On Nov 15, 2010, at 2:12 PM, Paul Hobbs wrote:
>>>
>>> Coming from Haskell, where composition and partial functions are cheap and
>>> free in terms of character count, it is actually pretty discouraging to have
>>> to spell it out in Clojure for the same effect.  Some of the cases where you
>>> "should" be using multiple expressions in Clojure would be perfectly clear
>>> in Haskell as one expression...
>>>
>>> On Mon, Nov 15, 2010 at 11:37 AM, Sean Corfield 
>>> <seancorfi...@gmail.com>wrote:
>>>
>>>> On Mon, Nov 15, 2010 at 10:26 AM, Alan <a...@malloys.org> wrote:
>>>> > The one that bugs me is complement - such a long name for a commonly-
>>>> > useful function. I often wind up defining ! as an alias for
>>>> > complement, but maybe others will think that is poor style.
>>>>
>>>> Possibly because bang functions indicate "Here be dragons" in terms of
>>>> mutating state? e.g., set!
>>>>
>>>> Are you really using complement a lot? I guess I would define an alias
>>>> for the complement-ed function or use not in expressions...
>>>> --
>>>> Sean A Corfield -- (904) 302-SEAN
>>>> Railo Technologies, Inc. -- http://getrailo.com/
>>>> An Architect's View -- http://corfield.org/
>>>>
>>>> "If you're not annoying somebody, you're not really alive."
>>>> -- Margaret Atwood
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Clojure" group.
>>>> To post to this group, send email to clojure@googlegroups.com
>>>> Note that posts from new members are moderated - please be patient with
>>>> your first post.
>>>> To unsubscribe from this group, send email to
>>>> clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/clojure?hl=en
>>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>>

<<attachment: abbrev-function-names.png>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to