diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-26 19:29:17 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-26 19:31:37 +0100 |
| commit | 1194c0266674ca7cbd3c6051dd05816087feb199 (patch) | |
| tree | c1b11dfa1a1094512b118c95c641a5b5d7b1d7ce /README.org | |
| parent | 1bb3d86ed03534f105d1d8bc38d621b99df44c9f (diff) | |
README: Update pcomplete documentation
Diffstat (limited to 'README.org')
| -rw-r--r-- | README.org | 37 |
1 files changed, 21 insertions, 16 deletions
@@ -290,27 +290,32 @@ define the advice ~corfu-send-shell~ which sends the candidate after insertion. (advice-add #'corfu-insert :after #'corfu-send-shell) #+end_src -Shell completion uses the flexible ~Pcomplete~ mechanism internally, which allows +Shell completion uses the flexible Pcomplete mechanism internally, which allows you to program the completions per shell command. If you want to know more, look -into this [[https://www.masteringemacs.org/article/pcomplete-context-sensitive-completion-emacs][blog post]], which shows how to configure Pcomplete for git commands. -Since Emacs 29 Pcomplete offers the =pcomplete-from-help= function which parses -the --help output of a command and produces completions. This functionality is -similar to the Fish shell, which also uses --help output parsing to dynamically +into the [[https://www.masteringemacs.org/article/pcomplete-context-sensitive-completion-emacs][blog post]], which shows how to configure Pcomplete for git commands. +Since Emacs 29, Pcomplete offers the =pcomplete-from-help= function which parses +the ~--help~ output of a command and produces completions. This functionality is +similar to the Fish shell, which also takes advantage of ~--help~ to dynamically generate completions. -Unfortunately Pcomplete has a few technical issues, which we can work around -with the [[https://github.com/minad/cape][Cape]] library (Completion at point extensions). Cape provides wrappers, -which sanitize the Pcomplete function. Ideally the bugs in Pcomplete should be -fixed upstream. *For now these two advices are strongly recommended to achieve a -sane Eshell experience.* +Unfortunately Pcomplete had a few technical issues on Emacs 28 and older. We can +work around the issues with the [[https://github.com/minad/cape][Cape]] library (Completion at point extensions). +Cape provides wrappers which sanitize the Pcomplete function. If you use Emacs +28 or older installing these advices is strongly recommend such that Pcomplete +works properly. On Emacs 29 the advices are not necessary, since the related +bugs have been fixed. I therefore recommend to not remove the the advices on +Emacs 29 and eventually report any Pcomplete issues upstream, such that they can +be fixed at the root. #+begin_src emacs-lisp - ;; Silence the pcomplete capf, no errors or messages! - (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent) - - ;; Ensure that pcomplete does not write to the buffer - ;; and behaves as a pure `completion-at-point-function'. - (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify) + ;; The advices are only needed on Emacs 28 and older. + (when (< emacs-major-version 29) + ;; Silence the pcomplete capf, no errors or messages! + (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent) + + ;; Ensure that pcomplete does not write to the buffer + ;; and behaves as a pure `completion-at-point-function'. + (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)) #+end_src ** Orderless completion |
