[Cleanup] Move eshell-C-d inside the eshell configuration block
This commit is contained in:
parent
cd733501e6
commit
8b560b69f4
@ -736,26 +736,6 @@ to the beginning of the file."
|
||||
(open-line-above)))
|
||||
#+END_SRC
|
||||
|
||||
** EShell related
|
||||
|
||||
*** Delete a character, or close ~eshell~ if nothing to delete
|
||||
:PROPERTIES:
|
||||
:SOURCE: https://ryuslash.org/posts/C-d-to-close-eshell.html
|
||||
:END:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun eshell-C-d ()
|
||||
"Either call `delete-char' interactively or quit."
|
||||
(interactive)
|
||||
|
||||
(condition-case err
|
||||
(call-interactively #'delete-char)
|
||||
(error (if (and (eq (car err) 'end-of-buffer)
|
||||
(looking-back eshell-prompt-regexp nil))
|
||||
(kill-buffer)
|
||||
(signal (car err) (cdr err))))))
|
||||
#+END_SRC
|
||||
|
||||
** ~idm~ (ID manager) related functions
|
||||
|
||||
*** Get specific fields from a record in ~idm~
|
||||
@ -1210,14 +1190,38 @@ Because I’m a sysadmin, too.
|
||||
|
||||
** ~eshell~
|
||||
|
||||
This is a function to delete a character, or close ~eshell~ if there’s nothing to delete. Taken
|
||||
from [[https://ryuslash.org/posts/C-d-to-close-eshell.html][here]].
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun eshell-C-d ()
|
||||
"Either call `delete-char' interactively or quit."
|
||||
(interactive)
|
||||
|
||||
(condition-case err
|
||||
(call-interactively #'delete-char)
|
||||
(error (if (and (eq (car err) 'end-of-buffer)
|
||||
(looking-back eshell-prompt-regexp nil))
|
||||
(kill-buffer)
|
||||
(signal (car err) (cdr err))))))
|
||||
#+END_SRC
|
||||
|
||||
Function to bind it locally to =C-d=.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun gpolonkai/eshell-set-c-d-locally ()
|
||||
(local-set-key (kbd "C-d") #'eshell-C-d))
|
||||
#+END_SRC
|
||||
|
||||
Now set up eshell.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package eshell
|
||||
:config
|
||||
(add-hook 'eshell-mode-hook
|
||||
(lambda () (local-set-key (kbd "C-d") #'eshell-C-d)))
|
||||
:bind
|
||||
(:map gpolonkai/pers-map
|
||||
("e" . eshell)))
|
||||
("e" . eshell))
|
||||
:hook
|
||||
(eshell-mode . gpolonkai/eshell-set-c-d-locally))
|
||||
#+END_SRC
|
||||
|
||||
** ~saveplace~
|
||||
|
Loading…
Reference in New Issue
Block a user