cpitclaudel / biblio.el

Browse and import bibliographic references from CrossRef, DBLP, HAL, arXiv, Dissemin, and doi.org from Emacs
GNU General Public License v3.0
180 stars 14 forks source link

Missing dash in pages field #47

Closed ericdanan closed 2 years ago

ericdanan commented 2 years ago

Hi,

Thanks for maintaining this nice package.

Whenever I insert or copy an entry, I don't have any dash in the pages field. For instance, a DOI lookup for 10.1016/j.jet.2014.12.013 (or equivalently a Crossref lookup for ranking multidimensional alternatives and grabbing the first result) yields an entry with 146171 instead of 146-171 in the pages field. Any idea what could be the issue? (it's not new, I just didn't report it before).

cpitclaudel commented 2 years ago

Surprising! This is what I get:

@Article{Mongin_2015,
  author       = {Mongin, Philippe and Pivato, Marcus},
  title        = {Ranking multidimensional alternatives and uncertain
                  prospects},
  journal      = {Journal of Economic Theory},
  year         = 2015,
  volume       = 157,
  month        = {May},
  pages        = {146–171},
  issn         = {0022-0531},
  doi          = {10.1016/j.jet.2014.12.013},
  url          = {http://dx.doi.org/10.1016/j.jet.2014.12.013},
  publisher    = {Elsevier BV}
}

The server returns an en dash ; could it be that your Emacs isn't displaying that properly?

ericdanan commented 2 years ago

Thanks. That could be the issue, especially as the "regular" dash in the issn field shows up correctly. However when I copy the en-dash from the pages field in your message and paste it in my bibtex buffer, it also shows up properly. Is there another way I should check?

cpitclaudel commented 2 years ago

Is there another way I should check?

No, that's convincing enough. Could you please use (setq url-debug t) to turn on URL debugging, and additionally run (advice-add 'biblio-format-bibtex :before (lambda (&rest args) (print args) (print (length (car args)))))?

Then, please call M-x doi-insert-bibtex with your example above. This will create a buffer *URL-DEBUG* showing what was sent to the server(s), and print a message showing what was received from it/them (there may be two calls, since biblio falls back on bibtex if the website that hosts the original DOI doesn't supply bibtex entries). Please show the contents of both, and hopefully we'll see a bit of light

ericdanan commented 2 years ago

Fixed! No issue on biblio's side, sorry that I wasted your time with this. biblio-format-bibtex in your last message gave me the hint: the culprit was some old code that I have (and had forgotten about) in bibtex-clean-entry-hook to tidy up the pages field. Thanks again.