GithubHelp home page GithubHelp logo

Comments (17)

arbv avatar arbv commented on June 27, 2024 1

Lispindent's behaviour can be customised as described here https://github.com/ds26gte/scmindent/blob/master/README.adoc.

from cormanlisp.

ninejaguar avatar ninejaguar commented on June 27, 2024

image

The then and else branches should be aligned.

You're right, they're aligned in Portacle...

image

from cormanlisp.

arbv avatar arbv commented on June 27, 2024

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.

phoe avatar phoe commented on June 27, 2024

If anything, indentation behavior should be configurable as soon as swank indentation is available on Corman CL. (See #43)

from cormanlisp.

ninejaguar avatar ninejaguar commented on June 27, 2024

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.

phoe avatar phoe commented on June 27, 2024

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.

arbv avatar arbv commented on June 27, 2024

@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.

arbv avatar arbv commented on June 27, 2024

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.

ninejaguar avatar ninejaguar commented on June 27, 2024

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"))

https://lisp-lang.org/style-guide/

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)

http://dept-info.labri.fr/~idurand/enseignement/lst-info/PFS/Common/Strandh-Tutorial/indentation.html

from cormanlisp.

arbv avatar arbv commented on June 27, 2024

@ninejaguar
@luismbo

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.

ninejaguar avatar ninejaguar commented on June 27, 2024

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...

image

But, using progn or prog2 instead seems to work...

image

image

from cormanlisp.

arbv avatar arbv commented on June 27, 2024

@ninejaguar

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.

olopierpa avatar olopierpa commented on June 27, 2024

from cormanlisp.

ninejaguar avatar ninejaguar commented on June 27, 2024

@arbv

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...

image

from cormanlisp.

ninejaguar avatar ninejaguar commented on June 27, 2024

@olopierpa

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.

arbv avatar arbv commented on June 27, 2024

Fixed.

from cormanlisp.

arbv avatar arbv commented on June 27, 2024

I have updated the 3.1 release to include the fix for this issue.

from cormanlisp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.