を呼び出して取得した文字列を取得しましたbuffer-substring
。設定に基づいて、この文字列からテキストを削除する方法はありface
ますか? ランダムな例として:
(save-excursion
(let ((end (point)))
(ignore-errors
(while (not (looking-at "[^][ \t\r\n(){}]+:"))
(backward-sexp)))
SO がそれを強調表示する方法はわかりませんが、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)))