emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Basic citations: should default citation style have a name and style code?
@ 2024-01-11  5:25 William Denton
  2024-01-11  7:52 ` Fraga, Eric
  2024-01-11 12:33 ` Ihor Radchenko
  0 siblings, 2 replies; 12+ messages in thread
From: William Denton @ 2024-01-11  5:25 UTC (permalink / raw)
  To: Emacs Org mode mailing list

This is a small point, but I think I've found a situation where the lack of a name for a default means there are situations where it can't be used.  

Let's say we have Basic.bib with this:

  @book{friends,
    title = {{{LaTeX}} and Friends},
    author = {van Dongen, M.R.C.},
    date = {2012},
    location = {Berlin},
    publisher = {Springer},
    doi = {10.1007/978-3-642-23816-1},
    isbn = {9783642238161}
  }

Also we have this Org file.  Note that it's using the basic citation processor and the author-year bibliography style.  There's no bibliography printed, but that doesn't matter for this example.  The author-year bibliography style is the default: if it was left out of the cite_export line it would still be used, but it can be specified by name.

Because no citation style is set for the document, the default (which has no name) will be used.  The first citation object will use the default and the second will be text with caps (/t/c means the style is set with t for text, variant with c for caps):

# ----------

#+bibliography: Basic.bib
#+cite_export: basic author-year

"Most scholarly works have citations and a bibliography or reference section," wrote a computer scientist [cite:@friends].

[cite/t/c:@friends] wrote, "Most scholarly works have citations and a bibliography or reference section."

# ----------

This exports (C-c C-e t A) to:

# ----------

"Most scholarly works have citations and a bibliography or reference
section," wrote a computer scientist (van Dongen, M.R.C., 2012).

Van Dongen, M.R.C. (2012) wrote, "Most scholarly works have citations
and a bibliography or reference section."

# ----------

But let's say we set the citation style for the document to "text".  Now there is no way to use the unnamed "default" citation style!  Note the change in the second citation object here, because now text is the default.

# ----------

#+bibliography: Basic.bib
#+cite_export: basic author-year text

"Most scholarly works have citations and a bibliography or reference section," wrote a computer scientist [cite:@friends].

[cite//c:@friends] wrote, "Most scholarly works have citations and a bibliography or reference section."

# ----------

This exports to:

# ----------

"Most scholarly works have citations and a bibliography or reference
section," wrote a computer scientist van Dongen, M.R.C. (2012).

Van Dongen, M.R.C. (2012) wrote, "Most scholarly works have citations
and a bibliography or reference section."

# ----------

As far as I can tell, there's nothing that can be done to the first citation object to make it use the "default" style.  The document-level setting makes a new default, and because the original "default" has no name or style code, there's no way to get at it.

The basic citation processor is a proof of concept and shouldn't be used for real work, so this is probably never going to result in a real problem.  Nevertheless, it seems like a bug.  There is a combination that should be possible but isn't.  Sadly my Lisp isn't good enough for me to offer a working solution, but if the default citation style had, for example, the name "default" and one-letter code "d" then I think the problem would go away.

With thanks to everyone who did all the great citation work originally,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-11  5:25 Basic citations: should default citation style have a name and style code? William Denton
@ 2024-01-11  7:52 ` Fraga, Eric
  2024-01-11 12:33 ` Ihor Radchenko
  1 sibling, 0 replies; 12+ messages in thread
From: Fraga, Eric @ 2024-01-11  7:52 UTC (permalink / raw)
  To: William Denton; +Cc: Emacs Org mode mailing list

Hi Bill,

On Thursday, 11 Jan 2024 at 05:25, William Denton wrote:
> The basic citation processor is a proof of concept and shouldn't be
> used for real work, so this is probably never going to result in a
> real problem.  

Proof of concept or not, the fact that it exists means people (e.g. me)
are going to use it so it would be good to have it be somewhat complete.

> Sadly my Lisp isn't good enough for me to offer a working solution,
> but if the default citation style had, for example, the name "default"
> and one-letter code "d" then I think the problem would go away.

I think this is a nice suggestion.  My Lisp is also not up to it so I
hope somebody does do this.

> With thanks to everyone who did all the great citation work
> originally,

+1 -- it's been a very useful extension to org.

And also, while I'm here, thank you Bill for your blog posts on the
citation capabilities of org.  Well written, very clear, and very
helpful.  Looking forward to part 3!

eric
-- 
: Eric S Fraga, with org release_9.6.6-418-g294a4d in Emacs 30.0.50

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-11  5:25 Basic citations: should default citation style have a name and style code? William Denton
  2024-01-11  7:52 ` Fraga, Eric
@ 2024-01-11 12:33 ` Ihor Radchenko
  2024-01-11 16:36   ` William Denton
  2024-01-13 19:05   ` Ihor Radchenko
  1 sibling, 2 replies; 12+ messages in thread
From: Ihor Radchenko @ 2024-01-11 12:33 UTC (permalink / raw)
  To: William Denton; +Cc: Emacs Org mode mailing list

William Denton <william@williamdenton.org> writes:

> "Most scholarly works have citations and a bibliography or reference section," wrote a computer scientist [cite:@friends].

> As far as I can tell, there's nothing that can be done to the first
> citation object to make it use the "default" style.  The
> document-level setting makes a new default, and because the original
> "default" has no name or style code, there's no way to get at it.

You can just use [cite/nil:@friends].

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-11 12:33 ` Ihor Radchenko
@ 2024-01-11 16:36   ` William Denton
  2024-01-11 18:10     ` Ihor Radchenko
  2024-01-13 19:05   ` Ihor Radchenko
  1 sibling, 1 reply; 12+ messages in thread
From: William Denton @ 2024-01-11 16:36 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org mode mailing list

On Thursday, January 11th, 2024 at 07:30, Ihor Radchenko <yantar92@posteo.net> wrote:

> > As far as I can tell, there's nothing that can be done to the first
> > citation object to make it use the "default" style. The
> > document-level setting makes a new default, and because the original
> > "default" has no name or style code, there's no way to get at it.
> 
> You can just use [cite/nil:@friends].

Huh!  Thanks, I didn't see that at all.  Looking again at the definition of org-cite-basic-export-citation in oc-basic.el, I see the doc string says, "Export CITATION object. STYLE is the expected citation style, as a pair of strings or nil."  And then there's a section below starting:

    ;; Default ("nil") style.

Now that I know what that does, I can sort of see what's going on.  The same thing is in the CSL code as well, so it's all making more sense now.

Thanks,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada


> 
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at https://orgmode.org/.
> 
> Support Org development at https://liberapay.com/org-mode,
> 
> or support my work at https://liberapay.com/yantar92


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-11 16:36   ` William Denton
@ 2024-01-11 18:10     ` Ihor Radchenko
  2024-01-11 22:37       ` William Denton
  0 siblings, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2024-01-11 18:10 UTC (permalink / raw)
  To: William Denton; +Cc: Emacs Org mode mailing list

William Denton <william@williamdenton.org> writes:

>> You can just use [cite/nil:@friends].
>
> Huh!  Thanks, I didn't see that at all.  Looking again at the definition of org-cite-basic-export-citation in oc-basic.el, I see the doc string says, "Export CITATION object. STYLE is the expected citation style, as a pair of strings or nil."  And then there's a section below starting:
>
>     ;; Default ("nil") style.
>
> Now that I know what that does, I can sort of see what's going on.  The same thing is in the CSL code as well, so it's all making more sense now.

Another way is [cite/style-that-surely-does-not-exist:@friends]

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-11 18:10     ` Ihor Radchenko
@ 2024-01-11 22:37       ` William Denton
  0 siblings, 0 replies; 12+ messages in thread
From: William Denton @ 2024-01-11 22:37 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org mode mailing list

On Thursday, January 11th, 2024 at 13:07, Ihor Radchenko <yantar92@posteo.net> wrote:

> Another way is [cite/style-that-surely-does-not-exist:@friends]

Useful, thanks.  The same thing happens with cite_export:  these don't match any real options so they fall through to the defaults.

#+cite_export: basic stuff nonsense

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada


> 
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at https://orgmode.org/.
> 
> Support Org development at https://liberapay.com/org-mode,
> 
> or support my work at https://liberapay.com/yantar92


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-11 12:33 ` Ihor Radchenko
  2024-01-11 16:36   ` William Denton
@ 2024-01-13 19:05   ` Ihor Radchenko
  2024-01-14  5:08     ` William Denton
  1 sibling, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2024-01-13 19:05 UTC (permalink / raw)
  To: William Denton; +Cc: Emacs Org mode mailing list

Ihor Radchenko <yantar92@posteo.net> writes:

>> "Most scholarly works have citations and a bibliography or reference section," wrote a computer scientist [cite:@friends].
>
>> As far as I can tell, there's nothing that can be done to the first
>> citation object to make it use the "default" style.  The
>> document-level setting makes a new default, and because the original
>> "default" has no name or style code, there's no way to get at it.
>
> You can just use [cite/nil:@friends].

I tried to clarify about the default style and #+cite_export keyword in
the manual:
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=56f6d8d1a
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=83f17091e

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-13 19:05   ` Ihor Radchenko
@ 2024-01-14  5:08     ` William Denton
  2024-01-14  5:38       ` William Denton
  0 siblings, 1 reply; 12+ messages in thread
From: William Denton @ 2024-01-14  5:08 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs Org mode mailing list

On Saturday, January 13th, 2024 at 14:03, Ihor Radchenko <yantar92@posteo.net> wrote:

> I tried to clarify about the default style and #+cite_export keyword in
> the manual:
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=56f6d8d1a
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=83f17091e

Thanks!  That helps.  

While we're talking about citations, I'm stuck on something else.  If I run "C-c C-x @" to insert a citation into a file, I'm shown a list of bibliography entries and I can go up and down and hit RET on any I chose.  That works well.  But---the prompt says, "Key (empty input exits)."  What makes empty input?  I can't figure it out.  I've never seen that phrase before.  I can't make it exit properly---I either keep adding citations or C-g or DEL cancels it---so I can't make the function work.  If anyone knows, I can try making a patch to make it clearer.

Thanks,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada


> 
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at https://orgmode.org/.
> 
> Support Org development at https://liberapay.com/org-mode,
> 
> or support my work at https://liberapay.com/yantar92


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-14  5:08     ` William Denton
@ 2024-01-14  5:38       ` William Denton
  2024-01-14  8:26         ` András Simonyi
  2024-01-14 15:16         ` Joost Kremers
  0 siblings, 2 replies; 12+ messages in thread
From: William Denton @ 2024-01-14  5:38 UTC (permalink / raw)
  To: Emacs Org mode mailing list

On Sunday, January 14th, 2024 at 00:08, William Denton <william@williamdenton.org> wrote:

> While we're talking about citations, I'm stuck on something else. If I run "C-c C-x @" to insert a citation into a file, I'm shown a list of bibliography entries and I can go up and down and hit RET on any I chose. That works well. But---the prompt says, "Key (empty input exits)." What makes empty input? I can't figure it out. I've never seen that phrase before. I can't make it exit properly---I either keep adding citations or C-g or DEL cancels it---so I can't make the function work. If anyone knows, I can try making a patch to make it clearer.

As so often happens, a few minutes after sending an email I think I found the answer: it's seems to be a problem with the completion mechanism Ivy.

https://stackoverflow.com/q/77489325/854346

I ran "emacs -Q" and I see how it works there, with RET closing things off, which makes sense.  

Last year I looked at Vertico and thought about trying it out, but since everything was working fine, I didn't.  Now I've found a reason, I guess.  Ah, Emacs!

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-14  5:38       ` William Denton
@ 2024-01-14  8:26         ` András Simonyi
  2024-01-14 19:10           ` William Denton
  2024-01-14 15:16         ` Joost Kremers
  1 sibling, 1 reply; 12+ messages in thread
From: András Simonyi @ 2024-01-14  8:26 UTC (permalink / raw)
  To: William Denton; +Cc: Emacs Org mode mailing list

Dear All,

On Sun, 14 Jan 2024 at 06:39, William Denton <william@williamdenton.org> wrote:

> > While we're talking about citations, I'm stuck on something else. If I run "C-c C-x @" to insert a citation into a file, I'm shown a list of bibliography entries and I can go up and down and hit RET on any I chose. That works well. But---the prompt says, "Key (empty input exits)." What makes empty input? I can't figure it out.

I'm not an active Ivy user (although I was in the past) but now I
tried it out with the basic cite-insert processor and  "C-u C-j" seems
to be working as "empty input".

best wishes,
András


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-14  5:38       ` William Denton
  2024-01-14  8:26         ` András Simonyi
@ 2024-01-14 15:16         ` Joost Kremers
  1 sibling, 0 replies; 12+ messages in thread
From: Joost Kremers @ 2024-01-14 15:16 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode


On Sun, Jan 14 2024, William Denton wrote:
> On Sunday, January 14th, 2024 at 00:08, William Denton
> <william@williamdenton.org> wrote:
>
>> While we're talking about citations, I'm stuck on something else. If I run
>> "C-c C-x @" to insert a citation into a file, I'm shown a list of bibliography
>> entries and I can go up and down and hit RET on any I chose. That works well.
>> But---the prompt says, "Key (empty input exits)." What makes empty input? I
>> can't figure it out. I've never seen that phrase before. I can't make it exit
>> properly---I either keep adding citations or C-g or DEL cancels it---so I
>> can't make the function work. If anyone knows, I can try making a patch to
>> make it clearer.
>
> As so often happens, a few minutes after sending an email I think I found the
> answer: it's seems to be a problem with the completion mechanism Ivy.
>
> https://stackoverflow.com/q/77489325/854346
>
> I ran "emacs -Q" and I see how it works there, with RET closing things off,
> which makes sense.
>
> Last year I looked at Vertico and thought about trying it out, but since
> everything was working fine, I didn't. Now I've found a reason, I guess. Ah,
> Emacs!

You'll run into the same issue with Vertico, I suspect. Completion mechanisms
such as Ivy and Vertico tend to default to the first visible candidate when you
just hit RET, not to the current input. This is so that you don't need to
complete the top candidate, you can just hit a few characters and if the
candidate you want is at the top, you can just hit RET.

A consequence of this is that you cannot use RET to select the empty input. Both
Ivy and vertico provide a command for that, though. I don't know which command
Ivy uses and to which it is bound, but the docs should be able to tell you.

-- 
Joost Kremers
Life has its moments


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Basic citations: should default citation style have a name and style code?
  2024-01-14  8:26         ` András Simonyi
@ 2024-01-14 19:10           ` William Denton
  0 siblings, 0 replies; 12+ messages in thread
From: William Denton @ 2024-01-14 19:10 UTC (permalink / raw)
  To: Emacs Org mode mailing list

On Sunday, January 14th, 2024 at 03:26, András Simonyi <andras.simonyi@gmail.com> wrote:

> I'm not an active Ivy user (although I was in the past) but now I
> tried it out with the basic cite-insert processor and "C-u C-j" seems
> to be working as "empty input".

Phew, what a morning.  I removed Ivy, Swiper and Counsel from my configuration and tried Vertico and its connected packages; then find-file didn't work; eventually I discovered some code I'd copied a decade ago and forgotten that was now interfering with completion somewhere; I tried org-cite-insert again and had the same problem; I wondered if I'd have to declare Emacs bankruptcy; I read this response and Joost Kremer's ("You'll run into the same issue with Vertico, I suspect"); I tried C-u C-j in Vertico and was glad it worked; I did some more tweaking to Vertico; I broke something and spent half an hour on that; finally I got everything working.

So after about four hours of fiddling things look more or less how they did before, except that Emacs now starts up much, much faster, *and* a long-standing problem with searching in a buffer is now gone: with Swiper, C-s to search would make Org lose the formatting on links and they would show [[in their raw naked form]].  I know someone else had this problem too, so I'm noting this for anyone searching the archives for Swiper.

Thanks to you both for your help,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-01-14 19:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-11  5:25 Basic citations: should default citation style have a name and style code? William Denton
2024-01-11  7:52 ` Fraga, Eric
2024-01-11 12:33 ` Ihor Radchenko
2024-01-11 16:36   ` William Denton
2024-01-11 18:10     ` Ihor Radchenko
2024-01-11 22:37       ` William Denton
2024-01-13 19:05   ` Ihor Radchenko
2024-01-14  5:08     ` William Denton
2024-01-14  5:38       ` William Denton
2024-01-14  8:26         ` András Simonyi
2024-01-14 19:10           ` William Denton
2024-01-14 15:16         ` Joost Kremers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).