1

私は erlang 開発に Distel を使用していますが、補完に使用される関数はその出力を ibuffer に出力しています。代わりに ido をサポートするミニバッファーに入れたいのですが、それを行う方法を知っている人はいますか?

コードは次のとおりです。

(defun erl-complete (node)
  "Complete the module or remote function name at point."
  (interactive (list (erl-target-node)))
  (let ((win (get-buffer-window "*Completions*" 0)))
    (if win (with-selected-window win (bury-buffer))))
  (let ((end (point))
    (beg (ignore-errors 
           (save-excursion (backward-sexp 1)
                   ;; FIXME: see erl-goto-end-of-call-name
                   (when (eql (char-before) ?:)
                 (backward-sexp 1))
                   (point)))))
    (when beg
      (let* ((str (buffer-substring-no-properties beg end))
         (buf (current-buffer))
         (continuing (equal last-command (cons 'erl-complete str))))
    (setq this-command (cons 'erl-complete str))
    (if (string-match "^\\(.*\\):\\(.*\\)$" str)
        ;; completing function in module:function
        (let ((mod (intern (match-string 1 str)))
          (pref (match-string 2 str))
          (beg (+ beg (match-beginning 2))))
          (erl-spawn
        (erl-send-rpc node 'distel 'functions (list mod pref))
        (&erl-receive-completions "function" beg end pref buf
                      continuing
                      #'erl-complete-sole-function)))
      ;; completing just a module
      (erl-spawn
        (erl-send-rpc node 'distel 'modules (list str))
        (&erl-receive-completions "module" beg end str buf continuing
                      #'erl-complete-sole-module)))))))

(defun &erl-receive-completions (what beg end prefix buf continuing sole)
  (let ((state (erl-async-state buf)))
    (erl-receive (what state beg end prefix buf continuing sole)
    ((['rex ['ok completions]]
      (when (equal state (erl-async-state buf))
        (with-current-buffer buf
          (erl-complete-thing what continuing beg end prefix
                  completions sole))))
     (['rex ['error reason]]
      (message "Error: %s" reason))
     (other
      (message "Unexpected reply: %S" other))))))
4

1 に答える 1

0

ステファンが提案したcompany-modeものは、私が望んでいたことをしたので、書き直しは必要ありませんでした。

ステファンの助けと時間をありがとう!

于 2013-06-26T08:36:03.880 に答える