Comments (17)
Lispindent's behaviour can be customised as described here https://github.com/ds26gte/scmindent/blob/master/README.adoc.
from cormanlisp.
The
then
andelse
branches should be aligned.
You're right, they're aligned in Portacle...
from cormanlisp.
It is not misindented. Dorai Sitaram's lispindent
uses old-school formatting for IF form which I kind-of like. The same formatting is used by default for Emacs Lisp, for example.
from cormanlisp.
If anything, indentation behavior should be configurable as soon as swank indentation is available on Corman CL. (See #43)
from cormanlisp.
Lispindent's behaviour can be customised as described here https://github.com/ds26gte/scmindent/blob/master/README.adoc.
Thank you for that clarifying link. I knew I'd seen that type of indentation before in Emacs but didn't have a vanilla install handy. Portacle's approach is non-standard. After comparing the two, along with the explanation in the link you'd provided, the default Emacs way makes more sense. Portacle may disappear as Lispbox and others have, but there will always be good old Emacs to show the way and compare with :-)
from cormanlisp.
Portacle may disappear as Lispbox and others have
AFAIK, both Portacle and Lispbox depend on the Swank indentation contrib that makes it possible for the Lisp image itself to provide indentation hints to the editor. See https://github.com/slime/slime/blob/master/contrib/swank-indentation.lisp
from cormanlisp.
@ninejaguar
@phoe
Portacle uses the indentation support provided by SLIME/SWANK.
To be fair, the different indentation of the IF form is a matter of taste, nothing more. And it is configurable. I should add some more information into the manual.
from cormanlisp.
I will consider changing default 'lispindent' behaviour it turns out to be a big deal for many users, although I would rather avoid supporting forked, specialised version of 'lispindent' solely because of this feature.
from cormanlisp.
I will consider changing default 'lispindent' behaviour it turns out to be a big deal for many users, although I would rather avoid supporting forked, specialised version of 'lispindent' solely because of this feature.
I don't know if you'll get the necessary user feedback, but a search on expected indentation for Common Lisp suggests that there's a strong preference to follow whatever Slime/Swank is doing on top of the default Emacs Lisp way of indentation.
According to the "Google Common Lisp Style Guide"...
"Ideally, use the default indentation settings provided by slime-indentation."
https://google.github.io/styleguide/lispguide.xml#Indentation
According to the "Lisp-Lang Style Guide"...
In the if special form, both branches must be on the same line:
(if (> x 5) (format t "Greater than five") (format t "Less than or equal to five"))
According to Robert Strandh's "Symbolic programming using Common Lisp: Indenting Common Lisp"...
Each special form has its own indentation rule. Here, we give a list of the most common ones.
Indenting the if special form
The if special form in Common Lisp takes exactly three subexpressions. The subexpressions should be lined up, like this:
(if (= (f x) 4) (top-level x) (g x))
This indentation is accomplished by the following Emacs expression that you can put in your .emacs file:
(put 'if 'lisp-indent-function nil)
from cormanlisp.
I don't know if you'll get the necessary user feedback, but a search on expected indentation for Common Lisp suggests that there's a strong preference to follow whatever Slime/Swank is doing on top of the default Emacs Lisp way of indentation.
It seems I have got enough user feedback regarding this matter.
OK then, let's try to not deviate from the more common way of indenting IF.
Does indenting IF-forms works as expected after executing the following snippet?
(setf (cdr (assoc "IF" ide::*lisp-keywords* :test #'string-equal)) -1)
P.S.
I could not imagine doing this stuff literally 3-hours after the New Year in my timezone.
from cormanlisp.
OK then, let's try to not deviate from the more common way of indenting IF.
Does indenting IF-forms works as expected after executing the following snippet?
(setf (cdr (assoc "IF" ide::*lisp-keywords* :test #'string-equal)) -1)
P.S.
I could not imagine doing this stuff literally 3-hours after the New Year in my timezone.
Happy New Year! May you and your loved ones enjoy great health and happiness in 2019!
It appears that executing the suggested snippet works on the first example below, but the second example may have an issue in the body of the THEN branch as seen in the prog1 form...
But, using progn or prog2 instead seems to work...
from cormanlisp.
It seems that 'lispindent' has some specific rules about indenting PROG1. Actually, I believe, this indentation makes sense.
BTW, SLIME/SWANK seems to indent PROG1 and PROG2 forms in exactly the same way. It has nothing to do with indenting IF-form.
Anyway, I am not sure that making current indenting engine to work exactly the same way as SLIME/SWANK is what should be done.
from cormanlisp.
from cormanlisp.
It seems that 'lispindent' has some specific rules about indenting PROG1. Actually, I believe, this indentation makes sense.
BTW, SLIME/SWANK seems to indent PROG1 and PROG2 forms in exactly the same way. It has nothing to do with indenting IF-form.
You're right. It looks like Portacle is indenting similarly based on the following snippet...
from cormanlisp.
The PROG1 is indented correctly. The first form should be on the same line as the PROG1 itself.
Good to know! Thank you for clarifying.
from cormanlisp.
from cormanlisp.
I have updated the 3.1 release to include the fix for this issue.
from cormanlisp.
Related Issues (20)
- *print-case* :capitalize does not capitalize printed values HOT 3
- The Format function's F directive's k parameter fails when preceded only by a tilde and 2 commas HOT 2
- The Format function's $ directive only displays one 0 after the decimal when default is two HOT 3
- Do not change lineendings when editing files using Corman Lisp IDE
- Consider static linking of Visual C++ runtime to the executables HOT 24
- atan2 incorrect for some inputs HOT 3
- Using keyword symbols as slot-descriptors in DEFSTRUCT
- Error when trying to create STANDARD-METHOD instances. HOT 2
- Missing file clos-tests.lisp HOT 4
- DLL compiled in "debug"? HOT 5
- sampledll causes an error when client.exe exits HOT 4
- Quicklisp HOT 4
- Implement conventional command line switches (-eval, -norc, etc) HOT 1
- load-image fails: push-module-directory undefined HOT 1
- retarget corman common lisp to GCC (GNU compiler collection) HOT 1
- Corman Lisp running on M1-based Mac (via Windows for ARM) HOT 4
- Is there a Windows binary I can download? I don't need the source code HOT 2
- Can we interface with C#? HOT 1
- Is this project still being worked on? HOT 2
- Cannot start; a window flickers then disappears
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 cormanlisp.