[BUG] Recently master branch commit breaks open file: link

2020-02-23 Thread stardiviner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256


When I open a link like this:

#+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")
  #f(compiled-function (file switches  wildcard full-directory-p) 
"Insert directory listing for FILE, formatted according to SWITCHES.\nLeaves 
point after the inserted text.\nSWITCHES may be a string of options, or a list 
of strings\nrepresenting individual options.\nOptional third arg WILDCARD means 
treat FILE as shell wildcard.\nOptional fourth arg FULL-DIRECTORY-P means file 
is a directory and\nswitches do not contain `d', so that a full listing is 
expected.\n\nThis works by running a directory listing program\nwhose name is 
in the variable `insert-directory-program'.\nIf WILDCARD, it also runs the 
shell specified by `shell-file-name'.\n\nWhen SWITCHES contains the long 
`--dired' option, this function\ntreats it specially, for the sake of dired.  
However, the\nnormally equivalent short `-D' option is just passed on 
to\n`insert-directory-program', as any other option." #)("/home/stardiviner/Org/Wiki/Thought/Data/Manuals/My..." 
"--dired -al" t nil)
  ls-lisp--insert-directory(#f(compiled-function (file switches  
wildcard full-directory-p) "Insert directory listing for FILE, formatted 
according to SWITCHES.\nLeaves point after the inserted text.\nSWITCHES may be 
a string of options, or a list of strings\nrepresenting individual 
options.\nOptional third arg WILDCARD means treat FILE as shell 
wildcard.\nOptional fourth arg FULL-DIRECTORY-P means file is a directory 
and\nswitches do not contain `d', so that a full listing is expected.\n\nThis 
works by running a directory listing program\nwhose name is in the variable 
`insert-directory-program'.\nIf WILDCARD, it also runs the shell specified by 
`shell-file-name'.\n\nWhen SWITCHES contains the long `--dired' option, this 
function\ntreats it specially, for the sake of dired.  However, the\nnormally 
equivalent short `-D' option is just passed on to\n`insert-directory-program', 
as any other option." #) 
"/home/stardiviner/Org/Wiki/Thought/Data/Manuals/My..." "--dired -al" t nil)
  apply(ls-lisp--insert-directory #f(compiled-function (file switches  
wildcard full-directory-p) "Insert directory listing for FILE, formatted 
according to SWITCHES.\nLeaves point after the inserted text.\nSWITCHES may be 
a string of options, or a list of strings\nrepresenting individual 
options.\nOptional third arg WILDCARD means treat FILE as shell 
wildcard.\nOptional fourth arg FULL-DIRECTORY-P means file is a directory 
and\nswitches do not contain `d', so that a full listing is expected.\n\nThis 
works by running a directory listing program\nwhose name is in the variable 
`insert-directory-program'.\nIf WILDCARD, it also runs the shell specified by 
`shell-file-name'.\n\nWhen SWITCHES contains the long `--dired' option, this 
function\ntreats it specially, for the sake of dired.  However, the\nnormally 
equivalent short `-D' option is just passed on to\n`insert-directory-program', 
as any other option." #) 
("/home/stardiviner/Org/Wiki/Thought/Data/Manuals/My..." "--dired -al" t nil))
  insert-directory("/home/stardiviner/Org/Wiki/Thought/Data/Manuals/My..." 
"--dired -al" t nil)
  
dired-insert-directory("/home/stardiviner/Org/Wiki/Thought/Data/Manuals/My..." 
"-al" nil t t)
  dired-readin-insert()
  dired-readin()
  dired-internal-noselect("~/Org/Wiki/Thought/Data/Manuals/My Thought 
Manuals..." nil)
  dired-noselect("~/Org/Wiki/Thought/Data/Manuals/My Thought Manuals..." nil)
  #f(compiled-function (dirname  switches) "\"Edit\" directory 
DIRNAME--delete, rename, print, etc. some files in it.\nOptional second 
argument SWITCHES specifies the `ls' options used.\n(Interactively, use a 
prefix argument to be able to specify SWITCHES.)\n\nIf DIRNAME is a string, 
Dired displays a list of files in DIRNAME (which\nmay also have shell wildcards 
appended to select certain files).\n\nIf DIRNAME is a cons, its first element 
is taken as the directory name\nand the rest as an explicit list of files to 
make directory entries for.\nIn this case, SWITCHES are applied to each of the 
files separately, and\ntherefore switches that control the order of the files 
in the produced\nlisting have no effect.\n\n\\You can flag 
files for deletion with \\[dired-flag-file-deletion] and then\ndelete them by 
typing \\[dired-do-flagged-delete].\nType \\[describe-mode] after entering 
Dired for more info.\n\nIf DIRNAME is already in a Dired buffer, that buffer is 
used without refresh." (interactive (dired-read-dir-and-switches "")) 
#)("~/Org/Wiki/Thought/Data/Manuals/My Thought 

Re: ob-python.el: questions about output

2020-02-23 Thread Jack Kamm
Sorry, my email had a typo:

> #+begin_src python :session session1 :results output
> x
> #+end_src

That should be ":results value".



Re: ob-python.el: questions about output

2020-02-23 Thread Jack Kamm
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: Exploring properties

2020-02-23 Thread Vikas Rawal
Thanks Bastien for advice and for connecting with Jose. It would be useful
to write some lisp for inserting and adding data from org into rec files.
It could either be from org-mode tables or from properties. I am
essentially thinking of org-mode providing an interface for feeding data to
recutils.

Vikas

On Sun, 23 Feb 2020 at 19:10, Bastien  wrote:

> Hi Vikas,
>
> Vikas Rawal  writes:
>
> > Would you think that an extension of org-collector is the direction to
> > look at? Doesn't look like org-collector has seen any updates in a
> > long time.
>
> You might want to look at recutils instead.
>
> It was announced on org-mode mailing list here 10 years ago:
> https://lists.gnu.org/archive/html/emacs-orgmode/2010-12/msg00219.html
>
> Jose is still developing it actively - it made the news on HN
> recently: https://news.ycombinator.com/item?id=22153665
>
> There is *some* integration with org-mode, although I have not tested
> it. I've also found this, but this seems outdated and not maintained:
> https://github.com/millarc/ob-rec.el
>
> I'm cc'ing Jose as he may be able to share his own wishlist on how Org
> could better interact with recutils.
>
> HTH,
>
> --
>  Bastien
>


Re: Limiting properties and property values

2020-02-23 Thread Vikas Rawal
Dear Eric, Bastien and John,

Thanks for references to recutils and org-ql. These are very interesting,
and I am looking at those.

A recutils database with a possibility of selecting, inserting and updating
records from org is one possibility.

Let me play around with these tools a bit and see what they are like.

Thanks again,

Vikas


On Sun, 23 Feb 2020 at 22:20, Fraga, Eric  wrote:

> On Sunday, 23 Feb 2020 at 15:10, Vikas Rawal wrote:
> > I am thinking of using org-mode to compile a small database.
>
> Although org is fantastic, it is sometimes worth considering other tools
> (and with babel, these can often be brought into the org sphere of
> activity easily).  For instance, GNU recutils [1] might suit you
> better.  There's even an emacs mode [2].
>
> Just my 2¢.
>
>
> Footnotes:
> [1]  https://www.gnu.org/software/recutils/
>
> [2]  https://www.gnu.org/software/recutils/rec-mode-manual/rec-mode.html
>
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-354-g9d5880
>


Re: [PATCH] support colorful blocks display on org-agenda

2020-02-23 Thread Daniele Nicolodi
On 20/02/2020 00:15, Bastien wrote:
> Days for the "contrib/" directory are counted: before Org 9.5, I will
> extract it from Org's repository, make it an independant repository on
> code.orgmode.org and make it available through Org ELPA.

This is an excellent plan!

Cheers,
Dan



ob-python.el: questions about output

2020-02-23 Thread R C
The approach proposed for graphical output at
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html is


#+begin_src python :results file

import matplotlib, numpy
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig=plt.figure(figsize=(4,2))
x=numpy.linspace(-15,15)
plt.plot(numpy.sin(x)/x)
fig.tight_layout()
plt.savefig('images/python-matplot-fig.png')
return 'images/python-matplot-fig.png' # return filename to org-mode
#+end_src


and to use :results output for displaying stdout.

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?
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.

Thanks,
RC


Re: Exporting comments to comments?

2020-02-23 Thread Christian Moe


I use a rather complex comment macro to make ODT annotations without
introducing unwanted paragraph breaks.

I'm not sure what the Markdown comment syntax is. But e.g. for HTML, the
macro could be defined as simply as:

#+MACRO: comment @@html:@@

Then you can write things like

  This is a sentence with a comment.{{{comment(This is the comment.)}}}
  This is another sentence.

and get comments in the exported HTML. It's ugly, and any commas within
the comment text must be backslash-escaped, but it works, and could be
adapted for Markdown.

HTH,
Christian

Allen S. Rout writes:

> I'd like to write an org-mode document, export it to markdown, and have
> comments exist in the markdown.
>
>
> I feel like I'm thinking about the process incorrectly, and it's hard to
> search around because the discussions around 'org-mode comments' focus
> on org data for which authors would like to _prevent_ export.
>
> I saw some old conversations about making links to the hacked-in
> comment: URI scheme, but that seemed quite hackish indeed.
>
> I thought about making a block of a 'comment' type, but of course all
> the workflow for that is, again, focused on either preventing its export
> in the first place, or making sure that it's exported in a visible
> manner in the output.  ("I want to print the comments in my LaTeX..").
>
>
> So... am I missing something obvious?  Anyone else trying something similar?
>
>
> - Allen S. Rout



Re: Possible to exclude/include tags for agenda custom commands?

2020-02-23 Thread Eric Abrahamsen
Bastien  writes:

> Hi Eric,
>
> Eric Abrahamsen  writes:
>
>> I hope that helps!
>
> thanks for the detailed example.  What verison of Org and Emacs?
>
> With your example and Org mode version 9.3.6 and GNU Emacs 28.0.50
> I don't get the warning.  If you have a ECM I'm willing to test more.

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.
Steps to reproduce:

1. emacs -Q
2. Add Org of your choice to load-path
3. Load the attached startup.el
4. Make sure the attached test.org is someplace where the previous file
   can find it.
5. org-agenda, then the "b" key
6. Hit "g" or "r", either will trigger the warning

Hope that works,

Eric

(setq org-agenda-custom-commands
  '(("b" "Bugs?"
 ((agenda ""
  ((org-agenda-start-day "2020-02-22")
   (org-agenda-span 10
 ((org-agenda-tag-filter '("+buggy"))

(setq org-agenda-files '("~/test.org")
  org-agenda-sticky t)


test.org
Description: Lotus Organizer


Re: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Bastien
Hi Jack,

Jack Kamm  writes:

> Stefan Nobis  writes:
>
>> What about a third collection option 'none' and make this the default?
>
> A variant on this idea, would be to instead have the third collection
> option be 'default', which would stand for a language-specific
> default. For example, ":results default" could be equivalent to
> ":results output" for shell blocks, but equivalent to ":results value"
> for emacs-lisp blocks.

Before exploring other collection options, I think we should document
the current state of the default for the main Babel languages.  This
will give us an idea on what to use as the default.

-- 
 Bastien



Org Babel: Submit SQL to command line app & capture results

2020-02-23 Thread Nathan Neff
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


Building MWE DEBUG.org template file

2020-02-23 Thread Ken Mankoff
Hello,

I'm trying to build a DEBUG.org that makes it easy to share MWEs of bugs I run 
across in Emacs packages. I'd like it to load the latest Org mode by default. 
Then for any given bug I load the needed packages, configure them, and 
demonstrate the bug.

Right now when I run the attached file, the first time I run it everything 
appears to work correctly. It installs Org from melpa into a temporary elpa 
folder, and the output of

#+BEGIN_SRC emacs-lisp :results value :noweb yes
<>
<>
(org-version nil t)
#+END_SRC

is:

#+RESULTS:
: Org mode version 9.3.6 (9.3.6-4-gdfa7a3-elpaplus @ 
/home/kdm/.emacs.d/DEBUG/elpa/org-plus-contrib-20200217/)

But when I load the file a second time in a clean emacs session (i.e. 
/usr/bin/emacs -Q ~/.emacs.d/DEBUG.org & ), then the Org version is incorrect, 
and I see:

#+RESULTS:
: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
/home/kdm/.emacs.d/DEBUG/elpa/org-plus-contrib-20200217/)


Can anyone explain what I'm doing incorrectly in the attached file?

Thanks,

  -k.


Run this debug Org file in a clean emacs session with:

/usr/bin/emacs -Q ~/.emacs.d/DEBUG.org & 

Initialize Emacs to reproduce this bug. Press `C-c C-c` in the Org Babel block below.

#+BEGIN_SRC emacs-lisp :results value :noweb yes
<>
<>
(org-version nil t)
#+END_SRC

#+RESULTS:
: Org mode version 9.3.6 (9.3.6-4-gdfa7a3-elpaplus @ /home/kdm/.emacs.d/DEBUG/elpa/org-plus-contrib-20200217/)

* Bug
** COMMENT Example Bug

Put example code here for this bug.

#+BEGIN_SRC emacs-lisp :results value
(defmacro measure-time ( body)
  "Measure the time it takes to evaluate BODY."
  `(let ((time (current-time)))
 ,@body
 (message "%.06f" (float-time (time-since time)

(measure-time (message "hello, world"))
#+END_SRC

#+RESULTS:
: 0.000134


* Init
** Emacs

#+NAME: init_emacs
#+BEGIN_SRC emacs-lisp :results none
(setq package-user-dir (expand-file-name "elpa" "~/.emacs.d/DEBUG"))

(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/;) t)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/;) t)

(package-initialize)
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(setq package-enable-at-startup nil)

(defvar use-package-verbose t)
(require 'use-package)
(setq use-package-always-ensure t)
;(setq use-package-always-defer t)
;; (require 'diminish);; if you use :diminish
;; (require 'bind-key)   
#+END_SRC

** Org

#+NAME: init_org
#+BEGIN_SRC emacs-lisp :results none
(use-package org
  :ensure org-plus-contrib)
(setq org-confirm-babel-evaluate nil) ;; don't ask to eval code
(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)   
   (shell . t)))
#+END_SRC





Re: Limiting properties and property values

2020-02-23 Thread Fraga, Eric
On Sunday, 23 Feb 2020 at 15:10, Vikas Rawal wrote:
> I am thinking of using org-mode to compile a small database. 

Although org is fantastic, it is sometimes worth considering other tools
(and with babel, these can often be brought into the org sphere of
activity easily).  For instance, GNU recutils [1] might suit you
better.  There's even an emacs mode [2].

Just my 2¢.


Footnotes:
[1]  https://www.gnu.org/software/recutils/

[2]  https://www.gnu.org/software/recutils/rec-mode-manual/rec-mode.html

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-354-g9d5880


Re: ICS agenda export exceeds max-specpdl-size probably because of org-depend (org-edna same?)

2020-02-23 Thread Karl Voit
* Bastien  wrote:
> Hi Karl,
>
> Karl Voit  writes:
>
>> So maybe I have to invest a weekend or so to bisect the issue. My
>> gut feeling tells me that I won't like the output somehow.
>
> In the meantime, can you share the values of your org-id-* options?

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

-- 
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: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Jack Kamm
Hi Stefan,

Stefan Nobis  writes:

> What about a third collection option 'none' and make this the default?

A variant on this idea, would be to instead have the third collection
option be 'default', which would stand for a language-specific
default. For example, ":results default" could be equivalent to
":results output" for shell blocks, but equivalent to ":results value"
for emacs-lisp blocks.



Re: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Fraga, Eric
On Friday, 21 Feb 2020 at 09:04, Bastien wrote:

[...]

> That said, we have three solutions:
>
> 1. Stick to a strict reading of Org and bash manuals: the absence of a
>:results header means "return the value, i.e. the exit status".

[...]

> Obviously, nobody wants the first solution.

Respectfully, I disagree!  I think the first solution is the cleanest
and most correct one.  Yes, this means a change in the behaviour but the
current behaviour, in my opinion, is wrong given org and bash
documentation.

I definitely do not like the third option (yet another variable).

Thank you.
-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-354-g9d5880



Feature freeze before 9.4

2020-02-23 Thread Bastien
Hi all,

let's have a small phase of feature-freeze before 9.4,
which should be released by the end of next week.

Only important bug fixes should will be committed.

Thanks!

-- 
 Bastien



Re: How to display overlay or propertize text on file: link type about the file?

2020-02-23 Thread John Kitchin
In that case:

#+BEGIN_SRC emacs-lisp
(defun file-description (start end path bracketp)
  (put-text-property start end 'display (shell-command-to-string
(format "file %s" path

(org-link-set-parameters
 "file"
 :activate-func 'file-description)
#+END_SRC

With this, you have to have a way to insert links that isn't typing them in
by hand; as soon as emacs recognizes the link, it changes the display which
makes it hard to type.

The shell command puts a long string, so you might replace that with
something that has the output you wanted above.
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 Sat, Feb 22, 2020 at 11:55 PM stardiviner  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
>
> John Kitchin  writes:
>
> > I think you are looking for the :activate-func property of a link. What
> > you want is somewhat tricky though, how would you edit the link?
> >
> > There is an example at
> >
> https://kitchingroup.cheme.cmu.edu/blog/2016/11/04/New-link-features-in-org-9/#org069cbfa
>
> Thanks for your tips. Helpful!!
>
> >
> > that might give you some ideas. You can use a 'display text property to
> > change the appearance, but you need some way to remove this if you want
> > to edit or see the original version.
>
> I usually edit link with =[C-c C-l]= to edit link URL and description, not
> literally.
>
> >
> > stardiviner  writes:
> >
> >> -BEGIN PGP SIGNED MESSAGE-
> >> Hash: SHA256
> >>
> >>
> >> I have a requirement, I want to display file: link's file type info on
> the link.
> >>
> >> For example, an Org file: link
> >>
> >> #+begin_src org
> >> [[file:~/Org/logo.png][logo]]
> >> [[file:~/Org/document.pdf][document]]
> >> [[file:~/Org/book.epub][book]]
> >> #+end_src
> >>
> >> I want to display link as:
> >>
> >> #+begin_src org
> >> logo (image: png)
> >> document (document: pdf)
> >> book (ebook: epub)
> >> #+end_src
> >>
> >> I'm inspired by this code snippet:
> >>
> >> #+begin_src emacs-lisp
> >> (org-link-set-parameters
> >>  "file+sys"
> >>  :complete 'org-file-complete-link
> >>  :face (lambda (path) (if (file-exists-p path) 'org-link 'org-warning)))
> >> #+end_src
> >>
> >> Is it possible to display those info between parentheses with an
> overlay or
> >> propertied text?
> >>
> >> If someone have any idea or how to implement this, please help me.
> Thanks in advanced.
> >>
> >> - --
> >> [ 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-
> >>
> >> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5OrLYUHG51bWJjaGls
> >> ZEBnbWFpbC5jb20ACgkQG13xyVromsPElQf/W71U1JQ9ZeFjCWCxICs0q87016Iq
> >> 8FQ5Fr3lSmRb6NRLqzqAAbY6b14roxtixxmllvArJgd7bz280xTZs3NGgYMm/HMf
> >> sZ+vtkpiHgJk31KXxAk/LT1OcgzYOrSv7g6c8Y3Gg8G5eSDmKGu+tMwqFzYtVmk2
> >> 6G0/wz9ezsdYAFLlNrX/FhcVaxCUSSdG08z0Ip/Op1I4iqh3Y86N7LalPVZWNa9H
> >> eZSFsf3Z8NqfVnCmTvmyJon4x1SGvJ8Iaf4QUiE7huNeizJK2+CSIhjSu8yDBGr4
> >> 2oMPrkAm1XkJDLMQh0FLjIrIJUoTLzLonEYtlmg3thvFEMqFuF8ziYaGdw==
> >> =sZhk
> >> -END PGP SIGNATURE-
>
>
> - --
> [ 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-
>
> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5SBYsUHG51bWJjaGls
> ZEBnbWFpbC5jb20ACgkQG13xyVromsOSOAgAmtN0JBgMB//D8EC7tQhrSwVX7spb
> NLH2EQbdDmzOyf2y+gwrvzGBojQ7TBLmM/dzm+IfPNsbyY4IMlLBvyrJST7D0uDC
> SXA8Ugi88qKkyS5H+Hw5jSNcOaPxwXLq5kxu3BXmtBpdNiIShL0qnTD4itNRHpG8
> v0NWFQwTcMI15OcsTKoGSG9PNw7qeJEt5vpYLL/oljAxMW0VsCnS061XjWda8w5u
> U2KWYLCeVAh3kXtas5pywar50F+ELAoutpr3USqJDtFPtRkyVYAmEKBHknFJ2R4u
> 8nTIchXoctS5JpINhwq4wfdmSRSjjcz1DYb9Y9LSMFjDbvzAKqcSk6eX4g==
> =xhBz
> -END PGP SIGNATURE-
>
>


Re: Exploring properties

2020-02-23 Thread John Kitchin
org-ql (https://github.com/alphapapa/org-ql) is also quite good for this
kind of thing.

Here is even a database like query to find the heading, and EMAIL property
from all the files in a list returned by the function nb-org-files.

(org-ql-query
  :select '(cons (fifth (org-heading-components))
 (org-entry-get (point) "EMAIL"))
  :from (nb-org-files)
  :where '(and (property "EMAIL")))


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 Sun, Feb 23, 2020 at 8:25 AM Vikas Rawal  wrote:

>
> >
> > > I don't know if I have missed something obvious. But I am trying to
> > > read all the properties data (key-value pairs) into an R source code
> > > block (essentially to gather into a data.frame before further
> > > processing).
> >
> > You might want to look at `org-map-entries'.
>
> Thanks. It seems it will take more lisp than I can handle. But let me try.
>
> I think there is a potential to combine orgmode tags and properties, with
> a little more lisp may be, along with version control to create small
> database applications.
>
> It would be good to design something as a proof-of-concept.
>
> Vikas
>
>


Re: Exploring properties

2020-02-23 Thread Bastien
Hi Vikas,

Vikas Rawal  writes:

> Would you think that an extension of org-collector is the direction to
> look at? Doesn't look like org-collector has seen any updates in a
> long time.

You might want to look at recutils instead.

It was announced on org-mode mailing list here 10 years ago:
https://lists.gnu.org/archive/html/emacs-orgmode/2010-12/msg00219.html

Jose is still developing it actively - it made the news on HN
recently: https://news.ycombinator.com/item?id=22153665

There is *some* integration with org-mode, although I have not tested
it. I've also found this, but this seems outdated and not maintained:
https://github.com/millarc/ob-rec.el

I'm cc'ing Jose as he may be able to share his own wishlist on how Org
could better interact with recutils.

HTH,

-- 
 Bastien



Re: ICS agenda export exceeds max-specpdl-size probably because of org-depend (org-edna same?)

2020-02-23 Thread Bastien
Hi Karl,

Karl Voit  writes:

> So maybe I have to invest a weekend or so to bisect the issue. My
> gut feeling tells me that I won't like the output somehow.

In the meantime, can you share the values of your org-id-* options?

Thanks,

-- 
 Bastien



Re: Limiting properties and property values

2020-02-23 Thread John Kitchin
One solution to this is a function you would write that validates the
properties, and prevents saving if they are invalid. You would want to use
it in a buffer/directory hook.

For example:

(defun validate-properties ()
  (goto-char (point-min))
  (catch 'error
(while (re-search-forward org-heading-regexp nil t)
  (let ((v (org-entry-get (point) "NUMERIC")))
(when v
 ;; Let's say we only allow +/- integers
 (if (string-match "\\`[-+]?[0-9]+\\'" v)
 nil
   (error "Non-integer value found: %s" v)
   (throw 'error nil)
   nil))

(add-hook 'write-file-functions 'validate-properties t)

You could use a different function for floats, or to make sure a value was
one of a few allowed options...

This only works if you only edit the files through emacs, and if everyone
is setup so this is automatically loaded in the directory, etc. An
alternative place to put something like this is in a git hook, if you have
your project in a git repo. you would have to figure out how to write a
script that would run emacs to do this kind of thing. But, then you could
make sure no invalid files were commited, for example.



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 Sun, Feb 23, 2020 at 4:40 AM Vikas Rawal  wrote:

>
>
> On Sun, 23 Feb 2020 at 15:02, Bastien  wrote:
>
>> Hi Vikas,
>>
>> Vikas Rawal  writes:
>>
>> > 1. Is it possible to restrict the sub-tree of a headline to have only
>> > properties specified in the column property of the parent? That is,
>> > no additional property can be specified.
>>
>> No, it is currently not possible.  What would be the use-case?
>>
>
>
> I am thinking of using org-mode to compile a small database. I would like
> to use properties to add data, and some restrictions of this kind to limit
> what properties a particular kind of headline could have.
>
> It might seem like an over-kill, but then for org-mode, almost nothing is
> an over-kill.
>
> I am missing a few nuts and bolts, but would really like to see how it
> works to use org-mode for a small org-mode-skilled team to use it as a data
> platform.
>
> Warmest greetings and regards,
>
> Vikas
>


Re: Exploring properties

2020-02-23 Thread Vikas Rawal


>
> > I don't know if I have missed something obvious. But I am trying to
> > read all the properties data (key-value pairs) into an R source code
> > block (essentially to gather into a data.frame before further
> > processing).
>
> You might want to look at `org-map-entries'.

Thanks. It seems it will take more lisp than I can handle. But let me try.

I think there is a potential to combine orgmode tags and properties, with a 
little more lisp may be, along with version control to create small database 
applications.

It would be good to design something as a proof-of-concept.

Vikas



Re: Exploring properties

2020-02-23 Thread Vikas Rawal


>
> You might want to look at `org-map-entries'.
>
Would you think that an extension of org-collector is the direction to look at? 
Doesn't look like org-collector has seen any updates in a long time.

Vikas



Re: Possible to exclude/include tags for agenda custom commands?

2020-02-23 Thread Bastien
Hi Eric,

Eric Abrahamsen  writes:

> I hope that helps!

thanks for the detailed example.  What verison of Org and Emacs?

With your example and Org mode version 9.3.6 and GNU Emacs 28.0.50
I don't get the warning.  If you have a ECM I'm willing to test more.

Thanks,

-- 
 Bastien



Re: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Bastien
Hi Stefan,

Stefan Nobis  writes:

> The downside would be that many existing Org documents needs to be
> fixed (but maybe it would be not too hard to automate the adjustments)
> and some source blocks may become a little more verbose.

Yes, backward-compatibilities issues, verbosity, and a non-functional
default are problematic.

I think we will have a better view on what is a sensible default after
we try to document the current behavior for the main languages.

Also, such a documentation page will be useful even after we change
the defaults, if we do this.

-- 
 Bastien



Re: [SOLVED] Re: [Question] adding document global properties drawer

2020-02-23 Thread Bastien
stardiviner  writes:

> This problem has gone, I don't know what config caused this problem. I 
> recently
> modify some config of Org Mode. Anyway, it's good news.

Thanks for confirming!

-- 
 Bastien



Re: Bug or not a bug? dot expansion in ob-shell

2020-02-23 Thread Stefan Nobis
Bastien  writes:

> I agree we should have a discussion on whether :results value is a
> good default.

What about a third collection option 'none' and make this the default?

This would emphasize that there is no sensible default for all babel
languages, users and use cases. Users would be forced to explicitly
select either the 'value' or 'output' option, which also helps
reproducibility a little bit (explicit is better than implicit).

The downside would be that many existing Org documents needs to be
fixed (but maybe it would be not too hard to automate the adjustments)
and some source blocks may become a little more verbose.

Just my 2¢.

-- 
Until the next mail...,
Stefan.



Re: Limiting properties and property values

2020-02-23 Thread Vikas Rawal
On Sun, 23 Feb 2020 at 15:02, Bastien  wrote:

> Hi Vikas,
>
> Vikas Rawal  writes:
>
> > 1. Is it possible to restrict the sub-tree of a headline to have only
> > properties specified in the column property of the parent? That is,
> > no additional property can be specified.
>
> No, it is currently not possible.  What would be the use-case?
>


I am thinking of using org-mode to compile a small database. I would like
to use properties to add data, and some restrictions of this kind to limit
what properties a particular kind of headline could have.

It might seem like an over-kill, but then for org-mode, almost nothing is
an over-kill.

I am missing a few nuts and bolts, but would really like to see how it
works to use org-mode for a small org-mode-skilled team to use it as a data
platform.

Warmest greetings and regards,

Vikas


Re: Exploring properties

2020-02-23 Thread Bastien
Hi Vikas,

Vikas Rawal  writes:

> I don't know if I have missed something obvious. But I am trying to
> read all the properties data (key-value pairs) into an R source code
> block (essentially to gather into a data.frame before further
> processing).

You might want to look at `org-map-entries'.

HTH,

-- 
 Bastien



Re: ob-prolog is sick. . .

2020-02-23 Thread Bastien
Hi Lawrence,

Lawrence Bottorff  writes:

> Besides the bad karma of listing a Babel language that actually
> doesn't work, I would like to have Prolog working in Babel because I
> get the sense Prolog's stock will slowly rise, mainly due to it being
> the basis of querying graph databases. Prolog and RDF, basically.

I didn't have time to look at ob-prolog.el either.

If you know prolog: it is good opportunity to help the list understand
how prolog block execution works: what is the prolog interpreter known
by ob-prolog.el, how the interpreter is called when executing a block,
what would be the notion of a "session" for prolog blocks, etc.

If we know more about these points above, it will be easier and more
fun to dive into ob-prolog.el to see what can go wrong.

Thanks!

-- 
 Bastien



Re: Limiting properties and property values

2020-02-23 Thread Bastien
Hi Vikas,

Vikas Rawal  writes:

> 1. Is it possible to restrict the sub-tree of a headline to have only
> properties specified in the column property of the parent? That is,
> no additional property can be specified.

No, it is currently not possible.  What would be the use-case?

> 2. Is it possible to limit the allowed values of a property to say
> only numeric values or to a specific range of numeric values?

Nope, it is not possible.

Allowed values for a property are only used in the UI for switching
and/or completing values, the notion of allowed values is not used to
"check" value types.

HTH,

-- 
 Bastien