:straight (git-email :repo "https://git.sr.ht/~yoctocell/git-email")
:config (git-email-piem-mode))
#+end_src
+** Java
+*** Evaluate current buffer
+Stolen from https://stackoverflow.com/questions/19953924/how-do-you-run-java-codes-in-emacs
+#+begin_src emacs-lisp
+ (defun java-eval-buffer ()
+ "run current program (that requires no input)"
+ (interactive)
+ (let* ((source (file-name-nondirectory buffer-file-name))
+ (out (file-name-sans-extension source))
+ (class (concat out ".class")))
+ (save-buffer)
+ (shell-command (format "rm -f %s && javac %s" class source))
+ (if (file-exists-p class)
+ (shell-command (format "java %s" out) "*scratch*")
+ (progn
+ (set (make-local-variable 'compile-command)
+ (format "javac %s" source))
+ (command-execute 'compile)))))
+#+end_src
* General text editing
** Indentation
Indent after every change.