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
Practical Emacs Lisp
11–20 of 60 posts
Re: Practical Emacs Lisp
#12Inexperienced 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...
Re: Practical Emacs Lisp
#13Earlier quoted context omitted.
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…
On the setq, I what I meant was iterating through setqs and while (and I seem to recall even catch/throw) as agumonkey mentioned.
Then again, 'in my mind', idiomatic elisp uses cl-lib :D. so (cl-incf total-count) would be better. snakeCase is unidiomatic as well.
Re: Practical Emacs Lisp
#14Earlier quoted context omitted.
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
Using lisp to while/set... sigh . This is old age emacs lisp. We need more dash.el. Unfortunately we'd need a more stream/functional buffer API ? I was thinking of porting scheme regexp SRFI because it felt a better fit than re-search-*.
[0]: https://www.reddit.com/r/lisp/comments/29ufoc/it_is_not_hard...
About Scheme's regexp SRFI, have you seen rx.el? Not quite but I like it myself.
Re: Practical Emacs Lisp
#15There are much better resources to learn Emacs Lisp from.
Re: Practical Emacs Lisp
#16Xah Lee can't program a line of Lisp on his own. Most of that code is collected from elsewhere. There are much better resources to learn Emacs Lisp from.
Re: Practical Emacs Lisp
#17Xah Lee can't program a line of Lisp on his own. Most of that code is collected from elsewhere. There are much better resources to learn Emacs Lisp from.
Re: Practical Emacs Lisp
#18Inexperienced 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...
Can you recommend a tutorial that uses idiomatic Emacs Lisp and covers both "why" and "how" of Emacs Lisp at a level appropriate for someone who's used CL and Emacs a lot but has never noticed that he needs ELisp?
Re: Practical Emacs Lisp
#19Xah Lee can't program a line of Lisp on his own. Most of that code is collected from elsewhere. There are much better resources to learn Emacs Lisp from.
seems like an unnecessary personal attack
He has posted lots of bad advice, because he does not understand much Lisp programming and makes claims about all kinds of random stuff.
Re: Practical Emacs Lisp
#20Earlier quoted context omitted.
Using lisp to while/set... sigh . This is old age emacs lisp. We need more dash.el. Unfortunately we'd need a more stream/functional buffer API ? I was thinking of porting scheme regexp SRFI because it felt a better fit than re-search-*.
As far as dash.el goes, I find lispm's critique of dash.el pretty convincing[0]. However a more profilic emacs coder fried of mine is undeterred and keeps using modern emacs lisp. I think much of the community does as well. [0]: https://www.reddit.com/r/lisp/comments/29ufoc/it_is_not_hard... About Scheme's regexp SRFI, have you seen rx.el? Not quite but I like it myself.
lispm point is nice (and no one can argue about evaluation order and count), but beside the battle-tested aspect, `loop` scares the crap out of me. That's even more a reason to prefer things that avoids it in my mind, mentally small building blocks and patterns versus huge macro-based sublanguages. Yes general and probably super-efficiently implemented, but .. nah.