Re: Basic citations: should default citation style have a name and style code?

2024-01-14 Thread William Denton
On Sunday, January 14th, 2024 at 03:26, András Simonyi 
 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




Re: Basic citations: should default citation style have a name and style code?

2024-01-14 Thread Joost Kremers


On Sun, Jan 14 2024, William Denton wrote:
> On Sunday, January 14th, 2024 at 00:08, William Denton
>  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



Re: Basic citations: should default citation style have a name and style code?

2024-01-14 Thread András Simonyi
Dear All,

On Sun, 14 Jan 2024 at 06:39, William Denton  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



Re: Basic citations: should default citation style have a name and style code?

2024-01-13 Thread William Denton
On Sunday, January 14th, 2024 at 00:08, William Denton 
 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




Re: Basic citations: should default citation style have a name and style code?

2024-01-13 Thread William Denton
On Saturday, January 13th, 2024 at 14:03, Ihor Radchenko  
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



Re: Basic citations: should default citation style have a name and style code?

2024-01-13 Thread Ihor Radchenko
Ihor Radchenko  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 .
Support Org development at ,
or support my work at 



Re: Basic citations: should default citation style have a name and style code?

2024-01-11 Thread William Denton
On Thursday, January 11th, 2024 at 13:07, Ihor Radchenko  
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



Re: Basic citations: should default citation style have a name and style code?

2024-01-11 Thread Ihor Radchenko
William Denton  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 .
Support Org development at ,
or support my work at 



Re: Basic citations: should default citation style have a name and style code?

2024-01-11 Thread William Denton
On Thursday, January 11th, 2024 at 07:30, Ihor Radchenko  
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



Re: Basic citations: should default citation style have a name and style code?

2024-01-11 Thread Ihor Radchenko
William Denton  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 .
Support Org development at ,
or support my work at 



Re: Basic citations: should default citation style have a name and style code?

2024-01-10 Thread Fraga, Eric
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


Basic citations: should default citation style have a name and style code?

2024-01-10 Thread William Denton
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