Re: [org-mode] make citation object available to org-cite-make-insert-processor SELECT-STYLE?

2021-07-29 Thread John Kitchin
my solution to this (which I think worked well) is to select the keys, and
insert a default style, and then you run a command that updates the style.
that way you can get the keys that are in the citation easily from
org-element-context, and then I can make a preview for each style that is
consistent with the best guess for what the exporter is. (based on the
cite_export keyword, or a default choice).


On Thu, Jul 29, 2021 at 8:58 PM Bruce D'Arcus  wrote:

> Hi Nicolas,
>
> On Thu, Jul 29, 2021 at 3:28 PM Nicolas Goaziou 
> wrote:
> >
> > Hello,
> >
> > "Bruce D'Arcus"  writes:
> >
> > > But to do that best and most consistently (next step is CSL, for
> > > example), I need the citation accessible from there, so I can run the
> > > export processors to generate the previews.
> > >
> > > Could we possibly tweak SELECT-STYLE to take one argument: citation?
> >
> > When you are inserting a whole new citation, what would be the value?
> > nil? What would you display then?
>
> The first iteration of the idea behind the request is this style selection
> UI:
>
>
> https://user-images.githubusercontent.com/1134/126531061-40cf47ab-0c7f-42ac-8ddb-341e7ab70d4b.png
>
> So the idea is to present a preview of the style/variant output when
> selecting the style.
>
> Like:
>
> /  (Doe, 2019)
>
> ... or maybe even multiple columns:
>
> /  (Doe, 2019)   \citep
>
> I'm thinking the best way to build this UI is to iterate through
> org-cite-support-styles, and run at least the default export processes
> to create that preview annotation,
>
> As my thinking has evolved (and there's been a lot of discussion on
> this the past week), I see two options:
>
> 1. Generate the previews from the citations at point. This was the
> idea that promoted the suggestion here, since I can't get access to
> that citation data if I use org-cite-make-insert-processor.
>
> 2. Instead, have a standardized example record just for the preview.
> With this approach, the citation context isn't relevant.
>
> As to your question, do any style UIs currently allow you to select a
> style on a new citation before selecting the keys?
>
> Bruce
>
>


Re: [org-mode] make citation object available to org-cite-make-insert-processor SELECT-STYLE?

2021-07-29 Thread Bruce D'Arcus
Hi Nicolas,

On Thu, Jul 29, 2021 at 3:28 PM Nicolas Goaziou  wrote:
>
> Hello,
>
> "Bruce D'Arcus"  writes:
>
> > But to do that best and most consistently (next step is CSL, for
> > example), I need the citation accessible from there, so I can run the
> > export processors to generate the previews.
> >
> > Could we possibly tweak SELECT-STYLE to take one argument: citation?
>
> When you are inserting a whole new citation, what would be the value?
> nil? What would you display then?

The first iteration of the idea behind the request is this style selection UI:

https://user-images.githubusercontent.com/1134/126531061-40cf47ab-0c7f-42ac-8ddb-341e7ab70d4b.png

So the idea is to present a preview of the style/variant output when
selecting the style.

Like:

/  (Doe, 2019)

... or maybe even multiple columns:

/  (Doe, 2019)   \citep

I'm thinking the best way to build this UI is to iterate through
org-cite-support-styles, and run at least the default export processes
to create that preview annotation,

As my thinking has evolved (and there's been a lot of discussion on
this the past week), I see two options:

1. Generate the previews from the citations at point. This was the
idea that promoted the suggestion here, since I can't get access to
that citation data if I use org-cite-make-insert-processor.

2. Instead, have a standardized example record just for the preview.
With this approach, the citation context isn't relevant.

As to your question, do any style UIs currently allow you to select a
style on a new citation before selecting the keys?

Bruce



Re: [BUG] Citations in tables are not exported

2021-07-29 Thread Matt Price
On Thu., Jul. 29, 2021, 8:30 a.m. Nicolas Goaziou, 
wrote:

> Hello,
>
> Matt Price  writes:
>
> > No doubt this is a bit too broad, though I am not entirely clear on why
> > there are any restrictions at all on inserting cites.
>
> There are locations which can break the structure of the document.
> Obviously, we can let users shoot themselves in the foot, but, OTOH,
> a decent interface should prevent the most obvious issues.
>
> WDYT?
>

What I think is, I am far too ignorant to have an opinion. I defer entirely
to yours. Thanks so much for the caption fix, at present it's one of my
main uses for citations so the convenience win is substantial.


> Regards,
> --
> Nicolas Goaziou
>


Re: [BUG] Citations in tables are not exported

2021-07-29 Thread John Kitchin
It all looks good now! Thanks for the quick fix.

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 Thu, Jul 29, 2021 at 3:26 PM Nicolas Goaziou 
wrote:

> Hello,
>
> John Kitchin  writes:
>
> > It is partially fixed for me. I can put a citation in all these places
> in a
> > cell (and in a caption),
> >
> > | x  |
> >  ^^^
> >
> > but not here
> >
> > | x  |
> > ^
> >
> > In case this doesn't render quite right, the cell has two spaces after x,
> > and I can insert a citation on the first space, but not the second one
> (or
> > subsequent ones if they exist).
>
> Fixed, too. Thank you.
>
> > It still looks like the citation in a table doesn't export, e.g.
> > in
> >
> > #+caption: in a caption [cite/t:@lin-2021-exper-theor]
> > | X [cite/t:@lin-2021-exper-theor] | test  |
> >
> >
> > the citation in the caption is exported (in latex), but not the one in
> the
> > cell.
>
> I cannot reproduce it. Do you still encounter it?
>
> Regards,
> --
> Nicolas Goaziou
>


[BUG] Indentation broken after double quote

2021-07-29 Thread Ivan Sokolov
How to reproduce:
1. open org file
2. set org-adapt-indentation to t
3. insert headline, text after headline should be automatically indented
4. insert double quote (")
5. org-return won't indent after double quote

Tested versions:
Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)
Org mode version 9.4.6 (9.4.6-11-g1ee52c-elpa @ 
/home/ivan/.local/share/emacs/package/org-20210726/)

I am not sure if this bug even fixable, but I think we at least should
mention it in org-adapt-indenation docstring. I also want to point out
that this behaviour can be triggered by syntactically correct
constructs, e.g.

#+begin_src sh
'"' 
#+end_src



Re: [org-mode] make citation object available to org-cite-make-insert-processor SELECT-STYLE?

2021-07-29 Thread Nicolas Goaziou
Hello,

"Bruce D'Arcus"  writes:

> But to do that best and most consistently (next step is CSL, for
> example), I need the citation accessible from there, so I can run the
> export processors to generate the previews.
>
> Could we possibly tweak SELECT-STYLE to take one argument: citation?

When you are inserting a whole new citation, what would be the value?
nil? What would you display then?

Regards,
-- 
Nicolas Goaziou



Re: [BUG] Citations in tables are not exported

2021-07-29 Thread Nicolas Goaziou
Hello,

John Kitchin  writes:

> It is partially fixed for me. I can put a citation in all these places in a
> cell (and in a caption),
>
> | x  |
>  ^^^
>
> but not here
>
> | x  |
> ^
>
> In case this doesn't render quite right, the cell has two spaces after x,
> and I can insert a citation on the first space, but not the second one (or
> subsequent ones if they exist).

Fixed, too. Thank you.

> It still looks like the citation in a table doesn't export, e.g.
> in
>
> #+caption: in a caption [cite/t:@lin-2021-exper-theor]
> | X [cite/t:@lin-2021-exper-theor] | test  |
>
>
> the citation in the caption is exported (in latex), but not the one in the
> cell.

I cannot reproduce it. Do you still encounter it?

Regards,
-- 
Nicolas Goaziou



Re: [BUG] Citations in tables are not exported

2021-07-29 Thread John Kitchin
It is partially fixed for me. I can put a citation in all these places in a
cell (and in a caption),

| x  |
 ^^^

but not here

| x  |
^

In case this doesn't render quite right, the cell has two spaces after x,
and I can insert a citation on the first space, but not the second one (or
subsequent ones if they exist).

It still looks like the citation in a table doesn't export, e.g.
in

#+caption: in a caption [cite/t:@lin-2021-exper-theor]
| X [cite/t:@lin-2021-exper-theor] | test  |


the citation in the caption is exported (in latex), but not the one in the
cell.




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 Thu, Jul 29, 2021 at 8:26 AM Nicolas Goaziou 
wrote:

> Hello,
>
> John Kitchin  writes:
>
> > I also see this behavior. I think this should be considered a bug, it is
> > pretty common to see citations in a table cell.
> >
> > Additionally, I cannot insert a citation in a caption that is above a
> > table (or a figure), I get
> > "user-error: Cannot insert a citation here". That should be considered a
> > bug in org-cite--allowed-p  I think. It fails because in the caption the
> > context is a table, and it has :post-affiliated item which causes
> > org-cite--allowed-p  to return nil.
> >
> > If I put a citation in the caption anyway, it does seem to get exported
> > correctly.
>
> Fixed. Thank you.
>
> Regards,
> --
> Nicolas Goaziou
>


Re: bug processing non emacs-lisp blocks

2021-07-29 Thread Maxim Nikulin

On 29/07/2021 11:13, Tim Cross wrote:

dmg writes:


org-babel-load-file will try to tangle any source block that contains
the substring emacs-lisp or elisp in their language.

For example, the following code block will be tangled:

#+begin_src emacs-lispDONOT
(use-package "org-sidebar")
#+end_src

I think this is a regression. I used to comment out blocks from my
.org init files by simply adding a XXX (as in emacs-lisp). In
current org these blocks are tangled :(


I think your right. The regexp should only match on complete string.


I agree as well. Related code changed in 9.4:
- 
https://orgmode.org/list/caloshornnlxjma6jnrt-ikie-b9f9o3clqdxfekrzvyiyze...@mail.gmail.com/T/#u

- https://code.orgmode.org/bzg/org-mode/commit/be93859c78

The following is just my opinion, not a request for an update of the patch.

Maybe it will be better to change `org-babel-tangle-collect-blocks' 
function in lisp/ob-tangle.el instead and to wrap passed argument in the 
suggested way (at first I thought of non-capturing group "\\(?:" "\\)", 
but it is not necessary since the regexp is passed to `string-match-p'). 
I suppose, it is more reliable default. If anyone really needs partial 
match, he may express it explicitly by adding ".*", "?", etc. I hope, 
such change will break no existing code.





Re: [BUG] Citations in tables are not exported

2021-07-29 Thread Nicolas Goaziou
Hello,

Matt Price  writes:

> No doubt this is a bit too broad, though I am not entirely clear on why
> there are any restrictions at all on inserting cites.

There are locations which can break the structure of the document.
Obviously, we can let users shoot themselves in the foot, but, OTOH,
a decent interface should prevent the most obvious issues.

WDYT?

Regards,
-- 
Nicolas Goaziou



Re: [BUG] Citations in tables are not exported

2021-07-29 Thread Nicolas Goaziou
Hello,

John Kitchin  writes:

> I also see this behavior. I think this should be considered a bug, it is
> pretty common to see citations in a table cell.
>
> Additionally, I cannot insert a citation in a caption that is above a
> table (or a figure), I get
> "user-error: Cannot insert a citation here". That should be considered a
> bug in org-cite--allowed-p  I think. It fails because in the caption the
> context is a table, and it has :post-affiliated item which causes
> org-cite--allowed-p  to return nil.
>
> If I put a citation in the caption anyway, it does seem to get exported
> correctly.

Fixed. Thank you.

Regards,
-- 
Nicolas Goaziou