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))
    
  • 相关阅读:
    Siege 3.0 正式版发布,压力测试工具
    Pomm 1.1.2 发布,专为 PG 设计的 ORM 框架
    Whonix 0.5.6 发布,匿名通用操作系统
    国内开源 java cms,Jspxcms 2.0 发布
    EZNamespaceExtensions.Net v2013增加对上下文菜单、缩略图、图标、属性表的支持
    GNU Guile 2.0.9 发布,Scheme 实现
    jdao 1.0.4 发布 轻量级的orm工具包
    OpenSearchServer 1.4 RC4 发布
    Percona Server for MySQL 5.5.3030.2
    Samba 4.0.5 发布
  • 原文地址:https://www.cnblogs.com/yangyingchao/p/3391869.html
Copyright © 2011-2022 走看看