From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: bug#15888: 24.3.50; Eval-after-load eval'ed twice
Date: Tue, 19 Nov 2013 23:06:02 -0500 [thread overview]
Message-ID: <87txf71zv9.fsf@gmail.com> (raw)
In-Reply-To: 86pppwkvhg.fsf__36548.772143624$1384891681$gmane$org@somewhere.org
"Sebastien Vauban" <sva-news@mygooglest.com>
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 code,
> 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-mode))
(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(#<buffer *load*-648596> 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(nil t)
find-file-noselect-1(#<buffer library-of-babel.org> "~/src/emacs/org/org-mode/doc/library-of-babel.org" nil nil "~/src/emacs/org/org-mode/doc/library-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-buffer)) (goto-char (point-min)) (while (re-search-forward org-babel-src-block-regexp nil t) (if (org-babel-active-location-p) (progn (goto-char (match-beginning 0)) (let ((full-block (match-string 0)) (beg-block (match-beginning 0)) (end-block (match-end 0)) (lang (match-string 2)) (beg-lang (match-beginning 2)) (end-lang (match-end 2)) (switches (match-string 3)) (beg-switches (match-beginning 3)) (end-switches (match-end 3)) (header-args (match-string 4)) (beg-header-args (match-beginning 4)) (end-header-args (match-end 4)) (body (match-string 5)) (beg-body (match-beginning 5)) (end-body (match-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-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 (goto-char (match-beginning 0)) (let ((full-block ...) (beg-block ...) (end-block ...) (lang ...) (beg-lang ...) (end-lang ...) (switches ...) (beg-switches ...) (end-switches ...) (header-args ...) (beg-header-args ...) (end-header-args ...) (body ...) (beg-body ...) (end-body ...)) (let* (... ...) (if source-name ...)) (goto-char end-block)))))) (set-window-configuration wconfig))
(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 (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-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 (goto-char ...) (let ... ... ...))))) (set-window-configuration 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-configuration wconfig))) (if visited-p nil (kill-buffer to-be-removed)) (goto-char point)) (message "%d src block%s added to Library of Babel" lob-ingest-count (if (> lob-ingest-count 1) "s" "")) lob-ingest-count)
org-babel-lob-ingest("/home/nick/src/emacs/org/org-mode/lisp/../doc/library-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) (progn (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-file) (progn (org-babel-lob-ingest lob-file))))))
mapc(funcall ((lambda nil (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)))))))
do-after-load-evaluation("/home/nick/src/emacs/org/org-mode/lisp/ob-lob.el")
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(#<buffer *load*-685075> nil "/home/nick/src/emacs/org/org-mode/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(#<buffer *load*-632088> nil "/home/nick/src/emacs/org/org-mode/lisp/ob-emacs-lisp.el" nil t)
load-with-code-conversion("/home/nick/src/emacs/org/org-mode/lisp/ob-emacs-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 (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))))))
(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)))))))((emacs-lisp . t))
mapc((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))))))) ((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 language will depend on a different set of\nsystem executables and/or Emacs modes. When a language is\n\"loaded\", then code blocks in that language can be 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 remove code block evaluation from the C-c C-c\nkeybinding. By default only Emacs Lisp (which has no\nrequirements) is loaded." :group org-babel :set org-babel-do-load-languages :version "24.1" :type (alist :tag "Babel Languages" :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) (const :tag "Dot" dot) (const :tag "Emacs Lisp" emacs-lisp) (const :tag "Fortran" 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 "Lilypond" lilypond) (const :tag "Lisp" lisp) (const :tag "Makefile" makefile) (const :tag "Maxima" maxima) (const :tag "Matlab" matlab) (const :tag "Mscgen" mscgen) (const :tag "Ocaml" ocaml) (const :tag "Octave" octave) (const :tag "Org" org) (const :tag "Perl" perl) (const :tag "Pico Lisp" picolisp) (const :tag "PlantUML" plantuml) (const :tag "Python" python) (const :tag "Ruby" 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" sqlite) (const :tag "ebnf2ps" ebnf2ps)) :value-type (boolean :tag "Activate" :value t)))
eval-buffer(#<buffer *load*> 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(#<buffer foo.org> "~/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(#<buffer *load*> 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(#<buffer foo.org> "~/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.
--
Nick
next prev parent reply other threads:[~2013-11-20 4:06 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <868uws6lgt.fsf@somewhere.org>
[not found] ` <mailman.6013.1384380609.10748.bug-gnu-emacs@gnu.org>
[not found] ` <864n7f7u8d.fsf@somewhere.org>
[not found] ` <mailman.6027.1384398545.10748.bug-gnu-emacs@gnu.org>
[not found] ` <8638myzu9t.fsf@somewhere.org>
2013-11-14 22:01 ` bug#15888: 24.3.50; Eval-after-load eval'ed twice Glenn Morris
2013-11-15 6:04 ` Bastien
[not found] ` <87y54qdwvh.fsf-E3UqQZAQFPqWIDz0JBNUog@public.gmane.org>
2013-11-15 8:33 ` Sebastien Vauban
[not found] ` <83siuyiyq4.fsf@gnu.org>
[not found] ` <83siuyiyq4.fsf-mXXj517/zsQ@public.gmane.org>
2013-11-15 8:16 ` Sebastien Vauban
[not found] ` <868uwqxeoj.fsf@somewhere.org>
2013-11-15 8:42 ` Eli Zaretskii
[not found] ` <83iovuhx8w.fsf@gnu.org>
[not found] ` <83iovuhx8w.fsf-mXXj517/zsQ@public.gmane.org>
2013-11-15 9:06 ` Sebastien Vauban
[not found] ` <86siuyvxtn.fsf@somewhere.org>
2013-11-15 10:34 ` Eli Zaretskii
[not found] ` <mailman.6245.1384511726.10748.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.6245.1384511726.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-11-15 13:01 ` Sebastien Vauban
2013-11-15 14:15 ` Stefan Monnier
[not found] ` <jwvbo1l4utn.fsf-monnier+emacsbugs@gnu.org>
[not found] ` <jwvbo1l4utn.fsf-monnier+emacsbugs-mXXj517/zsQ@public.gmane.org>
2013-11-15 14:27 ` Sebastien Vauban
2013-11-15 14:35 ` Eli Zaretskii
2013-11-15 0:06 ` Josh
2013-11-19 20:07 ` Sebastien Vauban
[not found] ` <CANdFEAEdD1rKvXOwi+ktROSqYXTGg3tbEgTd-hHe10Zfa7YbsQ@mail.gmail.com>
2013-11-15 2:30 ` Glenn Morris
[not found] ` <oofvqygzwk.fsf@fencepost.gnu.org>
[not found] ` <oofvqygzwk.fsf-iW7gFb+/I3LZHJUXO5efmti2O/JbrIOy@public.gmane.org>
2013-11-15 6:04 ` Sebastien Vauban
[not found] ` <86ob5mxktp.fsf@somewhere.org>
2013-11-15 17:02 ` Glenn Morris
2013-11-15 17:57 ` Nick Dokos
2013-11-15 18:31 ` Nicolas Goaziou
2013-11-17 1:23 ` Nick Dokos
2013-11-17 3:06 ` Nick Dokos
2013-11-17 8:59 ` Nicolas Goaziou
2013-11-17 13:41 ` Nick Dokos
2013-11-17 18:05 ` Nick Dokos
[not found] ` <4jppq1ha35.fsf@fencepost.gnu.org>
2013-11-17 19:45 ` Glenn Morris
[not found] ` <mailman.6434.1384717570.10748.bug-gnu-emacs@gnu.org>
[not found] ` <868uws6lgt.fsf-oHC15RC7JGTNLxjTenLetw@public.gmane.org>
2013-11-19 20:05 ` Sebastien Vauban
2013-11-20 4:06 ` Nick Dokos [this message]
2013-11-23 14:05 ` Nicolas Goaziou
2013-12-04 20:48 ` Sebastien Vauban
2013-12-04 21:35 ` Nicolas Goaziou
2020-05-22 12:51 ` Bastien
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 \
--in-reply-to=87txf71zv9.fsf@gmail.com \
--to=ndokos@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).