[O] Bug: org-babel-expand-noweb-references is very slow [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)]
Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. Hello, everyone. The mwe would be like: #+begin_src scheme :exports both :results output :noweb-ref bug1 #+end_src #+begin_src scheme :exports both :results output :noweb-ref bug2 #+end_src #+begin_src scheme :exports both :results output :noweb-ref bug3 #+end_src #+begin_src scheme :exports both :results output :noweb-ref bug4 #+end_src #+begin_src scheme :exports both :results output :noweb-ref bug5 #+end_src #+begin_src scheme :exports both :results output :noweb-ref bug6 #+end_src #+begin_src scheme :exports both :results output :noweb-ref bug7 #+end_src #+begin_src scheme :exports both :results output :noweb-ref bug8 #+end_src #+begin_src scheme :exports both :results output <> <> <> <> <> <> <> <> #+end_src C-c C-v C-v is already very slow, takes ~15 seconds to resolve the references (can be seen in the Emacs Profiler), even though the inclusion graph is very simple. Emacs : GNU Emacs 26.3 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 3.24.10) of 2019-08-30 Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-after-todo-state-change-hook '(org-clock-out-if-current) org-babel-after-execute-hook '((lambda nil (if org-inline-image-overlays (progn (org-redisplay-inline-images))) ) ) org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-pretty-entities t org-odt-format-headline-function 'org-odt-format-headline-default-function org-agenda-files '("~/DevLinux/chibi-sicp/index.org" "~/Personal_Planner/Planner.org") org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-modules '(org-habits org-w3m org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail) org-plantuml-jar-path "/usr/local/bin/plantuml.jar" org-mode-hook '(turn-on-org-cdlatex (lambda nil (imenu-add-to-menubar "Imenu")) #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"] org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"] org-babel-pre-tangle-hook '(save-buffer) org-latex-compiler "lualatex" org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages '((plantuml . t) (C . t) (scheme . t) (latex . t)) org-log-done 'time org-startup-align-all-tables t org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"] org-catch-invisible-edits t org-occur-hook '(org-first-headline-recenter) org-edit-src-auto-save-idle-delay 15 org-agenda-include-diary t org-structure-template-alist '(("E" "#+begin_src elisp :exports both :results output\n?\n#+end_src") ("SV" "#+begin_src scheme :exports both :results value\n?\n#+end_src") ("SO" "#+begin_src scheme :exports both :results output\n?\n#+end_src") ("p" "#+begin_src plantuml :exports both :file ? \n#+end_src ") ("s" "#+BEGIN_SRC ?\n\n#+END_SRC") ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE") ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE") ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE") ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM") ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER") ("C" "#+BEGIN_COMMENT\n?\n#+END_COMMENT") ("l" "#+BEGIN_EXPORT lat
[O] [PATCH] Add :eval only-manual to babel blocks
With this patch and ":eval only-manual" in a babel header, Org evaluates the source code if it is run via ~org-ctrl-c-ctrl-c~ (e.g. =C-c C-c= in the babel block), but not if run via the ~org-babel-execute-buffer~ function. This is my first contribution to Org core. I've signed FSF papers. -k. diff --git a/doc/org-manual.org b/doc/org-manual.org index 59591894d..aa72c642c 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17051,6 +17051,12 @@ evaluating untrusted code blocks by prompting for a confirmation. Org does not evaluate the source code when exporting, yet the user can evaluate it interactively. +- =only-manual= :: + + Org evaluates the source code if it is run via ~org-ctrl-c-ctrl-c~ + (e.g. =C-c C-c= in the babel block), but not if run via the + ~org-babel-execute-buffer~ function. + - =query-export= :: Org prompts the user for permission to evaluate the source code diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 572f97919..15fadadf0 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -228,7 +228,9 @@ should be asked whether to allow evaluation." (let* ((headers (nth 2 info)) (eval (or (cdr (assq :eval headers)) (when (assq :noeval headers) "no"))) - (eval-no (member eval '("no" "never"))) + (manual (and (not (eq nil (member 'org-ctrl-c-ctrl-c (org--function-stack + (not (eq nil (member eval '("only-manual")) + (eval-no (member eval '("no" "never" "only-manual"))) (export org-babel-exp-reference-buffer) (eval-no-export (and export (member eval '("no-export" "never-export" (noeval (or eval-no eval-no-export)) @@ -240,10 +242,24 @@ should be asked whether to allow evaluation." (nth 0 info) (nth 1 info)) org-confirm-babel-evaluate (cond + (manual t) (noeval nil) (query 'query) (t t +(defun org--function-stack () + "Return the current call stack function names." + ;; https://emacs.stackexchange.com/questions/7396/ + (butlast (mapcar 'cl-second + (let ((frames) + (frame) + (index 5)) + (while (setq frame (backtrace-frame index)) + (push frame frames) + (incf index)) + (remove-if-not 'car frames) + + (defun org-babel-check-evaluate (info) "Check if code block INFO should be evaluated. Do not query the user, but do display an informative message if
Re: [O] Bug: org-babel-expand-noweb-references is very slow [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)]
Hello, Vladimir Nikishkin writes: > The mwe would be like: > > #+begin_src scheme :exports both :results output :noweb-ref bug1 > #+end_src > > #+begin_src scheme :exports both :results output :noweb-ref bug2 > #+end_src > > #+begin_src scheme :exports both :results output :noweb-ref bug3 > #+end_src > > #+begin_src scheme :exports both :results output :noweb-ref bug4 > #+end_src > > #+begin_src scheme :exports both :results output :noweb-ref bug5 > #+end_src > > #+begin_src scheme :exports both :results output :noweb-ref bug6 > #+end_src > > #+begin_src scheme :exports both :results output :noweb-ref bug7 > #+end_src > > #+begin_src scheme :exports both :results output :noweb-ref bug8 > #+end_src > > #+begin_src scheme :exports both :results output > <> > <> > <> > <> > <> > <> > <> > <> > #+end_src > > C-c C-v C-v is already very slow, takes ~15 seconds to resolve the references > (can be seen in the Emacs Profiler), even though the inclusion graph is > very simple. Please try a more recent version of Org. Release 9.1.9 is pretty old. It might be fixed already. Regards, -- Nicolas Goaziou
Re: [O] Bug: Python session raises indentation error [9.2.6 (9.2.6-elpa @ /home/tobias/.emacs.d/elpa/org-9.2.6/)]
Dear, org-mode developer, I was not aware of the fact, that new lines are special in interactive mode and indicate the end of an indented block (I have just found out about that in the babel documentation for python). Therefore the issue which I have reported is probably not a bug but rather an expected behavior. Please excuse me for positing a false bug report. Best regards, Tobias Müller. Am 14.10.19 um 19:55 schrieb Tobias Müller: Dear org-mode developer, I have discovered the following issue with Python code-blocks: Using the :session header argument leads to errors of the type IndentationError: expected an indented block if the code block contains indented regions with empty lines. An example code-block which produces this kind of error is the following: #+begin_src python :session for k in range(3): print(k) #+end_src removing the :session header argument leads to correct execution of the code block. The same is true if the :results output header argument is used. If the blank line within the for-loop is removed the loop also gets executed correctly, however after executing the block the error NameError: name '_' is not defined is raised in the buffer of the Python session. The generated info-file is attached to this mail. Best regards, Tobias Müller.
[O] [PATCH] org-manual: Dynamic Blocks: Fix explanation of :content
* doc/org-manual.org (Dynamic Blocks): Correct the information given on :content in the plist passed to the writer function. --- doc/org-manual.org | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 59591894d..79257b7e0 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -20089,13 +20089,12 @@ These commands update dynamic blocks: Before updating a dynamic block, Org removes content between the =BEGIN= and =END= markers. Org then reads the parameters on the -=BEGIN= line for passing to the writer function. If the function -expects to access the removed content, then Org expects an extra -parameter, =:content=, on the =BEGIN= line. +=BEGIN= line for passing to the writer function as a plist. The +previous content of the dynamic block becomes erased from the buffer +and appended to the plist under ~:content~. The syntax for naming a writer function with a dynamic block labelled -=myblock= is: ~org-dblock-write:myblock~. Parameters come from the -=BEGIN= line. +=myblock= is: ~org-dblock-write:myblock~. The following is an example of a dynamic block and a block writer function that updates the time when the function was last run: -- 2.23.0
[O] [PATCH] Respect buffer-local value of `org-edit-src-content-indentation'
* lisp/org-src.el (org-src--contents-for-write-back): Use the potentially buffer-local value of `org-edit-src-content-indentation' from the source buffer instead of that from the editing buffer. --- lisp/org-src.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 9134d5b5d..b7fe4c0fa 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -422,7 +422,8 @@ Assume point is in the corresponding edit buffer." (if org-src--preserve-indentation 0 (+ (or org-src--block-indentation 0) (if (memq org-src--source-type '(example-block src-block)) - org-edit-src-content-indentation + (with-current-buffer (marker-buffer org-src--beg-marker) + org-edit-src-content-indentation) 0 (use-tabs? (and (> org-src--tab-width 0) t)) (source-tab-width org-src--tab-width) -- 2.23.0
[O] Configuring listings for file or language
Greetings. The help documentation for the variable org-latex-listings-options suggests that it is easy to configure these options - globally for all files and languages using this variable - for each code block separately using #+attr_latex Is it possible to configure these options for all code blocks 1. in a single org file 2. for a single language? Thanks! Jarmo