From: Nick Dokos <email@example.com> To: "Tom Breton (Tehom)" <firstname.lastname@example.org> Cc: email@example.com Subject: Re: Docs submitted (Was Re: Advice sought on managing decision alternatives.) Date: Wed, 11 Feb 2009 18:38:49 -0500 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: Message from "Tom Breton (Tehom)" <email@example.com> of "Wed, 11 Feb 2009 16:41:02 EST." <firstname.lastname@example.org> Tom Breton (Tehom) <email@example.com> wrote: > > > > On Feb 11, 2009, at 2:08 AM, Tom Breton (Tehom) wrote: > > > > >> This bug is simple. In "Setting it all up" at the end of org- > >> choose.el, > >> in 6.22b a quote got introduced before progn. That's all. With that > >> quote, it "evaluated" a quoted form and did nothing. I'd send a > >> patch, > >> but ISTM it's easier to just press backspace once. It's here: > >> > >> (eval-after-load 'org > >> '(progn > >> ;;^--HERE. > >> (add-to-list 'org-todo-setup-filter-hook > >> #'org-choose-setup-filter) > >> (add-to-list 'org-todo-get-default-hook > >> #'org-choose-get-default-mark) > >> (add-to-list 'org-trigger-hook > >> #'org-choose-keep-sensible) > >> (add-to-list 'org-todo-interpretation-widgets > >> '(:tag "Choose (to record decisions)" choose) > >> 'append) > >> )) > > > > Hi Tom, > > > > I added the quote because without it, evaluating org-chose.el did error= > . > > It was my understanding that such a form has to be quoted. Am > > I missing something here? > > What error did it give? I didn't get one here. > > Definitely the form should not be quoted. Quoted, it does nothing. > Demonstration (with libary `simple' which is fairly basic in emacs so > probably loaded for everyone): > > (let* > ((x 1)) > (eval-after-load 'simple (setq x 2)) > x) > > =3D> 2 > > > > (let* > ((x 1)) > (eval-after-load 'simple '(setq x 2)) > x) > > =3D> 1 Are you sure about this? My understanding of this differs from yours: eval-after-load is an ordinary function (not a special form), and function evaluation in most LISPs (elisp in particular) evaluates arguments before the function is called on them. So if you give it an unquoted form, the form will be evaluated *before* eval-after-load gets its hands on it. That seems to me to defeat the purpose. I'd think that the thing to do is to give the quoted form as argument, then function evaluation evaluates the argument (i.e. unquotes the quoted form, giving back the form) which is then passed to eval-after-load for action. The semantics of eval-after-load imply that (depending on whether the library is already loaded or not) the form may be evaluated once. It is then squirrelled away and if the library is ever loaded again, it is evaluated (perhaps for the first time, perhaps for the nth), *after* the library is loaded. And I think your demonstration is misleading: after doing the eval-after-load, you need to reload "simple" to trigger the "after-load" evaluation, otherwise eval-after-load reduces to just plain eval (in this particular case, since simple is, as you point out, already loaded - things would be different if you had chosen some obscure library that is not already loaded): (let* ((x 1)) (eval-after-load 'simple (setq x 2)) (load-library "simple") x) 2 (let* ((x 1)) (eval-after-load 'simple '(setq x 2)) (load-library "simple") x) 2 In the first case, (setq x 2) was evaluated, x was set to 2 and 2 was passed into eval-after-load. Assuming that simple is already loaded, the 2 is evaluated: the result is 2 and it is just thrown away. After the library is loaded again, 2 is evaluated again and the result is 2 and it just thrown away. Since x was set to 2 before, the value of x is 2. In the second case, (quote (setq x 2)) is evaluated, so the form (setq x 2) is passed to eval-after-load. Assuming that simple is already loaded, the form is evaluated, setting x to 2 and giving a result of 2 (which is thrown away). After the library is loaded, (setq x 2) is eval'led again, setting x to 2 again, and giving a result of 2 (which is thrown away). In both cases, the value of x (and therefore the value the let* form returns) is 2. But it seems to me that the second case is the useful one. Perhaps the most telling evidence that the quote should be there however is the following: if you look at eval-after-load instances in the emacs lisp directory, you'll see that the second argument in all of them is quoted or at least (when partial evaluation is required) backquoted -- although I guess one could argue that they all originated by copying a badly constructed precursor - the programming version of original sin!-) Regards, Nick
next prev parent reply other threads:[~2009-02-11 23:40 UTC|newest] Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20090101170227.C707734803@mail2.panix.com> 2009-01-01 22:53 ` Feature request and patch - blocked TODO to say BLOCKED Tom Breton (Tehom) 2009-01-09 8:16 ` Carsten Dominik 2009-01-15 2:34 ` Tom Breton (Tehom) 2009-01-17 8:01 ` Carsten Dominik 2009-01-19 3:33 ` Advice sought on managing decision alternatives Tom Breton (Tehom) 2009-01-22 11:15 ` Carsten Dominik 2009-01-31 4:21 ` Tom Breton (Tehom) 2009-01-31 5:41 ` Carsten Dominik 2009-01-31 18:36 ` Tom Breton (Tehom) 2009-02-01 15:54 ` James TD Smith 2009-02-06 13:08 ` Carsten Dominik 2009-02-06 16:16 ` William Henney 2009-02-06 20:07 ` Tom Breton (Tehom) 2009-02-07 0:18 ` Carsten Dominik 2009-02-07 20:46 ` Tom Breton (Tehom) 2009-02-08 13:06 ` Carsten Dominik 2009-02-08 20:25 ` Tom Breton (Tehom) 2009-02-09 6:42 ` Carsten Dominik 2009-02-10 3:14 ` Docs submitted (Was Re: Advice sought on managing decision alternatives.) Tom Breton (Tehom) 2009-02-10 7:55 ` Carsten Dominik 2009-02-24 0:51 ` org-choose bugfix Tom Breton (Tehom) 2009-02-24 3:05 ` Manish 2009-04-07 0:13 ` Tom Breton (Tehom) 2009-04-08 13:13 ` Carsten Dominik 2009-02-24 5:51 ` Carsten Dominik 2009-02-10 8:46 ` Docs submitted (Was Re: Advice sought on managing decision alternatives.) Manish 2009-02-10 9:12 ` Carsten Dominik 2009-02-10 10:26 ` Manish 2009-02-10 22:48 ` Tom Breton (Tehom) 2009-02-12 12:50 ` Manish 2009-02-12 20:13 ` Tom Breton (Tehom) 2009-02-13 4:23 ` Manish 2009-02-12 20:55 ` Patch " Tom Breton (Tehom) 2009-02-13 4:38 ` Manish 2009-02-11 1:08 ` Tom Breton (Tehom) 2009-02-11 10:34 ` Carsten Dominik 2009-02-11 21:41 ` Tom Breton (Tehom) 2009-02-11 23:38 ` Nick Dokos [this message] 2009-02-12 4:17 ` Tom Breton (Tehom) 2009-02-11 23:44 ` Carsten Dominik 2009-02-12 4:27 ` Tom Breton (Tehom) 2009-02-12 15:49 ` Nick Dokos 2009-02-12 20:32 ` Tom Breton (Tehom) 2009-02-12 21:25 ` Nick Dokos 2009-02-11 12:29 ` Carsten Dominik 2009-02-11 14:58 ` Docs submitted Bernt Hansen 2009-02-11 17:33 ` Samuel Wales 2009-02-11 15:38 ` Docs submitted (Was Re: Advice sought on managing decision alternatives.) Daniel Clemente 2009-02-11 15:41 ` Carsten Dominik 2009-02-11 20:02 ` Tom Breton (Tehom) 2009-02-11 23:45 ` Carsten Dominik 2009-02-11 1:45 ` Slight fix to update-org.sh Tom Breton (Tehom) 2009-02-10 23:19 ` Docs submitted (Was Re: Advice sought on managing decision alternatives.) Tom Breton (Tehom) 2009-02-11 10:34 ` Carsten Dominik 2009-02-10 22:45 ` Tom Breton (Tehom)
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: Docs submitted (Was Re: Advice sought on managing decision alternatives.)' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).