私は独自のカスタムカラーテーマを開発してきましたが、カーソルの下のテキストに影響を与えるフォント面のリストを取得できれば非常に便利です。
Textmateのshowcurrentscopeコマンドのようなものです。
これにより、Mxのcustomize-faceを実行し、使用可能なオプションを調べて、現在使用している単語に影響を与えるオプションを推測する手間を省くことができます。
何か案は?
私は独自のカスタムカラーテーマを開発してきましたが、カーソルの下のテキストに影響を与えるフォント面のリストを取得できれば非常に便利です。
Textmateのshowcurrentscopeコマンドのようなものです。
これにより、Mxのcustomize-faceを実行し、使用可能なオプションを調べて、現在使用している単語に影響を与えるオプションを推測する手間を省くことができます。
何か案は?
what-cursor-position
接頭辞付きの引数は、他の情報の中でも特に、ポイントの下の面を示します。
キーボードショートカットはCuCx=です。
出力例(faceプロパティは最後の段落に示されています):
position: 5356 of 25376 (21%), column: 4
character: r (displayed as r) (codepoint 114, #o162, #x72)
preferred charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x72
syntax: w which means: word
category: .:Base, L:Left-to-right (strong), a:ASCII, l:Latin, r:Roman
buffer code: #x72
file code: #x72 (encoded by coding system undecided-unix)
display: by this font (glyph code)
nil:-apple-Monaco-medium-normal-normal-*-12-*-*-*-m-0-iso10646-1 (#x55)
Character code properties: customize what to show
name: LATIN SMALL LETTER R
general-category: Ll (Letter, Lowercase)
decomposition: (114) ('r')
There are text properties here:
face org-level-2
fontified t
[back]
Mxdescribe-face
what-face
次のコードで定義できます。
(defun what-face (pos)
(interactive "d")
(let ((face (or (get-char-property (pos) 'read-face-name)
(get-char-property (pos) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
その後、
M-x what-face
現在のポイントで見つかった顔を印刷します。
(組み込まれていないことを指摘してくれたthedzwhat-face
に感謝します。)
トレイの顔は正しい軌道に乗っています。それは私をこれを持っていたメーリングリストの電子メールに導きました:
(defun what-face (pos)
(interactive "d")
(let ((face (or (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
「what-face」コードにバグがあります。関数は引数として「pos」を取りますが、顔を取得するときにそれを使用しません。代わりに、メッセージが後でposを要求しても、「(point)」を使用します。 「%dに顔がない」場合。
@tray関数を試しましたが、機能しませんでした。@thedz定義は機能します。
(defun what-face (pos)
(interactive "d")
(let ((face (or (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
いくつかの調査の後、私はその理由を見つけました:
(point)
ポイントの値を整数として返す関数です。pos
(interactive "d")
ポイントの位置となる戻り値を整数として取得します。get-char-property
位置を期待します。この場合、関数によって与えられます(point)
。