[erlang-questions] get erlang-shell working, displayed & active right after emacs startup - SOLVED

ami m3oucat@REDACTED
Mon Jul 7 14:02:35 CEST 2014


Hi Steve,

I’m quite a newbie in emacs lisp & emacs internals, So your code seemed 
to me some kind of magic. I googled a lot, read a lot. 

Your code “as is” didn’t work. But it really helped me.

Eventually, I came to this:

(erlang-shell)

(add-hook 'emacs-startup-hook
        '(lambda () (
                    (display-buffer "*erlang*")
                     )))

And it really works! 
(under OSX 10.9.3, Emacs 24.3(9.0)(downloaded from http://emacsformacosx.com/) - 
actually, “option key WORKS in this build as M)



I tried to place (erlang-shell) directly into the hook’s lambda, like

(add-hook 'emacs-startup-hook
        '(lambda () (
                    (erlang-shell)
                    (display-buffer "*erlang*")
                     )))

But that didn’t work.
Somewhy I was constantly getting an "Invalid function: (erlang-shell)”
message. How can a variable be visible in outer scope but be invisible in
inner scope… Magic :) But I’m a noob in emacs lisp though. 



On Jul 4, 2014, at 23:35, Steve Vinoski <vinoski@REDACTED> wrote:

> 
> 
> 
> On Fri, Jul 4, 2014 at 3:51 PM, ami <m3oucat@REDACTED> wrote:
> 
> 
> 
> > 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 code worked for me on Ubuntu 12.04 with emacs 24.3.1. But one thing about it is that the erlang buffer was not the focus if I specified a file to visit on the emacs command line at startup. The code below doesn't have that problem, and for me it does exactly what you're requesting.
> 
> (require 'erlang-start)
> (add-hook
>  'emacs-startup-hook
>  '(lambda ()
>     (let ((f (make-frame)))
>       (with-selected-frame f
>         (erlang-shell)
>         (delete-other-windows (display-buffer erlang-shell-buffer-name))))))
> 
> --steve




More information about the erlang-questions mailing list