Re: org-babel prepends <> expansions with the prefix of the <>? Can this be turned off?
Having re-read Vladimir's original question, it looks like I may have misunderstood it at first. Now I'm wondering: What's the use case for referencing a code block but commenting out the first line? On Tue, 25 Feb 2020 at 09:00, Johannes Dahl wrote: > > Hi, > > That's a fun coincidence, I ran into this behaviour a couple of days > ago as well. For anyone wondering why one would want to comment out > their noweb tags but still expect them to result in uncommented code > expansion: if one is to edit a source block containing Noweb tags, the > emacs mode for that programming language might interpret those tags in > an unexpected way and give a messy result, e.g. in my case with > LilyPond, mess up the indentation of the rest of the code block. > > Luckily, Noweb tag syntax is configurable using > org-babel-noweb-wrap-start and org-babel-noweb-wrap-end. Thus, the way > I worked around this was to define, for the file containing LilyPond > code blocks, org-babel-noweb-wrap-start as "%<<", % being LilyPond's > comment symbol. But I still wonder if there is a better way. > > Cheers, > Johannes > > On Tue, 25 Feb 2020 at 04:10, Vladimir Nikishkin wrote: > > > > Hello, everyone > > > > I have the following case: > > > > #+name: test1 > > #+begin_src shell > > LINE to comment > > LINE to not comment > > #+end_src > > > > #+begin_src shell > > #<> > > #+end_src > > > > When I expand it, I get: > > #LINE to comment > > #LINE to not comment > > > > That's not entirely what I want. Can this behaviour be switched off somehow? > > > > -- > > Yours sincerely, Vladimir Nikishkin > >
Re: Document backward-incompatible change in ORG-NEWS? (was: [BUG] Recently master branch commit breaks open file: link)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Samuel Wales writes: > no opinion on anything but a suggestion. > > i really like these little scripts that update your org files so they > are compatible with new org versions. > > perhaps one can give them an argument or something to work on all > agenda files, or a list of files, or somethign liek that? Sounds reasonable. Apply function on Org Agenda files will be the most case. > > On 2/24/20, Bastien wrote: >> Hi Nicolas, >> >> it seems that org-store-link stored links to headlines as >> >> [[*TODO headline][headline]] >> >> keeping the TODO keyword, if any. >> >> This is fixed in master but I won't if we should document this bug >> fix in ORG-NEWS (or if org-store-link was just momentarily broken.) >> >> If org-store-link was storing the todo keyword, perhaps we can add >> a command similar to this one to help users fix broken links: >> >> (defun org-fix-links () >> "Fix ill-formatted internal links. >> E.g. replace [[*TODO Headline][headline]] by [[*Headline][headline]]. >> Go through the buffer and ask for the replacement." >> (interactive) >> (visible-mode 1) >> (save-excursion >> (goto-char (point-min)) >> (while (re-search-forward org-link-any-re nil t) >> (let* ((raw (match-string 2)) >> (desc (match-string 3)) >> fix new) >> (when (and raw desc >> (string-match-p >> (concat "^\*" (regexp-opt org-todo-keywords-1) >> "\\s-+\\(.+\\)$") >> raw)) >>(setq new (replace-regexp-in-string >> (concat (regexp-opt org-todo-keywords-1) "\\s-+") >> "" raw)) >>(set-text-properties 0 (length new) nil new) >>(setq fix (completing-read "Replace link at point by: " >> nil nil nil new)) >>(replace-match (format "[[%s][%s]]" fix desc)) >> (visible-mode -1)) >> >> WDYT? >> >> -- >> Bastien >> >> - -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -BEGIN PGP SIGNATURE- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5UxnwUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsPwpgf/RqdCj+Y5dC+3lRUwPwYsi8crTrYP tOZdszU/V1mAPaEep8Q2ksJwvYBa/0TaZ7H+3M8rS55Ug9vSzQyZ/vO+MBSQIPu4 GcyWvyl6qxuWsn8YJr/2E5gGrvgCkGXbqf4tW4iSxm5gWT+Ui6wziW+c00++UFR9 40TnIVx5xx/2F3vuJGmXA9cyhm/K1O8rzG/7NUhvxypXZhFrU0Tns1WmeCUWi9/7 DPI+FRIxUBzcUlLhuZq3gHjDoCaIOie69MCFkrDFlHakr8s+rvbzokdff5C0r4vp DCtdIgEAFUFQvcfD7v4b5+5YiYe6Aq2erX7Jrkhn1Pkguku11xNu17HeFQ== =QjPn -END PGP SIGNATURE-
Re: org-babel prepends <> expansions with the prefix of the <>? Can this be turned off?
Hi, That's a fun coincidence, I ran into this behaviour a couple of days ago as well. For anyone wondering why one would want to comment out their noweb tags but still expect them to result in uncommented code expansion: if one is to edit a source block containing Noweb tags, the emacs mode for that programming language might interpret those tags in an unexpected way and give a messy result, e.g. in my case with LilyPond, mess up the indentation of the rest of the code block. Luckily, Noweb tag syntax is configurable using org-babel-noweb-wrap-start and org-babel-noweb-wrap-end. Thus, the way I worked around this was to define, for the file containing LilyPond code blocks, org-babel-noweb-wrap-start as "%<<", % being LilyPond's comment symbol. But I still wonder if there is a better way. Cheers, Johannes On Tue, 25 Feb 2020 at 04:10, Vladimir Nikishkin wrote: > > Hello, everyone > > I have the following case: > > #+name: test1 > #+begin_src shell > LINE to comment > LINE to not comment > #+end_src > > #+begin_src shell > #<> > #+end_src > > When I expand it, I get: > #LINE to comment > #LINE to not comment > > That's not entirely what I want. Can this behaviour be switched off somehow? > > -- > Yours sincerely, Vladimir Nikishkin >
correct remote path handling
Hello, there I bumped into a problem running src blocks using a remote (tramp) :dir. I've looked into it and found that the problem is that a temporary file is passed as a remote path to the remote process (temp file should be local to remote process). I'm attaching fixes for python and shell src blocks. I didn't add any tests because that would require more than 15 LOC. I'm willing to add them, but directly to git repo. I've signed the necessary papers from (to?) the FSF involving org mode, so I'm ready on my side to add tests and maybe add support for other tramp-related stuff. Thanks Felipe>From e902f40842a20baa0c4a2ca462b83d9ce949a19f Mon Sep 17 00:00:00 2001 From: Felipe Lema <1232306+felipel...@users.noreply.github.com> Date: Fri, 21 Feb 2020 14:34:53 -0300 Subject: [PATCH 1/2] Squashed commit of the following: commit 6ea888f432b5eeb3559706e336a752791f48d7fb Author: Felipe Lema <1232306+felipel...@users.noreply.github.com> Date: Fri Feb 21 11:25:51 2020 -0300 fix evaluate python code in remote directory Evaluating an "AST python code" should be local to the process / directory. `file-local-name` will do just this (strip the tramp prefix in path) --- lisp/ob-python.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-python.el b/lisp/ob-python.el index dbcfac08d..85c9644c4 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -345,7 +345,8 @@ last statement in BODY, as elisp." "python-"))) (with-temp-file tmp-src-file (insert body)) (format org-babel-python--eval-ast - tmp-src-file + (file-local-name +tmp-src-file) (org-babel-comint-with-output (session org-babel-python-eoe-indicator nil body) (let ((comint-process-echoes nil)) -- 2.16.4 >From d9d1c4180c86f38653ebdb0eb2e0a9d5865df0de Mon Sep 17 00:00:00 2001 From: Felipe Lema <1232306+felipel...@users.noreply.github.com> Date: Fri, 21 Feb 2020 14:35:35 -0300 Subject: [PATCH 2/2] "use this script file" should be local to interpreter we're using --- lisp/ob-shell.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-shell.el b/lisp/ob-shell.el index 6c8ca9652..8dce9c7dd 100644 --- a/lisp/ob-shell.el +++ b/lisp/ob-shell.el @@ -240,7 +240,8 @@ return the value of the last statement in BODY." (with-temp-buffer (call-process-shell-command (concat (if shebang script-file - (format "%s %s" shell-file-name script-file)) + (format "%s %s" shell-file-name + (file-local-name script-file))) (and cmdline (concat " " cmdline))) stdin-file (current-buffer)) -- 2.16.4
Running in-line babel code at auto-insert template file open
Let's say I have a standard org file I want to have created multiple times. I've created a template file and told Emacs autoinsert where it is. Here's the relevant in my init (use-package autoinsert :ensure t ... :config (define-auto-insert "poolchem.org?$" "poolchem.org")) So in this template file poolchem.org I have six table skeletons, but I also want various customized additions. For example, I would like the table names to reflect the current week starting with the coming Sunday's date #+tblname: pc1-*src_emacs-lisp[:results raw]{(org-read-date nil nil "++sun" nil (org-time-string-to-time "2020-02-24"))}* which would hopefully show up in the newly created buffer as #+tblname: pc1-2020-03-01 But then nothing of the sort happens, i.e., the in-line code just comes back verbatim when I create a new file, unevaluated. I guess I'm totally missing what is going on with in-line code. It seems other methods of template creation allow code to be embedded, then to be evaluated. (The variable auto-insert-alist has entire templates.) I've experimented with eval of org-sbe in # local variables: ... but that was for running code blocks upon file open, not individual embedded functions that would customize my newly created org file. Any ideas? LB
Re: Exploring properties
I don't know if this is useful. But this is what I could come up with. This might at least motivate somebody to think of other possible advantages/uses of building org-mode capabilities to interact with databases. Vikas --- Feature request: To build tools to facilitate using org-mode as a front-end for interacting with a database. The idea would be to use org-mode to select, insert and update records in a database. It is natural to think of recutils, a plain text database, as the database backend. But a more generalised solution may allow other choices of databases. With a text-based database backend like recutils, we could harness a version control system like git to semi-automate collaboraion. Why would one use org-mode for creating a database application? One can think of many advantages. But the biggest advantage (to me) would be that, in this setup, a multi-user database application can work without constant internet connectivity. You can query recutils files, insert/update records, and then let git deal with synchronisation across the team members. There are other advantages as well. We do not yet have a text-based, easy-to-deploy database application system. Recutils provides the infrastructure for a backend. But we do not have a fully-developed front-end system to interact with recutils. Org-mode is clearly best placed to provide the frontend for working with recutils. Needless to say, this would be particularly interesting to members of the org-mode/emacs fan-club. Over the last few years, org-mode has come to be used for many tasks that go way beyond what Carsten had in mind when he first built org-mode. From web-publishing to writing books, org-mode provides excellent tools. Being able to create and use databases from within org-mode would be a very useful addition to this toolkit. We already have tools that can be used to read data from recutils (and other databases) and create reports in org-mode. The missing feature is to be able to use org-mode to create/update records systemmatically. There are two possibilities here: to use org-mode tables or org-mode properties to interact with the database. The advantage of doing this using the org-mode properties is that the column-view of properties provides an easy to use interface for entering data. There is already a mechanism for defining "Allowed" values for any field which speeds up data entry and helps avoid typing errors. There are several challenges. Some of these are: 1. Extending "Allowed" values to specify type of data that can be recorded (numeric, char) or range of values. 2. How to deal with relationships/foreign keys. Can property inheritance be used to deal with at least simple foreign key constraints? 3. Org-mode macros provide {{{property(PROPERTYNAME)}}} syntax for macro replacement during export. But nothing as simple as this is available for use in source code blocks. Something like this would allow using some code to add/update records in a database. We should perhaps build on the property API or org-ql for creating something like this. If we can resolve some of these and creating a simple application for demonstration, it might help in showing the potential and identifying other challenges. On Mon, Feb 24, 2020 at 09:39:51AM +0100, Bastien wrote: > Hi Vikas, > > Vikas Rawal writes: > > > I am essentially thinking of org-mode providing an > > interface for feeding data to recutils. > > Yes, that would probably be useful. > > If you want to write a feature request, please write it as if the > reader does not know recutils and you precise use-case, so that we > understand all implication and motivate possible contributors. > > Thanks, > > -- > Bastien >
org-babel prepends <> expansions with the prefix of the <>? Can this be turned off?
Hello, everyone I have the following case: #+name: test1 #+begin_src shell LINE to comment LINE to not comment #+end_src #+begin_src shell #<> #+end_src When I expand it, I get: #LINE to comment #LINE to not comment That's not entirely what I want. Can this behaviour be switched off somehow? -- Yours sincerely, Vladimir Nikishkin
org-babel opens the error output of a block in a separate window... unless :stdin is given, but how are they connected?
Hello, everyone The MWE would be the following: #+name: empty #+begin_quote 1 #+end_quote #+begin_src shell :shebang "#! /usr/bin/chibi-scheme :stdin empty (/ 1 0) #+end_src Now the chibi-scheme shebang is just an example of an app writing things to stderr. The actual content of the <> doesn't matter, the app errs before ever having a chance to read anything from stdin. However, when :stdin is given (as in the MWE), the resulting error output is printed in the :RESULTS , and if not, it is displayed in a separate (a bit annoying) window called "*Org-Babel Error Output*. I would like to ask how these two things, stdin, and stderr are connected. Perhaps, this is a bug? -- Yours sincerely, Vladimir Nikishkin
Bug: ob-shell cannot forward empty blocks to stdin [9.3.1 (release_9.3.1-101-gc9ee3d @ /home/lockywolf/OfficialRepos/org-mode/lisp/)]
The MWE would be the following: #+name: empty #+begin_quote #+end_quote #+begin_src shell :stdin empty #+end_src Now if you try to execute the second block, you will get a lisp error. "Wrong argument integer-or-marker-p" 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. Emacs : GNU Emacs 26.3 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 3.24.12) of 2019-11-26 Package: Org mode version 9.3.1 (release_9.3.1-101-gc9ee3d @ /home/lockywolf/OfficialRepos/org-mode/lisp/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-link-shell-confirm-function 'yes-or-no-p 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 ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww) org-plantuml-jar-path "/usr/local/bin/plantuml.jar" org-mode-hook '(#[0 "\301\211\207" [imenu-create-index-function org-imenu-get-tree] 2] turn-on-org-cdlatex org-tempo-setup #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-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 (lambda nil (if (member #1=(quote ("p" . "src plantuml :exports both :file ")) org-structure-template-alist) org-structure-template-alist (setq org-structure-template-alist (cons #1# org-structure-template-alist)) ) (if (member #2=(quote ("SO" . "src scheme :exports both :results output")) org-structure-template-alist) org-structure-template-alist (setq org-structure-template-alist (cons #2# org-structure-template-alist)) ) (if (member #3=(quote ("SV" . "src scheme :exports both :results value")) org-structure-template-alist) org-structure-template-alist (setq org-structure-template-alist (cons #3# org-structure-template-alist)) ) (if (member #4=(quote ("SE" . "src scheme :exports code")) org-structure-template-alist) org-structure-template-alist (setq org-structure-template-alist (cons #4# org-structure-template-alist)) ) (if (member #5=(quote ("EL" . "src elisp :exports both :results output")) org-structure-template-alist) org-structure-template-alist (setq org-structure-template-alist (cons #5# org-structure-template-alist)) ) ) (lambda nil (modify-syntax-entry 60 ".") (modify-syntax-entry 62 ".")) (lambda nil (imenu-add-to-menubar "Imenu")) org-eldoc-load) 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-src-lang-modes
Re: Document backward-incompatible change in ORG-NEWS? (was: [BUG] Recently master branch commit breaks open file: link)
no opinion on anything but a suggestion. i really like these little scripts that update your org files so they are compatible with new org versions. perhaps one can give them an argument or something to work on all agenda files, or a list of files, or somethign liek that? On 2/24/20, Bastien wrote: > Hi Nicolas, > > it seems that org-store-link stored links to headlines as > > [[*TODO headline][headline]] > > keeping the TODO keyword, if any. > > This is fixed in master but I won't if we should document this bug > fix in ORG-NEWS (or if org-store-link was just momentarily broken.) > > If org-store-link was storing the todo keyword, perhaps we can add > a command similar to this one to help users fix broken links: > > (defun org-fix-links () > "Fix ill-formatted internal links. > E.g. replace [[*TODO Headline][headline]] by [[*Headline][headline]]. > Go through the buffer and ask for the replacement." > (interactive) > (visible-mode 1) > (save-excursion > (goto-char (point-min)) > (while (re-search-forward org-link-any-re nil t) > (let* ((raw (match-string 2)) >(desc (match-string 3)) >fix new) > (when (and raw desc > (string-match-p > (concat "^\*" (regexp-opt org-todo-keywords-1) > "\\s-+\\(.+\\)$") > raw)) > (setq new (replace-regexp-in-string >(concat (regexp-opt org-todo-keywords-1) "\\s-+") >"" raw)) > (set-text-properties 0 (length new) nil new) > (setq fix (completing-read "Replace link at point by: " >nil nil nil new)) > (replace-match (format "[[%s][%s]]" fix desc)) > (visible-mode -1)) > > WDYT? > > -- > Bastien > > -- The Kafka Pandemic What is misopathy? https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
Best strategy for sharing agenda between two machines?
Hi, I use Org mode & agenda on both my personal and work machines, in a private git repo repository. I use auto-commit and push automatically from each machine. It works alright. New items go in inbox.org, and I refile most to tasks.org, which has a structure a little like this: * Home :@home: ** TODO Some task to do at home ** TODO Another task to do at home * Work :@work: ** TODO A task to do at work ** TODO Another work task * TODO Some task that is not inherently work/home * WAITING Another task that blurs the barriers The different sections for Home and Work means that there are not too many merge conflicts. However, inbox.org is a different matter. My todo template adds a LOGBOOK with an `Added' property, and it's almost impossible to resolve the conflicts that result. I see that https://orgmode.org/worg/org-contrib/gsoc2012/student-projects/git-merge-tool/ sadly never produced a tool. But I'm wondering if people have some strategy for how to best deal with git conflicts (perhaps a non-default merge strategy works better with Org?) or maybe even better: how not to create conflicts in the first place! I could use a different default agenda file for each machine, since the inbox.org is worst affected. Is anyone doing this? I could extend this to use {work,home}_tasks.org too, but I kinda like having that "neither @work nor @home" option... Decisions decisions. Stig
Document backward-incompatible change in ORG-NEWS? (was: [BUG] Recently master branch commit breaks open file: link)
Hi Nicolas, it seems that org-store-link stored links to headlines as [[*TODO headline][headline]] keeping the TODO keyword, if any. This is fixed in master but I won't if we should document this bug fix in ORG-NEWS (or if org-store-link was just momentarily broken.) If org-store-link was storing the todo keyword, perhaps we can add a command similar to this one to help users fix broken links: (defun org-fix-links () "Fix ill-formatted internal links. E.g. replace [[*TODO Headline][headline]] by [[*Headline][headline]]. Go through the buffer and ask for the replacement." (interactive) (visible-mode 1) (save-excursion (goto-char (point-min)) (while (re-search-forward org-link-any-re nil t) (let* ((raw (match-string 2)) (desc (match-string 3)) fix new) (when (and raw desc (string-match-p (concat "^\*" (regexp-opt org-todo-keywords-1) "\\s-+\\(.+\\)$") raw)) (setq new (replace-regexp-in-string (concat (regexp-opt org-todo-keywords-1) "\\s-+") "" raw)) (set-text-properties 0 (length new) nil new) (setq fix (completing-read "Replace link at point by: " nil nil nil new)) (replace-match (format "[[%s][%s]]" fix desc)) (visible-mode -1)) WDYT? -- Bastien
Re: [BUG] Recently master branch commit breaks open file: link
Hi Stardiviner, stardiviner writes: >> IMHO we may have several file links such as yours broken: Nicolas, >> do you think the bugfix should be advertized in ORG-NEWS, along with >> a helper function to fix file links (ie remove the TODO keyword and >> priority cookies)? > > This broken update might need a little think. > > The new org-store-link does not include the TODO keyword. But what if user add > keyword before, then later does not use it in Org Mode config. This TODO > keyword > will caused broken. You can run something like this command in your org files, it will prompt you for the fixed link: (defun org-fix-links () "Fix ill-formatted internal links. E.g. replace [[*TODO Headline][headline]] by [[*Headline][headline]]. Go through the buffer and ask for the replacement." (interactive) (visible-mode 1) (save-excursion (goto-char (point-min)) (while (re-search-forward org-link-any-re nil t) (let* ((raw (match-string 2)) (desc (match-string 3)) fix new) (when (and raw desc (string-match-p (concat "^\*" (regexp-opt org-todo-keywords-1) "\\s-+\\(.+\\)$") raw)) (setq new (replace-regexp-in-string (concat (regexp-opt org-todo-keywords-1) "\\s-+") "" raw)) (set-text-properties 0 (length new) nil new) (setq fix (completing-read "Replace link at point by: " nil nil nil new)) (replace-match (format "[[%s][%s]]" fix desc)) (visible-mode -1)) HTH, -- Bastien
Re: ICS agenda export exceeds max-specpdl-size probably because of org-depend (org-edna same?)
Hi Karl, Karl Voit writes: > Retrying when error re-appears. OK, thanks for the feedback! -- Bastien
Re: Strange Org <> OS interaction w/ bad ID
On Mon, Feb 24, 2020 at 10:51 AM Nicolas Goaziou wrote: > > Does anyone know why Org is parsing files in random folders when > > I have a bad ID and a <>? > > I don't. You may want to check `org-id-files', or walk the hash table > `org-id-locations'. > (apropos "org-id-files") returns nil, which is strange because it seems to be in Org for the past 11 years https://github.com/bzg/org-mode/blame/a3da64ad574e6ba860ea03c1bf6af91f279d86ee/lisp/org-id.el#L216 Same with org-id-locations. With `emacs -Q` and nothing else, should these be set? -k.
Re: Strange Org <> OS interaction w/ bad ID
Hello, Ken Mankoff writes: > I thought named IDs were supposed to go into CUSTOM_ID properties > rather than ID properties. Is this incorrect? ID are meant to be automatically generated, and stored in a database. They can work across documents. CUSTOM_ID, OTOH are use-defined values, internal to the document. > Does anyone know why Org is parsing files in random folders when > I have a bad ID and a <>? I don't. You may want to check `org-id-files', or walk the hash table `org-id-locations'. Regards, -- Nicolas Goaziou
[O] Strange Org <> OS interaction w/ bad ID
Hi Org List, This is cross-posted here: https://www.reddit.com/r/emacs/comments/f8t50q/help_debugging_org_os_interaction/ I've run into a strange bug. This is reproducible on my machine with "emacs -Q", but not with with emacs-sandbox https://github.com/alphapapa/emacs-sandbox.sh/ so I don't know if you'll be able to recreate this... Problem: When exporting an Org file that contains 1) <> refs and 2) id:link links to CUSTOM_ID, then Org parses files all over my filesystem. Given that this happens with "emacs -Q", I don't know why it would be opening files in random folders! The MWE Org file that I'm opening and exporting is: === BEGIN === #+BEGIN_SRC emacs-lisp :results value :noweb yes :eval no-export <> #+END_SRC #+NAME: bar #+BEGIN_SRC emacs-lisp :results value :noweb yes :eval no-export (org-version) #+END_SRC * Bug: Export with IDs and links :PROPERTIES: :CUSTOM_ID: foo :END: + Link to id:foo === END === The file is eventually exported correctly and the link works. I think I found the bug - when I run org-lint, I am told > 18 high Unknown ID "foo" And when I change "CUSTOM_ID" to "ID", then everything works. No bug. No random files parsed. With CUSTOM_ID I can see it parse files throughout my filesystem (how does it find them??) because I get this error message about 10x: > The local variables in /path/to/folder > contains values that may not be safe (*). > > Do you want to apply it? You can type > [snip] > > * eval: (pyvenv-activate "/path/to/anaconda/envs/env") The bug needs both the id: link to CUSTOM_ID *and* the <> ref. If I comment out the <> ref, then the bug does not appear. I thought named IDs were supposed to go into CUSTOM_ID properties rather than ID properties. Is this incorrect? Does anyone know why Org is parsing files in random folders when I have a bad ID and a <>? Thanks, -k.
Re: Possible to exclude/include tags for agenda custom commands?
Bastien writes: > Hi Eric, > > Eric Abrahamsen writes: > >> The key is having `org-agenda-sticky' set to t -- this means that we'll >> let-bind buffer-local variables in a buffer where they're already >> set. > > thanks for the reproducible example, I was able to get the warning. > > You can safely ignore it: when redoing sticky agenda, we need to > let-bind the values as explicitely set in the agenda custom command > (here the org-agenda-tag-filter value) while preparing the agenda > requires the variables to be made local. I don't see what can be > done and I don't think there hidden bugs lingering around here. Okay! I also didn't think anything terrible was going on here. I note there's the variable `org-agenda-doing-sticky-redo' that we could presumably check, and avoid re-setting the tag filter when it's t, but again I don't think the warning is a big deal. Thanks, Eric
Re: ob-python.el: questions about output
On Monday, 24 Feb 2020 at 08:18, Jack Kamm wrote: > This sounds interesting. Do you know of any documentation or examples > for :prologue and :epilogue? I checked the Worg page for ob-maxima, but > it didn't mention these header arguments. I don't know of any documentation. They basically simply provide strings that are included before and after the text within the src block before evaluation but are not exported in a code listing. I can give you an example of how I use these with maxima: #+header: :prologue "fpprintprec: 2; linel: 50;" #+header: :epilogue "print(solution);" #+begin_src maxima :exports both :results output :cache yes solution: exp(1.0); #+end_src which sets the printing precision for numbers to 2 and the line length to 50 and prints out the contents of the solution variable at the end. These are details that are not important for display; I use these settings all the time for my lecture slides. The above example gives the following when exported to ascii: , | solution: exp(1.0); ` , | 2.7 ` so the slides can concentrate on the material that is important. Adding such to ob-python etc. should not be difficult. -- : Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-354-g9d5880
Re: ob-python.el: questions about output
On Monday, 24 Feb 2020 at 08:17, Jack Kamm wrote: > 1. noweb (as Eric mentioned). Then you only need to write the code > once, but note that it will be executed twice. Doesn't need to execute twice: maybe add ":eval no" to the first block, the one that will be included in the other one? -- : Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-354-g9d5880
Re: ob-python.el: questions about output
Hi Eric, "Fraga, Eric" writes: > Longer term, better would be an implementation of :prologue and > :epilogue options for python src blocks like we have for Maxima. It > would probably make sense to provide these options for most if not all > src blocks? This sounds interesting. Do you know of any documentation or examples for :prologue and :epilogue? I checked the Worg page for ob-maxima, but it didn't mention these header arguments.
Re: ob-python.el: questions about output
Hi RC, R C writes: > My python src blocks often have both graphical output as well as the > results of some numerical calculation displayed using print statements. > > When exported I would like the line: return 'img/ex1.png' not to be > included in the listing of the src block. > > Also, the output of the print statement is not displayed in this case. The external ob-jupyter [0] accomplishes what you want: 1. It can return multiple types of output, e.g. print statements and plots. 2. It doesn't require the "return" statement. It's main limitations are: 1. It requires jupyter. 2. It requires using session blocks. I'd recommend checking it out. It has excellent Python support. If you prefer a native solution, I think the options are: 1. noweb (as Eric mentioned). Then you only need to write the code once, but note that it will be executed twice. 2. Using multiple session blocks to return output and value separately. Since they use the same state, you would only need to execute the code once. 3. Possibly, you could insert the link to the image separately, create a named reference to it, and pass it to the Python block via ":var", which would create at an image at that link. Then use ":results output" to capture the print statements. I'm not 100% sure if this will work. [0] https://github.com/dzop/emacs-jupyter
Re: [BUG] Recently master branch commit breaks open file: link
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Bastien writes: > Hi Stardiviner, > > stardiviner writes: > >> So I did a git bisect. Found this bad commit caused this problem >> "afd3b04ec * bad ol: Extend open tooling in link parameters". > > This will work: > > #+begin_src org > [[file:~/Org/Tasks/Computer Todos.org::*厉害的人是怎么分析问题的?][厉害的人是怎么分析问题的?]] > #+end_src > > org-store-link used to store the TODO keyword, which was a mistake. > > Nicolas fixed this recently, now org-store-link DTRT and C-c C-o on > stored links will work correctly. I see. Thanks for explanation. > > IMHO we may have several file links such as yours broken: Nicolas, > do you think the bugfix should be advertized in ORG-NEWS, along with > a helper function to fix file links (ie remove the TODO keyword and > priority cookies)? This broken update might need a little think. The new org-store-link does not include the TODO keyword. But what if user add keyword before, then later does not use it in Org Mode config. This TODO keyword will caused broken. I personally used to have an advice on org-store-link to auto prompt user a "CUSTOM_ID" property with default value of headline string before (A month ago I disabled it). #+begin_src emacs-lisp ;;; use :CUSTOM_ID: property for org headlines linking. (defun org-store-link-set-headline-custom-id (arg interactive?) "Set property :CUSTOM_ID: for `org-store-link' on headline." (when (and (equal major-mode 'org-mode) ; handle case `org-store-link' not in org-mode file. (not (org-before-first-heading-p)) ; handle case point is in org-mode buffer ahead of first headline. ;; (org-on-heading-p t) ; detect whether on a headline ;; (re-search-backward (concat "^\\(?:" outline-regexp "\\)") nil t) ; detect whether under a headline? (not (region-active-p)) ; handle `org-drill' capture word case. (not (org-entry-get nil "CUSTOM_ID"))) (if (yes-or-no-p "Set property :CUSTOM_ID: ? ") (org-set-property "CUSTOM_ID" (read-from-minibuffer "Property :CUSTOM_ID: value: " (substring-no-properties (org-get-heading t t))) (advice-add 'org-store-link :before #'org-store-link-set-headline-custom-id) #+end_src Is this solution will be better than headline link? Because it does not have to consider TODO keyword, tags, end checkbox statistic etc. I know Org Mode has a similar feature called ~org-id-link-to-org-use-id~. But I don't like meaningless ID personally. WDYT? - -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -BEGIN PGP SIGNATURE- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5T5xkUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsO2jgf+NXmuhKM7CyjoN0qq+DuKppTvkv5S +iQUOOk5mGmRA8ayu6Veh1IJI5U/R61lXxYPJYzV6HIAuIG+Wz7c2UOUoJ4VJyf1 yp4sksY7d7/Uhak+hEjuQvsRWoT3F+80S251+kHcRkpyZZR41HLZVHlxLgGba6ub DP+8X4EmxO3bOByK5ixAuGUPCqASfT+njSOFK7CUGDPlFt58dTb78Z/hj0b5/pv0 er0e0mS3m6matGAlsmb0A8GM+9I/TxqBGdc6SySUqNrVhGZFXMBt7090jllqb6Cq SqGxUFUxI0G3vtZYp2kPPyaYCpb9OJlhKTVkd0PxCCWZrhuqKVyvx/OmNg== =PJ1+ -END PGP SIGNATURE-
Re: ICS agenda export exceeds max-specpdl-size probably because of org-depend (org-edna same?)
Hi Bastien, * Bastien wrote: > > Karl Voit writes: > >> Easy: I could not find any change of the defaults in my >> configuration[1]. So all of them have to be the default values. >> >> [1] https://github.com/novoid/dot-emacs/blob/master/config.org > > I would try setting `org-agenda-before-write-hook' to nil (it is set > to `org-agenda-add-entry-text' by default. > > Also, I see `org-icalendar-include-body' is set to 1000 in your setup. > > That's a lot and this will generate a lot of strings replacements, > I suggest trying a lower value for your export-and-write function. Thanks for the advice. I ran three test runs in order to find out how output is affected: Testrun with disabled org-depend: emacs-snapshot --batch --load /home/vk/.emacs.d/init.el --eval '(progn (my-export-agenda)) 261.95s user 1.57s system 99% cpu 4:24.01 total → I got a result without error Testrun with enabled org-depend: emacs-snapshot --batch --load /home/vk/.emacs.d/init.el --eval '(progn (my-export-agenda))' 117.58s user 1.46s system 99% cpu 1:59.60 total → much faster result without error :-) (probably caching?) revoking the two suggested changes and do another test run with org-depend, expecting error: emacs-snapshot --batch --load /home/vk/.emacs.d/init.el --eval '(progn (my-export-agenda))' 114.38s user 1.53s system 99% cpu 1:56.33 total → much faster result without error (contrary to expection) → the two setting changes do not have an effect for now regarding error/no error due to the fact that I can not reproduce the error. Retrying when error re-appears. -- get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode: > get Memacs from https://github.com/novoid/Memacs < Personal Information Management > http://Karl-Voit.at/tags/pim/ Emacs-related > http://Karl-Voit.at/tags/emacs/
Re: ob-python.el: questions about output
On Monday, 24 Feb 2020 at 02:13, R C wrote: > When exported I would like the line: return 'img/ex1.png' not to be > included in the listing of the src block. I don't think this is currently possible in the sense you want. You could use :noweb where you have one src block referring to others and only output the code for the main body. E.g. something along the lines of #+name: mainblock #+begin_src python :results file :noweb yes def f(x): return np.polyval(a, x) a = [1, -4, 4.5, -1.5] x = np.roots(a) print(f'Roots of the polynomial are {x}') x_ = np.linspace(np.min(x), np.max(x), 100) #+end_src #+name: full #+begin_src python :results file :noweb yes import numpy as np import matplotlib.pyplot as plt <> plt.plot(x_, f(x_)) plt.plot(x, f(x), marker='o') plt.savefig('img/ex1.png') return 'img/ex1.png' #+end_src Longer term, better would be an implementation of :prologue and :epilogue options for python src blocks like we have for Maxima. It would probably make sense to provide these options for most if not all src blocks? -- : Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-354-g9d5880
Re: Org Babel: Submit SQL to command line app & capture results
I think you can do something like this. I don't have impala-shell, so I wasn't able to test this. It worked using another executable though. This is pretty bare bones, no sessions, etc. (require 'org) (require 'ob) (defun org-babel-execute:impala (body params) (let* ((code (org-babel-expand-body:generic body params)) (src-dir (make-temp-file "ob-impala-" t)) (src-file (f-join src-dir (concat (file-name-nondirectory src-dir) ".imp" (with-temp-file src-file (insert code)) ;; Compile step (org-babel-eval (format "impala-shell %s" src-file) ""))) ;;;###autoload (eval-after-load 'org '(add-to-list 'org-src-lang-modes '("impala" . impala))) (add-to-list 'org-src-lang-modes '("impala" . sql)) Nathan Neff writes: > Hello all, > > I would like to use org-babel to have SQL code like this: > > * Some heading > > #+begin_src something > SELECT COUNT(*) FROM some_table; > #+end_src > > I would like to have the code highlighted as SQL. However, I'm not reading > from a DB matching the requirements of > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sql.html > > What I would like to do when I run the code above is to: > 1) simply take the contents of the code and push it into a tmp file > 2) run a shell program on the tmp file: > impala-shell -f tmp file.txt > 3) Capture the STDOUT from the above command > > How would I do this using org-babel? Create a new "language"? > Are there already similar implementations which basically take the contents > of the source code, save to a temp file then execute a standalone program > and capture results? > > Again, I would like to have SQL style highlighting. > > Thanks for pointers -- I'm sure this is something that's reasonably easy > to implement - I just don't want to start off on the wrong foo.t > --Nate -- 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
Re: [BUG] Recently master branch commit breaks open file: link
Hi Stardiviner, stardiviner writes: > So I did a git bisect. Found this bad commit caused this problem > "afd3b04ec * bad ol: Extend open tooling in link parameters". This will work: #+begin_src org [[file:~/Org/Tasks/Computer Todos.org::*厉害的人是怎么分析问题的?][厉害的人是怎么分析问题的?]] #+end_src org-store-link used to store the TODO keyword, which was a mistake. Nicolas fixed this recently, now org-store-link DTRT and C-c C-o on stored links will work correctly. IMHO we may have several file links such as yours broken: Nicolas, do you think the bugfix should be advertized in ORG-NEWS, along with a helper function to fix file links (ie remove the TODO keyword and priority cookies)? -- Bastien
Re: ob-python.el: questions about output
Hi Jack, Thanks for your response. Sorry for not being clearer. My python src blocks often have both graphical output as well as the results of some numerical calculation displayed using print statements. #+begin_src python :results file import numpy as np import matplotlib.pyplot as plt def f(x): return np.polyval(a, x) a = [1, -4, 4.5, -1.5] x = np.roots(a) print(f'Roots of the polynomial are {x}') x_ = np.linspace(np.min(x), np.max(x), 100) plt.plot(x_, f(x_)) plt.plot(x, f(x), marker='o') plt.savefig('img/ex1.png') return 'img/ex1.png' #+end_src Executing this results in #+RESULTS: [[file:img/ex1.png]] When exported I would like the line: return 'img/ex1.png' not to be included in the listing of the src block. Also, the output of the print statement is not displayed in this case. It seems that the display of the results of the print statement: print(f'Roots of the polynomial are {x}') , would require execution of a duplicate src block without the return statement in the last line, and with ':results output' replacing ':results file' which gives: #+RESULTS: : Roots of the polynomial are [2.3660254 1.0.6339746] I would have liked to avoid the duplication if possible. Thanks, RC On Sun, Feb 23, 2020 at 11:53 PM Jack Kamm wrote: > Hi RC, > > R C writes: > > > 1. Is it possible to have both types of output displayed from a single > src > > block to avoid having to duplicate the src block, using :exports results > > for one and :exports both for the other? > > No, there's no option to output both ":results output" and ":results > value". > > If you want both output and value results, and want to avoid executing > the same code twice, you could consider using a pair of ":session" > blocks, for example: > > #+begin_src python :session session1 :results output > print("Block that does some computations") > x = 1+1 > #+end_src > > #+begin_src python :session session1 :results output > x > #+end_src > > > 2. Is there an option to suppress export of the the last line of the src > > block which is specific to the ob-python implementation. > > I'm not sure what you mean by this, could you give an example of what > the observed and desired behaviors are? >
Re: [BUG] Recently master branch commit breaks open file: link
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Bastien writes: > Hi Stardiviner, > > stardiviner writes: > >> When I open a link like this: > > Thanks for testing links, the master branch contains a few changes. > >> #+begin_src org >> [[file:~/Org/Tasks/Computer Todos.org::*TODO 厉害的人是怎么分析问题的?][厉害的人是怎么分析问题的?]] >> #+end_src >> >> I =[M-x toggle-debug-on-error]= got following stacktrace: >> >> #+begin_example >> Debugger entered--Lisp error: (file-missing "Reading directory" "No >> such file or directory" >> "/home/stardiviner/Org/Wiki/Thought/Data/Manuals/My...") >> access-file("/home/stardiviner/Org/Wiki/Thought/Data/Manuals/My..." >> "Reading directory") > > Is this directory* existing in your setup? > > * /home/stardiviner/Org/Wiki/Thought/Data/Manuals/My... > > If yes, do you know what causes Org to check for its existence? I confirm this link directory and file exists. Including the headline exists too. So I did a git bisect. Found this bad commit caused this problem "afd3b04ec * bad ol: Extend open tooling in link parameters". This commit introduced new open file link function. > > Thanks, - -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -BEGIN PGP SIGNATURE- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5TvDUUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsPWNAgAiGRD65HV+3j7jl+xxJgOuvRgy+O8 Os2BJkiKTrM8YYTX9icLnygAPQN9oXLOTYVXdShQWo1lHtpx0417bGBW+L7TglPW hfdTYFl99No1+T0mnam0qnR44YDOrOYzPb83TqQnUOyhK/uWsk18pOhrvPf2UYpK YxiIhGdlyosb41P+9gVzPfTM0akWHddNY/LZuJT+Irr84zpIAYwiXc24VXN6qhnB /gDBosDGPbRl/XniFU3fUYSklHsBvUWuXb88df442pK+AfKEsh3c6lUqJ5AKtIm5 qmjye5OqZoQwt/zOpMakldvoK/hO/jT0UusRv1QqvKDpcyDAT7qrxIaODw== =oJQL -END PGP SIGNATURE-
Re: patch: add custom latex->html conversion command
Hi Matt, Matt Huszagh writes: > Thanks for the feedback. I've filled out the form you sent and sent it > to the email listed. this is now in master, thanks. -- Bastien
Re: Possible to exclude/include tags for agenda custom commands?
Hi Eric, Eric Abrahamsen writes: > The key is having `org-agenda-sticky' set to t -- this means that we'll > let-bind buffer-local variables in a buffer where they're already > set. thanks for the reproducible example, I was able to get the warning. You can safely ignore it: when redoing sticky agenda, we need to let-bind the values as explicitely set in the agenda custom command (here the org-agenda-tag-filter value) while preparing the agenda requires the variables to be made local. I don't see what can be done and I don't think there hidden bugs lingering around here. Best, -- Bastien
Re: ICS agenda export exceeds max-specpdl-size probably because of org-depend (org-edna same?)
Hi Karl, Karl Voit writes: > Easy: I could not find any change of the defaults in my > configuration[1]. So all of them have to be the default values. > > [1] https://github.com/novoid/dot-emacs/blob/master/config.org I would try setting `org-agenda-before-write-hook' to nil (it is set to `org-agenda-add-entry-text' by default. Also, I see `org-icalendar-include-body' is set to 1000 in your setup. That's a lot and this will generate a lot of strings replacements, I suggest trying a lower value for your export-and-write function. HTH, -- Bastien
Re: [BUG] Recently master branch commit breaks open file: link
Hi Stardiviner, stardiviner writes: > When I open a link like this: Thanks for testing links, the master branch contains a few changes. > #+begin_src org > [[file:~/Org/Tasks/Computer Todos.org::*TODO 厉害的人是怎么分析问题的?][厉害的人是怎么分析问题的?]] > #+end_src > > I =[M-x toggle-debug-on-error]= got following stacktrace: > > #+begin_example > Debugger entered--Lisp error: (file-missing "Reading directory" "No > such file or directory" > "/home/stardiviner/Org/Wiki/Thought/Data/Manuals/My...") > access-file("/home/stardiviner/Org/Wiki/Thought/Data/Manuals/My..." > "Reading directory") Is this directory* existing in your setup? * /home/stardiviner/Org/Wiki/Thought/Data/Manuals/My... If yes, do you know what causes Org to check for its existence? Thanks, -- Bastien
Re: Exploring properties
Hi Vikas, Vikas Rawal writes: > I am essentially thinking of org-mode providing an > interface for feeding data to recutils. Yes, that would probably be useful. If you want to write a feature request, please write it as if the reader does not know recutils and you precise use-case, so that we understand all implication and motivate possible contributors. Thanks, -- Bastien