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))
    
  • 相关阅读:
    GC 的认识
    SSRF 攻击技术
    文件包含漏洞
    文件的上传和下载
    XSS
    SQL注入工具 sqlmap
    自动化测试框架
    mac配置环境变量
    pycharm与git想集成 上传下载代码
    测试人员需要掌握的linux基本操作
  • 原文地址:https://www.cnblogs.com/yangyingchao/p/3391869.html
Copyright © 2011-2022 走看看