Re: [O] Nested calls in babel
Hi Chuck, >> I am being unable to make nested calls work. Here is a minimal snippet: >> >> --8<---cut here---start->8--- >> #+NAME: foo >> #+BEGIN_SRC emacs-lisp >> "foo" >> #+END_SRC >> >> #+NAME: bar >> #+CALL: foo() >> >> #+RESULTS: bar >> : foo >> >> #+CALL: bar() >> >> #+RESULTS: >> : nil >> --8<---cut here---end--->8--- > > Your example works for me. viz, the call to bar returns "foo" (not nil). thanks for checking. I was using 25.3. I have now upgraded to 26.3 and it works as expected :) Carlos
[O] Toggle on/off the display of individual image?
Hello Is it possible to toggle on/off the display of one specific image? I am aware of org-display-inline-images but it acts on the whole buffer, so it toggles all images. It would be nice if there was some way to toggle individual images on/off. A workaround of sorts would be to put each image under its own heading and then use folding, but that is hardly a good solution.
Re: [O] Import CSV file, remove columns, print table
Hi John, Thanks - that's a nicely compact solution, albeit in the category 'source block' and in a language I'm not very skilled at :-) I realise that I have slightly misstated the problem. The ID in the imported CSV is just a key from the database - I don't need it on the list of participants. However, it would be nice to number the participants, who are sorted by surname. How would I insert a column which just numbers the row? Cheers, Loris John Kitchin writes: > You can do something like this: > > #+name: csv > | ID | Name | Titel / Title | Vorname / First Name | Nachname / > Surname | Institution | > | 1 | Alice Apple | Fr./Ms. | Alice| Apple > | Universität zum Apfel | > | 2 | Bob Birne| Hr./Mr. | Bob | Birne > | Pear University | > | 3 | Carol Carrot | Prof. | Carol| Carrot > | University of Veg | > > #+BEGIN_SRC emacs-lisp :var data=csv > (let ((table (mapcar (lambda (row) (list (nth 0 row) (nth 4 row) (nth 3 > row))) data))) > (setf (car table) (append (car table) '("Signature"))) > table) > #+END_SRC > > #+RESULTS: > | ID | Nachname / Surname | Vorname / First Name | Signature | > | 1 | Apple | Alice| | > | 2 | Birne | Bob | | > | 3 | Carrot | Carol| | > > 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 Fri, Sep 13, 2019 at 9:36 AM Loris Bennett > wrote: > > Hi, > > I want to create a list of participants of an event which people can > sign, so that I can record who actually turned up. > > From the registration website I can download a CSV file and import it > into and org file: > > | ID | Name | Titel / Title | Vorname / First Name | Nachname / > Surname | Institution | > | 1 | Alice Apple | Fr./Ms. | Alice| Apple >| Universität zum Apfel | > | 2 | Bob Birne| Hr./Mr. | Bob | Birne >| Pear University | > | 3 | Carol Carrot | Prof. | Carol| Carrot >| University of Veg | > > I would like to reduce this to > > | ID | Nachname / Surname | Vorname / First Name | Signature | > | 1 | Apple | Alice| | > | 2 | Birne | Bob | | > | 3 | Carrot | Carol| | > > and then print it out as a LaTeX table. > > I can obviously write a source block of Python or R to do this, but can > I manipulate the table more directly in Org? > > Cheers, > > Loris > > -- > This signature is currently under construction. > -- Dr. Loris Bennett (Mr.) ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de
Re: [O] Toggle on/off the display of individual image?
* henr...@keemail.me [2019-09-16 12:35]: > Is it possible to toggle on/off the display of one specific image? I > am aware of org-display-inline-images but it acts on the whole > buffer, so it toggles all images. > > It would be nice if there was some way to toggle individual images > on/off. A workaround of sorts would be to put each image under its > own heading and then use folding, but that is hardly a good > solution. If Org headings would be stored somehow as structured data, that could be easily possible. I think, but I am not not sure, that any actions in Org files require iteration over the text file. For single images to be shown while others are not shown that would require some tweaking. That is nice feature that would help in finely grained review or access of the structured information. Jean
Re: [O] Import CSV file, remove columns, print table
Here is another 'source block' solution, this time in python. You could so something similar in elisp. Here I use the library of babel approach so you can call it wherever you want. #+name: csv | ID | Name | Titel / Title | Vorname / First Name | Nachname / Surname | Institution | | 3 | Carol Carrot | Prof. | Carol| Carrot | University of Veg | | 1 | Alice Apple | Fr./Ms. | Alice| Apple | Universität zum Apfel | | 2 | Bob Birne| Hr./Mr. | Bob | Birne | Pear University | See https://orgmode.org/worg/org-contrib/babel/library-of-babel.html #+name: signature-table #+BEGIN_SRC python :var data=csv :results value raw results = [[surname, firstname, ""] for _, _, _, firstname, surname, _ in data[1:]] sorted_results = sorted(results,key=lambda row: row[1]) sorted_results = [[i + 1] + result for i, result in enumerate(sorted_results)] import tabulate return tabulate.tabulate(sorted_results, ['#', 'Surname', 'First name', 'Signature'], tablefmt='orgtbl') #+END_SRC #+call: signature-table(data=csv) #+RESULTS: | # | Surname | First name | Signature | |---+-++---| | 1 | Apple | Alice | | | 2 | Birne | Bob| | | 3 | Carrot | Carol | | --- 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 Mon, Sep 16, 2019 at 8:48 AM Loris Bennett wrote: > Hi John, > > Thanks - that's a nicely compact solution, albeit in the category > 'source block' and in a language I'm not very skilled at :-) > > I realise that I have slightly misstated the problem. The ID in the > imported CSV is just a key from the database - I don't need it on the > list of participants. However, it would be nice to number the > participants, who are sorted by surname. > > How would I insert a column which just numbers the row? > > Cheers, > > Loris > > John Kitchin writes: > > > You can do something like this: > > > > #+name: csv > > | ID | Name | Titel / Title | Vorname / First Name | Nachname / > Surname | Institution | > > | 1 | Alice Apple | Fr./Ms. | Alice| Apple > | Universität zum Apfel | > > | 2 | Bob Birne| Hr./Mr. | Bob | Birne > | Pear University | > > | 3 | Carol Carrot | Prof. | Carol| Carrot >| University of Veg | > > > > #+BEGIN_SRC emacs-lisp :var data=csv > > (let ((table (mapcar (lambda (row) (list (nth 0 row) (nth 4 row) (nth 3 > row))) data))) > > (setf (car table) (append (car table) '("Signature"))) > > table) > > #+END_SRC > > > > #+RESULTS: > > | ID | Nachname / Surname | Vorname / First Name | Signature | > > | 1 | Apple | Alice| | > > | 2 | Birne | Bob | | > > | 3 | Carrot | Carol| | > > > > 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 Fri, Sep 13, 2019 at 9:36 AM Loris Bennett < > loris.benn...@fu-berlin.de> wrote: > > > > Hi, > > > > I want to create a list of participants of an event which people can > > sign, so that I can record who actually turned up. > > > > From the registration website I can download a CSV file and import it > > into and org file: > > > > | ID | Name | Titel / Title | Vorname / First Name | Nachname / > Surname | Institution | > > | 1 | Alice Apple | Fr./Ms. | Alice| Apple > | Universität zum Apfel | > > | 2 | Bob Birne| Hr./Mr. | Bob | Birne > | Pear University | > > | 3 | Carol Carrot | Prof. | Carol| Carrot > | University of Veg | > > > > I would like to reduce this to > > > > | ID | Nachname / Surname | Vorname / First Name | Signature | > > | 1 | Apple | Alice| | > > | 2 | Birne | Bob | | > > | 3 | Carrot | Carol| | > > > > and then print it out as a LaTeX table. > > > > I can obviously write a source block of Python or R to do this, but can > > I manipulate the table more directly in Org? > > > > Cheers, > > > > Loris > > > > -- > > This signature is currently under construction. > > > -- > Dr. Loris Bennett (Mr.) > ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de > > >
Re: [O] Patch: strip (unneeded) quotes from singular value results
Hello, Mike Ivanov writes: > lisp/ob-lisp.el | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el > index e717fc34e..0afb8c053 100644 > --- a/lisp/ob-lisp.el > +++ b/lisp/ob-lisp.el > @@ -107,7 +107,7 @@ a property list containing the parameters of the block." > (point-min) (point-max) >(cdr (assq :package params))) > (org-babel-result-cond (cdr (assq :result-params params)) > - result > + (org-babel-strip-quotes result) Applied, after changing `org-babel-strip-quotes' to `org-strip-quotes'. Thank you. Regards, -- Nicolas Goaziou
Re: [O] [PATCH] org-macs: Fix indentation for fullwidth characters
Hello, Yuichiro Hakozaki writes: > @@ -335,7 +335,7 @@ if it fails." >(let ((min-ind (point-max))) > (save-excursion >(while (re-search-forward "^[ \t]*\\S-" nil t) > -(let ((ind (1- (current-column > +(let ((ind (- (current-column) (char-width > (char-before) I used `current-indentation' instead. Thank you for the bug report, and the patch. Regards, -- Nicolas Goaziou
Re: [O] org-icalendar: Change dates to today in VEVENT export
Hello, Michaël Cadilhac writes: > Right, you pointed this out the first time, and I forgot to address > this: How would you build such a timestamp *with the -end bits* using > org-timestamp-from-time? It seems that > org-icalendar-convert-timestamp expects that these be filled. I suggest to fix `org-timestamp-from-time' so that it matches `org-element-timestamp-parser' return value. Regards, -- Nicolas Goaziou
Re: [O] [PATCH] org: Prevent loss of `re-search-forward' results
Hello, Max Mouratov writes: > * org.el (org-activate-links): `match-beginning' and `match-end` should > be called shortly after `re-search-forward'. Otherwise, they may return > values corresponding to a different invocation of `re-search-forward'. Applied. Thank you! Regards, -- Nicolas Goaziou
Re: [O] [PATCH] ox-latex.el: Extend :placement attribute to source blocks
Hello, Mario Schlegel writes: > * lisp/ox-latex.el (org-latex-src-block): Extend :placement attribute > to source blocks when the minted package is used. Applied. Thank you! Regards, -- Nicolas Goaziou
[O] Modify a variable before it is passed to babel (or exported)?
I'd like to modify a variable with a babel block before another block sees the variable. For example, I always want to add one to a variable: #+NAME: add-one #+BEGIN_SRC bash :results verbatim :var data=0 data=$(( data + 1 )) echo $data #+END_SRC #+RESULTS: add_one : 1 Test it: #+CALL: add_one(data=42) #+RESULTS: : 43 Can I use =add_one= to modify data passed elsewhere? For example, given #+NAME: table | 42 | I'm having trouble defining a =print_table= function that prints 43, using the =add_one= either via :prologue or <> or some other method. Preferably prologue because then the add_one function could be in a different language. I can get halfway to what I want with a :post option, but need this to be a :pre or :prologue. Example using :post #+NAME: python_using_add_one #+BEGIN_SRC python :results output values :post add-one(data=*this*) print(42) #+END_SRC #+RESULTS: python_using_add_one : 43 Any suggestions how to use this feature with :pre or :prologue? Thanks, -k
Re: [O] Modify a variable before it is passed to babel (or exported)?
Hello, I solved this with (org-sbe). For example, using "add-one" and "table" from the original email #+Name: test-add-one #+BEGIN_SRC python :results output values :var data=(org-sbe add-one (data table)) print(data) #+END_SRC #+RESULTS: test-add-one : 43 Or src_elisp{(org-sbe add-one (data table))} {{{results(=43=)}}} -k. On 2019-09-16 at 10:21 -07, Ken Mankoff wrote... > I'd like to modify a variable with a babel block before another block > sees the variable. For example, I always want to add one to a > variable: > > #+NAME: add-one > #+BEGIN_SRC bash :results verbatim :var data=0 > data=$(( data + 1 )) > echo $data > #+END_SRC > > #+RESULTS: add_one > : 1 > > Test it: > > #+CALL: add_one(data=42) > > #+RESULTS: > : 43 > > Can I use =add_one= to modify data passed elsewhere? > > For example, given > > #+NAME: table > | 42 | > > I'm having trouble defining a =print_table= function that prints 43, using > the =add_one= either via :prologue or <> or some other method. > Preferably prologue because then the add_one function could be in a different > language. > > > I can get halfway to what I want with a :post option, but need this to be a > :pre or :prologue. Example using :post > > #+NAME: python_using_add_one > #+BEGIN_SRC python :results output values :post add-one(data=*this*) > print(42) > #+END_SRC > > #+RESULTS: python_using_add_one > : 43 > > Any suggestions how to use this feature with :pre or :prologue? > > Thanks, > > -k
[O] Bug: COMMENT and noweb-ref
org-babel-tangle on * A #+BEGIN_SRC elisp :tangle yes :noweb yes ;; A <> #+END_SRC * COMMENT B #+BEGIN_SRC elisp :noweb-ref B ;; B #+END_SRC * COMMENT C #+BEGIN_SRC elisp :tangle yes ;; C #+END_SRC produces a file with A and B in it. Expected: Just A. Changing #+BEGIN_SRC elisp :noweb-ref B ;; B #+END_SRC to # #+BEGIN_SRC elisp :noweb-ref B # ;; B # #+END_SRC does yield the expected result.
Re: [O] Bug: COMMENT and noweb-ref
GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10) of 2019-08-29 Org mode version 9.2.6 (release_9.2.6-538-g23113f @ /home/w/borg/emacs/org/lisp/)
[O] Capture template issue ?
I have an issue with my capture templates where if I add an item at the end of list, the item seems to "eat" the following line break and merges with the item that follows: * List 1 ** item 1 ** item 2 * List 2 ** item 3 ** item 4 displayed * List 1 ... * List 2 ... I add item 5 to List 1, I should get: * List 1 ** item 1 ** item 2 ** item 5 * List 2 ... But instead I get * List 1 ** item 1 ** item 2 ** item 5 * List 2 ... which makes List 2 disappear for all practical purposes. That's pretty systematic, and very annoying. Nearly all my templates show a similar behavior. This one was: (file+headline "~/org/journal.org" "Dictionnaire") "* %? :%^{tag}:\n") I'm using the built-in 9.1.9 version, with an emacs from master built a few days ago, on macos. And my org setup is this: (setq org-use-speed-commands t org-directory "~/org" org-default-notes-file (concat org-directory "/notes.org") org-refile-targets '((org-agenda-files :maxlevel . 3)) org-refile-use-outline-path 'file org-outline-path-complete-in-steps nil org-refile-allow-creating-parent-nodes 'confirm org-startup-indented t org-use-fast-todo-selection t org-return-follows-link t org-link-abbrev-alist '(("message" . "mailto")) org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)") (sequence "WAIT(w)" "|" "IN-PROGRESS" "|" "CANCELED(c)")) org-agenda-files '("/Users/suzume/org/" "/Users/suzume/Library/Application Support/Notational Data/") org-indirect-buffer-display 'current-window org-modules '(org-bbdb org-bibtex org-docview org-habit org-info org-irc org-mhe org-protocol org-rmail) org-support-shift-select t org-todo-keyword-faces '(("IN-PROGRESS" . "orange") ("WAIT" . "magenta") ("CANCELED" . "darkgreen") ("TODO" . "pink") ("DONE" . "green"))) Where should I investigate to fix this ? Jean-Christophe Helary --- http://mac4translators.blogspot.com @brandelune
Re: [O] ANN: org-ql agenda block support
Mikhail Skorzhinskii writes: > Great overview, thanks a lot. > > So I give it a try and completely fell in love. On my data set it is > visibly faster then org-agenda. I also wrote a lot of code around > org-agenda over the years to support my sometimes awkward needs. And now > I just threw all this ugly code away! > > That was very emotional moment for me, very good job, kind sir. Hi Mikhail, Thanks for the kind words. I'm glad to hear that you like it. I knew there must be someone like you out there, if only I could get the word to you! :) If you're interested, here's a demo of a new feature I plan to publish soon, a sidebar for stored view queries: https://github.com/alphapapa/org-ql/raw/wip/refactor-org-ql-agenda/images/org-ql-view-sidebar.gif I think it will help bring a kind of feature parity with other to-do list-type software, ones where you can click in a sidebar and see items matching certain criteria displayed in a pane next to it. With org-ql's caching and such, switching between stored views can be very fast. And each one is displayed in its own buffer, so you could also e.g. show one pane with the "today" view and another with the "this week" view. If you'd like to help test it, you can use this branch: https://github.com/alphapapa/org-ql/tree/wip/refactor-org-ql-agenda e.g.: #+BEGIN_SRC elisp (use-package org-ql :quelpa (org-ql :fetcher github :repo "alphapapa/org-ql" :branch "wip/refactor-org-ql-agenda")) #+END_SRC