English 中文(简体)
模拟微型卫星投入
原标题:Simulate minibuffer input in Emacs

I m 寻求一种办法模拟小型布置投入。 因此,~func从小型面包店获得一些投入,并与之做一些事。 问题是,我不得不从其他职能-func上打电话,而且我需要以互动的方式来发言,以便我只能通过一个论点。

(defun some-func (arg)
  (interactive "*sEnter something: ")
  ;; Do something with arg
  )

(defun calling-func ()
  (call-interactively  some-func)
  ;; Type to minibuffer
  )

任何想法?

感谢!

最佳回答

探讨你为什么需要以互动的方式来形容其他职能,或许是令人感兴趣的。

这里有“召唤”互动功能的实例,并向小型广播公司发送案文。 你们只是使用关键板材:

(defun my-call-find-file (something)
  "An example of how to have emacs  interact  with the minibuffer
use a kbd macro"
  (interactive "sEnter something:")
  (let ((base-vector [?M-x ?f ?i ?n ?d ?- ?f ?i ?l ?e return]))
    ;; create new macro of the form
    ;; M-x find-file RET <userinput> RET
    (execute-kbd-macro (vconcat base-vector 
                                (string-to-vector something) 
                                (vector  return)))))

有关文件为:Key板 Macros

问题回答

我与宏观 st合。 审理这些不同案件:

(1) 当整个病媒齐头并进时!

(defun a ()
  (interactive)
  (execute-kbd-macro [?M-x ?l ?i ?n ?u ?m ?- ?m ?o ?d ?e return]))

2) 但是,当我分裂时,它就没有了。

(defun a ()
  (interactive)
  (b)
  (c)
  (d))

(defun b ()
  (execute-kbd-macro [?M-x]))

(defun c ()
  (execute-kbd-macro [?l ?i ?n ?u ?m ?- ?m ?o ?d ?e]))

(defun d ()
  (execute-kbd-macro (vector  return)))

3) 把它作为扼杀手段,也不可行。

(defun a ()
  (interactive)
  (execute-kbd-macro (string-to-vector "M-x linum-mode RET")))

(defun a ()
  (interactive)
  (execute-kbd-macro "M-x linum-mode RET"))

我实际上需要把这些事件联系在一起。 因此,我是否需要在病媒方面使用vconcat?





相关问题
suppress additional braces in emacs electric mode

I started using ruby-electric-mode. I like it except that I am used to closing open brackets myself (the other pairing are still useful to me). How can I make emacs suppress additional brackets when ...

Setting up an emacs environment in windows?

I am currently constrained to a windows dev box and I want to migrate my projects from eclipse to emacs. What are some good references on setting up an emacs dev environment for windows? Anything ...

Emacs Setting which-function-mode

I would like to have which-function-mode on by default when I open up Emacs. I ve added the following lines to my .emacs file. (setq which-func-mode t) (setq which-function-mode t) When I open ...

Enabling go mode for emacs

I don t seem to be able to enable a go mode for emacs. C mode doesn t work without semicolons. The best I have found is the JavaScript mode by Karl Landstrom, since JavaScript also doesn t require ...

Custom Emacs key bindings are not working

The key bindings I ve defined in my .emacs file aren t working. Here s the file: ;init modes (menu-bar-mode 0) (tool-bar-mode 0) (cua-mode) (column-number-mode) (fset perl-mode cperl-mode) (cperl-...

eval during emacs lisp macro expansion

How can I fix the simple macro foo in (elisp)Eval During Expansion? None of the followings work: (defmacro foo1 (a) `(setq (eval ,a) t)) (defmacro foo2 (a) `(setq ,(eval a) t)) (defmacro foo3 (...

Get local cvs comment history when committing file/s in emacs

I often commit files with similar cvs comment but not in a single operation. I would like to able to bring up previous comments I ve used in a previous commit when I am in the process of writing a ...

热门标签