Pet*_*r.O 5 emacs command-line elisp eshell
我打算在按RET时为每个提示使用bm.el Visible Bookmarks.我已经设法在某种程度上实现了这一点.如果缺少一些重要问题,请在下面评论我的代码:例如.我不知道我是否需要处理args而不仅仅是将它们传递给默认函数.
当我在空命令行上按RET时,我不想为该行添加书签.在将contol传递给默认函数之前,如何拦截命令行内容eshell-send-input?
(defun eshell-send-input-zAp (&optional use-region queue-p no-newline)
"eshell-send-input, customized to add bm-bookmark to prompt line"
(interactive)
(bm-bookmark-add)
(eshell-send-input use-region queue-p no-newline))
(add-hook 'eshell-mode-hook
#'(lambda ()
(define-key eshell-mode-map
[return]
'eshell-send-input-zAp)))
Run Code Online (Sandbox Code Playgroud)
你的代码看起来不错。如果您阅读 的代码eshell-send-input,您将了解如何获取当前输入。
另请阅读交互式论证。 "P"需要将用户区域传递给eshell-send-input.
(defun eshell-send-input-zAp (&optional use-region queue-p no-newline)
"eshell-send-input, customized to add bm-bookmark to prompt line"
(interactive "*P")
(unless (string-equal (eshell-get-old-input use-region) "")
(bm-bookmark-add))
(eshell-send-input use-region queue-p no-newline))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
364 次 |
| 最近记录: |