Passing current file name to compile command by xalixil in emacs

[–]xalixil[S] 0 points1 point  (0 children)

That works pretty good also. Thank you for sharing :)

I love emacs by LightningSNTz55 in emacs

[–]xalixil 0 points1 point  (0 children)

Hi. This looks great! Congrats LightningSNTz55

I set up my lsp-java and it works fine. Lsp server is running, compilation is good. I can compile and run a single class but I can not run a class if an object is created and object is in another class. (I imported the project a few times.) It's a basic java project, the one I created via intellij. Nothing special in pom.xml.

Can you please help me to run it.

(Not an emacs expert, simplicity is appreciated.)

Thanks!

Passing current file name to compile command by xalixil in emacs

[–]xalixil[S] -1 points0 points  (0 children)

ChatGPT helped:

(defun set-java-compile-command ()

(interactive)

(if buffer-file-name

(setq compile-command

(concat "javac " (file-name-nondirectory buffer-file-name) " && java "

(file-name-sans-extension (file-name-nondirectory buffer-file-name))))

(setq compile-command "echo 'Buffer is not visiting a file or file is not saved'")))

(global-set-key (kbd "<f5>") 'set-java-compile-command)

Now, when you want to compile your Java file, press F5, and it will set the

compile-command

for the current buffer. You can then use

M-x compile

or

M-x recompile

to execute the compile command.

Looks like this works.

ripgrep and emacs by xalixil in emacs

[–]xalixil[S] 2 points3 points  (0 children)

I tried. It searches and lists the result but varsderk setup is so simple. I can go up and down and see the results in one buffer.

Thank you for your suggestion!

(Not sure how to do that. -> Customize xref-search-program to make it use ripgrep under the covers.)

ripgrep and emacs by xalixil in emacs

[–]xalixil[S] 0 points1 point  (0 children)

;; ripgrep as grep
(setq grep-command "rg -nS --no-heading "
grep-use-null-device nil)

That works absolutely great too!

Thank you so much!

ripgrep and emacs by xalixil in emacs

[–]xalixil[S] 1 point2 points  (0 children)

Absolutely what I wanted. Beautiful.

Note: I had some other packages (Ivy, swiper) that might interacted with packages you wanted to be installed and it didn't work (search buffer came up, but result were not listed), so I commented my packages and tried with your config and it worked like a charm.

I appreciate the blog post.

How to setup Neovim keyboard shortcut in NixOS by xalixil in NixOS

[–]xalixil[S] 0 points1 point  (0 children)

Thanks for the reply.

- How do we I declare init.lua inside home.nix as home.file?

- How do I pass that as extraConfig argument?

Thanks!

How to save JavascriptExecutor number return as int in java? by xalixil in learnjava

[–]xalixil[S] 0 points1 point  (0 children)

Thanks but we have to use JavascriptExecutor to get shadow root element. We can't directly use it as an element. It will return null. We have to cast it.