Re: [PATCH] c-csl : accept relative CSL filenames

2021-11-04 Thread Bruce D'Arcus
On Thu, Nov 4, 2021 at 6:20 PM Nicolas Goaziou  wrote:

> I think there are two ways forward when a relative file name is used:
>
> 1. First check `org-cite-csl-styles-dir' and, if it is nil, expand
>against `default-directory';
>
> 2. Drop `org-cite-csl-styles-dir' and always expand against
>`default-directory'.
>
>  What do oc-csl users think about it?

I'm strongly opposed to 2.

1 seems fine.

Bruce



Re: [PATCH] c-csl : accept relative CSL filenames

2021-11-04 Thread Nicolas Goaziou
Hello,

Emmanuel Charpentier  writes:

> IMHO, `org-cite-csl-styles-dir' is deemed to be a more-or-less
> permanent setting (possibly in `.emacs'), whereas allowing a relative
> filename doesn't need any initial setup.

But your patch blocks any use for `org-cite-csl-styles-dir' (relative
file names can always be expanded from `default-directory', the other
branches are thus ignored). So it is either, not both.

I think there are two ways forward when a relative file name is used:

1. First check `org-cite-csl-styles-dir' and, if it is nil, expand
   against `default-directory';

2. Drop `org-cite-csl-styles-dir' and always expand against
   `default-directory'.

 What do oc-csl users think about it?

>> > +    ((and (pred (lambda (x)
>> > + (let ((fn (expand-file-name x default-directory)))
>> > +   (if (file-exists-p fn) fn nil file) file)
>> 
>> This pattern returns the relative file name, not the expanded one. It
>> may not be what you want.
>
> From `expand-file-name' docstring :

I'm not commenting about `expand-file-name', but about your `pcase'
pattern:

  (pcase relative-file-name
((and (pred ...) file) file))

IIUC, the above will return `file', which matches `relative-file-name',
not the return value from the predicate.

Regards,
-- 
Nicolas Goaziou



Re: [PATCH] oc-basic: support biblatex date field

2021-11-04 Thread Nicolas Goaziou
Hello,

"Bruce D'Arcus"  writes:

> This returns the correct result.
>
> (org-cite-basic--get-year "kohn2005" nil)
>
> How do I get that in the basic activate processor tooltip?

`org-cite-basic-activate' calls `org-cite-basic--print-entry', which in
turn calls `org-cite-basic--get-year'.

IOW, the tooltip should already use the date if the year is unavailable.
Isn't is the case? Do you have an ECM?

Regards,
-- 
Nicolas Goaziou



Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables

2021-11-04 Thread Juan Manuel Macías
Hi Nicolas,

Nicolas Goaziou writes:

> Good idea. Thanks.

Attached here the updated patch.

Best regards,

Juan Manuel 
>From fc9062caf43956ac68b72f16afbd5584ec84e687 Mon Sep 17 00:00:00 2001
From: Juan Manuel Macias 
Date: Thu, 4 Nov 2021 21:38:26 +0100
Subject: [PATCH] ox-latex.el: add `options' latex attribute to tables

* lisp/ox-latex.el (org-latex--org-table): The `:options' LaTeX
attribute allows adding an optional argument (`\begin{env}[opt]'),
since certain tabular environments, such as `longtblr', accept optional
arguments.
* doc/org-manual.org (Tables in LaTeX export): this feature in the manual.
* etc/ORG-NEWS (New :options attribute when exporting tables to
LaTeX): this feature in `ORG-NEWS'.
---
 doc/org-manual.org |  9 +
 etc/ORG-NEWS   | 14 ++
 lisp/ox-latex.el   |  4 +++-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index af88b8506..50cdb9101 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13572,6 +13572,14 @@ include:
   The LaTeX export back-end uses these attributes for regular tables
   to set their alignments, fonts, and widths.
 
+- =:options= ::
+
+  The =:options= attribute allows adding an optional argument with a
+  list of various table options (between brackets in LaTeX export),
+  since certain tabular environments, such as =longtblr= of the
+  =tabularray= LaTeX package, provides this structure. For example:
+  =:options remark{Note}={note},remark{Source}={source}=.
+
 - =:spread= ::
 
   When =:spread= is non-~nil~, the LaTeX export back-end spreads or
@@ -19770,6 +19778,7 @@ moves across a special context.
   (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
   (define-key yas/keymap [tab] 'yas/next-field)))
   #+end_src
+
 ** Using Org on a TTY
 :PROPERTIES:
 :DESCRIPTION: Using Org on a tty.
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index d73d0d3c3..626e19335 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -53,6 +53,13 @@ structures is supported.  Storing references between different
 variables is also supported (see =:inherit= key in
 ~org-persist-register~).
 
+*** New :options attribute when exporting tables to LaTeX 
+
+The =:options= attribute allows adding an optional argument with a
+list of various table options (between brackets in LaTeX export),
+since certain tabular environments, such as =longtblr= of the
+=tabularray= LaTeX package, provides this structure.
+
 ** New functions and changes in function arguments
 
 *** New function ~org-element-cache-map~ for quick mapping across Org elements
@@ -1555,6 +1562,7 @@ the headline to use for making the table of contents.
 ,* Another section
 ,#+TOC: headlines 1 :target "#TargetSection"
 #+end_example
+
 ** New functions
 *** ~org-dynamic-block-insert-dblock~
 
@@ -1845,6 +1853,7 @@ CIDER version which has not =sesman= integrated, only has
 (dissoc Clojure 'JVM)
 (conj clojurists "stardiviner")
 #+end_src
+
 *** Add ~:results link~ support for Babel
 
 With this output format, create a link to the file specified in
@@ -1863,14 +1872,17 @@ wget -c "https://ben.akrin.com/crackzor/crackzor_1.0.c.gz;
 #+begin_src js :session "*Javascript REPL*"
 console.log("stardiviner")
 #+end_src
+
 *** Add ~:session~ support of ob-js for Indium
 #+begin_src js :session "*JS REPL*"
 console.log("stardiviner")
 #+end_src
+
 *** Add ~:session~ support of ob-js for skewer-mode
 #+begin_src js :session "*skewer-repl*"
 console.log("stardiviner")
 #+end_src
+
 *** Add support for links to LaTeX equations in HTML export
 Use MathJax links when enabled (by ~org-html-with-latex~), otherwise
 add a label to the rendered equation.
@@ -1957,6 +1969,7 @@ you should expect to see something like:
 #+BEGIN_EXAMPLE
   ,#+STARTUP: shrink
 #+END_EXAMPLE
+
 *** Allow to filter by tags/property when capturing colview
 
 You can now use =:match= to filter entries using a todo/tags/properties
@@ -2339,6 +2352,7 @@ To use =vertica= in an sql =SRC_BLK= set the =:engine= like this:
   SELECT * FROM nodes;
   ,#+END_SRC
 #+END_EXAMPLE
+
  C++: New header ~:namespaces~
 
 The new ~:namespaces~ export option can be used to specify namespaces
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 3e3967033..409d92164 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3314,6 +3314,7 @@ This function assumes TABLE has `org' as its `:type' property and
 `table' as its `:mode' attribute."
   (let* ((attr (org-export-read-attribute :attr_latex table))
 	 (alignment (org-latex--align-string table info))
+ (opt (org-export-read-attribute :attr_latex table :options))
 	 (table-env (or (plist-get attr :environment)
 			(plist-get info :latex-default-table-environment)))
 	 (width
@@ -3343,8 +3344,9 @@ This function assumes TABLE has `org' as its `:type' property and
 		(format "\\end{%s}" table-env)
 		(and fontsize "}"
  (t
-  (let ((output (format "\\begin{%s}%s{%s}\n%s\\end{%s}"
+  (let ((output (format 

Re: [PATCH] oc-basic: support biblatex date field

2021-11-04 Thread Bruce D'Arcus
On Wed, Nov 3, 2021 at 11:16 AM Nicolas Goaziou  wrote:

> I pushed a change along these lines in bugfix branch.

Thank you!

> Please let me know if it works for you.

This returns the correct result.

(org-cite-basic--get-year "kohn2005" nil)

How do I get that in the basic activate processor tooltip?

That was my main reason to suggest it.

Bruce



Re: [BUG] Elisp error when exporting citation [9.5 (release_9.5-104-g2b1fc6 @ /home/quintus/.emacs.d/org-mode/lisp/)]

2021-11-04 Thread M . ‘quintus’ Gülker
Dear all,

Am Donnerstag, dem 04. November 2021 schrieb Nicolas Goaziou:
> Great! Hopefully, OP's problem is completely solved, then.

I can confirm that the original example I gave (the one with the missing
@ sign) does not error anymore now. The improper formatting on LaTeX
export I mentioned in the other e-mail[1] however is still persisting,
both with the @ and without it.

Org mode version 9.5 (release_9.5-214-gced2b3 @ 
/home/quintus/.emacs.d/org-mode/lisp/)
Citeproc.el at e93b45fe125d2ed61c60136638b3836ec770f879

  -quintus

[1]: 
https://list.orgmode.org/87pmrgs2la@nicolasgoaziou.fr/T/#m04c52902b1b2cb813269cac8088b4de94f0fcf2b

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: org-diary

2021-11-04 Thread Michael Maurer
On Thu, 4 Nov 2021 at 17:05, Eric S Fraga  wrote:
>
> On Thursday,  4 Nov 2021 at 16:56, Michael Maurer wrote:
> > I'm curious about this use of a diary-file in combination with
> > org-babel. I'm guessing it outputs only specific items from the
> > diary-file based on some variables? I tried to google this, but
> > couldn't find anything (or maybe I'm speculating wrong).
>
> There may be some fundamental misunderstanding here.  What does
> orb-babel have to do with org mode and the Emacs diary integration?
>
> The Emacs diary & calendar (core Emacs features) allow for elisp sexps
> in the diary file and org-diary is an elisp function that returns
> information in the form that the diary understands.  There is a section
> in the Emacs info manual on the Calendar and the Diary (section 31).
>
> Conversely, the org agenda can make use of Emacs diary expressions as
> well!  But that's another story.
>

Oh. I assumed

#+begin_src elisp
&%%(org-diary :deadline* :timestamp :scheduled*)
#+end_src

is an org-babel code block. But I'll check out that manual section as
well as org-diary.



Re: [BUG] Unregistered buffer modifications detected [9.5 (9.5-g49e2f6 @ /Users/myuser/.emacs.d/straight/29/straight/build/org/)]

2021-11-04 Thread Aaron Jensen
On Thu, Nov 4, 2021 at 10:11 AM Ihor Radchenko  wrote:
>
> Aaron Jensen  writes:
>
> > I got a warning when I did an org-agenda-todo to mark something as done.
> >
> > https://gist.github.com/aaronjensen/163913c0937376c9699eaa71eaa0959a
>
> If I read the backtrace correctly, you did not update to the latest
> main. Can you check if your Org is more recent than dc0c60f123?

Ah, it was not, I'm sorry. I have updated. I'll report back next time
I see something.

Thanks,

Aaron



Re: org-store-link question

2021-11-04 Thread Max Nikulin

On 04/11/2021 03:07, John Kitchin wrote:
In a basically vanilla emacs, if I have a target like <> with my 
point on it, and I run org-store-link (via C-c l), and then somewhere 
else do org-isnert-link (via C-c C-l) I get a link like


[[file:~/s/f.org::test]]

If I define a link now like this:

#+BEGIN_SRC emacs-lisp
(org-link-set-parameters "jump"
:store (lambda ()
  (org-link-store-props
   :type "jump"
   :link (format "jump:%s::%s"
(buffer-file-name)
(line-number-at-pos)
#+END_SRC

and do that again, all I can insert with C-c C-l is something like:

[[jump:~/s/f.org::9]]

and the file link is not an option anymore. Should the file link still 
be there?


It seems `org-store-link' is designed to store a single link. You can 
make :store for "jump" links more selective by returning nil in some 
cases or to hit C-u C-u before `org-store-link' to bypass custom :store 
functions.


P.S. There is a piece of code to store #CUSTOM_ID link in addition to 
search heading link, but the latter part is broken, so if #CUSTOM_ID is 
present, it is saved twice.





Re: [PATCH] c-csl : accept relative CSL filenames

2021-11-04 Thread Emmanuel Charpentier
Le mercredi 03 novembre 2021 à 17:19 +0100, Nicolas Goaziou a écrit :
> Hello,
> 
> Emmanuel Charpentier  writes:
> 
> > This (minuscule) patch allows to pass a relative (to the buffer's
> > default directory) file name to denote the CSL style file.
> 
> Thank you. However, I'm not sure to understand the purpose of the
> patch.
> 
> > Rationale : this allows the use of "one-of" styles for "one-of"
> > projects without overloading a defailt CSL style directory (which may
> > or may not exist on a given system : think JabRef users...). Also
> > useful for hacked CSL files specific to a given project.
> 
> If we expand every relative file name from `default-directory', what
> happens to `org-cite-csl-styles-dir'? Your patch makes this variable
> useless, doesn't it?

This can be useful to be able, for example, to use a one-off style for
a given exporter while keeping a standard one for another exporter (e.
g. a one-off exporter for a journal with complicated bibliographic
requirement and anorher for a preprint archive of the same paper).


> What about using a local `org-cite-csl-styles-dir' instead, using
> file-local variables?


IMHO, `org-cite-csl-styles-dir' is deemed to be a more-or-less
permanent setting (possibly in `.emacs'), whereas allowing a relative
filename doesn't need any initial setup.

> > +    ((and (pred (lambda (x)
> > + (let ((fn (expand-file-name x default-directory)))
> > +   (if (file-exists-p fn) fn nil file) file)
> 
> This pattern returns the relative file name, not the expanded one. It
> may not be what you want.

>From `expand-file-name' docstring :

"expand-file-name is a built-in function in ‘C source code’.

(expand-file-name NAME  DEFAULT-DIRECTORY)

  Probably introduced at or before Emacs version 1.6.

Convert filename NAME to absolute, and canonicalize it.

[ Abridged.. ]"

My tests confirmed that. I do not understand how you managed to reach
your conclusions...

Sincerely,

--
Emmanuel Charpentier

> 
> 
> Regards,




Re: org-diary

2021-11-04 Thread Eric S Fraga
On Thursday,  4 Nov 2021 at 16:56, Michael Maurer wrote:
> I'm curious about this use of a diary-file in combination with
> org-babel. I'm guessing it outputs only specific items from the
> diary-file based on some variables? I tried to google this, but
> couldn't find anything (or maybe I'm speculating wrong).

There may be some fundamental misunderstanding here.  What does
orb-babel have to do with org mode and the Emacs diary integration?

The Emacs diary & calendar (core Emacs features) allow for elisp sexps
in the diary file and org-diary is an elisp function that returns
information in the form that the diary understands.  There is a section
in the Emacs info manual on the Calendar and the Diary (section 31).

Conversely, the org agenda can make use of Emacs diary expressions as
well!  But that's another story.

-- 
: Eric S Fraga via Emacs 28.0.60, Org release_9.5-192-gd4e192
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: org-diary

2021-11-04 Thread Michael Maurer
On Wed, 3 Nov 2021 at 12:06, Eric S Fraga  wrote:
>
> Glad I could be of assistance! 
> --
> : Eric S Fraga via Emacs 28.0.60, Org release_9.5-192-gd4e192
> : Latest paper written in org: https://arxiv.org/abs/2106.05096

I'm curious about this use of a diary-file in combination with
org-babel. I'm guessing it outputs only specific items from the
diary-file based on some variables? I tried to google this, but
couldn't find anything (or maybe I'm speculating wrong).



Re: [BUG] org-element-at-point returns wrong element

2021-11-04 Thread Ihor Radchenko
Sébastien Miquel  writes:

> Hi,
>
> With point at the bol of the empty line after the keyword and before
> the heading at the end of this mail, =org-element-at-point= returns
> the headline element. It used to (a month ago, before all the caching)
> return the keyword.

Thanks for reporting!

Fixed on latest main.

Best,
Ihor



Re: [QUESTION] How to generate org-agenda view for clocked tasks and logs etc which are sorted by timestamps?

2021-11-04 Thread Russell Adams
On Thu, Nov 04, 2021 at 12:16:19PM +0800, stardiviner wrote:
> How to use elisp code to generate an org-agenda view for clocked tasks and
> logs etc which are sorted by timestamps? I want to view my daily done tasks
> and attach them as part of diary (maybe use org source block elisp code to
> generate output?)
>
> So how to setup `org-agenda-custom-commands` to archive this purpose?

I routinely export my agenda to HTML with logbook mode enabled and
inactive timestamps. This shows a complete timeline of my actions.  I
save timestamps on changing TODO to DONE, use active timestamps for
appointments, and I constantly add inactive timestamps while taking
notes. I use this to justify billing to clients.

I open the agenda, v m to make a monthly view, L for logbook, ] to
enable inactive timestamps, and then C-x C-w to save. You may be able
to just use elisp to trigger these actions.

I don't do it often enough to automate it. I love being able to
flatten my tree of notes into a timeline this way.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: [BUG] Unregistered buffer modifications detected [9.5 (9.5-g49e2f6 @ /Users/myuser/.emacs.d/straight/29/straight/build/org/)]

2021-11-04 Thread Ihor Radchenko
Aaron Jensen  writes:

> I got a warning when I did an org-agenda-todo to mark something as done.
>
> https://gist.github.com/aaronjensen/163913c0937376c9699eaa71eaa0959a

If I read the backtrace correctly, you did not update to the latest
main. Can you check if your Org is more recent than dc0c60f123?

Best,
Ihor



Re: [BUG] Elisp error when exporting citation [9.5 (release_9.5-104-g2b1fc6 @ /home/quintus/.emacs.d/org-mode/lisp/)]

2021-11-04 Thread Nicolas Goaziou
Hello,

András Simonyi  writes:

> On Wed, 3 Nov 2021 at 17:02, Nicolas Goaziou  wrote:
>> It looks like there's something to repair on the Citeproc side. I'm
>> Cc'ing András Simonyi for a better understanding of the problem.
>
> I think this problem has been fixed in citeproc-el (see PR #55)

Great! Hopefully, OP's problem is completely solved, then.

> you are probably using an earlier version.

I'm using latest stable release, indeed. Thanks for the answer.

Regards,
-- 
Nicolas Goaziou



Re: [BUG] Elisp error when exporting citation [9.5 (release_9.5-104-g2b1fc6 @ /home/quintus/.emacs.d/org-mode/lisp/)]

2021-11-04 Thread András Simonyi
Dear All,

On Wed, 3 Nov 2021 at 17:02, Nicolas Goaziou  wrote:
> It looks like there's something to repair on the Citeproc side. I'm
> Cc'ing András Simonyi for a better understanding of the problem.

I think this problem has been fixed in citeproc-el (see PR #55) -- you
are probably using an earlier version.

best wishes,
András