Comments (10)
Thank for the feedback and what you proposed makes sense actually. At least for point 1 (we could have a nano-faces.el
) and point 2 (code will be more consistent with the way I wrote nano-modeline.el
). For the third point, I'm not sure to understand why a non conventional indentation would break anything since we have parens to delimit blocks. I would understand for Python but for elisp, I really wonder.
from nano-emacs.
I understand that you will see changes for points 1 and 2 favorably - as such I will keep doing my edits and I hope to be able to show a PR before tomorrow, to keep the discussion going on these points.
Regarding point 3, I understand this might sound confusing - elisp is indeed not white space sensitive.
The glitch comes from parinfer-mode ; which infers parens from indentation ; and indentation from parens. It can get confused by unconventional indentation, which results in broken code.
Here's an example, when copying the whole nano-theme.el from a browser:
(defface nano-face-default nil
"Default face is used for regular information.") ;; <- wrongly inferred parens here
:group 'nano
Where it should have worked better, like so:
(defface nano-face-default nil
"Default face is used for regular information."
:group 'nano) ;; <-- should have inferred white space at the beginning of this line
I concede that you could very well say "not my problem" and leave it there.
As it happens, fixing unconventional indentation in a few spots is a quick and easy workaround to this parinfer bug. Clean, conventional indentation makes the code subjectively easier to read. It hopefully provides a consensual code style that all contributors can try to stick to, which reduces review size in PR and makes git blame
more useful.
from nano-emacs.
In fact I do not like very much automated tools that think they're smarter than me in terms of indentation and I tend to favor readability over correctness, even it if confuses tools. However, I've not yet strong opinion about identation in elisp and I can try to stick as much as possible to the default scheme. Can you make a separate PR for the indentation? Also, is there some linters to check indendation? I tried parinfer-mode but I think we're not friends.
from nano-emacs.
I understand favoring readability. It is however a more subjective metric than correctness is.
With regards with linters, I casually looked into it yesterday and I have not found anything widely adopted / popular that would be a good first choice. There are a number of automatic code formatters - but they're
It's non trivial for me to isolate the indentation change. Wrapping all the face setting looks like a full file rewrite from a git perspective at this point. I tried not to reindent thing for reindenting sake but I did notice parinfer doing a few things. I'll try to fight it back with settings in further commits following your review.
from nano-emacs.
You mean that asking emacs to re-indent the whole file would not do the trick ?
from nano-emacs.
Also, is there some linters to check indendation? I tried parinfer-mode but I think we're not friends.
You can try aggressive-indent
for elisp to prevent wrong indentation in the future.
from nano-emacs.
Using emacs itself to indent emacs lisp feels like the right way to go about it. I'm not sure how to have every contributor indentation settings converge though. First thing that comes to mind is having extensive # -*- ... -*-
blocks on each file specifying file local indentation settings. Another way would be nano-codestyle.el
that I can just require / call when needed - at the risk of forgetting doing it.
Code formatting tools tend to have their own isolated settings that can be versioned, which solves the problem of having identical indentation settings for everyone.
aggressive-indent
looks interesting, but it's the polar opposite of parinfer : with parinfer, you manually indent and parens are edited appropriately, with aggressive-indent you manually edit parens and indent is edited appropriately. I don't believe one can have both modes enabled at once.
from nano-emacs.
I don't believe one can have both modes enabled at once.
Sure.
from nano-emacs.
you manually edit parens
I use electric-pair-mode
for it. I prefer it over paredit-mode
, because it's available out of the box and feels not so pedantic (I can feel control).
from nano-emacs.
The relevant PR was merged, so I think this issue should be closed.
The conversation about coding style and linting will probably resume at some point in the future. I have no consensual solution to propose on this question at this time.
from nano-emacs.
Related Issues (20)
- Contrast difference for agenda tasks that are overdue and scheduled today HOT 13
- [Bug] Error "Invalid face" bookmark-menu-heading - causes ivy minibuffer on some commands to throw error (+ other packages) HOT 4
- [Bug] Org-mode headings in source code blocks override indentation and formatting from src code block HOT 4
- [Feature Request] Ability to change code syntax highlighting theme inside nano HOT 1
- Changing the default to Nano Dark? HOT 8
- Hide nano-modeline HOT 2
- Nano Writer Mode HOT 1
- frame/windows layout change when opening minibuffer
- Different `display-buffer` behaviour HOT 1
- nano-mu4e updates for newer mu? HOT 1
- No bookmark-menu-heading in Emacs 29.0.91 HOT 4
- ELPA version of nano-modeline is missing deps (nano-faces?) HOT 10
- We eagerly await evil-mode support!
- nano-modeline breaks on html files HOT 3
- Writer mode : add a custom to define the default font family HOT 2
- Wrong number of arguments HOT 2
- cursor stays visible in first window when switching to the second window HOT 2
- Add custom variables for optional packages HOT 1
- Weird emacs freezing with nano-modeline.el HOT 2
- (^^)(^^)(^^)(^^)(^^) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nano-emacs.