Compare commits

...

3 Commits

Author SHA1 Message Date
1b61d8f2db
Realign some comments to fit wider fill-column 2025-09-12 20:20:49 +02:00
1da79e1ac4
Use default completion in eshell to mimic standard shell behavior
Using vertico to complete file names feels irritating – I just want to have completion automatically
until a common prefix and will navigate from there with additional input or wildcards.
2025-09-12 20:19:33 +02:00
0b80424a6d
Disable default key binding to toggle Org comments
I don't need this and often enough hit the key by accident.
2025-09-12 17:50:30 +02:00

63
init.el
View File

@ -743,7 +743,9 @@ split horizontally again, but this extra work should not matter much."
:bind (:map org-mode-map :bind (:map org-mode-map
([remap org-return] . (lambda () (interactive) (org-return :indent))) ([remap org-return] . (lambda () (interactive) (org-return :indent)))
([remap org-clock-goto] . db/org-clock-goto-first-open-checkbox) ([remap org-clock-goto] . db/org-clock-goto-first-open-checkbox)
([remap org-goto] . consult-org-heading)) ([remap org-goto] . consult-org-heading)
("C-c ;" . nil) ; Disable default binding for `org-toggle-comment'
)
:autoload (org-get-todo-state :autoload (org-get-todo-state
org-entry-get) org-entry-get)
:commands (org-return) :commands (org-return)
@ -2785,6 +2787,8 @@ Note that this workaround is incomplete, as explained in this comment."
(require 'em-hist) (require 'em-hist)
(require 'em-glob)) (require 'em-glob))
(require 'db-eshell)
(setenv "PAGER" "cat") (setenv "PAGER" "cat")
(add-to-list 'eshell-command-completions-alist (add-to-list 'eshell-command-completions-alist
@ -2796,51 +2800,48 @@ Note that this workaround is incomplete, as explained in this comment."
(add-hook 'eshell-mode-hook (add-hook 'eshell-mode-hook
'with-editor-export-editor) 'with-editor-export-editor)
;; Ignoring case when completing file names seems to have a ;; Ignoring case when completing file names seems to have a bug: when a ~ is
;; bug: when a ~ is encountered, it is implicitly expaned by ;; encountered, it is implicitly expaned by `pcomplete-insert-entry, overwriting the
;; `pcomplete-insert-entry, overwriting the prompt as a side ;; prompt as a side effect. Keeping the case as it is does not seem to have this issue.
;; effect. Keeping the case as it is does not seem to have ;; This problem occurs by default only on Windows systems (in all flavors), because this
;; this issue. This problem occurs by default only on Windows ;; is the only time `pcomplete-ignore-case is non-nil by default.
;; systems (in all flavors), because this is the only time
;; `pcomplete-ignore-case is non-nil by default.
(when on-windows (when on-windows
(add-to-list 'eshell-mode-hook (add-to-list 'eshell-mode-hook
#'(lambda () #'(lambda ()
(setq completion-ignore-case nil)))) (setq completion-ignore-case nil))))
;; Sometimes, when completing path names and immediately ;; Sometimes, when completing path names and immediately hitting RET,
;; hitting RET, `completion-in-region-mode' still seems to be ;; `completion-in-region-mode' still seems to be active; this often happens when calling
;; active; this often happens when calling cd. Then, ;; cd. Then, `post-command-hook' still contains `completion-in-region--postch', which
;; `post-command-hook' still contains ;; calls some `pcomplete' function to determine whether completion mode should exit.
;; `completion-in-region--postch', which calls some `pcomplete' ;; However, after RET (i.e., `eshell-send-input'), we only have an empty prompt, and
;; function to determine whether completion mode should exit. ;; `pcomplete' just computes all possible functions for completion (doesn't show it,
;; However, after RET (i.e., `eshell-send-input'), we only have ;; though). This introduces a noticeable amount of delay, which is annoying.
;; an empty prompt, and `pcomplete' just computes all possible ;; Expliticly disabling `completion-in-region-mode' before sending input seems to
;; functions for completion (doesn't show it, though). This ;; alleviate the problem.
;; introduces a noticeable amount of delay, which is annoying.
;; Expliticly disabling `completion-in-region-mode' before
;; sending input seems to alleviate the problem.
(advice-add 'eshell-send-input (advice-add 'eshell-send-input
:before #'(lambda (&rest _) :before #'(lambda (&rest _)
"Disable completion-in-region-mode before sending input." "Disable completion-in-region-mode before sending input."
(when completion-in-region-mode (when completion-in-region-mode
(completion-in-region-mode -1)))) (completion-in-region-mode -1))))
;; After completing partial inputs, pcomplete wants to add an ;; After completing partial inputs, pcomplete wants to add an extra character stored in
;; extra character stored in `pcomplete-termination-string', ;; `pcomplete-termination-string', which is a space by default. When completing paths,
;; which is a space by default. When completing paths, this ;; this leads to spaces being inserted after every directory within the path, which is
;; leads to spaces being inserted after every directory within ;; annoying. We thus set the value of this variable locally to an empty string, thus
;; the path, which is annoying. We thus set the value of this ;; silencing this bug. A better way to handle this would be to correctly determine
;; variable locally to an empty string, thus silencing this ;; whether the completion is not done yet, by passing `exact' instead of `finished' to
;; bug. A better way to handle this would be to correctly ;; the handlers stored in `completion-extra-properties'.
;; determine whether the completion is not done yet, by passing
;; `exact' instead of `finished' to the handlers stored in
;; `completion-extra-properties'.
(add-hook 'eshell-mode-hook (add-hook 'eshell-mode-hook
#'(lambda () #'(lambda ()
(setq-local pcomplete-termination-string ""))) (setq-local pcomplete-termination-string "")))
(require 'db-eshell))) ;; Use default completion functions to allow partial completion of candidates that can
;; then be extended with wildcards and the like. This is what I am used to in shells
;; outside of Emacs.
(add-hook 'eshell-mode-hook
#'(lambda ()
(setq-local completion-in-region-function #'completion--in-region)))))
(use-package em-prompt (use-package em-prompt
:commands (eshell-previous-prompt :commands (eshell-previous-prompt