joostkremers / ebib

A BibTeX database manager for Emacs.
https://joostkremers.github.io/ebib/
BSD 3-Clause "New" or "Revised" License
275 stars 37 forks source link

Odd problems with undefined string abbrevations in the entry buffer #253

Closed Knusper closed 9 months ago

Knusper commented 2 years ago

In the current version of ebib (installed from melpa) I have a problem of entries not being completely displayed in the entry buffer. The corresponding error message is always: ebib-db-get-string: [Ebib] @String abbreviation 'XYZ’ does not exist, and 'XYZ' is often related to the month field

For example, in the following (created with https://www.doi2bib.org/bib/10.3758/BF03201412)

@article{Dunlap1986,
  doi = {10.3758/bf03201412},
  url = {https://doi.org/10.3758/bf03201412},
  year = {1986},
  month = sep,
  publisher = {Springer Science and Business Media {LLC}},
  volume = {18},
  number = {5},
  pages = {469--471},
  author = {William P. Dunlap and N. Clayton Silver},
  title = {Confidence intervals and standard errors for ratios of normal variables},
  journal = {Behavior Research Methods,  Instruments,  {\&} Computers}
}

I only get the fields author, title, journal, year, volume, number, and pages displayed. Similar results I get for all bibtex exports from the ads database, because also here the month field is formatted like this.

As a workaround I now created string abbreviations for all months, but to me this is rather odd behavior.

I also attach two screenshots from the entry buffer for different entry, the first is with and the second is without the string abbreviation for January defined:

ebib_with_abbrev ebib_without_abbrev

Thanks for making ebib, it is an important tool in my workflow!

joostkremers commented 2 years ago

Are you absolutely sure you have the latest version from Melpa? This seems to be the same issues #242, which was fixed by commit https://github.com/joostkremers/ebib/commit/714931a9aeeb430e9fc412fbb372b9b1264b947b. Your test entry above (Dunlap1986) displays fine for me.

Another workaround would be do unset the option ebib-expand-strings, but that shouldn't really be necessary...

Knusper commented 2 years ago

I am using version - 20220430.2219 -- this is the lates version in melpa and the entry does not display correct for me. I also get the message: ebib-db-get-string: [Ebib] @String abbreviation ‘sep’ does not exist. The mentioned option helps to get the desired behavior. (One thing maybe worth mentioning is, that I use a slightly older emacs 26.1)

joostkremers commented 2 years ago

This is strange indeed. I have the same version installed from Melpa on my work machine and it works fine.

Could you delete Ebib, restart Emacs and then reinstall Ebib? Sometimes when upgrading a package you end up with a mix of the old and the new version. And in case you downloaded the Ebib source somewhere for a manual installation, make sure Emacs doesn't read from there.

The fact that you're using Emacs 26 should not make a difference. If it did, the error would be different.

If reinstalling Ebib doesn't help, could you check out the source code for the function ebib--expand-string? The first line after the doc string should read (condition-case err.

Knusper commented 2 years ago

No - I tried this -- very strange. Everything also got re-compiled and its definitely the version that is loaded (i.e., I see stuff like Compiling /home/ehere/.emacs.d/elpa/ebib-20220430.2219/ebib-utils.el...done). I also confirm the (condition-case err beginning of the function. Here is the full debug output:

Debugger entered--Lisp error: (error "[Ebib] @String abbreviation ‘sep’ does not exist")
  signal(error ("[Ebib] @String abbreviation ‘sep’ does not exist"))
  error("[Ebib] @String abbreviation `%s' does not exist" "sep")
  ebib-db-get-string("sep" ((entries . #<hash-table equal 1094/1095 0x144096d>) (strings ("jan" . "{January}") ("feb" . "{February}") ("mar" . "{March}") ("apr" . "{April}") ("may" . "{May}") ("jun" . "{June}") ("jul" . "{July}") ("aug" . "{August}") ("oct" . "{October}") ("nov" . "{November}") ("dec" . "{December}")) (preamble) (comments "{jabref-meta: databaseType:bibtex;}" "{jabref-meta: fileDirectory:/home/knusper/science_works/Literatur;}" "{jabref-meta: fileDirectory-knusper:/home/knusper/science_works/Literatur;}" "{jabref-meta: grouping:0 AllEntriesGroup:;1 StaticGroup:Reviews\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:PMAS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Reference Data\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Popular Science, History etc.\\;0\\;1\\;\\;\\;\\;;1 KeywordGroup:High Redshift Galaxies\\;0\\;keywords\\;galaxies: high[-]*redshift\\;0\\;1\\;1\\;\\;\\;\\;;1 StaticGroup:Extended LyA around QSOs\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Teaching\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:DoFullRead\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA - Theory\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:unread\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS PMAS Related\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:VIMOS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Co-Author\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA-Surveys\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Introduction\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:SBS0335\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Luminosity Function\\;0\\;1\\;\\;\\;\\;;}" "{jabref-meta: groupsversion:3;}" "{jabref-meta: groupstree:\n0 AllEntriesGroup:;\n1 ExplicitGroup:LAB1 - possible refs\\;0\\;Geach2007\\;Umehata2017\\;Vernet2017\\;;\n}") (local-vars) (dialect) (buffer . #<buffer  1:bibliography.bib>) (cur-entry . "Sanderson2021") (marked-entries) (filter) (sortinfo) (filename . "/home/ehere/science_works/bibliography.bib") (main) (keys) (modtime 25214 38649 334337 408000) (modified) (backup . t)) nil)
  ebib-get-string("sep" ((entries . #<hash-table equal 1094/1095 0x144096d>) (strings ("jan" . "{January}") ("feb" . "{February}") ("mar" . "{March}") ("apr" . "{April}") ("may" . "{May}") ("jun" . "{June}") ("jul" . "{July}") ("aug" . "{August}") ("oct" . "{October}") ("nov" . "{November}") ("dec" . "{December}")) (preamble) (comments "{jabref-meta: databaseType:bibtex;}" "{jabref-meta: fileDirectory:/home/knusper/science_works/Literatur;}" "{jabref-meta: fileDirectory-knusper:/home/knusper/science_works/Literatur;}" "{jabref-meta: grouping:0 AllEntriesGroup:;1 StaticGroup:Reviews\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:PMAS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Reference Data\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Popular Science, History etc.\\;0\\;1\\;\\;\\;\\;;1 KeywordGroup:High Redshift Galaxies\\;0\\;keywords\\;galaxies: high[-]*redshift\\;0\\;1\\;1\\;\\;\\;\\;;1 StaticGroup:Extended LyA around QSOs\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Teaching\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:DoFullRead\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA - Theory\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:unread\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS PMAS Related\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:VIMOS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Co-Author\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA-Surveys\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Introduction\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:SBS0335\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Luminosity Function\\;0\\;1\\;\\;\\;\\;;}" "{jabref-meta: groupsversion:3;}" "{jabref-meta: groupstree:\n0 AllEntriesGroup:;\n1 ExplicitGroup:LAB1 - possible refs\\;0\\;Geach2007\\;Umehata2017\\;Vernet2017\\;;\n}") (local-vars) (dialect) (buffer . #<buffer  1:bibliography.bib>) (cur-entry . "Sanderson2021") (marked-entries) (filter) (sortinfo) (filename . "/home/ehere/science_works/bibliography.bib") (main) (keys) (modtime 25214 38649 334337 408000) (modified) (backup . t)) nil nil t)
  ebib--expand-string("sep" ((entries . #<hash-table equal 1094/1095 0x144096d>) (strings ("jan" . "{January}") ("feb" . "{February}") ("mar" . "{March}") ("apr" . "{April}") ("may" . "{May}") ("jun" . "{June}") ("jul" . "{July}") ("aug" . "{August}") ("oct" . "{October}") ("nov" . "{November}") ("dec" . "{December}")) (preamble) (comments "{jabref-meta: databaseType:bibtex;}" "{jabref-meta: fileDirectory:/home/knusper/science_works/Literatur;}" "{jabref-meta: fileDirectory-knusper:/home/knusper/science_works/Literatur;}" "{jabref-meta: grouping:0 AllEntriesGroup:;1 StaticGroup:Reviews\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:PMAS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Reference Data\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Popular Science, History etc.\\;0\\;1\\;\\;\\;\\;;1 KeywordGroup:High Redshift Galaxies\\;0\\;keywords\\;galaxies: high[-]*redshift\\;0\\;1\\;1\\;\\;\\;\\;;1 StaticGroup:Extended LyA around QSOs\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Teaching\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:DoFullRead\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA - Theory\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:unread\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS PMAS Related\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:VIMOS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Co-Author\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA-Surveys\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Introduction\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:SBS0335\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Luminosity Function\\;0\\;1\\;\\;\\;\\;;}" "{jabref-meta: groupsversion:3;}" "{jabref-meta: groupstree:\n0 AllEntriesGroup:;\n1 ExplicitGroup:LAB1 - possible refs\\;0\\;Geach2007\\;Umehata2017\\;Vernet2017\\;;\n}") (local-vars) (dialect) (buffer . #<buffer  1:bibliography.bib>) (cur-entry . "Sanderson2021") (marked-entries) (filter) (sortinfo) (filename . "/home/ehere/science_works/bibliography.bib") (main) (keys) (modtime 25214 38649 334337 408000) (modified) (backup . t)) noerror)
  ebib-get-field-value("month" "Dunlap1986" ((entries . #<hash-table equal 1094/1095 0x144096d>) (strings ("jan" . "{January}") ("feb" . "{February}") ("mar" . "{March}") ("apr" . "{April}") ("may" . "{May}") ("jun" . "{June}") ("jul" . "{July}") ("aug" . "{August}") ("oct" . "{October}") ("nov" . "{November}") ("dec" . "{December}")) (preamble) (comments "{jabref-meta: databaseType:bibtex;}" "{jabref-meta: fileDirectory:/home/knusper/science_works/Literatur;}" "{jabref-meta: fileDirectory-knusper:/home/knusper/science_works/Literatur;}" "{jabref-meta: grouping:0 AllEntriesGroup:;1 StaticGroup:Reviews\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:PMAS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Reference Data\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Popular Science, History etc.\\;0\\;1\\;\\;\\;\\;;1 KeywordGroup:High Redshift Galaxies\\;0\\;keywords\\;galaxies: high[-]*redshift\\;0\\;1\\;1\\;\\;\\;\\;;1 StaticGroup:Extended LyA around QSOs\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Teaching\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:DoFullRead\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA - Theory\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:unread\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS PMAS Related\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:VIMOS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Co-Author\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA-Surveys\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Introduction\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:SBS0335\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Luminosity Function\\;0\\;1\\;\\;\\;\\;;}" "{jabref-meta: groupsversion:3;}" "{jabref-meta: groupstree:\n0 AllEntriesGroup:;\n1 ExplicitGroup:LAB1 - possible refs\\;0\\;Geach2007\\;Umehata2017\\;Vernet2017\\;;\n}") (local-vars) (dialect) (buffer . #<buffer  1:bibliography.bib>) (cur-entry . "Sanderson2021") (marked-entries) (filter) (sortinfo) (filename . "/home/ehere/science_works/bibliography.bib") (main) (keys) (modtime 25214 38649 334337 408000) (modified) (backup . t)) noerror nil xref expand-strings)
  ebib--get-field-highlighted("month" "Dunlap1986" ((entries . #<hash-table equal 1094/1095 0x144096d>) (strings ("jan" . "{January}") ("feb" . "{February}") ("mar" . "{March}") ("apr" . "{April}") ("may" . "{May}") ("jun" . "{June}") ("jul" . "{July}") ("aug" . "{August}") ("oct" . "{October}") ("nov" . "{November}") ("dec" . "{December}")) (preamble) (comments "{jabref-meta: databaseType:bibtex;}" "{jabref-meta: fileDirectory:/home/knusper/science_works/Literatur;}" "{jabref-meta: fileDirectory-knusper:/home/knusper/science_works/Literatur;}" "{jabref-meta: grouping:0 AllEntriesGroup:;1 StaticGroup:Reviews\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:PMAS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Reference Data\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Popular Science, History etc.\\;0\\;1\\;\\;\\;\\;;1 KeywordGroup:High Redshift Galaxies\\;0\\;keywords\\;galaxies: high[-]*redshift\\;0\\;1\\;1\\;\\;\\;\\;;1 StaticGroup:Extended LyA around QSOs\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Teaching\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:DoFullRead\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA - Theory\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:unread\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS PMAS Related\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:VIMOS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Co-Author\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA-Surveys\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Introduction\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:SBS0335\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Luminosity Function\\;0\\;1\\;\\;\\;\\;;}" "{jabref-meta: groupsversion:3;}" "{jabref-meta: groupstree:\n0 AllEntriesGroup:;\n1 ExplicitGroup:LAB1 - possible refs\\;0\\;Geach2007\\;Umehata2017\\;Vernet2017\\;;\n}") (local-vars) (dialect) (buffer . #<buffer  1:bibliography.bib>) (cur-entry . "Sanderson2021") (marked-entries) (filter) (sortinfo) (filename . "/home/ehere/science_works/bibliography.bib") (main) (keys) (modtime 25214 38649 334337 408000) (modified) (backup . t)) nil)
  #f(compiled-function (field) #<bytecode 0x1b92ed1>)("month")
  mapc(#f(compiled-function (field) #<bytecode 0x1b92ed1>) ("volume" "number" "pages" "month" "note"))
  #f(compiled-function (fields) #<bytecode 0x1b92e51>)(("volume" "number" "pages" "month" "note"))
  mapc(#f(compiled-function (fields) #<bytecode 0x1b92e51>) (("author" "title" "journal" "year") ("volume" "number" "pages" "month" "note") ("crossref" "annote" "abstract" "keywords" "file" "timestamp" "url" "doi") ("publisher")))
  ebib--display-fields("Dunlap1986" ((entries . #<hash-table equal 1094/1095 0x144096d>) (strings ("jan" . "{January}") ("feb" . "{February}") ("mar" . "{March}") ("apr" . "{April}") ("may" . "{May}") ("jun" . "{June}") ("jul" . "{July}") ("aug" . "{August}") ("oct" . "{October}") ("nov" . "{November}") ("dec" . "{December}")) (preamble) (comments "{jabref-meta: databaseType:bibtex;}" "{jabref-meta: fileDirectory:/home/knusper/science_works/Literatur;}" "{jabref-meta: fileDirectory-knusper:/home/knusper/science_works/Literatur;}" "{jabref-meta: grouping:0 AllEntriesGroup:;1 StaticGroup:Reviews\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:PMAS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Reference Data\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Popular Science, History etc.\\;0\\;1\\;\\;\\;\\;;1 KeywordGroup:High Redshift Galaxies\\;0\\;keywords\\;galaxies: high[-]*redshift\\;0\\;1\\;1\\;\\;\\;\\;;1 StaticGroup:Extended LyA around QSOs\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Teaching\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:DoFullRead\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA - Theory\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:unread\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS PMAS Related\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:VIMOS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Co-Author\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LyA-Surveys\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:LARS\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Introduction\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:SBS0335\\;0\\;1\\;\\;\\;\\;;1 StaticGroup:Luminosity Function\\;0\\;1\\;\\;\\;\\;;}" "{jabref-meta: groupsversion:3;}" "{jabref-meta: groupstree:\n0 AllEntriesGroup:;\n1 ExplicitGroup:LAB1 - possible refs\\;0\\;Geach2007\\;Umehata2017\\;Vernet2017\\;;\n}") (local-vars) (dialect) (buffer . #<buffer  1:bibliography.bib>) (cur-entry . "Sanderson2021") (marked-entries) (filter) (sortinfo) (filename . "/home/ehere/science_works/bibliography.bib") (main) (keys) (modtime 25214 38649 334337 408000) (modified) (backup . t)) nil)
  ebib--update-entry-buffer()
  ebib-prev-entry()
  funcall-interactively(ebib-prev-entry)
  call-interactively(ebib-prev-entry nil nil)
  command-execute(ebib-prev-entry)
Hugo-Heagren commented 2 years ago

I know this will sound patronising, but are you sure the string is defined in the first place? Looking at the stack trace, I can see definitions for strings for all the other months ("oct", "nov", etc.), but not "sep". Does the behaviour change if you use a different month?

Knusper commented 2 years ago

Of course I removed the string definition for September for testing. That is the point of my bug report here...

joostkremers commented 2 years ago

The point of the commit I mentioned above was to make sure Ebib would handle missing @String abbrevs gracefully. And that seems to work fine for me, but not for @Knusper , and I have no idea why.

I'll take a closer look at the backtrace next week. No time this weekend. 🙂

Knusper commented 2 years ago

Thanks - and I will try with a clean emacs and just ebib to rule out wierd stuff from my complex configuration.

Knusper commented 2 years ago

OK. I tested it with a super clean emacs (I even created a new user on my system) - the problem still persists. I even tried using emacs -Q for the new user, no luck...

joostkremers commented 2 years ago

Well, this is a complete mystery to me. If I run with-emacs.sh and install Ebib from Melpa, then open a test .bib file and yank the entry above, it works fine. The month field is displayed as sep with an asterisk before it and the rest of the entry is shown.

Knusper commented 2 years ago

I only get this behavior if I set ebib-expand-strings to nil. Although on my work laptop I have emacs 26.1, I have a secondary machine with a newer debian and emacs 27.1 ... But you say, that this error can not be due to an older emacsen?

(Thanks for the pointer to with-emacs.sh, I will use this in the future for testing, but I am very confident that the emacs I used for testing was as vanilla as it gets)

joostkremers commented 10 months ago

Is this still happening? If not, I'll close this issue.

Knusper commented 9 months ago

OK. I can not reproduce this anymore either. The only thing, that I can think of, is that I had a mix-up between parsebib and ebib versions. This has happened before, because I only pinned ebib to melpa-stable in an older version of my config, than the parsebib library was taken from normal melpa. I will freeze the status of packages on my old machine with 26.1 emacs now, because this one will soon be retired. FYI - there I have v. 2.35 which serves my needs quite well 😺