How to build an editor with Emacs Lisp - 07 Basic Loops reddit / emacs ---------------------------------------------------------------------- lxsameer · 2022-06-18 18:05 ---------------------------------------------------------------------- licht1nstein · 2022-06-18 21:34 eval-defun is not what you say it is ---------------------------------------------------------------------- lxsameer · 2022-06-18 21:49 Thanks for your feedback, That was what I understood from the docs. What do you have in mind? ---------------------------------------------------------------------- licht1nstein · 2022-06-18 21:51 Try it ---------------------------------------------------------------------- lxsameer · 2022-06-18 21:56 I did actually. Would you mind sharing your thoughts ? I think there is a misunderstanding here ---------------------------------------------------------------------- licht1nstein · 2022-06-18 21:57 Ok, if `eval-defun` executes all top-level forms in a buffer, then what does `eval-buffer` do? ---------------------------------------------------------------------- lxsameer · 2022-06-18 22:10 * \`eval-buffer\` "Execute the accessible portion of current buffer as Lisp code." * \`eval-defun\` "Evaluate the top-level form containing point, or after point" \^\^ from the docs :) ---------------------------------------------------------------------- licht1nstein · 2022-06-18 23:19 Dude rewatch your own video ---------------------------------------------------------------------- lxsameer · 2022-06-18 23:29 I just did. I don't know what you are referring to. It seems right to me and based on docs right. I appreciate you taking the time but could you be more specific and clear? ---------------------------------------------------------------------- licht1nstein · 2022-06-18 23:33 You say in the video that eval-defun runs all top level forms. It doesn't. ---------------------------------------------------------------------- lxsameer · 2022-06-18 23:43 Thank you. But i didn't say "run". I said it evaluates top level forms. That aligns with the docstring of the function. :) ---------------------------------------------------------------------- mrprofessor007 · 2022-06-19 00:16 Be nice! ---------------------------------------------------------------------- disconsis · 2022-06-19 06:20 Haven't seen the video tbh, but the distinction being pointed out might be that it doesn't evaluate "all" top level forms, just the one the point is currently in ---------------------------------------------------------------------- licht1nstein · 2022-06-19 08:11 Exactly ---------------------------------------------------------------------- Bodertz · 2022-06-19 09:14 Which is to say it evaluates top-level forms. ---------------------------------------------------------------------- X7and7 · 2022-06-19 12:18 Very nice! I'll watch the series to freshen up my elisp. ---------------------------------------------------------------------- lxsameer · 2022-06-19 12:19 Cheers, I'll try my best ---------------------------------------------------------------------- disconsis · 2022-06-19 16:07 Your wording makes it seem like it evaluates the whole buffer ---------------------------------------------------------------------- [deleted] · 2022-06-19 17:22 [deleted] ---------------------------------------------------------------------- onetom · 2022-06-19 17:54 @lxsameer thanks for the mention; you pronounced my name perfectly @3:16 you are saying "you can automatically evaluate *all* the top level functions, you have in your buffer", which indeed how one would describe the behavior of `eval-buffer`, not `eval-defun`, as /u/licht1nstein pointed it out. @3:28 "with one function, re-evaluate all the function definitions or other top-level definitions you have" also sounds like as if you were describing eval-buffer. @3:45 "it's a great way to evaluate top-level functions ... top-level expressions" this one sounds correct I think the problem here is that instead of "all the top-level functions", you should have said "any top-level function", to indicate, that only a single function is evaluated by eval-defun. You should have demonstrated how eval-defun works, though and mention its default C-M-x shortcut too. That would have cleared things up :) But, hey, practice makes the master, so keep on doing these videos and keep on incorporating feedback! ---------------------------------------------------------------------- lxsameer · 2022-06-19 17:58 Hey friend, Thanks for the feedback, I'll make sure to point the mistake and the correction in the next episode. ;) ---------------------------------------------------------------------- licht1nstein · 2022-06-19 21:27 Thanks for taking the time to explain it all in such detail. ---------------------------------------------------------------------- onetom · 2022-06-20 01:51 it has just occurred to me this morning, that the built-in ielm REPL would be better for these kind of tutorial videos, because past evaluation results and printed messages would stay on the screen. ielm also allows you to select a buffer as the target of the evaluation, so you can demonstrate editing commands/functions too. ---------------------------------------------------------------------- lxsameer · 2022-06-20 07:57 I thought about ielm tbh. One of the key points that I wanted to implicitly demonstrate is that as a user we can literally evaluate elisp expressions anywhere. But I think an episode on ielm would be pretty useful as well.