[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice
From: |
Nick Dokos |
Subject: |
Re: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice |
Date: |
Tue, 19 Nov 2013 23:06:02 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
"Sebastien Vauban" <address@hidden>
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
[O] bug#15888: 24.3.50; Eval-after-load eval'ed twice, Josh, 2013/11/16
Message not availableRe: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice, Nick Dokos, 2013/11/15
Re: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice, Nicolas Goaziou, 2013/11/15
Re: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice, Nick Dokos, 2013/11/16
Re: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice, Nick Dokos, 2013/11/16
Re: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice, Nicolas Goaziou, 2013/11/17
Re: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice, Nick Dokos, 2013/11/17
Re: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice, Nick Dokos, 2013/11/17
Re: [O] bug#15888: 24.3.50; Eval-after-load eval'ed twice, Sebastien Vauban, 2013/11/19