From 8074496b13fb728bc6e11d8ed506013993d97cfc Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Sun, 12 Sep 2010 02:42:59 +0200 Subject: [PATCH] Start Ebib on a specific entry. Add ebib-start-on-entry, which starts Ebib (or brings it to the front) and asks for an entry to display. Can be called interactively or from a function. --- src/ebib.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ebib.el b/src/ebib.el index 8d6bc5b..46a4d6c 100644 --- a/src/ebib.el +++ b/src/ebib.el @@ -1265,6 +1265,24 @@ buffers and reads the rc file." (set-buffer ebib-index-buffer) (ebib-index-mode)) +(defun ebib-start-on-entry (entry) + "Starts Ebib on ENTRY. +ENTRY must be an entry in the last autoloaded database if Ebib is +started for the first time or in the current database if Ebib is +running in the background. If ENTRY is not found, the first or +current entry is shown." + (interactive "sEntry to display: ") + (ebib) + (let ((entry? (member entry (edb-keys-list ebib-cur-db)))) + (if entry? + (progn + (setf (edb-cur-entry ebib-cur-db) entry?) + (set-buffer ebib-index-buffer) + (goto-char (point-min)) + (re-search-forward (format "^%s " (ebib-cur-entry-key))) + (ebib-select-entry)) + (message "No entry `%s' in current database " entry)))) + (defun ebib-quit () "Quits Ebib. The Ebib buffers are killed, all variables except the keymaps are set to nil." -- 2.11.4.GIT