[logaling-commit] logaling/logalimacs [master] Apply fallback by text-translator.el

Back to archive index

null+****@clear***** null+****@clear*****
Mon Jun 11 11:35:11 JST 2012


yuta yamada	2012-06-11 11:35:11 +0900 (Mon, 11 Jun 2012)

  New Revision: e704d9fe8ed496668c1205d754cea7a4eba44a50

  Log:
    Apply fallback by text-translator.el

  Modified files:
    logalimacs.el

  Modified: logalimacs.el (+16 -1)
===================================================================
--- logalimacs.el    2012-06-11 09:14:35 +0900 (c4b11e0)
+++ logalimacs.el    2012-06-11 11:35:11 +0900 (a2158de)
@@ -65,6 +65,11 @@
   :group 'logalimacs
   :type 'integer)
 
+(defcustom loga-use-fallback nil
+  "if assign :text-translator, can be fallback."
+  :group 'logalimacs
+  :type 'symbol)
+
 (defvar loga-fly-timer nil
   "timer object for loga-fly-mode")
 
@@ -235,7 +240,9 @@
               (t (loga-return-word-on-cursor)))))
     (setq content (loga-command (concat "\"" word "\"")))
     (if (equal "" content)
-        (message (concat "'" (caar loga-word-cache) content "' is not found"))
+        (if loga-use-fallback
+            (text-translator/logalimacs-fallback-func)
+          (message (concat "'" (caar loga-word-cache) content "' is not found")))
       (case endpoint
         (:popup
          (loga-make-popup content))
@@ -527,6 +534,14 @@
     (string-match "[0-9].[0-9].[0-9]" version-string)
     (match-string 0 version-string)))
 
+(when (and (functionp 'text-translator-all)
+           (eq loga-use-fallback :text-translator))
+  (defun text-translator/logalimacs-fallback-func ()
+    (let* ((search-word (caar loga-word-cache)))
+      (text-translator-all (point)
+                           (substring (funcall text-translator-auto-selection-func "" search-word) 1)
+                           search-word))))
+
 (defvar loga-popup-menu-keymap
   (let ((map (copy-keymap popup-menu-keymap)))
     (define-key map (kbd "q") 'keyboard-quit)




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