proposed additions to org-collector code

2021-08-30 Thread Charles Millar
First, I thank Slava Barinov for his proposed patch to appending a 
#+tblfm line to an org-collector table. Date: 17 Mar 2019 13:22:58 +0300

Message-ID: <87sgvl4wes@gmail.com> (raw)

Attached is my, in all modesty named, cm-org-collector.el in which I 
have added code to prepend name and attribute headers to the table, for 
example:


* orgcollector experiment
:PROPERTIES:
:ID: test
:END:

** Heading One


** Heading two

#+BEGIN: propview :id "test" :cols (ITEM) :noquote t :defaultval "" 
:tblfm "@>$>" :tblname "That" :tblattributes "#+attr_latex: 
somethingelse" :content ""

#+name: That
#+attr_latex: somethingelse
| ITEM|
|-|
| orgcollector experiment |
| Heading One |
| Heading two |
|-|
| |
#+tblfm: @>$>
#+END:

Please note that the :content param must be set to an empty string on 
the #+BEGIN: propview line. Without doing so, upon evaluation of the 
block, the table is updated; however, the following conditions result:

(error "(user-error Not at a table)")
the #+tblfm line is not replaced but an additional #+tblfm line is 
added, and
the #+name and #+attr headers do not reflect any changes to :tblname and 
tblattributes if made in the propview line.


I realize that org-collector is an orphan and that it requires 
additional documentation. (See Bastien's comments to Slava's message.)


That said, if anyone so desires, please consider these additions, make 
all appropriate changes and corrections and patch them to 
org-coolector.el. I believe that this additional code makes 
org-collector more useful as database tool. Instead of having to add 
headers after evaluation, those headers would be inserted at the correct 
point when the propview is evaluated. The resulting table can be called 
from other code blocks. Also, the #+attr header allows, I believe, for 
exporting as desired. (I tried only a latex to pdf and it worked OK.)


I imagine other header params may be included as well.

Charlie Millar

;;; cm-org-collector --- Eric Schulte's org-collector modified to for Charlie

;; Copyright (C) 2008-2021 Free Software Foundation, Inc.

;; Author: Eric Schulte 
;; Keywords: outlines, hypermedia, calendar, wp, experimentation,
;;   organization, properties
;; Homepage: https://orgmode.org
;; Version: 0.01

;; This file is not yet part of GNU Emacs.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see .

;;; Commentary:

;; Pass in an alist of columns, each column can be either a single
;; property or a function which takes column names as arguments.
;;
;; For example the following propview block would collect the value of
;; the 'amount' property from each header in the current buffer
;;
;; #+BEGIN: propview :cols (ITEM amount)
;; | "ITEM"  | "amount" |
;; |-+--|
;; | "December Spending" |0 |
;; | "Grocery Store" |56.77 |
;; | "Athletic club" | 75.0 |
;; | "Restaurant"|30.67 |
;; | "January Spending"  |0 |
;; | "Athletic club" | 75.0 |
;; | "Restaurant"|50.00 |
;; |-+--|
;; | |  |
;; #+END:
;;
;; This slightly more selective propview block will limit those
;; headers included to those in the subtree with the id 'december'
;; in which the spendtype property is equal to "food"
;;
;; #+BEGIN: propview :id "december" :conds ((string= spendtype "food")) :cols (ITEM amount)
;; | "ITEM"  | "amount" |
;; |-+--|
;; | "Grocery Store" |56.77 |
;; | "Restaurant"|30.67 |
;; |-+--|
;; | |  |
;; #+END:
;;
;; Org Collector allows arbitrary processing of the property values
;; through elisp in the cols: property.  This allows for both simple
;; computations as in the following example
;;
;; #+BEGIN: propview :id "results" :cols (ITEM f d list (apply '+ list) (+ f d))
;; | "ITEM" | "f" | "d" | "list"  | "(apply (quote +) list)" | "(+ f d)" |
;; |+-+-+-+--+---|
;; | "run1" |   2 |  33 | (quote (9 2 3 4 5 6 7)) | 36   |35 |
;; | "run2" |   2 |  34 | :na | :na  |36 |
;; | "run3" |   2 |  35 | :na | :na 

Re: ob-lilypond.el doesn't generate midi files

2021-08-30 Thread Jonathan Gregory

Hi

On 29 Aug 2021, Michael Maurer wrote:

Yep, that's it. Modified ob-lilypond.el and recompiled it. 
Timidity works as helper, couldn't get vlc to work. Maybe the 
file ending should be modifiable via org-babel-lilypond-commands 
as well, or make ob-lilypond.el look for *.mid or *.midi. I'm 
pretty confident *.mid is the default setting for lilypond on 
win, and not my doing.


I attached a patch to use a different suffix on Windows. Thanks 
for your help.


--
Jonathan
>From 1929b8082b9cff2a4bd99c573b2a2bd50b76b184 Mon Sep 17 00:00:00 2001
From: Jonathan Gregory 
Date: Mon, 30 Aug 2021 13:49:48 -0300
Subject: [PATCH] Set the MIDI file extension conditionally

* lisp/ob-lilypond.el (org-babel-lilypond-attempt-to-play-midi): By
default, LilyPond outputs .mid files for Windows and .midi for
everything else.

See: 

TINYCHANGE
---
 lisp/ob-lilypond.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el
index eae1779ce..e197ea7a6 100644
--- a/lisp/ob-lilypond.el
+++ b/lisp/ob-lilypond.el
@@ -337,7 +337,9 @@ If TEST is non-nil, the shell command is returned and is not run."
 FILE-NAME is full path to lilypond file.
 If TEST is non-nil, the shell command is returned and is not run."
   (when org-babel-lilypond-play-midi-post-tangle
-(let ((midi-file (org-babel-lilypond-switch-extension file-name ".midi")))
+(let* ((ext (if (eq system-type 'windows-nt)
+".mid" ".midi"))
+   (midi-file (org-babel-lilypond-switch-extension file-name ext)))
   (if (file-exists-p midi-file)
   (let ((cmd-string
  (concat org-babel-lilypond-midi-command " " midi-file)))
-- 
2.25.1



Re: Bug: Unable to follow links to org files using org-open-at-point when the link is located in a property drawer [9.4.4 (release_9.4.4 @ /home/sync0/.emacs.d/straight/build/org/)]

2021-08-30 Thread Ihor Radchenko
Carlos Alberto Rivera CarreƱo  writes:

> org-id-open: Cannot find entry with ID "1e705ded-0364-412d-bb01-02a99fc78694"

I suspect that you did not create that link using built-in org
functions. org-id uses heuristics to determine which files contain id
targets. By default, Org only searches org-agenda-files and current
buffer. When org-id-track-globally is set, Org tries to be smarter and add
any file to where you programatically store an id: link. If you never do
it and create the link manually, Org will not find such link. See
docstring of org-id-extra-files for some more details.

Hope it helps.

Best,
Ihor



Re: Testing if a scheduled date is prior to another date

2021-08-30 Thread Ihor Radchenko
Tim Landscheidt  writes:

> Before I wade through the various functions to build a con-
> version chain, what is the best practice to compare time-
> stamp values with dates?  (And if there is an org-mode func-
> tion that checks if the task at point is scheduled prior to
> another date, I'd appreciate pointers as well :-).)

You can try org-parse-time-string + org-element-timestamp-interpreter
from org.

Alternatively, you can use external 'ts library: ts-parse-org-element

Best,
Ihor