2

I'm looking for an easy way to move quickly up or down by a single BibTeX entry when in bibtex-mode. Of course I could write a function that searches for the relevant lines, but it seems more sensible to me to redefine how bibtex-mode sees paragraphs as that will allow me to use default keybindings for navigation (M-} and M-{ for instance). I tried the following, since each BibTeX entry starts with the @ character and there's a newline between all entries:

(setq paragraph-start "@.*" paragraph-separate "\n"))

But this doesn't seem to have any effect, at least not when using forward-paragraph and backward-paragraph. What am I doing wrong?

Note: I'm aware of integration with imenu and bibtex-search-entry, but those serve a slightly different purpose.

4
  • 1
    In any case, paragraph-start needs to match whatever paragraph-end matches -- see the doc string. See the doc strings of each and this comment in paragraphs.el: paragraph-start requires a hard newline, but paragraph-separate does not: It is assumed that paragraph-separate is distinctive enough to be believed whenever it occurs, while it is reasonable to set paragraph-start to something very minimal, even including "." (which makes every hard newline start a new paragraph).
    – Drew
    May 19, 2014 at 2:23
  • 1
    See also this
    – Drew
    May 19, 2014 at 2:27
  • And see node Paragraphs in the Emacs manual and node Standard Regexps in the Elisp manual.
    – Drew
    May 19, 2014 at 2:32
  • Thanks for the information. I imagine I can get paragraph-start and paragraph-separate working with all this, but it seems that it might not be the best approach. Maybe I'll just write functions to search after all.
    – Karl
    May 19, 2014 at 17:26

1 Answer 1

4

WRT mentioned missing effect - leaving aside the regexp-question commented by Drews already:

Modes often set variables, which might overwrite values from init-file. To set variables after a mode is loaded, use "add-hook". Like that it should be recognised:

(add-hook 'bibtex-mode-hook (lambda ()(setq paragraph-start "START-VALUE" paragraph-separate "SEP-VALUE")))
1
  • Thanks for this. I actually have this exact line already, but just chopped most of it out for the sake of brevity. I guess I should have been more clear in case others ever read this.
    – Karl
    May 19, 2014 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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