News for hackers. Stuff that matters.
Re:Emacs Is Not Just an Editor by martin1975 on Sunday March 12, 2023 @07:50PM (#35128379)
are there plugins/add-ons to emacs for Java that lets a dev do the kind of refactoring available in eclipse or intellij? It seems emacs brings a lot of power to develop such tools with it, but are the tools there yet or am I stuck having to write every little thing on my own by having to master lisp?
Re:Emacs Is Not Just an Editor by pschw on Sunday March 12, 2023 @08:11PM (#35128631)
lsp-java mode should handle most of that: https://emacs-lsp.github.io/lsp-java/
Re:Emacs Is Not Just an Editor by fiddlerwoaroof on Sunday March 12, 2023 @08:07PM (#35128578)
lsp servers supply most of the refactorings available in VSCode.
Re:Emacs Is Not Just an Editor by squeegee_scream on Sunday March 12, 2023 @08:56PM (#35129067)
I worked at a place where several people used a Jetbrains IDE and they loved them. We were doing web dev with Go and TS. So I asked one day what were the killer features that they liked so much and I don't remember what they listed but Emacs had all of it. So I would assume that applies for Java.
Re:Emacs Is Not Just an Editor by simiones on Monday March 13, 2023 @07:50AM (#35134371)
Emacs definitely doesn't have any of the advanced refactoring and code analysis features of a Jetbrains IDE. Now, these are all mostly niche features that you'd use maybe once a month, but when you do need them, they save huge amounts of time for large code bases.

Here are some examples:

- Extract class / method / function (takes a piece of code and converts it to a class/method/free-floating function, while detecting all context dependencies and turning them to parameters or fields; also generates the proper constructors to populate those fields; and calls the right constructors/methods passing those parameters from context)

- Extract parameter / field (takes a local variable and makes it a parameter/field, and identifies all callers to propagate a value)

- Versions of the previous extractions that can go through a deeper call stack, automatically propagating along all functions along the way; essentially identical to using the same thing repeatedly, but in a single step

- Data flow to/from here (takes a variable and tells you something like 'the value here is coming from this parameter, which was populated from that field, which is assigned to in these two places; in the first place, it is assigned from this IO function; in the second place it is set to the value of this parameter which is populated from this constant; for "from", it is doing the same, but for all downstream uses of this value)

Re:Emacs Is Not Just an Editor by squeegee_scream on Monday March 13, 2023 @08:55PM (#35145760)
Emacs definitely has those, in the same way that VSCode has them, ie via extensions. Emacs has LSP builtin now I believe, so these things are easier to setup
Re:Emacs Is Not Just an Editor by simiones on Tuesday March 14, 2023 @05:11AM (#35148942)
If you know of an Emacs extension that does these, I would be very happy to know about it. These days I'm programming 100% in Emacs for various reasons, so I looked quite a bit (though it's true that was a few years ago now, so maybe some have turned up).

LSP itself certainly doesn't support this, though they can probably be built on top of it with some effort. For that matter, I also don't think VSCode supports them, though I have used Emacs far far more than that.

Re:Emacs Is Not Just an Editor by squeegee_scream on Tuesday March 14, 2023 @09:25AM (#35151084)
For TypeScript look at jsrefactor or js2refactor I forget. It has a lot of refactor functions which include extractions.
Re:Emacs Is Not Just an Editor by illiarian on Monday March 13, 2023 @07:53AM (#35134408)
> I don't remember what they listed but Emacs had all of it.

Of course Emacs has none of it. Through a combination of various extensions and plugins of wildly varying quality, and through increasingly arcane config files you can have some semblance of what and IDE offers, but definitely not even close to "all of it".

Re:Emacs Is Not Just an Editor by squeegee_scream on Monday March 13, 2023 @08:58PM (#35145788)
Of course Emacs has all of it. Through extensions, like VSCode or Atom or Sublime.

> through ... various extensions and plugins of wildly varying quality

Most Emacs plugins that I've seen are higher quality than most professional codebases I've seen.

> through increasingly arcane config files

Things are getting better not worse, so they are _decreasingly_ arcane config files. And Doom Emacs or Spacemacs make this dead simple to setup. This is no longer a valid issue.

Re:Emacs Is Not Just an Editor by kdtsh on Sunday March 12, 2023 @09:07PM (#35129201)
I developed Java in Emacs using lsp-mode and the Eclipse Language Server, it worked quite well but there were some things it couldn’t do/I couldn’t figure out how to do (moving a class to a different package was something I never figured out). It definitely worked though, and I found I was productive.

I ended up moving to IntelliJ after being a long term Eclipse user and then using Emacs for about a year. I miss the keyboard-driven environment in Emacs and the more parsimonious keybindings, but IntelliJ is better as an IDE. Still use Magit though.

You don’t have to master Elisp at all to use Emacs, I have written very little Elisp. However I did use a distribution (Prelude, then Doom Emacs) which did a lot of the heavy lifting in setting up my initial environment - YMMV if you go in with vanilla Emacs and then edit your init.el until you find a working configuration for your needs.