            (evernote-mode))
        (rename-buffer name t)
        (evernote-update-mode-line)
-       (set-buffer-modified-p nil)))))
+       (set-buffer-modified-p nil))
+     t)))
 
 
 (defun evernote-edit-tags ()

                                     name
                                     tags
                                     edit-mode)
       (setq evernote-note-guid (evernote-eval-command-result)
             evernote-note-name name
             evernote-note-tags tags

                                    def
                                    inherit-input-method))
    (delete "" results)))


(defun evernote-change-major-mode-from-note-name (note-name)
  (catch 'mode
    (mapc
     (lambda (pattern-mode-pair)
       (if (consp pattern-mode-pair)
           (let ((pattern (car pattern-mode-pair))
                 (mode (cdr pattern-mode-pair)))
             (if (consp mode)
                 (setq mode (car mode)))
             (if (and (stringp pattern)
                      (fboundp mode)
                      (string-match pattern note-name))
                 (condition-case nil
                     (progn
                       (funcall mode)
                       (throw 'mode mode))
                   (error
                    (throw 'mode nil)))))))
     auto-mode-alist)
    (if (fboundp default-major-mode)
        (condition-case nil
            (progn
              (funcall default-major-mode)
              (throw 'mode default-major-mode))
          (error
           (throw 'mode nil))))))


(defun evernote-get-first-line (str)
  "Get first line of the string"
  (let ((begin (string-match "^.*$" str)))
    (substring str begin (match-end 0))))


;;
