[logaling-commit] logaling/logalimacs [master] Refactor loga-version-number

Zurück zum Archiv-Index

null+****@clear***** null+****@clear*****
Sun Feb 26 22:16:17 JST 2012


yuta yamada	2012-02-26 22:16:17 +0900 (Sun, 26 Feb 2012)

  New Revision: 810c25fa048f35e983d35a32994ca2471e2c0a50

  Log:
    Refactor loga-version-number

  Modified files:
    logalimacs.el

  Modified: logalimacs.el (+10 -11)
===================================================================
--- logalimacs.el    2012-02-24 21:15:06 +0900 (db8005c)
+++ logalimacs.el    2012-02-26 22:16:17 +0900 (1658b70)
@@ -424,18 +424,16 @@
   (let* ((ruby '(lambda (arg)
                   (shell-command-to-string (concat "ruby -e " arg))))
          (version (funcall ruby "'print RUBY_VERSION'"))
-         (installed-p (not (string-match "no such file to load"
-                                         (funcall ruby "'require \"logaling\"'"))))
-         (rvm-p (eq 0 (shell-command "which rvm")))
-         logaling-version)
+         (installed-p
+          (not (string-match "no such file to load"
+                             (funcall ruby "'require \"logaling\"'"))))
+         (rvm-p (eq 0 (shell-command "which rvm"))))
     (cond
      ((and installed-p version)
       (message "Check OK: logaling-command already installed")
-      (setq logaling-version
-            (loga-return-version-num (loga-to-shell "\\loga version")))
-      (if (version< "0.1.2" logaling-version)
+      (if (version< "0.1.2" (loga-version-number))
           ;; @todo sets true when resolved problem
-          (setq loga-possible-json-p nil)) t)
+              (setq loga-possible-json-p nil)) t)
      ((not (string-match "1.9.[0-9]\\|[2-9].[0-9].[0-9]" version))
       (message "Note: Ruby version errer, require Ruby 1.9.x"))
      (rvm-p
@@ -444,9 +442,10 @@
         (message "Note: if use rvm, require rvm.el and sets the config to your dot emacs.")))
      (t message "Note: require 'sudo gem install logaling-command'"))))
 
-(defun loga-return-version-num (version-string)
-  (string-match "[0-9].[0-9].[0-9]" version-string)
-  (match-string 0 version-string))
+(defun loga-version-number ()
+  (let* ((version-string (loga-to-shell "\\loga version")))
+    (string-match "[0-9].[0-9].[0-9]" version-string)
+    (match-string 0 version-string)))
 
 (defvar loga-popup-menu-keymap
   (let ((map (copy-keymap popup-menu-keymap)))




More information about the logaling-commit mailing list
Zurück zum Archiv-Index