Reorganize section and simplify minibuffer configuration

This commit is contained in:
Gerard Vermeulen 2022-12-12 08:09:19 +01:00
parent da83d11130
commit 7a27545c1a

View File

@ -308,27 +308,6 @@ The [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ a
(add-to-list 'initial-frame-alist '(width . 180))) (add-to-list 'initial-frame-alist '(width . 180)))
#+end_src #+end_src
* [[https://git.savannah.gnu.org/cgit/emacs.git/tree/admin/notes/tree-sitter/starter-guide?h=feature/tree-sitter][Emacs Tree-sitter]]
:PROPERTIES:
:CUSTOM_ID: sec:emacs-tree-sitter
:END:
#+caption[Customize Emacs Tree-sitter]:
#+caption: Customize Emacs Tree-sitter.
#+name: lst:customize-emacs-tree-sitter
#+begin_src emacs-lisp
(when (require 'treesit nil t)
;; https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg01372.html
(let ((tselp (expand-file-name "~/VCS/tree-sitter-module/dist/")))
(when (file-exists-p tselp)
(add-to-list 'treesit-extra-load-path tselp)
;; Does not play nicely with eglot:
;; (setq major-mode-remap-alist '((python-mode . python-ts-mode)))
;; Plays nicely with eglot:
(add-to-list 'auto-mode-alist
`(,(rx ".py" (opt "[iw]") eos) . python-ts-mode)))))
#+end_src
* [[info:emacs#Package Installation][Install the selected packages (info)]] * [[info:emacs#Package Installation][Install the selected packages (info)]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:install-selected-packages :CUSTOM_ID: sec:install-selected-packages
@ -397,6 +376,27 @@ the contents of packages and allows to update packages to the latest version.
ok)) ok))
#+end_src #+end_src
* [[https://git.savannah.gnu.org/cgit/emacs.git/tree/admin/notes/tree-sitter/starter-guide?h=feature/tree-sitter][Emacs Tree-sitter]]
:PROPERTIES:
:CUSTOM_ID: sec:emacs-tree-sitter
:END:
#+caption[Customize Emacs Tree-sitter]:
#+caption: Customize Emacs Tree-sitter.
#+name: lst:customize-emacs-tree-sitter
#+begin_src emacs-lisp
(when (require 'treesit nil t)
;; https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg01372.html
(let ((tselp (expand-file-name "~/VCS/tree-sitter-module/dist/")))
(when (file-exists-p tselp)
(add-to-list 'treesit-extra-load-path tselp)
;; Does not play nicely with eglot:
;; (setq major-mode-remap-alist '((python-mode . python-ts-mode)))
;; Plays nicely with eglot:
(add-to-list 'auto-mode-alist
`(,(rx ".py" (opt "[iw]") eos) . python-ts-mode)))))
#+end_src
* [[info:emacs#Faces][Text faces or styles (info)]] * [[info:emacs#Faces][Text faces or styles (info)]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:text-faces-or-styles :CUSTOM_ID: sec:text-faces-or-styles
@ -823,6 +823,27 @@ by experienced Emacs users.
(define-key dired-mode-map (kbd "Y") #'dired-rsync)) (define-key dired-mode-map (kbd "Y") #'dired-rsync))
#+end_src #+end_src
* [[info:emacs#Completion Styles][Minibuffer completion styles (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:minibuffer-completion-styles
:END:
Listing [[lst:configure-minibuffer-completion-styles][configure minibuffer completion styles]] implements ideas of the post
[[https://www.masteringemacs.org/article/understanding-minibuffer-completion][Understanding minibuffer completion]].
#+caption[Configure =minibuffer= completion styles]:
#+caption: Configure =minibuffer= completion styles.
#+name: lst:configure-minibuffer-completion-styles
#+begin_src emacs-lisp
(when (require 'minibuffer nil 'noerror)
;; https://www.masteringemacs.org/article/understanding-minibuffer-completion
(custom-set-variables
'(completion-category-overrides
'((file (styles basic substring))))
'(completion-ignore-case nil)
'(completion-styles '(basic flex partial-completion substring))))
#+end_src
* [[info:elisp#Processes][Processes (info)]] * [[info:elisp#Processes][Processes (info)]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:processes :CUSTOM_ID: sec:processes
@ -1230,8 +1251,7 @@ where the order is that of [[https://github.com/bdarcus/citar#installation][enha
steps below. steps below.
Finally, [[https://company-mode.github.io/][company: a modular complete-anything framework for Emacs]] provides Finally, [[https://company-mode.github.io/][company: a modular complete-anything framework for Emacs]] provides
completion in any buffer and [[#sec:minibuffer-history-completion][minibuffer-history-completion]] provides completion completion in any buffer.
on previous input in the minibuffer.
** [[info:vertico#Top][Vertico (info)]] ** [[info:vertico#Top][Vertico (info)]]
:PROPERTIES: :PROPERTIES:
@ -1488,44 +1508,6 @@ Listing [[lst:configure-company]] configures =company=.
(add-hook hook #'company-mode))) (add-hook hook #'company-mode)))
#+end_src #+end_src
** [[https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00802.html][Minibuffer history completion]]
:PROPERTIES:
:CUSTOM_ID: sec:minibuffer-history-completion
:END:
See [[https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00802.html][Juri Linkov (Emacs Developer mailing list)]] for how to allow completion on
previous input in the minibuffer. Listing
[[lst:enable-minibuffer-history-completion]] enables minibuffer history completion.
#+caption[Enable =minibuffer-history-completion=]:
#+caption: Enable =minibuffer-history-completion=.
#+name: lst:enable-minibuffer-history-completion
#+begin_src emacs-lisp
(when (require 'minibuffer nil 'noerror)
;; https://www.masteringemacs.org/article/understanding-minibuffer-completion
(custom-set-variables
'(completion-category-overrides '((file (styles basic substring))))
'(completion-ignore-case nil)
'(completion-styles '(flex partial-completion substring)))
(defun minibuffer-setup-history-completions ()
(unless (or minibuffer-completion-table minibuffer-completion-predicate)
(setq-local minibuffer-completion-table
(symbol-value minibuffer-history-variable))))
(add-hook 'minibuffer-setup-hook 'minibuffer-setup-history-completions)
;; Adapted from minibuffer-complete:
(defun minibuffer-complete-history ()
"Allow minibuffer completion on previous input."
(interactive)
(completion-in-region (minibuffer--completion-prompt-end) (point-max)
(symbol-value minibuffer-history-variable)
nil))
(define-key minibuffer-local-map (kbd "C-<tab>") #'minibuffer-complete-history))
#+end_src
* [[info:emacs#Search][Search and replace (info)]] * [[info:emacs#Search][Search and replace (info)]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:search-replace :CUSTOM_ID: sec:search-replace