Hi Folks -

Trying to figure out how to use Org Protocol to capture a web page link
as a BibTeX entry. I've created a capture template as so:

("bib"
  "BibTex Entry"
  plain
  (function (lambda ()
              (find-file "~/org/bib/references.bib")
              (goto-char (point-min))))
  (function (lambda ()
              (string-join
               (list "@Online {,"
                     "author = {%?},"
                     "title = {%:description},"
                     "url = {%:link},"
                     "date = {%(cc-org-capture--bibtex-date)},"
                     "notes = {%i}"
                     "}")
               "\n")))
  :empty-lines 1
  :jump-to-captured t)


The function cc-org-capture--bibtex-date is just a call to format-time-string.

(defun cc-org-capture--bibtex-date ()
  "Enter date for bibtex entry."
  (format-time-string "%Y-%m-%d"))


When I try to finalize this capture I get this warning/error message:

⛔ Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org 
buffer #<buffer references.bib> (bibtex-mode)
⛔ Warning (org-element): org-element--cache: Org parser error in 
references.bib::2. Resetting.
The error was: (error "rx ‘**’ range error")
Backtrace:
"  backtrace-to-string(nil)
  org-element-at-point()
  org-up-heading-safe()
  org-fold-show-set-visibility(ancestors)
  org-fold-show-context(org-goto)
  org-goto-marker-or-bmk(#<marker at 2 in references.bib> 
\"org-capture-last-stored\")
  org-capture-goto-last-stored()
  org-capture-finalize(nil)
  funcall-interactively(org-capture-finalize nil)
  command-execute(org-capture-finalize)
"
Please report this to Org mode mailing list (M-x org-submit-bug-report).


Does Org capture only work with Org files?


Thanks!

Charles




—
Charles Y. Choi, Ph.D.
[email protected]






Reply via email to