[erlang-questions] get erlang-shell working, displayed & active right after emacs startup
ami
m3oucat@REDACTED
Fri Jul 4 21:51:13 CEST 2014
> You might try something like this in your ~/.emacs file:
>
> (add-hook 'erlang-shell-mode-hook
> '(lambda () (delete-other-windows (display-buffer "*erlang*"))))
> (erlang-shell)
>
> --steve
Unfortunately, it doesn’t work for me. The same story: erlang shell is being started,
but it’s not active & displayed. I have to manually (after emacs start) C-x b *erlang*
(switch to *erlang* buffer).
My full .emacs config file:
(tool-bar-mode -1)
;(split-window-right)
;TODO it's only erlang-related
(set-frame-parameter nil 'fullscreen 'fullboth)
;(set-keyboard-coding-system nil)
;Erlang related {
(setq erlang-root-dir "/usr/local/lib/erlang")
(setq load-path (cons (concat erlang-root-dir "/lib/tools-2.6.14/emacs") load-path))
(setq exec-path (cons (concat erlang-root-dir "/bin") exec-path))
(require 'erlang-start)
(require 'erlang-flymake)
;Erlang related }
;plugins
(load-file "/Users/a1/.emacs.d/etags-select.el")
;projects
;for each project -its own environment
(setq project-dir "/Users/a1/dev/otp/")
(setq erlang-tags "ERLANG_TAGS")
(setq c-tags "C_TAGS")
(setq erlang-tags-f (concat project-dir erlang-tags))
(setq c-tags-f (concat project-dir c-tags))
(defun create-tags ()
(interactive)
(message "building ERLANG_TAGS...")
(shell-command (format "find %s -type f -iname \"*.[he]rl\" | etags -l erlang -o %s -" project-dir erlang-tags-f))
(message "done")
(message "building C_TAGS...")
(shell-command (format "find %s -type f -iname \"*.[ch]\" | etags -l c -o %s -" project-dir c-tags-f))
(message "done")
)
(defun my-find-tag-simple(tagfile)
(interactive)
(message tagfile)
(cond
((not (file-exists-p tagfile)) create-tags)
(t nil)
)
(visit-tags-table tagfile)
(etags-select-find-tag-at-point)
)
(defun my-find-tag ()
(interactive)
(setq my-ext (file-name-extension buffer-file-name))
(message my-ext)
(cond
((string-equal my-ext "c") (my-find-tag-simple c-tags-f))
((string-equal my-ext "h") (my-find-tag-simple c-tags-f))
((string-equal my-ext "erl") (my-find-tag-simple erlang-tags-f))
((string-equal my-ext "hrl") (my-find-tag-simple erlang-tags-f))
(t nil)
)
)
(global-set-key (kbd "M-.") 'my-find-tag)
;(autoload 'erlang-mode "erlang.el" "Major mode for editing Python source." t)
;(autoload 'erlang-shell "ipython" "Use IPython as the Python interpreter." t)
;(setq inferior-erlang-machine-options '("-sname" "emacs"))
;(save-window-excursion
; (erlang-shell)
; (sit-for 20)
; )
;(erlang-shell)
;(sit-for 20)
(add-hook 'erlang-shell-mode-hook
'(lambda () (delete-other-windows (display-buffer "*erlang*"))))
(erlang-shell)
On Jul 4, 2014, at 21:29, Steve Vinoski <vinoski@REDACTED> wrote:
>
>
>
> On Fri, Jul 4, 2014 at 10:41 AM, ami <m3oucat@REDACTED> wrote:
> Hi all.
>
> I’m trying to run erlang shell at Emacs startup.
> Just to get a some kind of IDE, when I have an erlang shell, an editor window, etc
> right after startup.
>
> And I faced with the same problem as had been once arisen here
>
> (http://erlang.org/pipermail/erlang-questions/2004-January/011042.html )
>
> So, I start erlang shell by
>
> (erlang-shell)
> in .emacs
>
> but it’s not in active buffer. I, of course, can switch to *erlang* buffer afterwards.
> But I don’t want to switch to *erlang* buffer manually always :(
>
> I tried (sit-for 20) right after (erlang-shell), like
>
> (erlang-shell)
> (sit-for 20)
>
> And I do have an erlang shell displayed in emacs right after startup.
> But when I press any key/mouse button, it disappears :(
> But I can switch to *erlang* buffer manually (it’s not the case).
>
> (switch-to-buffer "*erlang*”)
>
> doesn’t work as well.(if I place it in .emacs right after (erlang-shell) )
>
> Has anybody got erlang shell displayed & working & active right after emacs startup?
>
> You might try something like this in your ~/.emacs file:
>
> (add-hook 'erlang-shell-mode-hook
> '(lambda () (delete-other-windows (display-buffer "*erlang*"))))
> (erlang-shell)
>
> --steve
More information about the erlang-questions
mailing list