在 elisp 中将缓冲区中的当前行作为字符串抓取
Grab current line in buffer as a string in elisp
如何在 elisp 中收集缓冲区的当前行作为字符串值?我可以做到,
(let (p1 p2 myLine)
(setq p1 (line-beginning-position) )
(setq p2 (line-end-position) )
(setq myLine (buffer-substring-no-properties p1 p2))
)
但是无论如何我可以在一行中完成,
(with-current-buffer get-current-line)
(thing-at-point 'line t)
但请注意,这也 returns 行尾的任何换行符。
如何在 elisp 中收集缓冲区的当前行作为字符串值?我可以做到,
(let (p1 p2 myLine)
(setq p1 (line-beginning-position) )
(setq p2 (line-end-position) )
(setq myLine (buffer-substring-no-properties p1 p2))
)
但是无论如何我可以在一行中完成,
(with-current-buffer get-current-line)
(thing-at-point 'line t)
但请注意,这也 returns 行尾的任何换行符。