pesterhazy / zprint-mode.el Goto Github PK
View Code? Open in Web Editor NEWEmacs minor mode for pretty-printing Clojure using zprint
License: GNU General Public License v3.0
Emacs minor mode for pretty-printing Clojure using zprint
License: GNU General Public License v3.0
When trying to run zprint
on a clojure file I get the following. It might be work adding the option to specify a local zprint path.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 604 0 604 0 0 703 0 --:--:-- --:--:-- --:--:-- 702
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
0 47.0M 0 254k 0 0 99k 0 0:08:04 0:00:02 0:08:02 239k
6 47.0M 6 3065k 0 0 896k 0 0:00:53 0:00:03 0:00:50 1592k
18 47.0M 18 8825k 0 0 2007k 0 0:00:23 0:00:04 0:00:19 3043k
29 47.0M 29 13.7M 0 0 2608k 0 0:00:18 0:00:05 0:00:13 3608k
40 47.0M 40 19.1M 0 0 3064k 0 0:00:15 0:00:06 0:00:09 3998k
52 47.0M 52 24.7M 0 0 3430k 0 0:00:14 0:00:07 0:00:07 5192k
64 47.0M 64 30.5M 0 0 3719k 0 0:00:12 0:00:08 0:00:04 5658k
77 47.0M 77 36.3M 0 0 3955k 0 0:00:12 0:00:09 0:00:03 5665k
89 47.0M 89 42.1M 0 0 4153k 0 0:00:11 0:00:10 0:00:01 5820k
100 47.0M 100 47.0M 0 0 4283k 0 0:00:11 0:00:11 --:--:-- 5894k
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/matthys/.pyenv/versions/3.7.1/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 25: invalid continuation byte
Hello!
I found this library extremely useful!!! Thanks for writing it.
I was fiddling with adding a defcustom to allow for optionally calling zprint with the --hang option, since I prefer that output. Makes sense to have it be an option only, because it ~doubles the time that zprint takes...
The part I'm not sure about is exaclty how this package calls into the graal version of zprint, or I would do it myself.
Hi there, thanks for the project, it is really quick with the native binary.
I am using the autoformatting feature of this mode but I see that sometimes the result does not match what I would get from the command line.
At the command line we force a {search-config? true}
option so that zprint goes up the directories tries to find either .zprintrc
or .zprint.edn
.
Does this mode do the same/should it do that?
PS.: maybe I am missing something and there is another way
Any reason for not choosing before-save-hook?
My beautifully reformatted file stays unsaved, because it was changed, until my next save.
Hi again, I am skimming the code and wrap-zprint
and I have noticed that both the wrapper and the version are hard-coded.
Would you be open to a patch that makes both configurable?
Having the binary called directly is probably a good idea if somebody went a ahead and installed zprint
herself.
Thanks!
First, thanks for zprint-mode :)
I had some trouble getting it to work initially -- it looks like there is an expectation of python2 being used. Is that right?
For whatever reasons, the system I'm using treats python
as python3
. Changing the instance of python
in the following bit to python2
seems to work for me:
$(python -c \"import sys,hashlib; m=hashlib.sha256(); f=open(sys.argv[1]) if len(sys.argv)>1 else sys.stdin; m.update(f.read()); print(m.hexdigest())\" \"$our_temp_dir/zprint\")\";
This seems consistent with:
We expect Unix-like software distributions (including systems like macOS and Cygwin) to install the python2 command into the default path whenever a version of the Python 2 interpreter is installed, and the same for python3 and the Python 3 interpreter
via: https://www.python.org/dev/peps/pep-0394/#for-python-runtime-distributors
Do you think changing the code to reference python2
would be reasonable?
You probably know that zprint has a :width
key in the top level options-map. You can get it to format to any width. Not everyone uses 80 columns as their preferred width. Now if you don't do anything, it should use ~/.zprintrc to initialize itself, and people can put a :width
value there, which might be the best thing. Also, if you configure {:cwd-zprintrc? true}
in ~/.zprintrc
, zprint will also look for a .zprintrc
in its current working directory. The theory is that this allows different projects to have different formatting standards. So if you do nothing special, all of that works and is probably pretty reasonable.
On the other hand, you might want to (optionally?) figure out someone's preferred width from a buffer (or something) in emacs and use that? I don't know if that makes sense or not (or would be possible or not on the emacs side). But it seemed worth mentioning it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.