0

I am not a Java guy at all, but I mess with it quite often for university reasons. I have used this awesome post by peter goldsborough to set up eclim. Which is nice! But this also requires a lot of setup in order to work. I have also use this awesome package called maghanada to set up a cool java environment that is much more portable but lacks refactoring features.

I wish I could load eclim, if my current username is cescoferraro, meaning I am on one of my machines. And load meghanada if I am somewhere else where I am usually just an id number like 34252354, and probably wont have neither time nor permission enough to perform a eclim installation.

(use-package eclim :ensure t :if (not(equals os/username "cescoferraro")) :config (progn (...)))
(use-package mehganada :ensure t :if (equals os/username "cescoferraro") :config (progn (...)))
  • 3
    Are you looking for user-login-name? – npostavs Apr 28 '17 at 18:27
  • You can also retrieve environment variables, e.g. (getenv "USERNAME") (or some other env variable available on your OS). But I think user-login-name is looking for these same variables and is a better way to go. – glucas Apr 28 '17 at 18:51
  • Thanks guys! I will give it a go asap. I am a emacs newbie – CESCO Apr 28 '17 at 19:44
  • 2
    Actually the best way would be to check if you have eclim installed, then your config will automagically work regardless of username. Something like (find-executable "eclimd"). – npostavs Apr 29 '17 at 12:41
  • Good point. The use-package config would just be :if (executable-find "eclimd"). @npostavs -- if you put your two suggestions in an answer I think it could be accepted. – glucas Apr 30 '17 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.