[logaling-commit] logaling/logalimacs [master] Use favorite function instead of fallback function for text-translator

Back to archive index

null+****@clear***** null+****@clear*****
Sun Jul 1 19:48:39 JST 2012


yuta yamada	2012-07-01 19:48:39 +0900 (Sun, 01 Jul 2012)

  New Revision: 73882273b7be361be1064ad0988663fb1fe6f443
  https://github.com/logaling/logalimacs/commit/73882273b7be361be1064ad0988663fb1fe6f443

  Log:
    Use favorite function instead of fallback function for text-translator

  Modified files:
    logalimacs.el

  Modified: logalimacs.el (+11 -14)
===================================================================
--- logalimacs.el    2012-06-30 11:55:05 +0900 (7278b7a)
+++ logalimacs.el    2012-07-01 19:48:39 +0900 (94f4df4)
@@ -69,11 +69,6 @@
   :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")
 
@@ -111,6 +106,13 @@
 (defvar loga-popup-point 0)
 (defvar loga-popup-width 0)
 
+;; Apply your favorite function
+;; Example:
+;; (setq loga-fallback-function
+;;       (lambda (search-word)
+;;         (my/super-translation-function search-word)))
+(defvar loga-fallback-function nil)
+
 (defvar loga-command-alist
   '((?a . :add)
     (?c . :config)
@@ -260,8 +262,8 @@
         (case endpoint
           (:popup  (loga-make-popup  terminal-output))
           (:buffer (loga-make-buffer terminal-output)))
-      (if loga-use-fallback
-          (text-translator/logalimacs-fallback-func)
+      (if (functionp loga-fallback-function)
+          (loga-fallback source-word)
         (minibuffer-message
          (format "%s is not found" source-word))))))
 
@@ -567,13 +569,8 @@
     (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))))
+(defun loga-fallback (search-word)
+  (funcall loga-fallback-function search-word))
 
 (provide 'logalimacs)
 
-------------- next part --------------
An HTML attachment was scrubbed...
다운로드 



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