emacs - 需要一个 Elisp 函数来推回输入

标签 emacs elisp

我写了一个新版本的“zap-to-char”。它只是突出显示区域而不是杀死它。我认为这会更灵活,因为我们可以选择杀死,或复制,或者只是去这个字符。

这是片段:

(defun new-zap-to-char (arg char)
  (interactive "p\ncZap to char: ")
  (push-mark)
  (setq mark-active t)
  (defun iter-zap ()
    (if (< arg 0)
      (search-forward (char-to-string char) nil nil -1)
      (search-forward (char-to-string char) nil nil 1))
    (if (char-equal char (setq c (read-char)))
        (iter-zap)
        (>>>>here is the "push-back-to-input" function"<<<<))
 (iter-zap))

如您所见,当您键入除“char”之外的输入时,我需要一个函数将“read-char”的结果推回输入。但我不知道 Emacs 是否提供了一个。所以我需要你的帮助。

我希望我已经说清楚了。

最佳答案

你可以试试unread-command-events .

例如:

(push ?a unread-command-events)

关于emacs - 需要一个 Elisp 函数来推回输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7332431/

相关文章:

emacs - Elisp - 从文件中加载表达式作为数据

emacs - 在 emacs 24.3.1 中使用 CEDET

emacs - 如何在Emacs Lisp中求和数字列表?

regex - emacs 语法突出显示数字不是单词的一部分(使用正则表达式?)

emacs - org-mode - 在循环普通列表时隐藏空行

emacs - 等待 comint 模式缓冲区

emacs - 如何捕获 `M-0 <f4>` 事件并将其写入 Emacs 中该格式的缓冲区?

使用 Clojure 开发 Android 应用程序

python - 设置emacs劣质进程提示位置

Emacs 口齿不清 : "Fall through" type for defcustom.