Skip to content

Instantly share code, notes, and snippets.

@mori-dev
Created June 30, 2010 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mori-dev/458545 to your computer and use it in GitHub Desktop.
Save mori-dev/458545 to your computer and use it in GitHub Desktop.
;; iphoneを持っていないので未検証
;; 「[Create new note] で新しいメモを作成&保存した場合は以下のような表示になり、
;; やはり同期を行うまではローカルにのみ存在するメモとなります。」の対処例
;; C-x C-s(save-buffer)でセーブする前に[Sync with server] する例
(defadvice save-buffer (before my-save-buffer activate)
(when (equal (buffer-name) "*Simplenote*")
(simplenote-sync-notes)
(simplenote-browser-refresh))
;; (when (equal (buffer-name) " *hoge*")
;; ...)
)
;; 概略このようなかんじで、save-buffer のbeforeアドバイスとして、
;; それぞれの処理のためのバッファ名でチェックしたうえで、行ないたい処理を書くといいはずだとおもいます。
;; 「それぞれの処理のためのバッファ名」とは、"*Simplenote*"や" *simplenote-temp*"をさします。
;; 追記
;; アドバイスより before-save-hook のほうが素直かもしれません
(add-hook 'before-save-hook
(lambda()
(when (equal (buffer-name) "*Simplenote*")
(simplenote-sync-notes)
(simplenote-browser-refresh))
;; (when (equal (buffer-name) " *hoge*")
;; ...)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment