From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: bug#15888: 24.3.50; Eval-after-load eval'ed twice Date: Tue, 19 Nov 2013 23:06:02 -0500 Message-ID: <87txf71zv9.fsf@gmail.com> References: <868uws6lgt.fsf@somewhere.org> <86ob5mxktp.fsf@somewhere.org> <4jppq1ha35.fsf@fencepost.gnu.org> <86pppwkvhg.fsf__36548.772143624$1384891681$gmane$org@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Viz3W-00033j-W6 for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 23:06:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Viz3S-0002GN-3a for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 23:06:22 -0500 Received: from plane.gmane.org ([80.91.229.3]:35956) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Viz3R-0002GH-Oq for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 23:06:18 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Viz3Q-0008PS-6R for emacs-orgmode@gnu.org; Wed, 20 Nov 2013 05:06:16 +0100 Received: from pool-108-7-96-134.bstnma.fios.verizon.net ([108.7.96.134]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Nov 2013 05:06:16 +0100 Received: from ndokos by pool-108-7-96-134.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Nov 2013 05:06:16 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org "Sebastien Vauban" writes: > Glenn Morris wrote: >> Apparently this is fixed: >> >> http://lists.gnu.org/archive/html/emacs-orgmode/2013-11/msg00682.html > > Sadly, it's only partially fixed: if it is WELL fixed for the original co= de, > the problem comes BACK with the following minimized Emacs file: > > (add-to-list 'load-path "~/Public/Repositories/org-mode/testing") > (add-to-list 'load-path "~/Public/Repositories/org-mode/contrib/lisp") > (add-to-list 'load-path "~/Public/Repositories/org-mode/lisp") > > ;; getting started > (require 'org-loaddefs) > (add-to-list 'auto-mode-alist '("\\.txt\\'" . org-mode)) > (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) > > (with-eval-after-load "ob-lob" > ;; load some code blocks into the library of Babel > (let ((lob-file (concat (file-name-directory (locate-library "org")) > "../doc/library-of-babel.org"))) > (when (file-exists-p lob-file) > (org-babel-lob-ingest lob-file)))) > > (with-eval-after-load "org" > (message "Eval this when Org is loaded") > (sit-for 3) > (message "")) > > (message "End of minimal .emacs") > > FYI, I just added the lines 10-15 (expression with `ob-lob'). > > That's only reproducible with a development branch of Org mode, as > library-of-babel.org is not copied into the official Emacs release. > Well, Nicolas warned us that we are not out of the woods yet. I repeated the previous exercise, this time with the following file: --8<---------------cut here---------------start------------->8--- (add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/lisp")) (add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/contrib= /lisp")) (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-m= ode)) (require 'org-loaddefs) (with-eval-after-load "ob-lob" ;; load some code blocks into the library of Babel (let ((lob-file (concat (file-name-directory (locate-library "org")) "../doc/library-of-babel.org"))) (when (file-exists-p lob-file) (org-babel-lob-ingest lob-file)))) (defun foobar () (message "LOADED") (sit-for 3) (message "")) (setq org-load-hook (function foobar)) --8<---------------cut here---------------end--------------->8--- started emacs with emacs -Q -l ./double-load.el edebugged foobar and C-x C-f foo.org. It stopped at foobar twice and I got the following backtraces at the two stopping points. The first backtrace looks like this: --8<---------------cut here---------------start------------->8--- foobar() run-hooks(org-load-hook) eval-buffer(# nil "/home/nick/src/emacs/org/org-mo= de/lisp/org.el" nil t) load-with-code-conversion("/home/nick/src/emacs/org/org-mode/lisp/org.el"= "/home/nick/src/emacs/org/org-mode/lisp/org.el" nil t) org-mode() set-auto-mode-0(org-mode nil) set-auto-mode() normal-mode(t) after-find-file(nil t) find-file-noselect-1(# "~/src/emacs/org/org-= mode/doc/library-of-babel.org" nil nil "~/src/emacs/org/org-mode/doc/librar= y-of-babel.org" (16393680 2097)) find-file-noselect("/home/nick/src/emacs/org/org-mode/lisp/../doc/library= -of-babel.org" nil nil nil) find-file("/home/nick/src/emacs/org/org-mode/lisp/../doc/library-of-babel= .org") (progn (find-file file)) (if file (progn (find-file file))) (progn (if file (progn (find-file file))) (setq to-be-removed (current-bu= ffer)) (goto-char (point-min)) (while (re-search-forward org-babel-src-bloc= k-regexp nil t) (if (org-babel-active-location-p) (progn (goto-char (match-= beginning 0)) (let ((full-block (match-string 0)) (beg-block (match-beginni= ng 0)) (end-block (match-end 0)) (lang (match-string 2)) (beg-lang (match-b= eginning 2)) (end-lang (match-end 2)) (switches (match-string 3)) (beg-swit= ches (match-beginning 3)) (end-switches (match-end 3)) (header-args (match-= string 4)) (beg-header-args (match-beginning 4)) (end-header-args (match-en= d 4)) (body (match-string 5)) (beg-body (match-beginning 5)) (end-body (mat= ch-end 5))) (let* ((info ...) (source-name ...)) (if source-name (progn ...= ))) (goto-char end-block)))))) (unwind-protect (progn (if file (progn (find-file file))) (setq to-be-rem= oved (current-buffer)) (goto-char (point-min)) (while (re-search-forward or= g-babel-src-block-regexp nil t) (if (org-babel-active-location-p) (progn (g= oto-char (match-beginning 0)) (let ((full-block ...) (beg-block ...) (end-b= lock ...) (lang ...) (beg-lang ...) (end-lang ...) (switches ...) (beg-swit= ches ...) (end-switches ...) (header-args ...) (beg-header-args ...) (end-h= eader-args ...) (body ...) (beg-body ...) (end-body ...)) (let* (... ...) (= if source-name ...)) (goto-char end-block)))))) (set-window-configuration w= config)) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (i= f file (progn (find-file file))) (setq to-be-removed (current-buffer)) (got= o-char (point-min)) (while (re-search-forward org-babel-src-block-regexp ni= l t) (if (org-babel-active-location-p) (progn (goto-char (match-beginning 0= )) (let (... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (let*= ... ...) (goto-char end-block)))))) (set-window-configuration wconfig))) (let* ((file file) (visited-p (or (null file) (get-file-buffer (expand-fi= le-name file)))) (point (point)) to-be-removed) (let ((wconfig (current-win= dow-configuration))) (unwind-protect (progn (if file (progn (find-file file= ))) (setq to-be-removed (current-buffer)) (goto-char (point-min)) (while (r= e-search-forward org-babel-src-block-regexp nil t) (if (org-babel-active-lo= cation-p) (progn (goto-char ...) (let ... ... ...))))) (set-window-configur= ation wconfig))) (if visited-p nil (kill-buffer to-be-removed)) (goto-char = point)) (let ((lob-ingest-count 0)) (let* ((file file) (visited-p (or (null file)= (get-file-buffer (expand-file-name file)))) (point (point)) to-be-removed)= (let ((wconfig (current-window-configuration))) (unwind-protect (progn (if= file (progn (find-file file))) (setq to-be-removed (current-buffer)) (goto= -char (point-min)) (while (re-search-forward org-babel-src-block-regexp nil= t) (if (org-babel-active-location-p) (progn ... ...)))) (set-window-config= uration wconfig))) (if visited-p nil (kill-buffer to-be-removed)) (goto-cha= r point)) (message "%d src block%s added to Library of Babel" lob-ingest-co= unt (if (> lob-ingest-count 1) "s" "")) lob-ingest-count) org-babel-lob-ingest("/home/nick/src/emacs/org/org-mode/lisp/../doc/libra= ry-of-babel.org") (progn (org-babel-lob-ingest lob-file)) (if (file-exists-p lob-file) (progn (org-babel-lob-ingest lob-file))) (let ((lob-file (concat (file-name-directory (locate-library "org")) "../= doc/library-of-babel.org"))) (if (file-exists-p lob-file) (progn (org-babel= -lob-ingest lob-file)))) (lambda nil (let ((lob-file (concat (file-name-directory (locate-library = "org")) "../doc/library-of-babel.org"))) (if (file-exists-p lob-file) (prog= n (org-babel-lob-ingest lob-file)))))() funcall((lambda nil (let ((lob-file (concat (file-name-directory (locate-= library "org")) "../doc/library-of-babel.org"))) (if (file-exists-p lob-fil= e) (progn (org-babel-lob-ingest lob-file)))))) mapc(funcall ((lambda nil (let ((lob-file (concat (file-name-directory (l= ocate-library "org")) "../doc/library-of-babel.org"))) (if (file-exists-p l= ob-file) (progn (org-babel-lob-ingest lob-file))))))) do-after-load-evaluation("/home/nick/src/emacs/org/org-mode/lisp/ob-lob.e= l") load-with-code-conversion("/home/nick/src/emacs/org/org-mode/lisp/ob-lob.= el" "/home/nick/src/emacs/org/org-mode/lisp/ob-lob.el" nil t) require(ob-lob) eval-buffer(# nil "/home/nick/src/emacs/org/org-mo= de/lisp/ob.el" nil t) load-with-code-conversion("/home/nick/src/emacs/org/org-mode/lisp/ob.el" = "/home/nick/src/emacs/org/org-mode/lisp/ob.el" nil t) require(ob) eval-buffer(# nil "/home/nick/src/emacs/org/org-mo= de/lisp/ob-emacs-lisp.el" nil t) load-with-code-conversion("/home/nick/src/emacs/org/org-mode/lisp/ob-emac= s-lisp.el" "/home/nick/src/emacs/org/org-mode/lisp/ob-emacs-lisp.el" nil t) require(ob-emacs-lisp) (progn (require (intern (concat "ob-" lang)))) (if active (progn (require (intern (concat "ob-" lang)))) (progn (funcall= (quote fmakunbound) (intern (concat "org-babel-execute:" lang))) (funcall = (quote fmakunbound) (intern (concat "org-babel-expand-body:" lang))))) (let ((active (cdr pair)) (lang (symbol-name (car pair)))) (if active (pr= ogn (require (intern (concat "ob-" lang)))) (progn (funcall (quote fmakunbo= und) (intern (concat "org-babel-execute:" lang))) (funcall (quote fmakunbou= nd) (intern (concat "org-babel-expand-body:" lang)))))) (lambda (pair) (let ((active (cdr pair)) (lang (symbol-name (car pair))))= (if active (progn (require (intern (concat "ob-" lang)))) (progn (funcall = (quote fmakunbound) (intern (concat "org-babel-execute:" lang))) (funcall (= quote fmakunbound) (intern (concat "org-babel-expand-body:" lang)))))))((em= acs-lisp . t)) mapc((lambda (pair) (let ((active (cdr pair)) (lang (symbol-name (car pai= r)))) (if active (progn (require (intern (concat "ob-" lang)))) (progn (fun= call (quote fmakunbound) (intern (concat "org-babel-execute:" lang))) (func= all (quote fmakunbound) (intern (concat "org-babel-expand-body:" lang))))))= ) ((emacs-lisp . t))) org-babel-do-load-languages(org-babel-load-languages ((emacs-lisp . t))) custom-initialize-reset(org-babel-load-languages (quote ((emacs-lisp . t)= ))) custom-declare-variable(org-babel-load-languages (quote ((emacs-lisp . t)= )) "Languages which can be evaluated in Org-mode buffers.\nThis list can be= used to load support for any of the languages\nbelow, note that each langu= age will depend on a different set of\nsystem executables and/or Emacs mode= s. When a language is\n\"loaded\", then code blocks in that language can b= e evaluated\nwith `org-babel-execute-src-block' bound by default to C-c\nC-= c (note the `org-babel-no-eval-on-ctrl-c-ctrl-c' variable can\nbe set to re= move code block evaluation from the C-c C-c\nkeybinding. By default only E= macs Lisp (which has no\nrequirements) is loaded." :group org-babel :set or= g-babel-do-load-languages :version "24.1" :type (alist :tag "Babel Language= s" :key-type (choice (const :tag "Awk" awk) (const :tag "C" C) (const :tag = "R" R) (const :tag "Asymptote" asymptote) (const :tag "Calc" calc) (const := tag "Clojure" clojure) (const :tag "CSS" css) (const :tag "Ditaa" ditaa) (c= onst :tag "Dot" dot) (const :tag "Emacs Lisp" emacs-lisp) (const :tag "Fort= ran" fortran) (const :tag "Gnuplot" gnuplot) (const :tag "Haskell" haskell)= (const :tag "IO" io) (const :tag "Java" java) (const :tag "Javascript" js)= (const :tag "LaTeX" latex) (const :tag "Ledger" ledger) (const :tag "Lilyp= ond" lilypond) (const :tag "Lisp" lisp) (const :tag "Makefile" makefile) (c= onst :tag "Maxima" maxima) (const :tag "Matlab" matlab) (const :tag "Mscgen= " mscgen) (const :tag "Ocaml" ocaml) (const :tag "Octave" octave) (const :t= ag "Org" org) (const :tag "Perl" perl) (const :tag "Pico Lisp" picolisp) (c= onst :tag "PlantUML" plantuml) (const :tag "Python" python) (const :tag "Ru= by" ruby) (const :tag "Sass" sass) (const :tag "Scala" scala) (const :tag "= Scheme" scheme) (const :tag "Screen" screen) (const :tag "Shell Script" sh)= (const :tag "Shen" shen) (const :tag "Sql" sql) (const :tag "Sqlite" sqlit= e) (const :tag "ebnf2ps" ebnf2ps)) :value-type (boolean :tag "Activate" :va= lue t))) eval-buffer(# nil "/home/nick/src/emacs/org/org-mode/lisp= /org.el" nil t) load-with-code-conversion("/home/nick/src/emacs/org/org-mode/lisp/org.el"= "/home/nick/src/emacs/org/org-mode/lisp/org.el" nil t) org-mode() set-auto-mode-0(org-mode nil) set-auto-mode() normal-mode(t) after-find-file(t t) find-file-noselect-1(# "~/src/emacs/org/org-mode/foo.org"= nil nil "~/src/emacs/org/org-mode/foo.org" nil) find-file-noselect("~/src/emacs/org/org-mode/foo.org" nil nil t) find-file("~/src/emacs/org/org-mode/foo.org" t) call-interactively(find-file nil nil) command-execute(find-file) --8<---------------cut here---------------end--------------->8--- The second backtrace is "normal": --8<---------------cut here---------------start------------->8--- foobar() run-hooks(org-load-hook) eval-buffer(# nil "/home/nick/src/emacs/org/org-mode/lisp= /org.el" nil t) load-with-code-conversion("/home/nick/src/emacs/org/org-mode/lisp/org.el"= "/home/nick/src/emacs/org/org-mode/lisp/org.el" nil t) org-mode() set-auto-mode-0(org-mode nil) set-auto-mode() normal-mode(t) after-find-file(t t) find-file-noselect-1(# "~/src/emacs/org/org-mode/foo.org"= nil nil "~/src/emacs/org/org-mode/foo.org" nil) find-file-noselect("~/src/emacs/org/org-mode/foo.org" nil nil t) find-file("~/src/emacs/org/org-mode/foo.org" t) call-interactively(find-file nil nil) command-execute(find-file) --8<---------------cut here---------------end--------------->8--- HTH. --=20 Nick