Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (require 'cl)
- (require 'erlang-start)
- ;; Run a emacs repl with yaws loaded and configured
- (defvar yaws-path "~/Applications/YAWS")
- (defvar yaws-listening-regex "Yaws: Listening")
- (defvar yaws-extra-paths ())
- (defvar yaws-extra-flags ())
- (defadvice inferior-erlang-wait-prompt (before send-ret-before-waiting last () activate)
- (or (with-current-buffer inferior-erlang-buffer (save-excursion
- (goto-char (process-mark inferior-erlang-process))
- (forward-line 0)
- (looking-at comint-prompt-regexp)))
- (comint-send-string inferior-erlang-process "\n")))
- (defun* erlang-yaws-wait-for-listen (&key (timeout 2) (buffer (current-buffer)))
- (ignore-errors
- (while (not (string-match-p yaws-listening-regex (buffer-string)))
- (or (accept-process-output (get-buffer-process buffer) timeout)
- (error "Yaws didn't seems to listen before timeout (%s) in %s" timeout buffer)))
- (comint-send-string (get-buffer-process buffer) "\n") t))
- (defun erlang-yaws-do-wait-for-listen ()
- (message "Waiting for yaws to listen...")
- (if (erlang-yaws-wait-for-listen)
- (progn (message "Erlang+YAWS Ready")
- t)
- (message "Erlang+YAWS load FAILED")
- nil))
- (defun erlang-yaws-get-extra-paths ()
- ())
- (defun erlang-yaws-get-extra-flags ()
- ())
- (defun run-erlang-yaws ()
- (interactive)
- (let ((inferior-erlang-machine-options `("-pa" ,(expand-file-name (concat yaws-path "/lib/yaws/ebin"))
- ,@(or (erlang-yaws-get-extra-paths) '(""))
- ,@(or (erlang-yaws-get-extra-flags) '(""))
- "-yaws" "debug"
- "-run" "yaws"
- "-yaws" "id" "default"))
- (erlang-shell-mode-hook ()))
- (add-hook 'erlang-shell-mode-hook 'erlang-yaws-do-wait-for-listen)
- (run-erlang)))
- (message "Eval'd")
- (provide 'erlang-yaws)
Add Comment
Please, Sign In to add comment