• 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))
    
  • 相关阅读:
    C#内存释放(垃圾回收)
    C#内存释放(垃圾回收)
    C# winform窗口打开特效及窗口位置居中
    QString 字符串操作
    qt exe文件添加图标
    Qt 多语言转换
    加密算法比较
    C语言中最常用标准库函数
    fprintfAndFscanf简单操作
    vs使用fscanf和fprintf错误警告处理
  • 原文地址:https://www.cnblogs.com/yangyingchao/p/3391869.html
Copyright © 2020-2023  润新知