我想要改变一个小模式行为取决于一个主要模式。现在我的写作方式如下。
(defun foo (input)
(if (or
(eql major-mode 'foo-mode)
(eql major-mode 'foo1-mode)
(eql major-mode 'foo2-mode))
(myfunc-one input)
(myfunc-two input)))我工作,但我不想写类似的条件声明3次。我怎样才能写得更有效率?
发布于 2013-07-25 22:04:02
(defun foo (input)
(if (memql major-mode '(foo-mode foo1-mode foo2-mode))
(myfunc-one input)
(myfunc-two input)))发布于 2013-07-26 13:43:47
您通常不想直接测试major-mode。相反,您希望使用(derived-mode-p 'foo1-mode 'foo2-mode 'foo3-mode)。
https://stackoverflow.com/questions/17869551
复制相似问题