zoukankan      html  css  js  c++  java
  • Adding Completion to (interactive)

     

    Adding Completion to (interactive)

    Author: Tubo

    Question:

    Is there any way to add my own completion to an (interactive) elisp function? Ideally, I'd
    like to pass it a list of strings that it would tab-complete from. I know that using (interactive "D"), (interactive "F") or (interactive "b") give you completion for directories, files and buffer-names respectively, but what about more general inputs?
    

    Answer:

    The argument to interactive need not be a string; if it isn't, it's evaluated to get the list of arguments to pass to the function. Therefore, you can do something like this:
    
    (defun insert-foo-bar-or-baz (arg)
      (interactive
       (list
        (completing-read "Choose one: " '("foo" "bar" "baz"))))
      (insert arg))
    
  • 相关阅读:
    SpringBoot-启动原理解析及源码阅读-todo
    SpringBoot-入门简介和优缺点分析
    《机器学习》笔记 第2章——模型评估与选择: 经验误差与过拟合、评估方法、性能度量、比较检验方法、偏差与方差
    《机器学习》笔记 第1章——绪论 : 基本术语/假设空间的基础概念
    【JS 01】 JS中的JSON.stringify后的json字符串后怎么转为Java中String.class可以直接接受的转义json字符串?
    【Java多线程07】 并发安全读取Shell脚本/命令的输出的INFO流和ERR流
    时序预测 03
    时序预测 02
    时序预测 01
    【搬运链接】美团技术团队
  • 原文地址:https://www.cnblogs.com/yangyingchao/p/3391869.html
Copyright © 2011-2022 走看看