2

I am running emacs 25.3 and have been having issues with my bib files. Whenever I edit the bib file and reformat/sort the entries it takes a long time to carry out the reformatting (15-20 seconds) and after it is finished emacs hangs. I noticed CPU usage on one core goes to 100% while reformatting and stays there after completion. I need to kill emacs to get out of this loop.

The bib file I have is not terribly large, several hundred entries with a total of ~8k lines. I ran a test on a smaller bib file (~2k lines) and experienced the same issue. Are my bib files too large? Is there a way to identify which part of the reformat/sort is causing it to hang?

  • Please clarify what you mean by hangs Emacs. What behavior do you see? Do you see the same problem if you start Emacs using emacs -Q? If so, consider M-x report-emacs-bug. If not, bisect your init file to find the culprit. – Drew Apr 15 at 14:52
  • @Drew You commented as I wrote my answer below. By hang, I mean I cannot do anything in emacs (cannot move cursor, cannot change buffers, cannot close buffer, etc.). The ONLY thing that still works is C-g followed by hitting the top-left "x" to close the window. However, as you suggested, the issue was in the init file. – tnknepp Apr 15 at 15:04
1

I got the idea this may be a problem in my init (.emacs) file so I began commenting out sections and zeroed in on wc-mode and linum-mode. I have read that combining word-count mode and linum-mode is problematic for scrolling large files (I've never experienced this), but this is the first I have heard of it interfering with bibtex-mode. Here are three solutions (all require completely disabling word count mode...might as well uninstall it):

  1. comment out both modes. This solved the problem and the .bib files takes roughly 1 second to save.

  2. permanently disable wc-mode. Disable linum-mode when in bibtex-mode using the following hook:

    (add-hook 'bibtex-mode-hook (lambda() (nlinum-mode 0)))

The .bib file takes roughly 10 seconds to save

  1. permanently disable wc-mode, install nlinum and enable it in the .emacs file. This works without problem and the .bib file takes roughly 5-10 seconds to save.

The optimal solution as far as performance is concerned is completely disabling word counts and line numbering. I prefer line numbering when writing (code, latex, etc.), so option 3 provides a good trade off. I'll keep this posted for posterity in case anyone else has similar problems.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.