Eshell: Move prompt navigation fix to patch-eshell.el
parent
3720313b24
commit
9540330538
|
@ -50,6 +50,13 @@
|
||||||
;;;
|
;;;
|
||||||
;;; > date +%Z
|
;;; > date +%Z
|
||||||
|
|
||||||
|
;;; TODO: Hour is printed twice. We don't need to set this?
|
||||||
|
;; (setq eshell-ls-date-format (replace-regexp-in-string "^\\+*" "" (getenv "TIME_STYLE")))
|
||||||
|
|
||||||
|
;;; TODO: ls: Sort using locale.
|
||||||
|
|
||||||
|
;;; TODO: `kill -#' does not work.
|
||||||
|
|
||||||
(setq eshell-directory-name (concat emacs-cache-folder "eshell"))
|
(setq eshell-directory-name (concat emacs-cache-folder "eshell"))
|
||||||
|
|
||||||
;;; Use native 'sudo', system sudo asks for password every time.
|
;;; Use native 'sudo', system sudo asks for password every time.
|
||||||
|
@ -69,13 +76,6 @@
|
||||||
eshell-hist-ignoredups t
|
eshell-hist-ignoredups t
|
||||||
eshell-destroy-buffer-when-process-dies t)
|
eshell-destroy-buffer-when-process-dies t)
|
||||||
|
|
||||||
;;; TODO: Hour is printed twice. We don't need to set this?
|
|
||||||
;; (setq eshell-ls-date-format (replace-regexp-in-string "^\\+*" "" (getenv "TIME_STYLE")))
|
|
||||||
|
|
||||||
;;; TODO: ls: Sort using locale.
|
|
||||||
|
|
||||||
;;; TODO: `kill -#' does not work.
|
|
||||||
|
|
||||||
;;; Leave `eshell-highlight-prompt' to t as it sets the read-only property.
|
;;; Leave `eshell-highlight-prompt' to t as it sets the read-only property.
|
||||||
(setq eshell-prompt-function
|
(setq eshell-prompt-function
|
||||||
(lambda nil
|
(lambda nil
|
||||||
|
@ -92,12 +92,13 @@
|
||||||
(setq-default eshell-prompt-regexp "^> ")
|
(setq-default eshell-prompt-regexp "^> ")
|
||||||
|
|
||||||
(with-eval-after-load 'em-term
|
(with-eval-after-load 'em-term
|
||||||
(nconc eshell-visual-commands
|
(dolist (p '("abook" "alsamixer" "cmus" "dtach" "fzf" "htop" "mpsyt" "mpv" "mutt" "ncdu" "newsbeuter" "pinentry-curses" "ranger" "watch" "wifi-menu"))
|
||||||
'("abook" "alsamixer" "cmus" "fzf" "htop" "mpsyt" "mpv" "mutt" "ncdu" "newsbeuter" "pinentry-curses" "ranger" "watch" "wifi-menu"))
|
(add-to-list 'eshell-visual-commands p))
|
||||||
(setq eshell-visual-subcommands
|
(setq eshell-visual-subcommands
|
||||||
'(("git" "log" "l" "lol" "diff" "d" "dc" "show")
|
'(("git" "log" "diff" "show"
|
||||||
("sudo" "wifi-menu")
|
"l" "lol" "d" "dc") ; aliases
|
||||||
("sudo" "vi"))))
|
("sudo" "wifi-menu") ; Arch Linux
|
||||||
|
("sudo" "vi" "visudo"))))
|
||||||
|
|
||||||
;;; Support for Emacs' pinentry
|
;;; Support for Emacs' pinentry
|
||||||
;;; TODO: gpg-agent seems to be misconfigured for mu4e at least:
|
;;; TODO: gpg-agent seems to be misconfigured for mu4e at least:
|
||||||
|
@ -120,7 +121,7 @@
|
||||||
;;; into account. Going to normal mode and back to insert mode works.
|
;;; into account. Going to normal mode and back to insert mode works.
|
||||||
;;;
|
;;;
|
||||||
;;; If we read the alias list here, it means we make commandline-defined aliases persistent.
|
;;; If we read the alias list here, it means we make commandline-defined aliases persistent.
|
||||||
;; (eshell-read-aliases-list)
|
;; (eshell-read-aliases-list)
|
||||||
(dolist
|
(dolist
|
||||||
(alias
|
(alias
|
||||||
'(("l" "ls -1 $*")
|
'(("l" "ls -1 $*")
|
||||||
|
@ -191,27 +192,6 @@ See `eshell' for the numeric prefix ARG."
|
||||||
(switch-to-buffer (car last))
|
(switch-to-buffer (car last))
|
||||||
(eshell (or arg t))))))
|
(eshell (or arg t))))))
|
||||||
|
|
||||||
;;; REVIEW: Emacs' standard functions fail when output has empty lines.
|
|
||||||
;;; This implementation is more reliable.
|
|
||||||
;;; Reported at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27405.
|
|
||||||
(with-eval-after-load 'em-prompt
|
|
||||||
(defun eshell-next-prompt (n)
|
|
||||||
"Move to end of Nth next prompt in the buffer.
|
|
||||||
See `eshell-prompt-regexp'."
|
|
||||||
(interactive "p")
|
|
||||||
(re-search-forward eshell-prompt-regexp nil t n)
|
|
||||||
(when eshell-highlight-prompt
|
|
||||||
(while (not (get-text-property (line-beginning-position) 'read-only) )
|
|
||||||
(re-search-forward eshell-prompt-regexp nil t n)))
|
|
||||||
(eshell-skip-prompt))
|
|
||||||
|
|
||||||
(defun eshell-previous-prompt (n)
|
|
||||||
"Move to end of Nth previous prompt in the buffer.
|
|
||||||
See `eshell-prompt-regexp'."
|
|
||||||
(interactive "p")
|
|
||||||
(backward-char)
|
|
||||||
(eshell-next-prompt (- n))))
|
|
||||||
|
|
||||||
(when (require 'bash-completion nil t)
|
(when (require 'bash-completion nil t)
|
||||||
;; Sometimes `eshell-default-completion-function' does better, e.g. "gcc
|
;; Sometimes `eshell-default-completion-function' does better, e.g. "gcc
|
||||||
;; <TAB>" shows .c files.
|
;; <TAB>" shows .c files.
|
||||||
|
|
|
@ -92,4 +92,26 @@ This is done after all necessary filtering has been done."
|
||||||
(eshell-interactive-print prompt)))
|
(eshell-interactive-print prompt)))
|
||||||
(run-hooks 'eshell-after-prompt-hook)))
|
(run-hooks 'eshell-after-prompt-hook)))
|
||||||
|
|
||||||
|
;;; Fix 27405, expected in Emacs 26.1.
|
||||||
|
;;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27405
|
||||||
|
;;; Emacs' standard functions fail when output has empty lines.
|
||||||
|
;;; The following implementation is more reliable.
|
||||||
|
(with-eval-after-load 'em-prompt
|
||||||
|
(defun eshell-next-prompt (n)
|
||||||
|
"Move to end of Nth next prompt in the buffer.
|
||||||
|
See `eshell-prompt-regexp'."
|
||||||
|
(interactive "p")
|
||||||
|
(re-search-forward eshell-prompt-regexp nil t n)
|
||||||
|
(when eshell-highlight-prompt
|
||||||
|
(while (not (get-text-property (line-beginning-position) 'read-only) )
|
||||||
|
(re-search-forward eshell-prompt-regexp nil t n)))
|
||||||
|
(eshell-skip-prompt))
|
||||||
|
|
||||||
|
(defun eshell-previous-prompt (n)
|
||||||
|
"Move to end of Nth previous prompt in the buffer.
|
||||||
|
See `eshell-prompt-regexp'."
|
||||||
|
(interactive "p")
|
||||||
|
(backward-char)
|
||||||
|
(eshell-next-prompt (- n))))
|
||||||
|
|
||||||
(provide 'patch-eshell)
|
(provide 'patch-eshell)
|
||||||
|
|
Loading…
Reference in New Issue