Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs mode/function that wraps operators with spaces

I remember that there was a mode for Emacs, or was it an option, can't recall, that prettified the code by placing space after operators like ,, ., wrapped = with spaces, and some other cools stuff that I can't remember.

I reckon that this is pretty much language-specific issue, but I usually put space after commas, and wrap = with spaces. Any ideas about this mode?

like image 526
aL3xa Avatar asked Oct 18 '11 06:10

aL3xa


2 Answers

You're probably thinking of smart-operator.el.

like image 158
sanityinc Avatar answered Oct 29 '22 18:10

sanityinc


How about smartchr.el? This is probably not what you are trying to recall, but I'm sure it works nicely for that purpose.

For example:

(require 'smartchr)
(global-set-key (kbd "=") (smartchr '(" = " " == " "=")))

With this configuration, when you type = several times,  =  is inserted and it rotates to  ==  to = then back to  = .

Here is an introduction by the author (written in Japanese, but with a demo video and example of configuration): http://tech.kayac.com/archive/emacs-tips-smartchr.html

like image 36
yibe Avatar answered Oct 29 '22 17:10

yibe