Browse Source

org-bibtex: optionally fill in optional fields on bibtex headline creation

  Thanks to Tom Dye for suggesting this functionality

* lisp/org-bibtex.el (org-bibtex-create): Adding prefix argument which
  will result in prompting for optional fields.
Eric Schulte 10 years ago
parent
commit
daef7d8631
1 changed files with 7 additions and 7 deletions
  1. 7 7
      lisp/org-bibtex.el

+ 7 - 7
lisp/org-bibtex.el

@@ -464,20 +464,20 @@ With prefix argument OPTIONAL also prompt for optional fields."
 With prefix argument OPTIONAL also prompt for optional fields."
   (interactive) (org-map-entries (lambda () (org-bibtex-check optional))))
 
-(defun org-bibtex-create (type)
+(defun org-bibtex-create (&optional arg)
   "Create a new entry at the given level."
-  (interactive
-   (list (org-icompleting-read
-          "Type: "
-	  (mapcar (lambda (type) (symbol-name (car type))) org-bibtex-types))))
-  (let ((type (if (keywordp type) type (intern type))))
+  (interactive "P")
+  (let* ((type (org-icompleting-read
+		"Type: " (mapcar (lambda (type) (symbol-name (car type)))
+				 org-bibtex-types)))
+	 (type (if (keywordp type) type (intern type))))
     (unless (assoc type org-bibtex-types)
       (error "type:%s is not known" type))
     (org-insert-heading)
     (let ((title (org-bibtex-ask :title)))
       (insert title) (org-bibtex-put "TITLE" title))
     (org-bibtex-put "TYPE" (substring (symbol-name type) 1))
-    (org-bibtex-fleshout type)))
+    (org-bibtex-fleshout type arg)))
 
 (defun org-bibtex-read ()
   "Read a bibtex entry and save to `*org-bibtex-entries*'.