我有以下函数来打印指向*scratch*缓冲区的行,
(defun print-line ()
(print (thing-at-point 'line) (get-buffer "*scratch*")))
Run Code Online (Sandbox Code Playgroud)
但它甚至打印出像这样的精彩信息
#(" OFFICE
" 0 2 (fontified t org ...
Run Code Online (Sandbox Code Playgroud)
如何丢弃已完成信息的打印.
phi*_*ils 16
扩展Daimrod提到buffer-substring-no-properties......
M-x apropos RET no-properties RET
buffer-substring-no-properties
Function: Return the characters of part of the buffer, without the
text properties.
field-string-no-properties
Function: Return the contents of the field around POS, without text
properties.
insert-buffer-substring-no-properties
Function: Insert before point a substring of BUFFER, without text
properties.
match-string-no-properties
Function: Return string of text matched by last search, without text
properties.
minibuffer-contents-no-properties
Function: Return the user input in a minibuffer as a string, without
text-properties.
substring-no-properties
Function: Return a substring of STRING, without text properties.
Run Code Online (Sandbox Code Playgroud)
您可以在手册中阅读有关文本属性的信息:
M-: (info"(elisp)文字属性") RET
在操作org-table中的字符串时,我需要类似于eredis的东西.您可以使用`set-text-properties'在显示字符串时删除它们.
(defun strip-text-properties(txt)
(set-text-properties 0 (length txt) nil txt)
txt)
(defun print-line ()
(print (strip-text-properties
(thing-at-point 'line))
(get-buffer "*scratch*")))
Run Code Online (Sandbox Code Playgroud)