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))
    
  • 相关阅读:
    线段树模板题 contest 线段树 T5
    Guide AHOI2017 洛谷P3720
    静态RMQ模板题 contest 静态RMQ T2
    树状数组模板题 P1904
    AC自动机模板题 P2017
    高精度排序模板题 P1110
    Trie树模板题 P2016
    树状数组套权值线段树
    爬山 启发式合并 / STL
    [POI2011]ROT-Tree Rotations 线段树合并|主席树 / 逆序对
  • 原文地址:https://www.cnblogs.com/yangyingchao/p/3391869.html
Copyright © 2011-2022 走看看