Re: Library of Babel usage of other programming languages than elisp

2021-08-09 Thread Dr. Arne Babenhauserheide

Zelphir Kaltstahl  writes:

> I have repeatedly tried to use another programming language than elisp for
> writing source blocks in org-mode, which I intended to use as functions inside
> org-mode spreadsheets. So far without success.

I’m using scheme in org-mode during export (though not it tables) and
that works.

call: 
https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=ccc9148e78a4#L27

begin_src: 
https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=ccc9148e78a4#L137

#+call: generate-char-jetzt()

#+name: generate-char-jetzt
#+begin_src scheme :exports none :results output raw :prologue "(import (srfi 
srfi-1)(ice-9 match)(ice-9 receive))(set! *random-state*  
(random-state-from-platform))\n" :tangle chargen.scm :noweb yes :var 
kernantriebe=tabelle-grundantriebe :var hautfarbe=tabelle-hautfarbe :var 
haarfarbe=tabelle-haarfarbe :var augenfarbe=tabelle-augenfarbe :var 
darstellung1=tabelle-darstellung1 :var darstellung2=tabelle-darstellung2 :var 
kleidung_oben_maenner=tabelle-kleidung-jetzt-oben-maenner  :var 
kleidung_unten_maenner=tabelle-kleidung-jetzt-unten-maenner :var 
kleidung_oben_frauen=tabelle-kleidung-jetzt-oben-frauen  :var 
kleidung_unten_frauen=tabelle-kleidung-jetzt-unten-frauen :var 
kleidung_oben_frauen=tabelle-kleidung-jetzt-oben-frauen  :var 
kleidung_unten_frauen=tabelle-kleidung-jetzt-unten-frauen :var 
namen=tabelle-namen-fantasy-jetzt :var sex=tabelle-sexualitaet :var 
stichwort=tabelle-stichwort-jetztzeit
  (let ()
{{{chargen-setup}}}
{{{chargen-generic}}}
{{{chargen-colors}}}
{{{chargen-specifics-jetzt}}}
{{{chargen-print-char}}}
(chargen-print-char)
  )
#+end_src

#+begin_src scheme :noweb-ref chargen-specifics-jetzt
(define first-names 
  (map first 
(map string-split-space 
  (map third 
(remove (λ(x)(not (equal? geschlecht (fourth x namen)
(define last-names (map (λ (x) (string-join (cdr x))) (map 
string-split-space (map third namen
(define names (apply append (map (λ (fi) (map (λ(la) (string-join (list fi 
la))) last-names)) first-names)))
  ;; (define worte (list->d6alist (second (apply zip zweiworte

#+end_src

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken


signature.asc
Description: PGP signature


bug: Error handling in source blocks.

2021-08-09 Thread James Powell

  Error handling is important and hard to get right.  Me, I prefer to
  treat every warning as an error (-Werror in gcc, "options(warn=2)" in
  R, etc).  I want the system to grind to a halt at the least sign of
  trouble.

  When I write some nonsense into a code block as in this example:

  ,
  | : This next code block is intended to trigger an error, because that
  | : variable "f838293483" with that attribute/member "x8483848"
  | : probably does not exist.
  | :
  | : #+begin_src R :exports both
  | : x <- f838293483$x8483848
  | : #+end_src
  | :
  | : #+RESULTS:
  | :
  | : #+begin_src R :exports both :results table :colnames yes
  | : require(tidyverse)
  | : tribble(~a, ~b, 1, 2)
  | : #+end_src
  | :
  | : #+RESULTS:
  | : | a | b |
  | : |---+---|
  | : | 1 | 2 |
  | : #+end_src
  `


  which does trigger an error in R
  ,
  | Error: object 'f838293483' not found
  | [traceback follows]
  `


  and I do org-to-PDF export, I would like the PDF to be not built and
  loud alarm bells to ring bringing the error to my attention.

  What happens instead: the document builds from org into PDF with no
  indication that anything went wrong at all, except perhaps minor bits
  of missing or incorrect text in the PDF file.  The error can easily be
  buried in the output as more and later source blocks from the same
  document are evaluated.

  Likewise, in 'sh',
  ,
  | #+begin_src sh :exports results
  | exit 1
  | #+end_src
  `


  Sh exits 1 to indicate an error, so I would like this to ring alarm
  bells and fail to produce a PDF on org-to-PDF export.

  We might add examples in Java, Python, C++, C along the same lines.
  All of these should be in a unit test (because error handling is 
important).

  There do not seem to be any unit tests that exercise error handling in
  org-9.4.4.

  Exceptions that are thrown in the block should also at least
  optionally always and reliably abort the org-to-PDX export and ring
  alarm bells.

  I would like to see a section in the org manual called "Error handling
  in source blocks" that discusses the issue.

  I searched for "error handling" at ,
  with no results that are relevant.

  thank you for your time,
  - JP

--
James E. Powell, MS
Pronouns: he/him/his
Applied Physics PhD Candidate
Department of Physics
Portland State University
Home page: http://web.pdx.edu/~powellj
Office: SRTC 409B Phone: +1-503-725-8515




Re: [BUG] Fill-paragraph issue with hidden emphasis markers and composed characters

2021-08-09 Thread Tim Cross


I was able to reproduce this using Emacs 28.0.50 and emacs -Q.

It is important to ensure both of the below paragraphs are completely
'unwrapped' i.e. all on one line and then wrap them with M-q. 

The result seems counter-intuitive to me - the second paragraph with an
extra character is wrapped correctly. The first paragraph has the first
line broken too early.

This is likely going to be a very difficult issue to fix. I'm not sure
how fill column mode is aware of add on features like prettify symbols
and hidden emphasis markers. Obviously it is aware at some level because
it does wrap the second paragraph correctly. My wild guess would be that
the second one works because the additional character breaks up the
'special' handling and allows fill column to correctly calculate the
'virtual' line length.

Lucas Viana  writes:

> Dear list, 
>
> I'm not sure if this is a general issue with fill-paragraph or with the way 
> org hides emphasis markers, but I'm facing a problem with bare emacs +
> org.
>
> Steps to reproduce:
> 1. Start emacs -Q (no configuration)
> 2. Set some variables:
>
> (setq org-pretty-entities t
>   org-hide-emphasis-markers t
>   fill-column 80)
>
> 3. Create an empty org-mode buffer with the following paragraph:
> ""
> This is a /italic sentence for a buggy/ \alpha\beta\gamma\delta\nu\epsilon
> paragraph in terms of filling, see, it's not filled yet and still the line 
> above
> ends early.
> ""
>
> So far so good, and with the previous config the emphasis markers are now 
> hidden and the greek letters appear as unicode characters.
>
> 4. Hit M-q (either fill-paragraph or org-fill-paragraph, both have the same 
> issue)
> The first line wrongly wraps after "buggy" and leaves a big empty space after 
> that, as if the greek letters were not composed.
>
> 5. In the same buffer, compare the behaviour with this paragraph (very 
> similar, but note the ! character after "buggy"):
> ""
> This is a /italic sentence for a buggy/ ! \alpha\beta\gamma\delta\nu\epsilon
> paragraph in terms of filling, see, it's not filled yet and still the line 
> above
> ends early.
> ""
>
> When I fill this slightly different paragraph with M-q, it wraps the text in 
> the right way and the first line is completely filled.
>
> So the issue happens when a hidden emphasis marker is immediately followed 
> (maybe after a space) by a composed character like \alpha. I am also
> facing the same issue when the characters are composed by 
> prettify-symbols-mode instead of org-pretty-entities, and also with other 
> types of
> hidden emphasis markers. If org-hide-emphasis-markers is disabled then the 
> issue doesn't happen.
>
> Thanks in advance!
>
> Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
> 3.24.29, cairo version 1.17.4)
>  of 2021-07-09
> Package: Org mode version 9.5 (9.5-b83ae59 @ 
> /home/lucas/.emacs.d/.local/straight/build-28.0.50/org/)




Re: Library of Babel usage of other programming languages than elisp

2021-08-09 Thread Greg Minshall
Zelphir,

> So I still have not understood, what the actual issue is with the
> timediff function. Perhaps it is something about the imports.
>
> Thanks for taking the time to try and reproduce the behavior!

you're welcome.  if there's something else i might try, i'll be happy to
try (to try).

good luck.

cheers, Greg



Re: [ANN] EmacsConf 2021 Call for Proposals

2021-08-09 Thread quiliro
Philip Kaludercic  writes:

> quil...@riseup.net writes:
>
>> What a great call for papers.  If it was created using Emacs, it would
>> be great to have a talk or a howto for how it was made.
>
> It seems to me like it is just an org-mode document, converted to
> plain text using one of the built-in exporters.

Yes.  It would be nice to see the source.



Re: citations: rx problems with emacs-26.3

2021-08-09 Thread Maxim Nikulin

On 08/08/2021 21:14, Nicolas Goaziou wrote:

Maxim Nikulin writes:


I have noticed another problem with
a lot of pcase branches in `org-cite-natbib--style-to-command' in and
my experience is not enough to resolve it. On attempt to
byte-compile-file
the following error is reported after significant delay (and CPU fan
becomes more noisy)

oc-natbib.el:108:9:Error: Bytecode overflow


Fixed. Thank you.


Nice. Perhaps `org-cite-biblatex-export-citation' should be fixed in a 
similar way. There is no error yet but compiled file is significantly 
blown up:


-rw-rw-r-- 1 ubuntu ubuntu 13383 Aug  9 02:17 lisp/oc-biblatex.el
-rw-rw-r-- 1 ubuntu ubuntu 48906 Aug  9 17:06 lisp/oc-biblatex.elc

There are a couple of issues with "make single" for emacs-25.2:

Compiling single /home/ubuntu/org-mode/lisp/oc-basic.el...

In end of data:
oc-basic.el:772:1:Warning: the function ‘buffer-hash’ is not known to be
defined.
Compiling single /home/ubuntu/org-mode/lisp/oc-biblatex.el...
Compiling single /home/ubuntu/org-mode/lisp/oc-csl.el...

In toplevel form:
oc-csl.el:90:1:Error: Cannot open load file: No such file or directory, 
org-cite

Makefile:59: recipe for target 'oc-csl.elc' failed
make[2]: [oc-csl.elc] Error 1 (ignored)




Re: citations: rx problems with emacs-26.3

2021-08-09 Thread Maxim Nikulin

On 08/08/2021 03:27, Nicolas Goaziou wrote:


Maxim Nikulin writes:


It seems, rx e.g. in emacs-26.3 does not support all features used in
oc.el and oc-csl.el. Loading an org file using git master, I get
a warning


Eager macro-expansion failure: (error "rx form ‘regexp’ requires args satisfying 
‘stringp’")


Thanks. Could you send the patch again with a proper commit message,
using git format-patch?


With the attached patches I do not see warnings any more while org is 
loading. On the other hand I am not an org-cite user, so I am not sure 
that nothing is broken by these patches.



>From 151191d0283cb55e719c9c01459de02dfb584e02 Mon Sep 17 00:00:00 2001
From: Max Nikulin 
Date: Mon, 9 Aug 2021 23:59:41 +0700
Subject: [PATCH 1/2] oc: rx compatibility with Emacs < 27.1

* lisp/oc.el (org-cite-adjust-note):
* lisp/oc-basic.el (org-cite-basic-goto):
* lisp/oc-biblatex.el (org-cite-biblatex-prepare-preamble):
* lisp/oc-csl.el (org-cite-csl--label-regexp): Avoid `rx' forms
introduced in Emacs-27.1 to keep compatibility with older versions.

Use `rx-to-string' instead of `rx' due to lack of support of  `regexp'
and `literal' forms with a variable as an argument.
---
 lisp/oc-basic.el|  4 +++-
 lisp/oc-biblatex.el |  2 +-
 lisp/oc-csl.el  | 11 +++
 lisp/oc.el  | 21 ++---
 4 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index c46e7a715..6d625e4a5 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -667,7 +667,9 @@ present in the citation."
 (org-open-file file '(4))
 (pcase (file-name-extension file)
   ("json"
-   (let ((regexp (rx "\"id\":" (0+ (any "[ \t]")) "\"" (literal key) "\"")))
+   ;; `rx' can not be used with Emacs <27.1 since `literal' form
+   ;; is not supported.
+   (let ((regexp (rx-to-string `(seq "\"id\":" (0+ (any "[ \t]")) "\"" ,key "\"") t)))
  (goto-char (point-min))
  (re-search-forward regexp)
  (search-backward "{")))
diff --git a/lisp/oc-biblatex.el b/lisp/oc-biblatex.el
index 5a9c304a3..c82a77046 100644
--- a/lisp/oc-biblatex.el
+++ b/lisp/oc-biblatex.el
@@ -260,7 +260,7 @@ to the document, and set styles."
   ;; Then set options.
   (goto-char (match-beginning 0))
   (let ((re (rx "\\usepackage"
-(opt (group "[" (*? anychar) "]"))
+(opt (group "[" (*? anything) "]"))
 "{biblatex}")))
 (cond
  ;; No "biblatex" package loaded.  Insert "usepackage" command
diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el
index 5e0e27211..c08adc430 100644
--- a/lisp/oc-csl.el
+++ b/lisp/oc-csl.el
@@ -253,10 +253,13 @@ If nil then the Chicago author-date style is used as a fallback.")
   "Alist mapping locator names to locators.")
 
 (defconst org-cite-csl--label-regexp
-  (rx word-start
-  (regexp (regexp-opt (mapcar #'car org-cite-csl--label-alist) t))
-  (0+ digit)
-  (or word-start line-end (any ?\s ?\t)))
+  ;; Prior to Emacs-27.1 argument of `regexp' form must be a string literal.
+  ;; It is the reason why `rx' is avoided here.
+  (rx-to-string `(seq word-start
+  (regexp ,(regexp-opt (mapcar #'car org-cite-csl--label-alist) t))
+  (0+ digit)
+  (or word-start line-end (any ?\s ?\t)))
+t)
   "Regexp matching a label in a citation reference suffix.
 Label is in match group 1.")
 
diff --git a/lisp/oc.el b/lisp/oc.el
index 338348116..53eafb3bd 100644
--- a/lisp/oc.el
+++ b/lisp/oc.el
@@ -878,14 +878,19 @@ the same object, call `org-cite-adjust-punctuation' first."
   (when org-cite-adjust-note-numbers
 (pcase-let* ((rule (or rule (org-cite--get-note-rule info)))
  (punct-re (regexp-opt (or punct org-cite-punctuation-marks)))
+ ;; with Emacs <27.1. Argument of `regexp' form (PUNCT-RE this case)
+ ;; must be a string literal.
  (previous-punct-re
-  (rx (opt (group (0+ (any blank ?\n)) (regexp punct-re)))
-  (opt (0+ (any blank ?\n)) (group ?\"))
-  (opt (group (1+ (any blank ?\n
-  string-end))
+  (rx-to-string `(seq (opt (group (regexp ,(rx (0+ (any blank ?\n
+  (regexp ,punct-re)))
+  (regexp ,(rx (opt (0+ (any blank ?\n)) (group ?\"))
+   (opt (group (1+ (any blank ?\n
+   string-end)))
+t))
  (next-punct-re
-  (rx string-start
-  (group (0+ (any blank ?\n)) (regexp punct-re
+  (rx-to-string `(seq string-start
+  (group (0+ (any blank ?\n)) (regexp ,punct-re)))
+t))
 

Re: [ANN] EmacsConf 2021 Call for Proposals

2021-08-09 Thread Philip Kaludercic
quil...@riseup.net writes:

> What a great call for papers.  If it was created using Emacs, it would
> be great to have a talk or a howto for how it was made.

It seems to me like it is just an org-mode document, converted to
plain text using one of the built-in exporters.

>  Congratulations
> for the organizers for making this a free software event and not just an
> event with free software.

-- 
Philip Kaludercic



Re: [ANN] EmacsConf 2021 Call for Proposals

2021-08-09 Thread quiliro
What a great call for papers.  If it was created using Emacs, it would
be great to have a talk or a howto for how it was made.  Congratulations
for the organizers for making this a free software event and not just an
event with free software.



Bug: org-clock-report tag matching seems to be broken [9.1.9 (release_9.1.9-65-g5e4542 @ c:/Users/user/emacs-26.3-x86_64/share/emacs/26.3/lisp/org/)]

2021-08-09 Thread Lewalder, Sebastian
I recently updated my packages and after the update the clock tables are

not working anymore. I reran an report from june and here too the

matching didn't work anymore.



#+BEGIN: clocktable :scope file :maxlevel 4 :match "traj"

#+CAPTION: Clock summary at [2021-08-06 Fr 08:48]

| Headline  | Time   |  |  |  |

|---++--+--+--|

| *Total time*  | *2:33* |  |  |  |

|---++--+--+--|

| 2021  | 2:33   |  |  |  |

| \_  2021-06 Juni  || 2:33 |  |  |

| \_2021-06-01 Dienstag ||  | 2:33 |  |

| \_  Trajectory calc   ||  |  | 0:41 |

| \_  Concept work  ||  |  | 1:52 |

#+END:





* 2021

** 2021-06 Juni

*** 2021-06-01 Dienstag

 Trajectory calc   :traj:

 :LOGBOOK:

 CLOCK: [2021-06-01 Di 11:40]--[2021-06-01 Di 12:21] =>  0:41

 :END:

 Concept work  :concept:

 :LOGBOOK:

 CLOCK: [2021-06-01 Di 13:10]--[2021-06-01 Di 13:24] =>  0:14

 CLOCK: [2021-06-01 Di 12:21]--[2021-06-01 Di 12:41] =>  0:20

 CLOCK: [2021-06-01 Di 10:22]--[2021-06-01 Di 11:40] =>  1:18

 :END:



Emacs  : GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)

of 2019-08-29

Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
c:/Users/user/emacs-26.3-x86_64/share/emacs/26.3/lisp/org/)



current state:

==

(setq

org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)

org-after-todo-state-change-hook '(org-clock-out-if-current)

org-metadown-hook '(org-babel-pop-to-session-maybe)

org-clock-out-hook '(org-clock-remove-empty-clock-drawer)

org-agenda-files '("~/org")

org-modules '(org-habit)

org-mode-hook '(er/add-org-mode-expansions

 #[0 "\300\301\302\303\304$\207"

   [add-hook change-major-mode-hook org-show-block-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

 #[nil "\300\301!\207" [run-hooks prelude-org-mode-hook] 2])

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-babel-pre-tangle-hook '(save-buffer)

org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)

org-log-done 'time

org-habit-show-habits-only-for-today nil

org-occur-hook '(org-first-headline-recenter)

org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers 
org-cycle-show-empty-lines

  org-optimize-window-after-visibility-change)

org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)

org-confirm-shell-link-function 'yes-or-no-p

org-link-parameters '(("id" :follow org-id-open) ("file+sys") ("file+emacs") 
("doi" :follow org--open-doi-link)

   ("elisp" :follow org--open-elisp-link) ("file" :complete 
org-file-complete-link)

   ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" 
path

   ("help" :follow org--open-help-link)

   ("http" :follow (lambda (path) (browse-url (concat 
"http:" path

   ("https" :follow (lambda (path) (browse-url (concat 
"https:" path

   ("mailto" :follow (lambda (path) (browse-url (concat 
"mailto:; path

   ("news" :follow (lambda (path) (browse-url (concat 
"news:; path

   ("shell" :follow org--open-shell-link))

)


[BUG] Fill-paragraph issue with hidden emphasis markers and composed characters [9.5 (9.5-b83ae59 @ /home/lucas/.emacs.d/.local/straight/build-28.0.50/org/)]

2021-08-09 Thread Lucas Viana Reis
Hello, I'm not sure if this is a general issue with fill-paragraph or with
the way org hides emphasis markers, but I'm facing this problem with bare
emacs + org:

Steps to reproduce:
1. Start emacs -Q (no configuration)
2. Set some variables:

(setq org-pretty-entities t
  org-hide-emphasis-markers t
  fill-column 80)


3. Create an empty org-mode buffer with the following text:

This is a /italic sentence for a buggy/ \alpha\beta\gamma\delta\nu\epsilon
paragraph in terms of filling, see, it's not filled yet and still the line above
ends early.


So far so good, and with the previous config the emphasis markers are now
hidden and the greek letters appear as unicode characters.

4. Hit M-q (either fill-paragraph or org-fill-paragraph, both have the same
issue)
The first line wrongly wraps after "buggy" and leave a big empty space
after that, as if the greek letters were not composed.

5. In the same buffer, compare the behaviour with this paragraph (very
similar, but note the ! character after "buggy"):

This is a /italic sentence for a buggy/ ! \alpha\beta\gamma\delta\nu\epsilon
paragraph in terms of filling, see, it's not filled yet and still the line above
ends early.


When I fill this slighly different paragraph with M-q, it wraps the text in
the right way and the first line is completely filled.

So the issue happens when a hidden emphasis marker is immediately followed
(maybe after a space) by a composed charater like \alpha. I am also facing
the same issue when the characters are composed by prettify-symbols-mode
instead of org-pretty-entities, and also with other types of hidden
emphasis markers. If org-hide-emphasis-markers is disabled then the issue
doesn't happen.

Thanks in advance!

Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.29, cairo version 1.17.4)
 of 2021-07-09
Package: Org mode version 9.5 (9.5-b83ae59 @
/home/lucas/.emacs.d/.local/straight/build-28.0.50/org/)


[BUG] Fill-paragraph issue with hidden emphasis markers and composed characters

2021-08-09 Thread Lucas Viana
Dear list,

I'm not sure if this is a general issue with fill-paragraph or with the way
org hides emphasis markers, but I'm facing a problem with bare emacs + org.

Steps to reproduce:
1. Start emacs -Q (no configuration)
2. Set some variables:

(setq org-pretty-entities t
  org-hide-emphasis-markers t
  fill-column 80)

3. Create an empty org-mode buffer with the following paragraph:
""
This is a /italic sentence for a buggy/ \alpha\beta\gamma\delta\nu\epsilon
paragraph in terms of filling, see, it's not filled yet and still the line
above
ends early.
""

So far so good, and with the previous config the emphasis markers are now
hidden and the greek letters appear as unicode characters.

4. Hit M-q (either fill-paragraph or org-fill-paragraph, both have the same
issue)
The first line wrongly wraps after "buggy" and leaves a big empty space
after that, as if the greek letters were not composed.

5. In the same buffer, compare the behaviour with this paragraph (very
similar, but note the ! character after "buggy"):
""
This is a /italic sentence for a buggy/ ! \alpha\beta\gamma\delta\nu\epsilon
paragraph in terms of filling, see, it's not filled yet and still the line
above
ends early.
""

When I fill this slightly different paragraph with M-q, it wraps the text
in the right way and the first line is completely filled.

So the issue happens when a hidden emphasis marker is immediately followed
(maybe after a space) by a composed character like \alpha. I am also facing
the same issue when the characters are composed by prettify-symbols-mode
instead of org-pretty-entities, and also with other types of hidden
emphasis markers. If org-hide-emphasis-markers is disabled then the issue
doesn't happen.

Thanks in advance!

Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.29, cairo version 1.17.4)
 of 2021-07-09
Package: Org mode version 9.5 (9.5-b83ae59 @
/home/lucas/.emacs.d/.local/straight/build-28.0.50/org/)


Bug: refreshing agenda moves all lines up [9.4.6 (9.4.6-12-gdcc3a8-elpa @ /Users/pu/.emacs.d/elpa/org-20210802/)]

2021-08-09 Thread pat
Hello everybody,

my first bug report so I hope this is useful.

Since the last org-mode update, whenever I press "r" to refresh my customised 
agenda view (org-agenda-redo),
the whole buffer moves up by 1 line, which hasn't been the case until now.

Emacs : GNU Emacs 27.2 (build 1, aarch64-apple-darwin20.5.0, NS appkit-2022.50 
Version 11.4 (Build 20F71))
 of 2021-06-05
Package: Org mode version 9.4.6 (9.4.6-12-gdcc3a8-elpa @ 
/Users/pu/.emacs.d/elpa/org-20210802/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-capture-prepare-finalize-hook '(org-roam-capture--install-finalize)
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-roam-db-node-include-function #[0 "300207" [t] 1]
 org-refile-targets '((nil :maxlevel . 9))
 org-agenda-files '("/Users/pu/nc/Emacs/org/work.org"
 "/Users/pu/nc/Emacs/org-roam/20210724155503-vakanz_cl.org"
 "/Users/pu/nc/Emacs/org-roam/20210725223625-geofencing.org"
 "/Users/pu/nc/Emacs/org-roam/20210726130719-borgbackup.org"
 "/Users/pu/nc/Emacs/org-roam/20210726131153-backup.org"
 "/Users/pu/nc/Emacs/org-roam/20210727000115-agile.org"
 "/Users/pu/nc/Emacs/org-roam/20210727001222-gdpr.org"
 "/Users/pu/nc/Emacs/org-roam/20210727105327-emacs.org"
 "/Users/pu/nc/Emacs/org-roam/20210727105409-toc.org"
 "/Users/pu/nc/Emacs/org-roam/20210728145813-alter_ego.org"
 "/Users/pu/nc/Emacs/org-roam/20210730111443-communication.org"
 "/Users/pu/nc/Emacs/org-roam/20210730111506-sync_vs_async.org"
 "/Users/pu/nc/Emacs/org-roam/20210801155154-ios_backups.org")
 org-mode-hook '(#[0 "300301302303304$207"
 [add-hook change-major-mode-hook org-show-all append local] 5]
 #[0 "300301302303304$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)
 org-outline-path-complete-in-steps nil
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-roam-capture-new-node-hook '(org-roam-capture--insert-ref)
 org-agenda-use-time-grid nil
 org-confirm-elisp-link-function 'yes-or-no-p
 org-todo-repeat-to-state "TODO"
 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 "300236A207" [:title] 3 "nn(fn 
ENTRY)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
 org-hide-leading-stars t
 org-load-hook '((closure (t) nil (define-key org-mode-map "a" 'org-agenda)
 (setq org-hide-leading-stars t) (setq org-return-follows-link t)
 (setq org-agenda-show-future-repeats nil) (setq org-tags-column -90)
 (setq org-todo-keyword-faces
 '(("WAIT" :foreground "dark cyan") ("TODO" :foreground "orange")
 ("DELG" :foreground "brown") ("DONE" :foreground "grey"))
 )
 (setq calendar-week-start-day 1) (setq org-deadline-warning-days 0)
 (setq org-todo-repeat-to-state "TODO")
 (setq org-agenda-sorting-strategy
 '((agenda priority-down todo-state-down alpha-up)
 (todo priority-down category-keep) (tags priority-down category-keep)
 (search category-keep))
 )
 (setq org-agenda-custom-commands
 '(("L" "PU's view"
 ((todo "TODO"
 ((org-agenda-skip-function '(org-agenda-skip-entry-if 'scheduled))
 (org-agenda-prefix-format '((todo . " "
 )
 (agenda ""
 ((org-agenda-span 15) (org-agenda-prefix-format '((agenda . " ")
 nil ("~/nc/Emacs/org/agenda.txt"))
 )
 )
 )
 (setq org-agenda-start-with-follow-mode t))
 )
 org-agenda-loop-over-headlines-in-active-region nil
 org-roam-mode-section-functions '(org-roam-backlinks-section 
org-roam-reflinks-section
 org-roam-unlinked-references-section)
 org-roam-find-file-hook '(org-roam-open-id-with-org-roam-db-h
 org-roam--replace-roam-links-on-save-h
 org-roam--register-completion-functions
 org-roam-buffer--setup-redisplay-h org-roam-db--update-on-save-h)
 org-occur-hook '(org-first-headline-recenter)
 org-agenda-mode-hook '((closure (t) nil
 (define-key org-agenda-mode-map "360" 'org-agenda-backward-block)
 (define-key org-agenda-mode-map "356" 'org-agenda-forward-block))
 (closure (t) nil (define-key org-agenda-mode-map "k" 'kan)))
 org-log-into-drawer t
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
 org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)
 org-roam-node-annotation-function 'org-roam-node--annotation
 org-tags-column -90
 org-return-follows-link t
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-follow :complete
 org-attach-complete-link)
 ("eww" :follow org-eww-open :store org-eww-store-link)
 ("rmail" :follow org-rmail-open :store org-rmail-store-link)
 ("mhe" :follow org-mhe-open 

Re: Library of Babel usage of other programming languages than elisp

2021-08-09 Thread Zelphir Kaltstahl
Hi Greg!

On 8/9/21 5:23 PM, Greg Minshall wrote:
> Zelphir,
>
> actually...
>
> Everybody,
>
> i have an awkwardness about not being clear of the meaning of "Library
> of Babel".  my sense is it a collection of "subroutines".
>
> in my typical use of Org mode for programming, all my code blocks are
> defined in the same .org file, and executed in that file, or tangled to
> external files (normally, scripts).  i do use <> to include bits
> from one part of the same file to the code in another part.  i don't
> know if this means i am using the Library of Babel or not.

I love noweb and literate programming facilities. Have done the same thing
multiple times, especially, when there was some code I want to learn about and
understand or simply explain to my future self. My best example is at:
https://notabug.org/ZelphirKaltstahl/the-little-schemer/src/master/chapter-09-y-combinator/code.org

Big fan of noweb : )

> then, on to...
>
> Zelphir,
>
> i also don't know what is going on.  but, installing geiser,
> geiser-guile, and running your code from the source block, looking at
> the output results, i get an error that might mean something to you?
> see below.  (notice i embedded your call to =org-lob-timediff= at the
> end of your source code.)
>
> in addition to with elisp, i use org src blocks with R, shell scripts,
> awk, etc.  but, never (till now!) with scheme.
>
> hth.  good luck.  i'll be curious what your next steps are.
>
> cheers, Greg
> 
>
> #+HEADER: :var dt1="uninitialized1" dt2="uninitialized2"
> #+name: org-lob-timediff
> #+begin_src scheme :results output
>   (import
>(ice-9 format)
>(srfi srfi-19))
>
>
>   (define org-timestamp->time-utc
> (λ (timestamp-string)
>   (let ([parsed-date (string->date timestamp-string "[~Y-~m-~d ~a 
> ~H:~M]")])
> (date->time-utc parsed-date
>
>
>   (define duration->hours
> (λ (duration)
>   ;; 1h = 60min = 3600s
>   (/ (time-second duration) 3600)))
>
>
>   (define org-lob-timediff
> (λ (org-dt1 org-dt2)
>   ;; formatting float:
>
>   ;; ~@width, decimals, scale, overflowchar, padchar
>
>   ;; ~ placeholder is following
>   ;; @ with sign if negative
>   ;; width: minimum width
>   ;; decimals: minimum number of digits after decimal point
>   ;; scale: ???
>   ;; overflowchar: ???
>   ;; padchar: char to use for padding
>
>   (format #f
>   "~,2f"
>   (number->string
>(exact->inexact
> (duration->hours
>  (time-difference (org-timestamp->time-utc org-dt2)
>   (org-timestamp->time-utc org-dt1
>   (org-lob-timediff "[2021-01-01 Fri 00:00]" "[2021-01-01 Fri 01:45]")
> #+end_src
>
> #+RESULTS: org-lob-timediff
> : ice-9/boot-9.scm:222:17: In procedure map1:
> : Syntax error:
> : unknown file:12:0: definition in expression context, where definitions are 
> not allowed, in form (define org-timestamp->time-utc (λ (timestamp-string) 
> (let ((parsed-date (string->date timestamp-string "[~Y-~m-~d ~a ~H:~M]"))) 
> (date->time-utc parsed-date
> : 
> : Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> : scheme@(guile-user) [1]> 

Hmmm this might be a GNU Guile version difference. I remember something about
definition context changing in something like Guile 3.0.3 or so, allowing
definitions in more places than before. For me this error does not happen, as I
use GNU Guile 3.0.7 currently:

 START 
scheme@(guile-user)> (version)
$6 = "3.0.7"
  END  

Perhaps org-babel for Guile (I think ob-scheme? or ob-guile?) wraps everything
inside another (define ...) and that causes an error with the definition 
context.

What I did notice before is, that the set locale seems to matter for the short
names of weekdays and can lead to an error, but that was on another laptop and
not on this system:

 START 
executing Scheme code block (org-lob-timediff)...

(dt1 '"uninitialized1")

(dt2 '"uninitialized2")

Starting Geiser REPL ... [3 times]
Guile REPL up and running!
Debug REPL. Enter ,q to quit, ,h for help.
=> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure string->date: TIME-ERROR type bad-date-format-string: "[~Y-~m-~d 
~a ~H:~M]"

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> 
Error during redisplay: (jit-lock-function 315) signaled (wrong-type-argument 
markerp nil)
Code block evaluation complete.
  END  

But that is a Guile thing and nothing to do with LOB and easily fixed.

I began collecting small snippets and facts about whatever I learn about Emacs
in sone repository: https://notabug.org/ZelphirKaltstahl/emacs-usage-guide
. Not much there yet,
but I will add a working example of LOB, if I can 

Re: Org-cite follow function for ebib

2021-08-09 Thread Thomas S. Dye
Aloha John,

Thanks!

All the best,
Tom

John Kitchin  writes:

> If every thing is working right, you can get the file that a key is in like
> this:
>
> #+BEGIN_SRC emacs-lisp
> (cl-loop for (file . entries) in (org-cite-basic--parse-bibliography)
> when (gethash  "some-key" entries)
>  return file)
> #+END_SRC
>
> This returns the first file that matches.
>
> John
>
> ---
> Professor John Kitchin (he/him/his)
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Mon, Aug 9, 2021 at 6:45 AM Joost Kremers 
> wrote:
>
>> Hi Thomas & others,
>>
>> On Sat, Aug 07 2021, Thomas S. Dye wrote:
>> > Aloha Joost,
>> >
>> > Following some pointers from Eric and Bruce I have this in my
>> > configuration and it seems to work fine, though I haven't had a chance
>> > to use it very much.
>>
>> Thanks for figuring that out. :-) Once I get to implementing support, I'll
>> use
>> it as a starting point. There should also be a way to open the correct file
>> automatically, without the user having to select it.
>>
>>
>>
>> --
>> Joost Kremers
>> Life has its moments
>>
>>


--
Thomas S. Dye
https://tsdye.online/tsdye



Re: Library of Babel usage of other programming languages than elisp

2021-08-09 Thread Zelphir Kaltstahl
The CALL does not work at all for me, not even in the same document, while the
code works just fine in geiser. It results in and empty "#+RESULTS:" being
output below the "#+CALL: ..." and the error in *Messages*.

I did not mention, that I did the lob ingest step as well. Sorry for incomplete
information.

My Emacs version is:

 START 
GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo 
version 1.16.0)
  END  

And my version of org is:

 START 
Package org is built-in.

 Status: Built-In.
Version: 9.4.4
Summary: Export Framework for Org Mode
Required by: ob-async-20200921.205
Other versions: 9.4.6 (gnu).
  END  

Thank you,
Zelphir

On 8/9/21 5:11 PM, Eric S Fraga wrote:
> On Monday,  9 Aug 2021 at 14:25, Zelphir Kaltstahl wrote:
>> the call in this case can be in the same document. I could copy the
>> code to each document I intend to use it in, without much of a
>> problem. Neater would of course be to have it in a global file,
>> collecting all sorts of snippets/functions.
> Indeed.  I was asking for clarification: does the CALL work when in the
> same document but not otherwise?  For me, I can access awk scripts from
> other documents using LOB with no problem.
>
-- 
repositories: https://notabug.org/ZelphirKaltstahl



Re: Library of Babel usage of other programming languages than elisp

2021-08-09 Thread Greg Minshall
Zelphir,

actually...

Everybody,

i have an awkwardness about not being clear of the meaning of "Library
of Babel".  my sense is it a collection of "subroutines".

in my typical use of Org mode for programming, all my code blocks are
defined in the same .org file, and executed in that file, or tangled to
external files (normally, scripts).  i do use <> to include bits
from one part of the same file to the code in another part.  i don't
know if this means i am using the Library of Babel or not.

then, on to...

Zelphir,

i also don't know what is going on.  but, installing geiser,
geiser-guile, and running your code from the source block, looking at
the output results, i get an error that might mean something to you?
see below.  (notice i embedded your call to =org-lob-timediff= at the
end of your source code.)

in addition to with elisp, i use org src blocks with R, shell scripts,
awk, etc.  but, never (till now!) with scheme.

hth.  good luck.  i'll be curious what your next steps are.

cheers, Greg


#+HEADER: :var dt1="uninitialized1" dt2="uninitialized2"
#+name: org-lob-timediff
#+begin_src scheme :results output
  (import
   (ice-9 format)
   (srfi srfi-19))


  (define org-timestamp->time-utc
(λ (timestamp-string)
  (let ([parsed-date (string->date timestamp-string "[~Y-~m-~d ~a ~H:~M]")])
(date->time-utc parsed-date


  (define duration->hours
(λ (duration)
  ;; 1h = 60min = 3600s
  (/ (time-second duration) 3600)))


  (define org-lob-timediff
(λ (org-dt1 org-dt2)
  ;; formatting float:

  ;; ~@width, decimals, scale, overflowchar, padchar

  ;; ~ placeholder is following
  ;; @ with sign if negative
  ;; width: minimum width
  ;; decimals: minimum number of digits after decimal point
  ;; scale: ???
  ;; overflowchar: ???
  ;; padchar: char to use for padding

  (format #f
  "~,2f"
  (number->string
   (exact->inexact
(duration->hours
 (time-difference (org-timestamp->time-utc org-dt2)
  (org-timestamp->time-utc org-dt1
  (org-lob-timediff "[2021-01-01 Fri 00:00]" "[2021-01-01 Fri 01:45]")
#+end_src

#+RESULTS: org-lob-timediff
: ice-9/boot-9.scm:222:17: In procedure map1:
: Syntax error:
: unknown file:12:0: definition in expression context, where definitions are 
not allowed, in form (define org-timestamp->time-utc (λ (timestamp-string) (let 
((parsed-date (string->date timestamp-string "[~Y-~m-~d ~a ~H:~M]"))) 
(date->time-utc parsed-date
: 
: Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
: scheme@(guile-user) [1]> 



Re: Library of Babel usage of other programming languages than elisp

2021-08-09 Thread Eric S Fraga
On Monday,  9 Aug 2021 at 14:25, Zelphir Kaltstahl wrote:
> the call in this case can be in the same document. I could copy the
> code to each document I intend to use it in, without much of a
> problem. Neater would of course be to have it in a global file,
> collecting all sorts of snippets/functions.

Indeed.  I was asking for clarification: does the CALL work when in the
same document but not otherwise?  For me, I can access awk scripts from
other documents using LOB with no problem.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-617-g926dba
: Latest paper written in org: https://arxiv.org/abs/2106.05096



[PATCH] Fix bug assuming canonical duration units in org-agenda-format-items

2021-08-09 Thread Anders Johansson
org-duration-from-minutes was called with canonical = t, but without
providing a corresponding format only using the canonical units. This
broke if the user’s org-duration-format used other than the canonical units.
---
 lisp/org-agenda.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index b4e5547d7..e78ab6b72 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6749,7 +6749,7 @@ (defun org-agenda-format-item (extra txt
 with-level with-category tags
   (org-duration-from-minutes
(+ (org-duration-to-minutes s1 t)
   org-agenda-default-appointment-duration)
-   nil t)))
+   '(("d" (special . h:mm))) t)))
   ;; Compute the duration
   (when s2
 (setq duration (- (org-duration-to-minutes s2)
--
2.32.0



Re: Library of Babel usage of other programming languages than elisp

2021-08-09 Thread Zelphir Kaltstahl
Hi Eric,

the call in this case can be in the same document. I could copy the code to each
document I intend to use it in, without much of a problem. Neater would of
course be to have it in a global file, collecting all sorts of 
snippets/functions.

Regards,
Zelphir

On 8/9/21 3:34 PM, Eric S Fraga wrote:
> On Monday,  9 Aug 2021 at 12:52, Zelphir Kaltstahl wrote:
>> I have repeatedly tried to use another programming language than elisp
>> for writing source blocks in org-mode, which I intended to use as
>> functions inside org-mode spreadsheets. So far without success.
> I cannot help you directly with this but I can say that I use library of
> babel with awk scripts successfully quite often.  Is the call within the
> same document?  If it is, the issue won't be library of babel support in
> any case, as far as I can tell.
>
-- 
repositories: https://notabug.org/ZelphirKaltstahl




Re: [patch] priorities range reversed

2021-08-09 Thread General discussions about Org-mode.
Actually, there some bigger problems with the function as well...

— It didn’t update the priority cookie properly when one had been set before

* [#1] Exercise: update to [#2]

— After fixing that, I noticed that the included save-excursion doesn’t work
  
(https://emacs.stackexchange.com/questions/7574/why-save-excursion-doesnt-save-point-position)

So, here’s a more comprehensive patch, including the previous changes
(in order to support numeric priorities) and then adjusting the
update/insert logic so that it makes more sense.

I did not adjust the indentation, so that you can more clearly see which
lines were changed.  Inline comments in the patch explain what’s going
on.

diff --git a/lisp/org.el b/lisp/org.el
index ce68f4692..69e333c84 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11305,8 +11305,9 @@ or a character."
   (user-error "Priority commands are disabled"))
 (setq action (or action 'set))
 (let ((nump (< org-priority-lowest 65))
+  (saved-position (point))
 	  current new news have remove)
-  (save-excursion
+
 	(org-back-to-heading t)
 	(when (looking-at org-priority-regexp)
 	  (let ((ms (match-string 2)))
@@ -11337,7 +11338,7 @@ or a character."
 		 (= (upcase org-priority-lowest) org-priority-lowest))
 	(setq new (upcase new)))
 	  (cond ((equal new ?\s) (setq remove t))
-		((or (< (upcase new) org-priority-highest) (> (upcase new) org-priority-lowest))
+		((or (> (upcase new) org-priority-highest) (< (upcase new) org-priority-lowest))
 		 (user-error
 		  (if nump
 		  "Priority must be between `%s' and `%s'"
@@ -11364,8 +11365,8 @@ or a character."
 			org-priority-default
 			  (1+ org-priority-default))
 	 (t (user-error "Invalid action")))
-	(when (or (< (upcase new) org-priority-highest)
-		  (> (upcase new) org-priority-lowest))
+	(when (or (> (upcase new) org-priority-highest)
+		  (< (upcase new) org-priority-lowest))
 	  (if (and (memq action '(up down))
 		   (not have) (not (eq last-command this-command)))
 	  ;; `new' is from default priority
@@ -11377,12 +11378,26 @@ or a character."
 	;; Numerical priorities are limited to 64, beyond that number,
 	;; assume the priority cookie is a character.
 	(setq news (if (> new 64) (format "%c" new) (format "%s" new)))
+;; Actually setting the priority isn’t so straightforward
+;; There are several cases
 	(if have
+;; ① have and remove
 	(if remove
 		(replace-match "" t t nil 1)
-	  (replace-match news t t nil 2))
+  ;; ② have and not remove, i.e., update
+	  (let ((case-fold-search nil)) (looking-at org-priority-regexp))
+  (if (match-end 2)
+		  (progn
+		(goto-char (match-end 2))
+(delete-region (match-beginning 2) (match-end 2))
+		(insert news))
+	(goto-char (match-end 1))
+	(insert "[#" news "] "))
+  )
+  ;; ③ don’t have and remove — nonsense
 	  (if remove
 	  (user-error "No priority cookie found in line")
+;; ④ don’t have and not remove, i.e., insert
 	(let ((case-fold-search nil)) (looking-at org-todo-line-regexp))
 	(if (match-end 2)
 		(progn
@@ -11390,7 +11405,8 @@ or a character."
 		  (insert " [#" news "]"))
 	  (goto-char (match-beginning 3))
 	  (insert "[#" news "] "
-	(org-align-tags))
+	(org-align-tags)
+  (goto-char saved-position)
   (if remove
 	  (message "Priority removed")
 	(message "Priority of current item set to %s" news)
diff --git a/lisp/org.el b/lisp/org.el
index ce68f4692..69e333c84 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11305,8 +11305,9 @@ or a character."
   (user-error "Priority commands are disabled"))
 (setq action (or action 'set))
 (let ((nump (< org-priority-lowest 65))
+  (saved-position (point))
 	  current new news have remove)
-  (save-excursion
+
 	(org-back-to-heading t)
 	(when (looking-at org-priority-regexp)
 	  (let ((ms (match-string 2)))
@@ -11337,7 +11338,7 @@ or a character."
 		 (= (upcase org-priority-lowest) org-priority-lowest))
 	(setq new (upcase new)))
 	  (cond ((equal new ?\s) (setq remove t))
-		((or (< (upcase new) org-priority-highest) (> (upcase new) org-priority-lowest))
+		((or (> (upcase new) org-priority-highest) (< (upcase new) org-priority-lowest))
 		 (user-error
 		  (if nump
 		  "Priority must be between `%s' and `%s'"
@@ -11364,8 +11365,8 @@ or a character."
 			org-priority-default
 			  (1+ org-priority-default))
 	 (t (user-error "Invalid action")))
-	(when (or (< (upcase new) org-priority-highest)
-		  (> (upcase new) org-priority-lowest))
+	(when (or (> (upcase new) org-priority-highest)
+		  (< (upcase new) org-priority-lowest))
 	  (if (and (memq action '(up down))
 		   (not have) (not (eq last-command this-command)))
 	  ;; `new' is from default priority
@@ -11377,12 +11378,26 @@ or a character."
 	;; Numerical priorities are limited to 64, beyond that number,
 	;; 

Re: Recursive publish bug?

2021-08-09 Thread Felix E. Klee
"Felix E. Klee"  writes:
>  ("static"
>   :base-directory "."
 ^
 This!

no bug




Re: Library of Babel usage of other programming languages than elisp

2021-08-09 Thread Eric S Fraga
On Monday,  9 Aug 2021 at 12:52, Zelphir Kaltstahl wrote:
> I have repeatedly tried to use another programming language than elisp
> for writing source blocks in org-mode, which I intended to use as
> functions inside org-mode spreadsheets. So far without success.

I cannot help you directly with this but I can say that I use library of
babel with awk scripts successfully quite often.  Is the call within the
same document?  If it is, the issue won't be library of babel support in
any case, as far as I can tell.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-617-g926dba
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: columns view, org-lint, and native compilation

2021-08-09 Thread Eric S Fraga
On Thursday,  5 Aug 2021 at 23:14, Ihor Radchenko wrote:
> I suggest to run =e (point) = while in backtrace and go to reveal
> point in the Org file where error happens. Then, you can manually check
> if the Org syntax is violated.

Thank you.  This was helpful.  Lot's of very bad org structure in that
file (which dates back quite a few years), mostly misplaced properties
drawers, e.g. appearing after logbook drawers.

Column view still not working as it should so investigation continues!

Thanks again,
eric


-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-617-g926dba
: Latest paper written in org: https://arxiv.org/abs/2106.05096



[patch] priorities range reversed

2021-08-09 Thread General discussions about Org-mode.
In the case of numeric priorities [#1] [#9] and so on, there is a test
that is reversed in org.el.  This appears twice with a slight variation.

;; Are we are less than the highest or greater than the lowest?
(or (< (upcase new) org-priority-highest)
(> (upcase new) org-priority-lowest))

The test is, in itself (and in principle) just fine.  The problem is
that it then triggers an error, which is exactly the opposite of what’s
wanted!

The attached patch reverses the test so that we enter the error case
when the priority is *outside* of the range of acceptable priority tags.

Here’s some test data for reproducing the problem and testing the
solution (with the patch applied).

Evaluate:

(setq org-default-priority 2)
(setq org-highest-priority 9)
(setq org-lowest-priority 1)

* This is a test
(Run M-x org-priority RET on the above line.)

diff --git a/lisp/org.el b/lisp/org.el
index ce68f4692..bd6fd3146 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11337,7 +11337,7 @@ or a character."
 		 (= (upcase org-priority-lowest) org-priority-lowest))
 	(setq new (upcase new)))
 	  (cond ((equal new ?\s) (setq remove t))
-		((or (< (upcase new) org-priority-highest) (> (upcase new) org-priority-lowest))
+		((or (> (upcase new) org-priority-highest) (< (upcase new) org-priority-lowest))
 		 (user-error
 		  (if nump
 		  "Priority must be between `%s' and `%s'"
@@ -11364,8 +11364,8 @@ or a character."
 			org-priority-default
 			  (1+ org-priority-default))
 	 (t (user-error "Invalid action")))
-	(when (or (< (upcase new) org-priority-highest)
-		  (> (upcase new) org-priority-lowest))
+	(when (or (> (upcase new) org-priority-highest)
+		  (< (upcase new) org-priority-lowest))
 	  (if (and (memq action '(up down))
 		   (not have) (not (eq last-command this-command)))
 	  ;; `new' is from default priority


-- 
Dr Joseph A. Corneli (https://github.com/holtzermann17)

HYPERREAL ENTERPRISES LTD is a private company limited by shares, incorporated
25th, June 2019 as Company Number 634284 on the Register of Companies for
Scotland (https://beta.companieshouse.gov.uk/company/SC634284).


Library of Babel usage of other programming languages than elisp

2021-08-09 Thread Zelphir Kaltstahl
Hello Org-mode users!

I have repeatedly tried to use another programming language than elisp for
writing source blocks in org-mode, which I intended to use as functions inside
org-mode spreadsheets. So far without success.

Here is my latest attempt:

 START 
#+HEADER: :var dt1="uninitialized1" dt2="uninitialized2"
#+name: org-lob-timediff
#+begin_src scheme
(import
 (ice-9 format)
 (srfi srfi-19))


(define org-timestamp->time-utc
  (λ (timestamp-string)
(let ([parsed-date (string->date timestamp-string "[~Y-~m-~d ~a ~H:~M]")])
  (date->time-utc parsed-date


(define duration->hours
  (λ (duration)
;; 1h = 60min = 3600s
(/ (time-second duration) 3600)))


(define org-lob-timediff
  (λ (org-dt1 org-dt2)
;; formatting float:

;; ~@width, decimals, scale, overflowchar, padchar

;; ~ placeholder is following
;; @ with sign if negative
;; width: minimum width
;; decimals: minimum number of digits after decimal point
;; scale: ???
;; overflowchar: ???
;; padchar: char to use for padding

(format #f
"~,2f"
(number->string
 (exact->inexact
  (duration->hours
   (time-difference (org-timestamp->time-utc org-dt2)
(org-timestamp->time-utc org-dt1
#+end_src

#+CALL: org-lob-timediff(dt1="[2021-01-01 Fri 00:00]", dt2="[2021-01-01 Fri 
01:45]")

#+RESULTS:
  END  

This code works just fine in geiser using GNU Guile:

 START 
scheme@(guile-user)> (org-lob-timediff "[2021-01-01 Fri 00:00]" "[2021-01-01 
Fri 01:45]")
$4 = "1.75"
  END  

However, when I C-c C-c the `CALL` line to actually run the code using library
of babel, as a precursor to using `org-sbe` inside a spreadsheet, it fails! I
see the following in my *Messages* buffer:

 START 
executing Scheme code block...

(dt1 '"[2021-01-01 Fri 00:00]")

(dt2 '"[2021-01-01 Fri 01:45]")

Starting Geiser REPL ... [3 times]
Guile REPL up and running!
Debug REPL. Enter ,q to quit, ,h for help.
=> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Wrong type to apply: #

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> 
Error during redisplay: (jit-lock-function 315) signaled (wrong-type-argument 
markerp nil)
Code block evaluation complete.
  END  

So something obviously is getting confused. `time-second` is not a
syntax-transformer. It is a procedure:

 START 
scheme@(guile-user)> time-second
$5 = #
  END  

Now I have many questions:

+ What am I doing wrong? How comes perfectly valid code does not work in LOB?

+ Can LOB even be used with other languages than Elisp?

+ Almost all examples I see online are elisp only. Perhaps I am trying to do
something, that is impossible with current Org-mode and Library of Babel?

Best regards,
Zelphir

-- 
repositories: https://notabug.org/ZelphirKaltstahl



Re: Org-cite follow function for ebib

2021-08-09 Thread John Kitchin
If every thing is working right, you can get the file that a key is in like
this:

#+BEGIN_SRC emacs-lisp
(cl-loop for (file . entries) in (org-cite-basic--parse-bibliography)
when (gethash  "some-key" entries)
 return file)
#+END_SRC

This returns the first file that matches.

John

---
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Mon, Aug 9, 2021 at 6:45 AM Joost Kremers 
wrote:

> Hi Thomas & others,
>
> On Sat, Aug 07 2021, Thomas S. Dye wrote:
> > Aloha Joost,
> >
> > Following some pointers from Eric and Bruce I have this in my
> > configuration and it seems to work fine, though I haven't had a chance
> > to use it very much.
>
> Thanks for figuring that out. :-) Once I get to implementing support, I'll
> use
> it as a starting point. There should also be a way to open the correct file
> automatically, without the user having to select it.
>
>
>
> --
> Joost Kremers
> Life has its moments
>
>


Re: org-cite and pandoc

2021-08-09 Thread Eric S Fraga
On Saturday,  7 Aug 2021 at 22:09, Nicolas Goaziou wrote:
> Would you have an ECM? I cannot reproduce it.

Unfortunately, I cannot reproduce it with emacs -Q [1].  Has to be
something in my configuration but I have no idea what.  No time at
present to bisect etc. but I will in due course hopefully.

Sorry for the noise.

thank you,
eric

Footnotes:
[1] the one real disadvantage of using Emacs as my window manager,
 i.e. exwm, is the hassle involved in actually running Emacs with
 -Q. :-(

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-617-g926dba
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: Org-cite follow function for ebib

2021-08-09 Thread Bruce D'Arcus
I don't have a super specific suggestion ATM, but will just make the
following observation:

John Kitchin and I have been working on respective processors, and
they are modular enough that:

1) one can mix-and-match across projects

2) one can customize within each follow processor; for org-ref-cite,
you can extend its hydra-based follow UI using hydra+, and for
bibtex-actions you can write and use your own keymap to tell embark
which commands to use for it's menu.

Upshot: a function that takes a key (or list of keys, as with
bibtex-completion, which is what I use behind-the-scenes) is the
starting point for a basic single action follow processor. But it
should be easily incorporated into more feature-full UIs.



On Mon, Aug 9, 2021 at 6:45 AM Joost Kremers  wrote:
>
> Hi Thomas & others,
>
> On Sat, Aug 07 2021, Thomas S. Dye wrote:
> > Aloha Joost,
> >
> > Following some pointers from Eric and Bruce I have this in my
> > configuration and it seems to work fine, though I haven't had a chance
> > to use it very much.
>
> Thanks for figuring that out. :-) Once I get to implementing support, I'll use
> it as a starting point. There should also be a way to open the correct file
> automatically, without the user having to select it.
>
>
>
> --
> Joost Kremers
> Life has its moments



Re: Org-cite follow function for ebib

2021-08-09 Thread Joost Kremers
Hi Thomas & others,

On Sat, Aug 07 2021, Thomas S. Dye wrote:
> Aloha Joost,
>
> Following some pointers from Eric and Bruce I have this in my
> configuration and it seems to work fine, though I haven't had a chance
> to use it very much.

Thanks for figuring that out. :-) Once I get to implementing support, I'll use
it as a starting point. There should also be a way to open the correct file
automatically, without the user having to select it.



-- 
Joost Kremers
Life has its moments



Re: virtual-fill mode in mail buffers, with orgalist-mode, prefix is not considered when virtual-fill is on

2021-08-09 Thread Ihor Radchenko
Uwe Brauer  writes:

> So the prefix is not taken into account. Anybody seeing this and knows a 
> solution?

Not sure about orgalist-mode, but you may need to define custom
adaptive-fill-function. I use the following (though for org-mode itself):

(defun org-adaptive-fill-function ()
"Fill headlines to the beginning of headline in org."
(save-excursion
  (cond
   ((org-at-heading-p)
(beginning-of-line)
(looking-at org-complex-heading-regexp)
(goto-char (or (match-beginning 4) (match-end 0))) ;; at headline
(make-string (current-column) ?\ ))
   ((org-at-item-p)
(beginning-of-line)
(looking-at org-list-full-item-re)
(goto-char (or (match-beginning 4) (match-end 3) (match-end 2) 
(match-end 1)))
(skip-chars-forward " \t")
(make-string (current-column) ?\ )
  (add-hook! 'org-mode-hook (setq-local adaptive-fill-function 
#'org-adaptive-fill-function))

Best,
Ihor



Re: Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]

2021-08-09 Thread Tim Landscheidt
Eric S Fraga  wrote:

> What if you escape the \n, i.e. \\n?

Then org-mode's display is correct, but the message call
will not output a newline, but a backslash and an "n" :-).

Tim



Re: Bug: Cannot insert multiple multi-line elisp links [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)]

2021-08-09 Thread Eric S Fraga
What if you escape the \n, i.e. \\n?
-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-607-g185706
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: ConTeXt exporter for Org Mode

2021-08-09 Thread Denis Maier

Am 04.08.2021 um 18:01 schrieb Jason Ross:

Hello,

I have developed a ConTeXt exporter for Org Mode. It is available at
https://github.com/Jason-S-Ross/ox-context

The exporter provides custom environments for each document element
in an effort to make customization easier, in contrast to the Pandoc
exporter which uses built-in environments for document elements.

I welcome any feedback.

Thanks,
Jason




Thanks, Jason. That's really awesome.

Denis




Re: org-attach-sync uses directory-empty-p (new in Emacs 28)

2021-08-09 Thread Arthur Miller
Kyle Meyer  writes:

> Hi Marco,
>
> In 61e083732 (org-attach: Possibly delete empty attach directory,
> 2021-07-09), you added a call to directory-empty-p.  This function was
> introduced in Emacs's 0806075520 (Add directory-empty-p and new argument
> COUNT for directory-files-*, 2020-11-02) and hasn't yet made it into a
> release.
>
> Could you update org-attach-sync to avoid using directory-empty-p (e.g.,
> by inlining it or by adding a compatibility alias)?
>
> Thanks.

Can this help:

#+begin_src emacs-lisp

(when (version< emacs-version "28")
  (defun directory-empty-p (file-name)
"Check if a directory contains any other files then dot-files"
(when (file-directory-p file-name)
  (null (directory-files file-name nil
 directory-files-no-dot-files-regexp t)

#+end_src