emacs使帧交换缓冲区 [英] emacs make frame switch buffer

查看:142
本文介绍了emacs使帧交换缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在emacs中创建一个将创建一个新帧的功能,然后在该新帧中获取缓冲区列表。我试过这个:

 (defun get-buffer-menu-in-new-frame(arg)
-frame)
(switch-to-buffer-other-frame(list-buffers)))



我在init.el中工作。我补充说:

 (get-buffer-menu-in-new-frame)

然后我运行了eval-buffer。这似乎有效:我有新的框架,它有缓冲区列表(我希望这个结果不是巧合。



但是我试过这个:

 (global-set-key(kbd< f4>)'get-buffer-menu-in-new-框架)

然后我点击了function4键,但我得到:

  recursive-edit:错误的类型参数:commandp,get-buffer-menu-in-new-frame 
pre>

我做错了什么?

解决方案

通过使用 interactive 将您的功能转换为命令。

 (defun get -buffer-menu-in-new-frame()
(interactive)
(switch-to-buffer-other-frame(list-buffers-noselect)))

我也删除了没有使用的参数。


I want to create a function in emacs that will create a new frame and then, in that new frame, fetch the list of buffers. I tried this:

(defun get-buffer-menu-in-new-frame (arg)
(make-frame)
(switch-to-buffer-other-frame ( list-buffers)))

I was working in init.el. I added this to call it:

(get-buffer-menu-in-new-frame)

Then I ran "eval-buffer". This seems to have worked: I got new frame, and it has the buffer list in it (I hope this result was not a coincidence.

But then I tried this:

(global-set-key (kbd "<f4>") 'get-buffer-menu-in-new-frame)

Then I hit the function4 key, but I got:

recursive-edit: Wrong type argument: commandp, get-buffer-menu-in-new-frame

What am I doing wrong?

解决方案

You need to make your function into a command by using interactive.

(defun get-buffer-menu-in-new-frame ()
  (interactive)
  (switch-to-buffer-other-frame (list-buffers-noselect)))

I also removed arg that was not used.

这篇关于emacs使帧交换缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆