抓取缓冲区中的当前行作为elisp中的字符串 [英] Grab current line in buffer as a string in elisp
本文介绍了抓取缓冲区中的当前行作为elisp中的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在elisp中将缓冲区的当前行收集为字符串值?我可以做到这一点,
How can i collect the buffer's current line as a string value in elisp? i can do this,
(let (p1 p2 myLine)
(setq p1 (line-beginning-position) )
(setq p2 (line-end-position) )
(setq myLine (buffer-substring-no-properties p1 p2))
)
但是我仍然可以在一行中做到这一点吗?
but is there anyway i can do it in one line as,
(with-current-buffer get-current-line)
推荐答案
使用 thing-at-点
:
(thing-at-point 'line t)
但请注意,这也会在行尾返回换行符。
but note that this also returns any newline at the end of the line.
这篇关于抓取缓冲区中的当前行作为elisp中的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文