5 ms·
Improving my Emacs experience with completion
- globular-toast 3y agoThe author might want to check out the orderless completion style which goes even further and matches the groups in any order, so in the example the string "emacs articles" would also match (as well as "em art" etc.) I used Emacs full time for more than a decade without fully understanding completion and that meant I wasn't able to tweak it to my liking. Things would break and I didn't understand why. Although I think company is probably the most polished and best in-buffer completion UI there is, using modular components like eglot, orderless and corfu has helped me to understand the various aspects of completion and get it all working how I want it.
- megamix 3y agoHow long did it take to "get it all working"?
- textread 3y agoProfessor Mike says that copy/paste of the example config from their respective readmes is all it takes. See:- https://youtu.be/5ffb2at2d7w https://youtu.be/5ffb2at2d7w
- globular-toast 3y agoI think the most difficult thing was in understanding the roles the various components have. "Completion" means something in Emacs that might not mean what you expect it to mean (but you probably expect that from Emacs anyway). Many tools/packages cover more than one part of the overall solution. Maybe I should write something up to demystify it for others wanting to go down the same path. In the end it took me an evening or two to get it all working.
- textread 3y agoI am a helm user. Am I missing out too much by not checking out Vertico, Embark, Corfu and friends?
- medstrom 3y agoYou're not missing out feature-wise, no. Helm is the original kitchen sink power tool on this front. The Vertico-stack is interesting for different reasons, like simplicity of implementation.
- cmrdporcupine 3y agoI have tried various things for completion, etc over the years, and found Helm just too 'deep' of a topic to dig into... but vertico is the first time any of these things just 'clicked' and it's improved my experience of emacs 10-fold.
- textread 3y agoFor me, helm kinda clicked after a careful reading of its author's blogpost at https://tuhdo.github.io/helm-intro.html https://tuhdo.github.io/helm-intro.html Somehow, I feel like, if I were to configure vertico etc to my liking, I might just end up recreating a ductaped version of helm.
- medstrom 3y agoYou just unlocked a memory of when I found Helm intimidating just because some of its behavior surprised me on my initial tryouts. After reading the manual, it was actually much simpler than it had seemed.
- lvass 3y agoIIRC helm doesn't provide complete-at-point so Corfu would be in a different category. Otherwise no, helm is really featureful and works pretty nice out-of-the-box, those packages are far more lean and probably easier to hack on.
- taeric 3y agoTo be fair to your decade comment, a lot changed in how things were done in that time period. It is also surprising how far dabbrev-expand can get you in most code bases.
- megamix 3y agoOn another note, how many feel Mr Fowler's notes on software engineering are worth reading?
- noelwelsh 3y agoThere is some wisdom in there, but like everything there is a lot of skill in the application of that wisdom. Not all refactorings (to name something for which Martin Fowler is well known) are the same.
- sureglymop 3y agoI also feel sometimes there is a tendency to overcomplicate by taking very simple concepts and ideas and assigning a name or almost "field of research" to them. The main example I can think of is "Dependency Injection". The idea to pass an object to another object (for different purposes, e.g. testing) is pretty simple and understandable. But over time the term " dependency injection" has probably confused a whole lot of people but for some reason a term just had to be coined. I do understand that it's probably not on purpose because the author(s) are deeply studying or thinking about what they are describing (probably more so than the readers) and maybe coming up with new terminology does help them to keep making sense of it all.
- bern4444 3y agoI agree. Dependency injection is 'just' passing an argument to a function or method. Whether that happens via the constructor, some method, or a plain ol' function, its very simple. But naming it dependency injection and ascribing terms like setter injection, or constructor injection or discussing dependency injection frameworks with complicated set up instructions, can make this very simple concept seem significantly more complex and difficult for junior and mid level engineers. All my opinion but this was also my experience.
- megamix 3y agoSo that's what DI is. Took me 7years. Kidding!
- TacticalCoder 3y agoI use that too: ivy / counsel etc. Then to quickly select among the candidates and to not go "arrow down / arrow down / arrow down / arrow down / {tab,enter,whatever}" I use ivy-avy. ivy-avy works like vim's EasyMotion or the older Emacs "ace-jump" mode (inspired by EasyMotion): you keep your eyes on the thing you want to select (or the place on the screen where you want your cursor to go to) and then invoke avy (by using a shortcut very conveniently placed as I use it all the time). Then a letter appears and you hit that letter (requires to be a touch typist as you cannot both keep your eyes on the candidate and look at your keyboard) and boom, you just selected the candidate / moved the cursor. There's no faster way to select / move anywhere on the screen. I'm using that since years (I used to use ace-jump before ivy/avy was a thing). Imagine this list of candidates after I asked to open a file containing the regexp "green" (well it's just a word, but it could be a regexp): /home/jack/work/green.pdf /home/jack/private/greendayschedule.org . . (omit 10 lines here) . /mnt/greenvelvet.txt /mnt/backup/green.cfg Now I invoke "ivy-avy" and the list of candidates becomes this: f/home/jack/work/green.pdf g/home/jack/private/greendayschedule.org n b (omit 10 lines here) c e/mnt/greenvelvet.txt d/mnt/backup/green.cfg And these individual letters appear in another color, so they stand out. To select, say, "mnt/greenvelvet.txt", you just hit the letter 'e'. Done. It's really sweet and it works with nearly everything: selecting a candidate in a list (like a file, a completion, ...), moving the cursor anywhere on the screen, selecting a buffer, etc.
- textread 3y agoIs this the equivalent to calling ~avy-goto-char-timer~ (from a keybinding) whenever inside Helm completion windows? > To select, say, "mnt/greenvelvet.txt", you just hit the letter 'e'. Done. With helm+avy, I need to explicitly press Ctrl+Space to select. But, pressing 'e' does move the caret to the proper line containing '/mnt/greenvelvet.txt' I coudnt find a helm counterpart to 'ivy-avy' package though. --------------------------------------------------------- Edit:- avy-ivy, on pressing 'e' confirms greenvelvet.txt as the selection. It is the helm equivalent of C-n...C-n until reaching '/mnt/greenvelvet.txt' and pressing Return. I was looking for someway to 'helm mark' the line containing '/mnt/greenvelvet.txt' using avy.
- hprotagonist 3y agoorderless and fussy with vertico is real nice.
- iLoveOncall 3y agoA comment that will certainly get me downvoted into oblivion, but I'm always amazed at the amount of time people are willing to waste customizing outdated tools to match 10% of the out-of-the-box capabilities of modern IDEs. And it's not even like he ignores the advantages since he uses IntelliJ for Java!
- lvass 3y agoModern IDEs don't match 10% of Emacs 29's out-of-the box capabilities.
- ParetoOptimal 3y agoIts because editors like emacs don't change on them and personalized workflows can be made smoother or automated. Emacs users believe the tool should be adapted to the user rather than the user adapting to the tool.
- cmrdporcupine 3y agoa) You know you're going to be downvoted and yet b) You still pitch what you're saying in way that is an insult to both the tool and its users. I don't know what to say. Ignorance and antagonism mixed together, consciously... ... Maybe emacs users know something you don't? (FWIW I have been using JetBrains tools' & emacs as well for over a couple decades now [since IntelliJ 3-something back in 2003 if I recall], usually complimentary to each other, not competing. As of last week, I am not renewing my CLion subscription, and work fully in emacs and it's fine.)
- deng 3y agoI'm not downvoting you if you show me a modern IDE that out-of-the-box(!) can do filename completion in the way Martin describes ("type 'articles emacs' to get a list of any file paths that contain 'articles' and 'emacs' in their file path").
- cmrdporcupine 3y agoI believe the JetBrains tools can actually do this (ctrl-shift-N if I recall) and can do it for symbols, filenames, and classes, etc. Keyword match with some fuzzy logic. Though actually I'm not sure if they'll do it on directory name components or just the filename itself. They will, however, have 5x the memory and battery consumption and not be nearly as snappy in response time, nor nearly as customizable.
- billfruit 3y agoI wish code completion in Emacs worked out of the box like modern IDEs. Now it depends on 3rd party LSP servers(that is for intellisense like project and context aware completions) that are not bundled with Emacs. I feel completion is an essential feature for an editor presently and not having it baked in is not a good approach.
- cmrdporcupine 3y agoThere are plenty of emacs "bundles" that configure things up with a whole pile of preset things like this. It doesn't belong in the base emacs setup. The reality is that these kinds of things end up being just a starting place, and rarely satisfy everyone, and they'd bloat startup time etc. etc. It's gotten quite simple in recent years. use-package lsp, use-package company, and hook to enable those for the things you want
- billfruit 3y agoI think those steps are not sufficient, one must have an LSP server itself, before one can use the LSP client inside Emacs.
- cmrdporcupine 3y agoYeah, but you'd have that with VSCode, too. For myself as primarily a Rust developer, rust-analyzer is just part of my toolchain already, so there was no extra step.
- lvass 3y agoLSP servers are such an important part of my workflow that it just makes more sense to manage their installation myself, makes it simpler to track their configurations and version. LSP-mode does ship an ad-hoc package manager if you want that.
- billfruit 3y agoIt may work for you, but base Emacs itself is buildable and usable on many older platforms. But external dependencies like LSPs, not so much. And don't you think the convenience of like installing intellij, and it works fully is very convenient, whereas with Emacs a major component of the workflow, the LSP could be major hassle to get installed.