简体   繁体   中英

Pasting bibitem into .bib file in terminal emacs

I have a strange problem with emacs in terminal (on both linux and mac). when I want to paste (system paste, Ctrl+Shift+V in linux terminal and Command+V in mac) a bibitem such as an article item into an emacs buffer for a .bib file, it only pastes the first line of the bibitem and gives this error on emacs command line: "Not on Bibtex field". a simple example of a bibitem is:

@article{citation, 
title = {a title},
author = {an author}
}

when I paste it, it only pastes:

@article{citation,

but it pastes normally in other types of buffers.

Anyone has any idea why this happens?

Thank you.

By default, bibtex-mode binds tab to bibtex-find-text which exits with an error when used on a line which does not already contain a bibtex field, so if you try to paste a bibtex entry which uses tab for indentation, it'll stop at the first tab. You can rebind it to something saner, from https://groups.google.com/d/msg/comp.emacs/z7dfQ2lvdv0/sbm-cIdTVgoJ :

(defun my-bibtex-mode-setup ()
  (local-set-key (kbd "TAB") 'indent-for-tab-command))
(add-hook 'bibtex-mode-hook 'my-bibtex-mode-setup)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM