Current emacs recommendations?

For some reason I don’t understand, I thought I might try out emacs again 16 years after I decided I hate it. I like using hot keys and shortcuts more now, so maybe that’s it.

When I looked at the emacs page, I learned that there are different “flavors” (GNU emacs, Xemacs, etc.). What do folks use and is there really a noticeable difference? Does the julia emacs extension even work with other versions?

Aside from the Julia extension, are there any others that make learning (especially!) or using emacs easier?

6 Likes

I use emacs for about 30 years. It is a really powerful text editing platform.
XEmacs is no longer in active development.
So just go for GNU Emacs.

9 Likes

I use doom emacs with emacs 29.1.90 on macOS. Julia works well with the packages julia-ts-mode, julia-repl, and lsp-mode. This is based on the excellent work by @Ronis_BR , @Tamas_Papp and others. Please take a look at this repo for notes and a doom config which works well on macOS.

This is a good emacs resource.

7 Likes

Can’t get Emacs work with Julia on Windows. Bummer!

1 Like

I’m also interested in seeing if people are using different things. I have been using the basic gnu/emacs with very few modifications for around 2 years and I still consider myself pretty awful at it but I prefer it to using bloated text editors. On Linux, by the way.

Here’s my configuration block for julia files:

  (use-package julia-mode
    :ensure t
    :mode "\\.jl\\'"
    :interpreter ("julia" . julia-mode)
    :init
    (setenv "JULIA_NUM_THREADS" "8")
    :config
    (add-hook 'julia-mode-hook 'eglot-jl-init)
    (add-hook 'julia-mode-hook (lambda () (setq eglot-connect-timeout 120)))
    (add-hook 'julia-mode-hook (lambda () (setq eglot-autoshutdown t)))
    (add-hook 'julia-mode-hook 'julia-repl-mode)
    (add-hook 'julia-mode-hook 'company-mode)
    (add-hook 'julia-mode-hook #'yas-minor-mode)
    (add-hook 'julia-mode-hook (lambda () (setq julia-repl-set-terminal-backend 'vterm))))

I suspect it doesn’t work 100%. I am using eglot and eglot-jl as a language server but I only activate it manually (because it’s heavy) with the M-x eglot command.

2 Likes

This one is new to me. Any feedback about it?

1 Like

ahhhh, that’s an interesting consideration… Most of the time I’m on Linux, but I do have to use Windows occasionally.

I used to use Emacs on Windows about 10 years ago. It wasn’t the most natural integration, but it was ok. But I haven’t touched a Windows system since then.

There is a recent discussion on Reddit.
https://www.reddit.com/r/Julia/comments/195z9i8/emacs_support/

It’s worked well for syntax highlighting. See this post on Discourse, the relevant section here, and detailed looks here, here, and here.

3 Likes

Man, I need to be productive this week, but these new toys seem very tempting to try out…

4 Likes

Thanks for all the tips! I do work on Windows frequently, so I would have to make sure that emacs has decent Windows support first I guess.

It does not. The shell in which to run Julia does not cooperate. I could not get it to work. Could anyone?

When I paste more than 10 lines of code into the julia-repl shell, the screen flickers for a few seconds before the pasted text settles down. Is this a common problem people have seen?

1 Like

I’ll take the opportunity to plug my own Julia IDE for Emacs project, Julia Snail. It uses a network bridge to make Emacs and Julia talk to each other (like SLIME for Common Lisp and CIDER for Clojure). This lets it do useful things like evaluate code in Julia buffers in the context of the current module. It also has completion and code navigation support, without requiring LSP (I was going for minimal dependencies and configuration).

No Windows support, alas, as Windows terminal emulation in Emacs is dicey. Some day, Snail will get a native Elisp Julia REPL, but that day is far off.

15 Likes

Hi Tom, in the last line of your config you should use (add-hook 'julia-mode-hook (lambda () (julia-repl-set-terminal-backend 'vterm))), without setq.

Actually I think the safest thing is

(with-eval-after-load 'julia-repl
  (julia-repl-set-terminal-backend 'vterm))

This invokes the function julia-repl-set-terminal-backend once when the library julia-repl is loaded. Adding julia-repl-set-terminal-backend to the julia-mode-hook makes Emacs invoke it each time you activate julia-mode.

3 Likes

Why not?

Install scoop first in PowerShell.
Then do scoop install emacs in PowerShell.
scoop install julia install Julia.

And now it is all about to correctly setup everything in $HOME/.emacs.d/init.el to install the correct packages and set them up correctly.

Even better is of course to activate Windows Subsystem for Linux (WSL), install there Linux or Archlinux, and then you have sudo apt or pacman to setup everything for you as if you were in a Linux machine (instead of Windows).

I’m using julia-ts-mode with doom emacs and got lsp and treesitter to work but I can only send code to the repl line by line or if I mark code in visual mode. Is there a way to send a full function or a begin/end block at once?

You can use julia-repl, GitHub - tpapp/julia-repl: Run an inferior Julia REPL in a terminal inside Emacs . It have nice shortkeys to eval a complete buffer, or region. I thin you can use both at the same time.

3 Likes

Thank you! I’m using julia-repl and wrote a little extension to automatically parse julia blocks to regions
(sorry cannot get syntax highlighting to work)
EDIT: do blocks were not correctly parsed
EDIT2: moved to a gist where I keep fixing problems:

1 Like