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
([remap org-return] . (lambda () (interactive) (org-return :indent)))
([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
org-entry-get)
:commands (org-return)
@ -2785,6 +2787,8 @@ Note that this workaround is incomplete, as explained in this comment."
(require 'em-hist)
(require 'em-glob))
(require 'db-eshell)
(setenv "PAGER" "cat")
(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
'with-editor-export-editor)
;; Ignoring case when completing file names seems to have a
;; bug: when a ~ is encountered, it is implicitly expaned by
;; `pcomplete-insert-entry, overwriting the prompt as a side
;; effect. Keeping the case as it is does not seem to have
;; this issue. This problem occurs by default only on Windows
;; systems (in all flavors), because this is the only time
;; `pcomplete-ignore-case is non-nil by default.
;; Ignoring case when completing file names seems to have a bug: when a ~ is
;; encountered, it is implicitly expaned by `pcomplete-insert-entry, overwriting the
;; prompt as a side effect. Keeping the case as it is does not seem to have this issue.
;; This problem occurs by default only on Windows systems (in all flavors), because this
;; is the only time `pcomplete-ignore-case is non-nil by default.
(when on-windows
(add-to-list 'eshell-mode-hook
#'(lambda ()
(setq completion-ignore-case nil))))
;; Sometimes, when completing path names and immediately
;; hitting RET, `completion-in-region-mode' still seems to be
;; active; this often happens when calling cd. Then,
;; `post-command-hook' still contains
;; `completion-in-region--postch', which calls some `pcomplete'
;; function to determine whether completion mode should exit.
;; However, after RET (i.e., `eshell-send-input'), we only have
;; an empty prompt, and `pcomplete' just computes all possible
;; functions for completion (doesn't show it, though). This
;; introduces a noticeable amount of delay, which is annoying.
;; Expliticly disabling `completion-in-region-mode' before
;; sending input seems to alleviate the problem.
;; Sometimes, when completing path names and immediately hitting RET,
;; `completion-in-region-mode' still seems to be active; this often happens when calling
;; cd. Then, `post-command-hook' still contains `completion-in-region--postch', which
;; calls some `pcomplete' function to determine whether completion mode should exit.
;; However, after RET (i.e., `eshell-send-input'), we only have an empty prompt, and
;; `pcomplete' just computes all possible functions for completion (doesn't show it,
;; though). This 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
:before #'(lambda (&rest _)
"Disable completion-in-region-mode before sending input."
(when completion-in-region-mode
(completion-in-region-mode -1))))
;; After completing partial inputs, pcomplete wants to add an
;; extra character stored in `pcomplete-termination-string',
;; which is a space by default. When completing paths, this
;; leads to spaces being inserted after every directory within
;; the path, which is annoying. We thus set the value of this
;; variable locally to an empty string, thus silencing this
;; bug. A better way to handle this would be to correctly
;; determine whether the completion is not done yet, by passing
;; `exact' instead of `finished' to the handlers stored in
;; `completion-extra-properties'.
;; After completing partial inputs, pcomplete wants to add an extra character stored in
;; `pcomplete-termination-string', which is a space by default. When completing paths,
;; this leads to spaces being inserted after every directory within the path, which is
;; annoying. We thus set the value of this variable locally to an empty string, thus
;; silencing this bug. A better way to handle this would be to correctly 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
#'(lambda ()
(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
:commands (eshell-previous-prompt