[O] Can I get the results of shell code block when exit code is non-zero?
Hi all, apparently when the exit code of the last command in a shell code block is not zero, I do not get the results. This doesn't seem to be documented in the manual (though I might be missing something). Check this: #+begin_src bash :results verbatim echo hello world exit 0 #+end_src and this: #+begin_src bash :results verbatim echo hello world exit 1 #+end_src How can I tell Org to put the results in the file anyway? My use case is =diff=, which exists with status 1 if differences are found, and this is a blog post, so I do not want to pollute the post with an =exit 0= at the end of the code snippet. TIA, -- Marcin Borkowski http://mbork.pl
[O] Use Emacs support for image resizing when using org-image-actual-width
I am running Emacs version 27 (building from master) and recently noticed that my images no longer scales using org-image-actual-width. I then read that ImageMagick support is no longer enabled by default as there is a new "native" resizing method built-in to Emacs. As seen in the news for on Emacs version 27 (master branch): > ** Emacs no longer defaults to using ImageMagick to display images, > due to security and stability concerns. To override the default, use > 'configure --with-imagemagick'. As well as: > ** Emacs now supports resizing and rotating images without ImageMagick. > All modern systems support this feature. (On GNU and Unix systems, > Cairo drawing or the XRender extension to X11 is required for this to > be available; the configure script will test for it and, if found, > enable scaling.) > The new function 'image-transforms-p' can be used to test whether any > given frame supports these capabilities. I then inspected the code of org-mode and noticed there is an expression in the cond that figures out how to scale, e.g.: > ((not (image-type-available-p 'imagemagick)) nil) I haven't looked into yet how the scaling is done, but I know some other modes such as image-mode had support for using the new method. I think it would be great to support the native scaling option as well when available. Since opting in to imagemagick will be Emacs wide and then we loose the benefit of the new functionality. Best regards, Terje Larsen
Re: [O] Use Emacs support for image resizing when using org-image-actual-width
Hi Terje! > I am running Emacs version 27 (building from master) and recently > noticed that my images no longer scales using org-image-actual-width. > > I then read that ImageMagick support is no longer enabled by default as > there is a new "native" resizing method built-in to Emacs. > > As seen in the news for on Emacs version 27 (master branch): >> ** Emacs no longer defaults to using ImageMagick to display images, >> due to security and stability concerns. To override the default, use >> 'configure --with-imagemagick'. > > As well as: >> ** Emacs now supports resizing and rotating images without ImageMagick. >> All modern systems support this feature. (On GNU and Unix systems, >> Cairo drawing or the XRender extension to X11 is required for this to >> be available; the configure script will test for it and, if found, >> enable scaling.) > >> The new function 'image-transforms-p' can be used to test whether any >> given frame supports these capabilities. > > I then inspected the code of org-mode and noticed there is an expression > in the cond that figures out how to scale, e.g.: >> ((not (image-type-available-p 'imagemagick)) nil) > > I haven't looked into yet how the scaling is done, but I know some other > modes such as image-mode had support for using the new method. > > I think it would be great to support the native scaling option as well > when available. Since opting in to imagemagick will be Emacs wide and > then we loose the benefit of the new functionality. I committed a fix to the master branch. I think the way was clear. But testing is welcome as always. Thanks, Marco
Re: [O] Can I get the results of shell code block when exit code is non-zero?
Hi there, This is the expected behavior, implemented in `org-babel-eval`. (By the way, the docline of `org-babel-sh-evaluate` seems to talk about a different function.) As a workaround, you could define a new shell that always returns 0: (push "0bash" org-babel-shell-names) (org-babel-shell-initialize) (defun org-babel-execute:0bash (body params) "Execute a block of bash commands with Babel, returning 0." (let ((shell-file-name "bash")) (org-babel-execute:shell (concat "trap 'exit 0' EXIT\n" body) params))) —This is called 0bash because there are special treatments if the shell name ends with "bash", see `org-babel--variable-assignments:bash`. Cheers, M. On Thu, 29 Aug 2019 at 02:10, Marcin Borkowski wrote: > Hi all, > > apparently when the exit code of the last command in a shell code block > is not zero, I do not get the results. This doesn't seem to be > documented in the manual (though I might be missing something). Check > this: > > #+begin_src bash :results verbatim > echo hello world > exit 0 > #+end_src > > and this: > > #+begin_src bash :results verbatim > echo hello world > exit 1 > #+end_src > > How can I tell Org to put the results in the file anyway? My use case > is =diff=, which exists with status 1 if differences are found, and this > is a blog post, so I do not want to pollute the post with an =exit 0= at > the end of the code snippet. > > TIA, > > -- > Marcin Borkowski > http://mbork.pl > >
[O] org-agenda-todo obliterates my windows
I've been ignoring this for a long time, but it's getting more disruptive as more of my daily life lives in emacs/org; I've tried a little blind hacking and only managed to make things worse, and I feel like I'm missing something easy and obvious. Is there any way to just open my org-agenda-todo items in the /current/ window, or even just any window that already happens to be open, without modifying, splitting, or above all deleting any others? Sorry if this has been discussed already; I tried searching my list folder (and admit I don't do a good job of following the list in the first place) but keep coming up empty.
Re: [O] minimal testing setup for pdf export?
On Tue, Aug 27, 2019 at 6:34 PM Matt Price wrote: > > > > On Tue, Aug 27, 2019 at 1:33 PM John Kitchin wrote: >> >> that does suggest that pdflatex is getting called somewhere else. >> >> Maybe you can edebug the export function and check the value of >> default-directory to see where it is getting called. >> >> You could also try this >> >> #+BEGIN_SRC emacs-lisp >> (defun my-build (quoted-tex-file) >> (message "Building %s. Called from %s" quoted-tex-file default-directory)) >> >> (setq org-latex-pdf-process 'my-build) >> #+END_SRC >> >> It won't build the pdf, but it will tell you in the messages where it was >> called from. It might help figure out what is happening. > > > huh. that was kinda cool... but the value of default-directory seems to be > correct. However, this helped a bit: > > #+BEGIN_SRC emacs-lisp > (shell-command-to-string "echo $PWD") > > #+END_SRC > > > #+RESULTS: > : /home/matt/src/org-mode > > Not sure what's going on here, but this value is the same in a regular emacs > and "emacs -Q". is this normal? > Did this get solved? It kind of bothers me to think it hasn't. I also think this is a case where erring on the side of overwhelming details would help a lot. Could you start from the beginning with the exact process using emacs -Q, post the full output of *Messages* and *Org PDF LaTeX Output*? Like in the above, you post the output of $PWD, but not what the *Messages* buffer contained from John's code. Maybe they are the same, maybe they are different, but we can't tell. Example: $ cd ~/ $ emacs -Q M-x org-version Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.2/lisp/org/) C-x C-f pdf-test.org File contents: * foo C-x C-s C-c C-e l p $ ls ~/ pdf-test.org pdf-test.pdf pdf-test.tex Alternatively, insert the code from John Kitchin: Wrote /home/jwhendy/pdf-text.org org-babel-exp process emacs-lisp at position 8... Saving file /home/jwhendy/pdf-text.tex... Wrote /home/jwhendy/pdf-text.tex Processing LaTeX file pdf-text.tex... Building pdf-text.tex. Called from /home/jwhendy/ org-compile-file: File "/home/jwhendy/pdf-text.pdf" wasn’t produced. See "*Org PDF LaTeX Output*" for details I still don't feel I understand the full nature of your working directory, what does and doesn't get saved in that directory, etc. I'd love to help, but am not able to replicate for you! Thanks, John > >> John >> >> --- >> Professor John Kitchin >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> @johnkitchin >> http://kitchingroup.cheme.cmu.edu >> >> >> >> On Tue, Aug 27, 2019 at 8:57 AM Matt Price wrote: >>> >>> >>> >>> On Tue, Aug 27, 2019 at 8:27 AM John Kitchin >>> wrote: Can you manually compile the empty.tex file from the command line? eg pdflatex empty >>> (reposting to group) >>> >>> pdflatex empty >>> >>> Seems to work fine. Hmmm... John --- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Tue, Aug 27, 2019 at 7:57 AM Julius Dittmar wrote: > > Am 27.08.19 um 12:34 schrieb Matt Price: > > This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch > > Linux) (preloaded format=pdflatex) > > restricted \write18 enabled. > > entering extended mode > > ! I can't find file `empty.tex'. > > So pdflatex is called and found. Then pdflatex can't find empty.tex. > That looks like pdflatex is called in another directory than where > empty.tex resides. How that could happen, no idea. > > Julius >
[O] Checkbox dependencies - Discern between DONE and CANCELED
Hello all, I have org-enforce-todo-checkbox-dependencies set to t, and I would like to simply mark some tasks as canceled without needing to mess with the checkboxes. I can press C-u C-u C-u C-c C-t which will override dependencies. However, I was wondering if there's a way for org-mode to automatically not enforce checkbox dependencies when canceling a parent task? Thanks, --Nate
[O] org-megaup
When I use org-megaup I get a "Invalid function: org-preserve-local-variables" is there a way to fix that ? Jean-Christophe Helary --- http://mac4translators.blogspot.com @brandelune
Re: [O] org-agenda-todo obliterates my windows
Well, that sure was easy, and I certainly had missed it. This selection does indeed produce the behavior I was hoping for; thanks so much for the help! PR On Thu, Aug 29, 2019 at 12:17 PM Jack Kamm wrote: > > Is there any way to just open my org-agenda-todo items in the /current/ > > window, or even just any window that already happens to be open, without > > modifying, splitting, or above all deleting any others? > > Does customizing the variable org-agenda-window-setup (e.g. by setting > it to 'current-window) solve this? >
Re: [O] HTML export with LaTeX babel blocks
> On Aug 28, 2019, at 5:59 PM, Michaël Cadilhac wrote: > > My goal is to export SVG files of TikZ drawings in HTML. Now, what follows > is a bit of a rant on `org-babel-execute:latex`; let's go through the options: > > - [snip] Well you can try to continue on your path, but it can get `interesting'. An alternative is to do something like this: Define an export backend that derives from 'html. Flesh out the function `org-tikz-html-export-block' to process the content of `tikz' export blocks to render the derived SVG. Use existing functions in `ox-latex.el' as helpers if that works. #+begin_src emacs-lisp (org-export-define-derived-backend 'tikz-html 'html :translate-alist '((export-block . org-tikz-html-export-block))) (defun org-tikz-html-export-block (export-block contents info) "Transcoder to TikZ in html exports." (when (string= (org-element-property :type export-block) "TIKZ") (let ((tikz-code (org-remove-indentation (org-element-property :value export-block ;; process TikZ code to SVG ;; produce a suitable link to include the SVG as the result ))) #+end_src Then blocks like #+begin_export tikz % tikz code goes here #+end_export should render when you run #+begin_src emacs-lisp (org-export-to-file 'tikz-html "file-name.html") #+end_src You might adapt `org-html-export-to-html' if the features it offers are needed and add a :menu-entry to enable running from the export dispatcher under the html choices. HTH, Chuck
Re: [O] org-agenda-todo obliterates my windows
> Is there any way to just open my org-agenda-todo items in the /current/ > window, or even just any window that already happens to be open, without > modifying, splitting, or above all deleting any others? Does customizing the variable org-agenda-window-setup (e.g. by setting it to 'current-window) solve this?
[O] Bug: (org-babel-script-escape) is whitespace at the end of line dependent. [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. First, let me show the mwe (uses org-babel, created using chibi-scheme, but doesn't really need it (chicken should also work)): #+begin_src scheme :export both :results output (display "(+ 0) ") #+end_src #+RESULTS: : 0 #+begin_src scheme :export both :results output (display "(+ 0)") #+end_src #+RESULTS: | + | 0 | The difference in behaviour is caused by difference in the evaluation of the following calls: (org-babel-script-escape "(+ 0)") (org-babel-script-escape "(+ 0) ") Also, both of those are actually wrong, because the interpreter prints: (+ 0) Would be super grateful if someone could have a look into it! Vlad 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 '((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)) 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 :export both :results value :session\n?\n#+end_src") ("S" "#+begin_src scheme :export both :results value :session\n?\n#+end_src") ("p" "#+begin_src plantuml :export 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 latex\n?\n#+END_EXPORT") ("L" "#+LaTeX: ") ("h" "#+BEGIN_EXPORT html\n?\n#+END_EXPORT") ("H" "#+HTML: ") ("a" "#+BEGIN_EXPORT ascii\n?\n#+END_EXPORT") ("A" "#+ASCII: ") ("i" "#+INDEX: ?") ("I" "#+INCLUDE: %file ?")) org-cycle-hook '(org-cycle-hide-archived-subtrees