代码之家  ›  专栏  ›  技术社区  ›  Matthew Stopa

emacs:有没有方法将变量或字符串传递到m-x命令中?

  •  2
  • Matthew Stopa  · 技术社区  · 15 年前

    我有一个名为go to url的命令,我在lisp代码中调用该命令,它打开一个网页,我只是将一个值字符串传递给它,因此:

    (go-to-url "www.yahoo.com")
    

    不过,最好从m-x命令行使用这个函数。有办法吗?我试过的都没用

    3 回复  |  直到 13 年前
        1
  •  11
  •   Community CDub    8 年前

    (defun go-to-url (url)
      (interactive "sURL: ")
      (do-your-stuff url))
    

    go-to-url M-x: go-to-url

    Emacs: Is there a way to create a interactive script using Emacs?

        2
  •  1
  •   justinhj    15 年前

        3
  •  0
  •   Drew    13 年前

    Icicles insert a string that was saved in a variable or a register

    icicle-input-string

    icicle-save-string-to-variable