0
我有一個字符串,我通過調用buffer-substring
得到。有沒有辦法根據它的face
設置從該字符串中刪除文本?作爲一個隨便舉個例子:Emacs從基於字體的字符串中刪除文本
(save-excursion
(let ((end (point)))
(ignore-errors
(while (not (looking-at "[^][ \t\r\n(){}]+:"))
(backward-sexp)))
不知道怎麼會這樣是要強調這一點,但在Emacs,save-excursion
,let
,ignore-errors
和while
都強調作爲關鍵字,和正則表達式參數looking-at
被高亮顯示爲一個字符串。的buffer-substring
返回值看起來像
#(" (save-excursion
(let ((end (point)))
(ignore-errors
(while (not (looking-at \"[^][ \\t\\r\\n(){}]+:\"))
(backward-sexp)))" 0 5 (fontified t) 5 19 (fontified t face font-lock-keyword-face) 19 28 (fontified t) 28 31 (fontified t face font-lock-keyword-face) 31 50 (fontified t) 50 63 (fontified t face font-lock-keyword-face) 63 65 (fontified t) 65 69 (fontified t) 69 74 (fontified t face font-lock-keyword-face) 74 75 (fontified t) 75 92 (fontified t) 92 94 (fontified t face font-lock-string-face) 94 95 (fontified t face (font-lock-negation-char-face font-lock-string-face)) 95 112 (fontified t face font-lock-string-face) 112 115 (fontified t) 115 137 (fontified t))
鑑於例如字符串,我將如何去剝具有face
font-lock-keyword-face
一切嗎?也就是說,我想做能像做
(foo-bar *that-region* 'font-lock-keyword-face)
,並使其返回
(
(((end (point)))
(
((not (looking-at "[^][ \t\r\n(){}]+:"))
(backward-sexp)))
你是什麼意思刪除? –
爲什麼不在你的問題中粘貼這樣一個字符串的例子? – sds
@ abo-abo - 我的意思是「返回字符串的一個副本,而不在特定的'font'' face'中突出顯示部分」。 – Inaimathi