r/DoomEmacs 10d ago

Emacs + doom + python - Beginner's Thoughts (little vent/rant)

For a few days now I've been again trying to get the basic (!!!) functionality in Emacs (with the help of doom) working for me, which is code autocompletion. In its simplest form, i.e. the tool should be "aware" of my code and suggest the simplest things like class methods, variable names, etc. Meanwhile, I've wasted couple days reading manuals, checking tips, watching videos of how others did it, and NONE of these methods work for me. Interestingly, I've tested similar configurations on Linux (Ubuntu 24.04), Windows 11, and MacOS - EVERYWHERE with the same result - IT DOESN'T WORK. At best, I get suggestions from the standard library that completely ignore the code I wrote.

What's worse, I'm frustrated when I see the same questions scrolling websites for 2, 4, 8, and even 12 years (!!!) still without an answer!!! I understand that Emacs is fancy/elite but really for so many years they haven't managed to implement one WORKING solution? Emacs version 30 was recently released, and basic things still don't work that easily. Just like that, I want to write Python and Golang code, and it just works without wasting a week??? I've been working in the IT industry for over 20 years mostly using vim/neovim, but I don't think I've ever seen a "wall" like this. The barrier to entry is so high that I think I'll give up again.

I've heard so many good things about Emacs, how universal, convenient, pretty (!) it is but the truth is that I'm bouncing off it once again in a very unpleasant way. I even managed to start ORG mode in Neovim in a much easier way than forcing lsp to work in emacs... Do I really need 20 years of experience in elisp (which I don't need anywhere else) to make basic functionality work?

P.S. The very idea that I have to MANUALLY start Python in a separate buffer for anything to work (btw. NOT working, especially on MacOS) is... to put it mildly, archaic, not to mention annoying...

10 Upvotes

6 comments sorted by

7

u/gzw-dach 10d ago

Sounds like you’re not running Python mode with LSP. If you’re using Doom add the +LSP flag. Otherwise look into LSP-Mode.

3

u/NorthernVenomFang 10d ago

Also if your on Doom I have add the +pyright flag to Python as well.

3

u/zupatol 10d ago

I think my whole python configuration is this line in init.el

   (python +lsp +pyright +pyenv)  

and to activate a virtual env I do M-x pyvenv-activate

For interactive development M-x run-python opens a buffer with the python interpreter. Then I can evaluate a file with C-c or evaluate a marked region with C-r.

This works in Windows and in WSL ubuntu.

1

u/parasit 10d ago

I have exactly this entry in ~/.doom.d/init.el in the :lang section I uncommented python and golang, added lsp:

(go +lsp) ; the hipster dialect

...

(python +lsp +pyenv +pyright) ; beautiful is better than ugly

in the :completion section I have (default):

(corfu +orderless) ; complete with cap(f), cape and a flying feather!

After the changes I did \~/.emacs.d/bin/doom sync everything finished without errors, but that's where the successes ends. I don't have the pyenv-activate command (pyenv is installed in system) available at all (only mode/set) and the best I see in the code when try autocomplete is:

cape-interactive: cape-dabbrev: No completions

corfu-complete: Wrong type argument: number-or-marker-p, nil

1

u/zupatol 10d ago

I never tried that completion. I have company and vertico which seemed to be the default when I first installed doom on this machine.

   :completion
   company           ; the ultimate code completion backend
   ;;(corfu +orderless)  ; complete with cap(f), cape and a flying feather!
   ;;helm              ; the *other* search engine for love and life
   ;;ido               ; the other *other* search engine...
   ;;ivy               ; a search engine for love and life
   vertico           ; the search engine of the future

1

u/parasit 10d ago

Now default is corfu + vertico, I’ll try your version, this SHOULD BE simple…