   (force-mode-line-update))
 
 
-(defun evernote-completing-read-multiple (prompt table &optional predicate require-match initial-input hist def inherit-input-method)
-  (let ((results (completing-read-multiple prompt table predicate require-match initial-input hist def inherit-input-method)))
+(defun evernote-completing-read-multiple
+  (prompt table &optional predicate require-match initial-input hist def inherit-input-method)
+  "Read multiple strings with completion. and return nil if no input is given"
+  (let (results)
+    (setq results
+          (completing-read-multiple prompt
+                                    table
+                                    predicate
+                                    require-match
+                                    initial-input
+                                    hist
+                                    def
+                                    inherit-input-method))
     (delete "" results)))
-
-
-(defun evernote-read-note-attr (note-list)
-  "Prompts a note name and returns a note attribute"
-  (let ((name-num-map (make-hash-table :test #'equal))
-        evernote-note-cands
-        evernote-note-display-map
-        evernote-minibuffer-note-completion-prompt)
-    (mapc (lambda (attr)
-            (let* ((name (cdr (assoc 'name attr)))
-                   displayed-name
-                   (num (gethash name name-num-map)))
-              (if num
-                  (progn
-                    (setq num (+ num 1))
-                    (setq displayed-name (format "%s(%d)" name num))
-                    (puthash name num name-num-map))
-                (setq displayed-name (substring name 0))
-                (puthash name 1 name-num-map))
-              (setq evernote-note-cands
-                    (cons (cons displayed-name attr) evernote-note-cands))
-              (setq evernote-note-display-map
-                    (cons (cons displayed-name
-                                (format "%s    %s"
-                                        (cdr (assoc 'updated attr))
-                                        displayed-name))
-                          evernote-note-display-map))))
-          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
-;;          (mapcar (lambda (attr)
-;;                    (cons (cdr (assoc 'name attr)) attr))
-;;                  note-list))
-;;    (setq evernote-note-display-map
-;;          (mapcar (lambda (attr)
-;;                    (cons (cdr (assoc 'name attr))
-;;                          (format "%s    %s"
-;;                                  (cdr (assoc 'updated attr))
-;;                                  (cdr (assoc 'name attr)))))
-;;                  note-list))
-;;    (setq evernote-minibuffer-note-completion-prompt "Note:")
-;;    (cdr (assoc (read-from-minibuffer evernote-minibuffer-note-completion-prompt
-;;                                      nil evernote-minibuffer-read-note-name-map)
-;;                evernote-note-cands))))
-
-
-(defun evernote-minibuffer-note-completion ()
-  "Complete note name and display completion list"
-  (interactive)
-  (let (word result start)
-    (setq start (+ 1 (minibuffer-prompt-width)))
-    (setq word (buffer-substring start (point)))
-    (setq result (try-completion word evernote-note-cands)) ;; from here.
-    ;(evernote-tmp-message (concat "[" word "]"))
-    (cond
-     ((eq result t) (evernote-tmp-message "[Sole Completion]"))
-     ((eq result nil) (ding) (evernote-tmp-message "[No Match]"))
-     ((string= result word)
-      (let (displayed-name-and-name-map completion-buf)
-        (setq displayed-name-and-name-map
-              (mapcar (lambda (name)
-                        (cons
-                         (cdr (assoc name evernote-note-display-map))
-                         name))
-                      (all-completions word evernote-note-display-map)))
-        (setq completion-buf (get-buffer-create "*Evernote-Completions*"))
-        (save-excursion
-          (set-buffer completion-buf)
-          (evernote-display-completion-list displayed-name-and-name-map)
-          (setq evernote-search-mode-displayed-name-and-name-map displayed-name-and-name-map)
-          (evernote-search-mode))
-        (display-buffer completion-buf)))
-     (t (delete-region start (point))
-        (insert result)
-        (if (eq t (try-completion result evernote-note-cands))
-            nil
-          (evernote-tmp-message "[Complete, but not unique]"))))))
-
-
-(defun evernote-minibuffer-note-input-finish ()
-  "Finish input note name"
-  (interactive)
-  (if (assoc
-       (buffer-substring
-        (progn
-          (goto-char (+ 1 (minibuffer-prompt-width)))
-          (point))
-        (progn
-          (end-of-line)
-          (point)))
-       evernote-note-cands)
-      (exit-minibuffer)
-    (evernote-tmp-message "[No Match]")))
-
-
-(defun evernote-tmp-message (msg)
-  (save-excursion
-    (goto-char (point-max))
-    (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)))))
 
 
 ;;


(provide 'evernote-mode)

;;(setq debug-on-error nil)



(defun evernote-issue-command (inbuf &rest args)
  "Invoke external process to issue an evernote command."
  (let ((outbuf (get-buffer-create evernote-command-output-buffer-name))
        (infile nil)
        (coding-system-for-read 'utf-8)
        (coding-system-for-write 'utf-8))
