     (save-excursion (insert " " msg))
     (sit-for 1)
     (delete-region (point) (point-max))))
+
+
+(defun evernote-display-completion-list (displayed-name-and-name-map)
+  (setq buffer-read-only nil)
+  (erase-buffer)
+  (mapc (lambda (elem)
+          (insert (car elem) "\n"))
+        displayed-name-and-name-map)
+  (setq buffer-read-only t))
+
+
+(defun evernote-select-note-in-search-mode ()
+  (interactive)
+  (save-excursion
+    (let (name)
+      (setq name
+            (cdr
+             (assoc
+              (buffer-substring
+               (progn
+                 (beginning-of-line)
+                 (point))
+               (progn
+                 (end-of-line)
+                 (point)))
+              evernote-search-mode-displayed-name-and-name-map)))
+      (kill-buffer (current-buffer))
+      (save-excursion
+        (set-buffer (window-buffer (active-minibuffer-window)))
+        (save-excursion
+          (delete-region
+           (progn
+             (goto-char (+ 1 (minibuffer-prompt-width)))
+             (point))
+           (progn
+             (end-of-line)
+             (point))))
+        (insert name)
+        (exit-minibuffer)))))
 
 
 ;;

;; Evernote mode
;;

(defun evernote-mode ()
  "Toggle Evernote mode, a minor mode for using evernote functions."
  (interactive)

          note-list)
    (setq evernote-note-cands (nreverse evernote-note-cands)
          evernote-note-display-map (nreverse evernote-note-display-map))
    (cdr (assoc (read-from-minibuffer "Note:"
                                      nil evernote-minibuffer-read-note-name-map)
                evernote-note-cands))))

;;    (setq evernote-note-cands
