开发者

Property lists in elisp

I know little elisp, and I'm trying to figure out how to call a function that takes a property list as one of its arguments. The particular function is rudel-join-session from the Rudel package; I'm trying to set it up so Rudel will automatically join a session when Emacs starts. I'm not sure how property lists work, so I tried doing this:

(rudel-join-session (list :backend 'obby
                          :host "foo"
                          :port 6522
                          :username "username"
                          :color "blue"
          开发者_JAVA技巧                :global-password ""
                          :user-password ""
                          ))

I'm getting the error:

Wrong type argument: listp, obby

I assume it's from using property lists wrong. Any idea what the correct syntax is?


No, that's a correct property list. I notice this snippet in rudel.el:

(let* ((backend    (cdr (plist-get info :backend)))

That means that the :backend parameter is expected to be a cons cell. All of the documentation I can find presumes that rudel-join-session is being called interactively, in which case the backend parameter is being generated programmatically, and I can't figure out from a casual perusal of the code just what it's supposed to be. But the first thing I'd try is this:

(rudel-join-session (list :backend '(dummy . obby) ...))

That way the expression (cdr (plist-get info :backend)) will evaluate to the symbol obby, which may be what's expected by the rest of the code.


In addition, you may want to look at the content of rudel-session-initiation.el.

That file contains the variable rudel-configured-sessions the documentation string of which explains "session information property lists" in more detail.

In the same file, there is rudel-session-initiation-adjust-info which resolves backend references in plists by replacing them with the actual backend objects. What this function does is replacing a backend name like 'obby or "obby" with a cons-cell of the form ('obby . #<backend object>). Internally, this uses rudel-backend-get as you suspected.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜