emacs - How can I revert 'fancy lambdas' after an edit -


when editing clojure code in emacs, it's common tweak font-lock insert 'fancy' characters lambdas, sets, anon functions.

this achieved variant of following (seen in clojure-mode, emacs-live etc.)

(dolist (mode '(clojure-mode clojurescript-mode nrepl-interaction-mode))   (eval-after-load mode     (font-lock-add-keywords      mode '(("(\\(fn\\)[\[[:space:]]"  ; anon funcs 1              (0 (progn (compose-region (match-beginning 1)                                        (match-end 1) "λ")                    nil)))         ("\\(#\\)("                ; anon funcs 2          (0 (progn (compose-region (match-beginning 1)                                    (match-end 1) "ƒ")                    nil)))         ("\\(#\\){"                 ; sets          (0 (progn (compose-region (match-beginning 1)                                    (match-end 1) "∈")                    nil))))))) 

this works great until make edit around fancy character. can leave hanging characters per following screenshot... enter image description here

how can emacs revert 'real' characters when i've made edit. nil(s) in code above modification function (presumably) , there (decompose-region) seems fit bill. how should invoked, passing symbol doesn't work.

e.g. i've tried this:

(dolist (mode '(clojure-mode clojurescript-mode nrepl-interaction-mode))   (eval-after-load mode     (font-lock-add-keywords      mode '(("(\\(fn\\)[\[[:space:]]"  ; anon funcs 1              (0 (progn (compose-region (match-beginning 1)                                        (match-end 1) "λ")                        'decompose-region)))             ("\\(#\\)("                ; anon funcs 2              (0 (progn (compose-region (match-beginning 1)                                        (match-end 1) "ƒ")                        'decompose-region)))             ("\\(#\\){"                 ; sets              (0 (progn (compose-region (match-beginning 1)                                        (match-end 1) "∈")                        'decompose-region))))))) 

the easiest way add (set (make-local-variable 'font-lock-extra-managed-props) '(composition)).


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -