[logaling-commit] logaling/logalimacs [master] Apply fallback when the add command failed

Back to archive index

null+****@clear***** null+****@clear*****
Wed Jun 27 01:28:12 JST 2012


yuta yamada	2012-06-27 01:28:12 +0900 (Wed, 27 Jun 2012)

  New Revision: 35ca416dc7456474c5bd953b3e909ae9131f0f77
  https://github.com/logaling/logalimacs/commit/35ca416dc7456474c5bd953b3e909ae9131f0f77

  Log:
    Apply fallback when the add command failed

  Modified files:
    logalimacs.el

  Modified: logalimacs.el (+9 -3)
===================================================================
--- logalimacs.el    2012-06-27 00:44:24 +0900 (a5e7955)
+++ logalimacs.el    2012-06-27 01:28:12 +0900 (cdbe1bc)
@@ -213,9 +213,15 @@
        (minibuffer-message (loga-to-shell loga task))))))
 
 (defun loga-add/update (task)
-  (let* ((input (loga-input)))
-    (loga-to-shell "\\loga" (concat task " " input))
-    (kill-buffer "*logalimacs*")))
+  (let* ((input (loga-input))
+         (spew-message (loga-to-shell "\\loga" (concat task " " input))))
+    (if (and (string-match "^term '.+' already exists in '.+'" spew-message)
+             (yes-or-no-p
+              (format "%sAre you sure you want to 'update' followed by?"
+                      spew-message)))
+        (loga-update)
+      (kill-buffer "*logalimacs*"))))
+
 (defun loga-lookup-attach-option (search-word)
   (let* ((options '()))
     (if loga-use-dictionary-option
-------------- next part --------------
An HTML attachment was scrubbed...
다운로드 



More information about the logaling-commit mailing list
Back to archive index