Live data from Hacker News

Practical Emacs Lisp

ergoemacs.org

1–10 of 60 posts

Re: Practical Emacs Lisp

#5
post #4

Inexperienced Emacs Lisp programmers coming to this site for the first time should be aware that Xah Lee's code is generally not very idiomatic. He discusses it himself here: http://ergoemacs.org/misc/emacs_lisp_coding_style_language_i...

I'm an experienced Lisp programmer and most of it looks fine to me from a random sampling, as far as formatting goes.

Sometimes a closing parenthesis is on a line by itself:

   (defun foo ()
      ...
   )

   (let ((x y)
         (z w)
        )
      ...)
Historically, it's not been unheard of that Lisp experts (even implementors) do this sort of thing. Exhibit A, randomly picked source file inside CLISP:

http://sourceforge.net/p/clisp/clisp/ci/default/tree/src/clo...

Some of Xah's indentation is inconsistent:

   (function
    (one space)
    indent like data)

   (function
     (two space indent)
     like code))
Not too much stands out otherwise; the code is readable.

I'd have to read deeper to see whether things that are usually done one way are done differently for no good reason. What I would consider "unidiomatic" would be, for instance:

  (if (not (null list)) ...)
rather than

  (if list ...)
(Any Lisp dialect requiring code such the former is labelled differently, namely "idiotic".)

Re: Practical Emacs Lisp

#7
post #4

Inexperienced Emacs Lisp programmers coming to this site for the first time should be aware that Xah Lee's code is generally not very idiomatic. He discusses it himself here: http://ergoemacs.org/misc/emacs_lisp_coding_style_language_i...

I'm an experienced Lisp programmer and most of it looks fine to me from a random sampling, as far as formatting goes. Sometimes a closing parenthesis is on a line by itself: (defun foo () ... ) (let ((x y) (z w) ) ...) Historically, it's not been unheard of that Lisp experts (even implementors) do this sort of thing. Exhibit A, randomly picked source file inside CLISP: http://sourceforge.net/p/clisp/clisp/ci/default/…

I perused a couple of links. This code [0] is pretty much unidiomatic. Closing parens one per line and using setq all over the place.

[0]: http://ergoemacs.org/emacs/elisp_grep_string_inside_tag.html

Re: Practical Emacs Lisp

#8
post #4

Inexperienced Emacs Lisp programmers coming to this site for the first time should be aware that Xah Lee's code is generally not very idiomatic. He discusses it himself here: http://ergoemacs.org/misc/emacs_lisp_coding_style_language_i...

[deleted]

Re: Practical Emacs Lisp

#9

Earlier quoted context omitted.

I'm an experienced Lisp programmer and most of it looks fine to me from a random sampling, as far as formatting goes. Sometimes a closing parenthesis is on a line by itself: (defun foo () ... ) (let ((x y) (z w) ) ...) Historically, it's not been unheard of that Lisp experts (even implementors) do this sort of thing. Exhibit A, randomly picked source file inside CLISP: http://sourceforge.net/p/clisp/clisp/ci/default/…

I perused a couple of links. This code [0] is pretty much unidiomatic. Closing parens one per line and using setq all over the place. [0]: http://ergoemacs.org/emacs/elisp_grep_string_inside_tag.html

That is pretty atrocious. All the initializing setq's could just be init forms in the let.

Now you might think that this is also unidiomatic:

  (setq totalCnt (1+ totalCnt))
Turns out, though, that Elisp doesn't have modify macros, except in the CL compatibility package.

What Xah is doing is the same as the accepted SO answer for incrementing a local variable:

http://stackoverflow.com/questions/6858894/how-to-increment-...

Re: Practical Emacs Lisp

#10
post #4

Inexperienced Emacs Lisp programmers coming to this site for the first time should be aware that Xah Lee's code is generally not very idiomatic. He discusses it himself here: http://ergoemacs.org/misc/emacs_lisp_coding_style_language_i...

I'd say that inexperienced Lisp programmers are likely to be classed as inexperienced based on far deeper issues than formatting. The sort of things that keep code from running correctly or at all. YMMV.
Post reply on HN