Re: [O] [PATCH] New header parameter :show-process for Org-babel-clojure
Hello, Frederick Giassonwrites: > I made all the changes requested and merged in a single commit. See > the attachment. Thank you. > I did as of today. Waiting to get a reply from them on that. Great! Please let me know once the process is complete, so that I can apply your patch in master. Regards, -- Nicolas Goaziou
Re: [O] org.texi edits, patch attached
Hello, Lambda Coderwrites: > I've attached an updated patch file to this msg. Thank you. Some comments and suggestions follow. > -Source code can be included in Org mode documents using a @samp{src} block, > -e.g.: > +Source code here refers to any code typed in Org mode documents. Org can > +manage source code in any Org file once such code is tagged with begin and > +end markers. Working with source code begins with tagging source code > +blocks. Such source code blocks can be put anywhere in an Org document. I don't think we should add this last sentence, which may be misleading. E.g., you cannot put a source block in a comment or a fixed width area... > +An important feature of Org's execution of the @samp{src} code blocks is > +passing variables, functions, and results between @samp{src} blocks. Such > +interoperability uses a common syntax even if these @samp{src} blocks are in > +different source code languages. The integration extends to linking the > +debugger's error messages to the line in the source code block in the Org > +file. That should partly explain why this functionality by the original > +contributors, Eric Schulte and Dan Davison, was called > @samp{Org-babel}. @samp{Org Babel}. > +Org mode's @ref{Easy templates} system speeds up creating @samp{src} blocks > +with just a couple of keystrokes. Don't be put-off by having to type or > +remember the source block syntax. Emacs already has other completion systems > +(yasnippet and company, to name two) that can be configured to create these I don't think we should name them since they are not built-in. > +Optional. Heading arguments control many aspects of evaluation, export and > +tangling of code blocks (see @ref{Header arguments}). Using Org's properties (@pxref{Header arguments}) > +Extracting source code from code blocks is one of the basic tasks in literate > +programming. Org's features makes it an ideal tool for creating literate > +programming documents. In literate programming parlance, on creation, such > +documents are @emph{woven} with code and documentation, and on export, the > +code is @emph{tangled} for execution by a computer. Org export facilitates > +weaving and tangling with several customization options. ITYM "Org babel" not "Org export". > +When Org tangles the source code blocks, it expands, merges, and transforms > +source code blocks. Then it recomposes them into one or more separate files > +(as specified in the options). During this tangling process, Org expands > +variables in the source code, and also resolve any ``noweb'' style references > +(see @ref{Noweb reference syntax}). (@pxref{Noweb reference syntax}) > +Debuggers normally link errors and messages back to the source code. But for > +tangled files, we want to link back to the Org file, not to the tangled > +source file. To make this extra jump, Org uses > +@code{org-babel-tangle-jump-to-org} function with two additional source code > +block header arguments: One, set @code{padline} (@ref{padline}) to true (the (@pxref{padline}) > +default setting). Two, set @code{comments} (@ref{comments}) to > @code{link} Ditto. > +After evaluation of the source code block, Org inserts the results after > +inserting the label @code{#+RESULTS} in the Org file. Edit > +@code{org-babel-results-keyword} to change the label, @code{#+RESULTS}. The > +results may optionally have a cache identifier and a block name. I would remove the sentence starting with "Edit @code{...}". Results keyword is always "results". The variable above is just a way to change case. For this reason, I don't think it is worth documenting. Also, a space is missing before "Edit" > +By default, (@code{emacs-lisp} is enabled for evaluation. The option to > +enable additional languages for evaluation is > +@code{org-babel-load-languages}. Use the Emacs customization interface to > +change. Or add code to the init file as shown here: Missing space above. > +For buffer-wide header arguments, use @code{#+PROPERTY:} lines anywhere in > +the Org mode file (see @ref{Property syntax}). (@pxref{Property syntax}) > +The following example sets @code{*R*} (only for R code blocks) to ---only for @samp{R} code blocks---to > +@code{session}, which means all R code is executed in the same session. It > +also sets @code{results} from all blocks to @code{silent}, which means > +results of executions for all blocks (not just R code blocks) are ignored ---not just @samp{R} code blocks---are ignored > +(therefore, not inserted in the buffer). and, therefore, not inserted in the buffer. > +Header arguments set through property drawers (see @ref{Property > syntax}) (@pxref{Property syntax}) > +apply at the sub-tree level on down. Since these property drawers can appear > +anywhere in the file hierarchy, Org uses outermost call or source block to > +resolve the values. Org ignores @code{org-use-property-inheritance} setting. > + >
Re: [O] [PATCH] New header parameter :show-process for Org-babel-clojure
Hi Nicolas, Thank you. Some nit-picks follow. I made all the changes requested and merged in a single commit. See the attachment. BTW, did you sign FSF papers already? I cannot find any reference in org-contribute.org? I did as of today. Waiting to get a reply from them on that. Thanks, Fred >From 3eb282c554f8099627b748e7c4eb07d0e810a2ae Mon Sep 17 00:00:00 2001 From: Frederick GiassonDate: Mon, 14 Nov 2016 15:43:16 -0500 Subject: [PATCH] Multiple improvements of ob-clojure have been performed in this commit. (1) better error handling. Errors and exceptions are output in the results section of a org-mode document. They were silenced with the previous version. (2) A new header parameter has been created: ":show-process" what will output the underlying NREPL processing in a new window + buffer Note that the behavior of ob-clojure *did not change* with these modications. Only the function (org-babel-execute:clojure) has been modified. --- etc/ORG-NEWS | 32 lisp/ob-clojure.el | 105 + 2 files changed, 113 insertions(+), 24 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index a360e35..95c97a7 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -27,6 +27,38 @@ into ** New features *** Horizontal rules are no longer ignored in LaTeX table math mode +*** Org-babel-clojure :show-process + +A new block code header has been created for Org-babel-clojure that enables +developers to output the process of an ongoing process into a new window/buffer. + +You can tell Org-babel-clojure to output the process of a running code block. + +To show that output you only have to specify the =:show-process= option +in the code block's header like this: + +#+begin_example +#+BEGIN_SRC clojure :results output :show-process + (dotimes [n 10] +(println n ".") +(Thread/sleep 500)) +#+END_SRC +#+end_example + +If =:show-process= is specified that way, then when you will run the code using +=C-c C-c= a new window will open in Emacs. Everything that is output +by the REPL will immediately be added to that new window. + +When the processing of the code is finished, then the window and its +buffer will be closed and the results will be reported in the +=#+RESULTS= section. + +Note that the =:results= parameter's behavior is *not* changed. If +=silent= is specified, then no result will be displayed. If =output= is +specified then all the output from the window will appears in the results +section. If =value= is specified, then only the last returned value of +the code will be displayed in the results section. + * Version 9.0 diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el index 72ea77d..f78dd69 100644 --- a/lisp/ob-clojure.el +++ b/lisp/ob-clojure.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2009-2016 Free Software Foundation, Inc. -;; Author: Joel Boehland, Eric Schulte, Oleh Krehel +;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson ;; ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org @@ -84,34 +84,91 @@ body))) (defun org-babel-execute:clojure (body params) - "Execute a block of Clojure code with Babel." + "Execute a block of Clojure code with Babel. + The underlying process performed by the code block can be output + using the :show-process parameter." (let ((expanded (org-babel-expand-body:clojure body params)) - result) +(sbuffer "*Clojure Show Process Sub Buffer*") + (show (assq :show-process params)) + (response (list 'dict)) +status +result) (cl-case org-babel-clojure-backend (cider (require 'cider) (let ((result-params (cdr (assq :result-params params -(setq result - (nrepl-dict-get - (nrepl-sync-request:eval -expanded (cider-current-connection) (cider-current-session)) - (if (or (member "output" result-params) - (member "pp" result-params)) - "out" - "value") - (slime - (require 'slime) - (with-temp-buffer -(insert expanded) -(setq result - (slime-eval - `(swank:eval-and-grab-output - ,(buffer-substring-no-properties (point-min) (point-max))) - (cdr (assq :package params))) -(org-babel-result-cond (cdr (assq :result-params params)) - result - (condition-case nil (org-babel-script-escape result) - (error result) + ;; Check if the user want show the process in an output buffer/window. + (when show + ;; Create a new window with the show output buffer. + (switch-to-buffer-other-window sbuffer) + + ;; Run the Clojure code in nREPL. + (nrepl-request:eval +expanded +(lambda (resp) + (when (member "out" resp)
Re: [O] “Match data clobbered by buffer modification hooks”
Nicolas Goaziouwrites: > I don't have emoji-cheat-sheet-plus. I think it would be worth reporting > the problem upstream. Done: https://github.com/syl20bnr/emacs-emoji-cheat-sheet-plus/issues/5. Sincerely, Gour -- While contemplating the objects of the senses, a person develops attachment for them, and from such attachment lust develops, and from lust anger arises.
[O] Release 9.0 test failed: test-ob/indented-cached-org-bracket-link
I built org 9.0 on my Mac today. 'make test' reported one failed test. I don't know if it is important or not. Please advise me. 'make test' said: 1 unexpected results: FAILED test-ob/indented-cached-org-bracket-link make: *** [test] Error 1 I have bash 4.4 freshly installed from mac ports. I have emacs 24.5.1. Here is the backtrace: Test test-ob/indented-cached-org-bracket-link backtrace: (if (unwind-protect (setq value-1119 (let ((default-directory tempor (let (form-description-1120) (if (unwind-protect (setq value-1119 (l (let ((value-1119 (cl-gensym "ert-form-evaluation-aborted-"))) (let (lambda nil (let ((value-1119 (cl-gensym "ert-form-evaluation-aborte ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc ert-run-test([cl-struct-ert-test test-ob/indented-cached-org-bracket ert-run-or-rerun-test([cl-struct-ert--stats "\\(org\\|ob\\)" [[cl-st ert-run-tests("\\(org\\|ob\\)" #[385 "\306\307\"\203G\211\211G\310 ert-run-tests-batch("\\(org\\|ob\\)") ert-run-tests-batch-and-exit("\\(org\\|ob\\)") (let ((org-id-track-globally t) (org-test-selector (if org-test-sele org-test-run-batch-tests("\\(org\\|ob\\)") eval((org-test-run-batch-tests org-test-select-re)) command-line-1(("--eval" "(setq vc-handled-backends nil org-startup- command-line() normal-top-level() Test test-ob/indented-cached-org-bracket-link condition: (ert-test-failed ((should (let (...) (org-test-with-temp-text " * Test #+BEGIN_SRC emacs-lisp :file test.txt :cache yes (message \"test\") #+END_SRC" ... ...))) :form (let ((default-directory temporary-file-directory)) (org-test-with-temp-text " * Test #+BEGIN_SRC emacs-lisp :file test.txt :cache yes (message \"test\") #+END_SRC" (org-babel-execute-src-block) (string= ... ...))) :value nil)) FAILED 166/670 test-ob/indented-cached-org-bracket-link
Re: [O] “Match data clobbered by buffer modification hooks”
Saša Janiškawrites: > Thank you for your assistance - I was able to find the problematic piece > of setup (https://github.com/syl20bnr/emacs-emoji-cheat-sheet-plus): > > ;; emoji cheat sheet > (use-package emoji-cheat-sheet-plus > :ensure t > :init > (progn > ;; enabled emoji in buffer > (add-hook 'org-mode-hook 'emoji-cheat-sheet-plus-display-mode) > ;; insert emoji with helm > (global-set-key (kbd "C-c C-e") 'emoji-cheat-sheet-plus-insert))) > > Can you try to add the above snippet and check whether you can reproduce > the problem? I don't have emoji-cheat-sheet-plus. I think it would be worth reporting the problem upstream. It is probably missing `save-match-data' in function called through `after-change-functions' and `post-command-hook'. Regards,
Re: [O] HTML export with ":export" parameter with Orgmode 9.0
Hi Charles, Setting `org-export-babel-evaluate' to nil will ensure that NONE of your header arguments are followed. Like the docstring says "Users who wish to avoid evaluating code on export should use the header argument ‘:eval never-export’." It is tempting to `make-obsolete-variable' this variable and change its name to something that more completely describes what does not happen when set to nil. Great, thanks for the clarification! Take care, Fred
[O] Capture templates - using result from %^g twice?
Hi I have the following capture template and would like to re-use the tag entered by %^g . I try to use %\2 but this is not working. Is there a way that I can re-use the tag entered by %^g and add it as a property? Thanks, Rainer , | ("s" "Change logged in buffer - for spreadsheet changes" | entry (file+headline (lambda() (buffer-file-name)) "CHANGES") | "* %^{Header of CHANGES item} :%^g: | :PROPERTIES: | :SHEET: %\2 | :AUTHOR: Rainer M Krug, rai...@krugs.de | :DATE: %T | :END: | %?") ` -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982 signature.asc Description: PGP signature
Re: [O] Capture template to capture in current buffer
On Monday, 14 Nov 2016 at 08:05, Rainer M Krug wrote: > Is it only me who want's to do this, or is this working for everybody else? I would like to do this but it doesn't work for me either. What appears to be happening is that org captures the note to the default notes file, org-default-notes-file. This defaults to ~/.notes. It doesn't capture to the buffer-file-name. This looks like a bug to me. -- : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_8.3.6-1272-gc61ee8
Re: [O] Capture template to capture in current buffer
Nicolas Goaziouwrites: > Rainer M Krug writes: > >> Hi >> >> I am trying to get an in-buffer logging to work. I want to log some >> changes in the file and I am using the following template, which was >> working some (longer?) time ago: >> >> (setq org-capture-templates >> `( >> ;; :: >> ;; In File Logging :: >> ;; :: >> ("c" "Changes to be logged in buffer" >> entry (file+headline (buffer-file-name) "CHANGES Log") >> "* %^{Header of CHANGES item}\nLOGGED: %T \n- link :: %a \n- >> author :: Rainer M Krug, email: rai...@krugs.de\n %?") >> )) >> >> But now I get the following error message when using the capture >> template: >> >> , >> | if: Target buffer ".notes" for file+headline should be in Org mode >> ` >> >> Any suggestions on how I can get this to work? > > It should work again in latest Org ELPA. > > In Org 9.1, you will need to change it to > > (file+headline (lambda () (buffer-file-name) ...)) Thanks - upgraded to newest master from git and used the syntax you gave - works perfectly. Thanks, Rainer > > > Regards, -- Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 signature.asc Description: PGP signature
Re: [O] org.texi edits, patch attached
On Fri, Nov 11, 2016 at 2:18 AM, Nicolas Goaziouwrote: > > If your FSF papers are in order, could you send an updated patch? > > > Regards, > > -- > Nicolas Goaziou > I've attached an updated patch file to this msg. --Lambda Coder. 0001-doc-org.texi-Editorial-revisions-to-the-manual.patch.gz Description: GNU Zip compressed data
Re: [O] “Match data clobbered by buffer modification hooks”
Nicolas Goaziouwrites: > The latter. Thank you for your assistance - I was able to find the problematic piece of setup (https://github.com/syl20bnr/emacs-emoji-cheat-sheet-plus): ;; emoji cheat sheet (use-package emoji-cheat-sheet-plus :ensure t :init (progn ;; enabled emoji in buffer (add-hook 'org-mode-hook 'emoji-cheat-sheet-plus-display-mode) ;; insert emoji with helm (global-set-key (kbd "C-c C-e") 'emoji-cheat-sheet-plus-insert))) Can you try to add the above snippet and check whether you can reproduce the problem? Sincerely, Gour --
Re: [O] Stuck projects documentation suggestion
Hello, Jon Kristensenwrites: > Looking at http://orgmode.org/manual/Stuck-projects.html>, it wasn't > clear to me that "+PROJECT/-MAYBE-DONE" was something called a "match > syntax". If the documentation could be extended to include this > information, and a link to the matching tags and properties page, it > would be more understandable for new users. Isn't it already done in the footnote in the page above? Would you want to suggest a better wording for this page? > The docstring for "org-stuck-projects" does include a reference to the > match syntax. (However, "C-h v" (describe variable) didn't work for > "org-stuck-projects" for me until I loaded "org-agenda", which was > surprising from my perspective as a newbie.) It should probably be renamed to `org-agenda-stuck-projects' then. Regards, -- Nicolas Goaziou
Re: [O] Capture template to capture in current buffer
Rainer M Krugwrites: > Hi > > I am trying to get an in-buffer logging to work. I want to log some > changes in the file and I am using the following template, which was > working some (longer?) time ago: > > (setq org-capture-templates > `( > ;; :: > ;; In File Logging :: > ;; :: > ("c" "Changes to be logged in buffer" > entry (file+headline (buffer-file-name) "CHANGES Log") > "* %^{Header of CHANGES item}\nLOGGED: %T \n- link :: %a \n- > author :: Rainer M Krug, email: rai...@krugs.de\n %?") > )) > > But now I get the following error message when using the capture > template: > > , > | if: Target buffer ".notes" for file+headline should be in Org mode > ` > > Any suggestions on how I can get this to work? It should work again in latest Org ELPA. In Org 9.1, you will need to change it to (file+headline (lambda () (buffer-file-name) ...)) Regards, -- Nicolas Goaziou
Re: [O] “Match data clobbered by buffer modification hooks”
Hello, Saša Janiškawrites: > Now I tried with -Q and minimal 9.0 setup and it works. Do you have any > hint which packages might be problematic or I should simply try to bisect > my init file? The latter. Regards, -- Nicolas Goaziou
Re: [O] “Match data clobbered by buffer modification hooks”
Nicolas Goaziouwrites: > Have you tried with -Q, modulo load-path setting to include Org 9.0? Now I tried with -Q and minimal 9.0 setup and it works. Do you have any hint which packages might be problematic or I should simply try to bisect my init file? Sincerely, Gour -- Never was there a time when I did not exist, nor you, nor all these kings; nor in the future shall any of us cease to be.
Re: [O] Capture template to capture in current buffer
On 2016-11-10 11:35, Rainer M Krug wrote: Hi I am trying to get an in-buffer logging to work. I want to log some changes in the file and I am using the following template, which was working some (longer?) time ago: --8<---cut here---start->8--- (setq org-capture-templates `( ;; :: ;; In File Logging :: ;; :: ("c" "Changes to be logged in buffer" entry (file+headline (buffer-file-name) "CHANGES Log") "* %^{Header of CHANGES item}\nLOGGED: %T \n- link :: %a \n- author :: Rainer M Krug, email: rai...@krugs.de\n %?") )) --8<---cut here---end--->8--- But now I get the following error message when using the capture template: , | if: Target buffer ".notes" for file+headline should be in Org mode ` I had a similar problem. Have a look at: https://www.reddit.com/r/emacs/comments/5b3mtr/orgmode_capture_template_issue_after_updating_to/ I fixed my problem by: ("c" "New blog post (cycling.ianbarton.net)" plain (file (lambda() (capture-pelican-draft-file "~/Documents/emacs/web_sites/cycling.ianbarton.net/org/_posts"))) "#+AUTHOR: Ian Barton\n#+DATE: %u\n#+PROPERTY: MODIFIED: \n#+TITLE\n#+CATEGORY: Blog \n#+PROPERTY: TAGS \n#+PROPERTY: SUMMARY \n") capture-pelican-draft-file is a function that gets the file name. So entry (file+headline (lambda() buffer-file-name)) "CHANGES Log") "* %^{Header of CHANGES item}\nLOGGED: %T \n- link :: %a \n- author :: Rainer M Krug, email: rai...@krugs.de\n %?") may fix your problem (not tested). Ian.
Re: [O] Capture template to capture in current buffer
Eric S Fragawrites: > On Monday, 14 Nov 2016 at 08:05, Rainer M Krug wrote: >> Is it only me who want's to do this, or is this working for everybody else? > > I would like to do this but it doesn't work for me either. What appears > to be happening is that org captures the note to the default notes file, > org-default-notes-file. This defaults to ~/.notes. It doesn't capture > to the buffer-file-name. Exactly the same here - thanks for confirming. > > This looks like a bug to me. -- Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 signature.asc Description: PGP signature
Re: [O] Capture template to capture in current buffer
Is it only me who want's to do this, or is this working for everybody else? Rainer Rainer M Krugwrites: > Hi > > I am trying to get an in-buffer logging to work. I want to log some > changes in the file and I am using the following template, which was > working some (longer?) time ago: > > (setq org-capture-templates > `( > ;; :: > ;; In File Logging :: > ;; :: > ("c" "Changes to be logged in buffer" > entry (file+headline (buffer-file-name) "CHANGES Log") > "* %^{Header of CHANGES item}\nLOGGED: %T \n- link :: %a \n- > author :: Rainer M Krug, email: rai...@krugs.de\n %?") > )) > > But now I get the following error message when using the capture > template: > > , > | if: Target buffer ".notes" for file+headline should be in Org mode > ` > > Any suggestions on how I can get this to work? > > Thanks, > > Rainer > > -- > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, > UCT), Dipl. Phys. (Germany) > > Centre of Excellence for Invasion Biology > Stellenbosch University > South Africa > > Tel : +33 - (0)9 53 10 27 44 > Cell: +33 - (0)6 85 62 59 98 > Fax : +33 - (0)9 58 10 27 44 > > Fax (D):+49 - (0)3 21 21 25 22 44 > > email: rai...@krugs.de > > Skype: RMkrug > > PGP: 0x0F52F982 > -- Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 signature.asc Description: PGP signature