]> code.delx.au - gnu-emacs-elpa/blobdiff - company-tempo.el
Make a new release
[gnu-emacs-elpa] / company-tempo.el
index 0fa5c75c312f305f612f866cf5fd3f958822011b..cba42c3e36e1f7d7e29edcfe130b326136f6aa08 100644 (file)
 (require 'cl-lib)
 (require 'tempo)
 
+(defgroup company-tempo nil
+  "Tempo completion backend."
+  :group 'company)
+
+(defcustom company-tempo-expand nil
+  "Whether to expand a tempo tag after completion."
+  :type '(choice (const :tag "Off" nil)
+                 (const :tag "On" t)))
+
 (defsubst company-tempo-lookup (match)
   (cdr (assoc match (tempo-build-collection))))
 
   "`company-mode' completion backend for tempo."
   (interactive (list 'interactive))
   (cl-case command
-    (interactive (company-begin-backend 'company-tempo
-                                        'company-tempo-insert))
+    (interactive (company-begin-backend 'company-tempo))
     (prefix (or (car (tempo-find-match-string tempo-match-finder)) ""))
     (candidates (all-completions arg (tempo-build-collection)))
     (meta (company-tempo-meta arg))
+    (post-completion (when company-tempo-expand (company-tempo-insert arg)))
     (sorted t)))
 
 (provide 'company-tempo)