定义一个emacs命令,调用另一个emacs命令(保留交互式东西) [英] Define an emacs command that calls another emacs command (preserving interactive stuff)

查看:200
本文介绍了定义一个emacs命令,调用另一个emacs命令(保留交互式东西)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何定义一个emacs命令X执行某事,然后调用另一个emacs命令Y,并还复制命令Y的交互式界面?

How can I define an emacs command X that does something and then calls another emacs command Y and also copying the interactive interface of the command Y too?

用case-fold-search的临时性切换值定义查询替换的替换版本:

I want to define an altenative version of query-replace with temporarilly toggled value of case-fold-search:

(defun alt-query-replace (a b c d e)
  (interactive)
  (let ((case-fold-search (not case-fold-search))
    (query-replace a b c d e)))

这不工作当我调用alt-query-replace时,它说错误的参数数我需要检查查询替换的源代码或有一个一般的方法?

This doesn't work. When I call alt-query-replace, it says "wrong number of arguments". I want the interactive interface of alt-query-replace to be the same as query-replace. Do I need to inspect the source code of query-replace or is there a general approach?

推荐答案

使用调用交互方式:


(defun alt-query-replace ()
  (interactive)
  (let ((case-fold-search (not case-fold-search)))
    (call-interactively 'query-replace)))

这篇关于定义一个emacs命令,调用另一个emacs命令(保留交互式东西)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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