我想做
(destructuring-bind (start end) (bounds-of-thing-at-point 'symbol))
Run Code Online (Sandbox Code Playgroud)
但是bounds-of-thing-at-point返回一个cons单元而不是列表,所以
destructuring-bind不起作用.什么可以适用于这种情况?
小智 20
由于destructuring-bind是cl包中的宏,因此有必要查看Common Lisp文档以获取更多示例.
此页面显示宏的语法.请注意(wholevar reqvars optvars . var).虽然我不确定cl版本destructuring-bind实际上支持所有不太常见的情况(许多关键字只有在与Common Lisp宏/函数一起使用时才有意义,但在Emacs Lisp中没有那个含义).
从而:
(destructuring-bind (start . end) (bounds-of-thing-at-point 'symbol) ;...)
Run Code Online (Sandbox Code Playgroud)
应该管用.
我用了
(pcase-let ((`(,start . ,end) (bounds-of-thing-at-point 'symbol)))
...)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2272 次 |
| 最近记录: |