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))
    
  • 相关阅读:
    Swift中的单例的实现方式
    关于iOS自定义UITabBar的几种方法
    iOS数据持久化(三)
    iOS数据持久化(二)SQLite
    iOS数据持久化(一)
    iOS自定义NavigationBar
    UINavigationController基本使用
    UILabel 整理
    [DEMO]AR 1
    [分享]自主行驶小车idea
  • 原文地址:https://www.cnblogs.com/yangyingchao/p/3391869.html
Copyright © 2011-2022 走看看