こないだの,文字の16進表示とか。

(format "%x" ?'\e') について

format 関数については,Help 参照。上記のようにつかえると。
printf っぽいですね。


んで,このクエスチョンマークはなんじゃい?
というところへ疑問が移るわけです。
しばし Web のマニュアルを眺める。ほうほう。


emacs lisp では,文字は,クエスチョンマークを頭にくっつけるわけですね。
へぇ〜,知らんかったでごわす。ま,この関数自体の存在,
いや,Emacs Lisp 自体ほとんどしらんですたい。
てか,そのものずばりが書いてあったでごわす。

The usual read syntax for alphanumeric characters is a question mark followed by the character; thus, `?A' for the character A, `?B' for the character B, and `?a' for the character a.

For example:

?Q => 81 ?q => 113

?\a => 7 ; control-g, C-g
?\b => 8 ; backspace, , C-h
?\t => 9 ; tab, , C-i
?\n => 10 ; newline, C-j
?\v => 11 ; vertical tab, C-k
?\f => 12 ; formfeed character, C-l
?\r => 13 ; carriage return, , C-m
?\e => 27 ; escape character, , C-[
?\s => 32 ; space character,
?\\ => 92 ; backslash character, \
?\d => 127 ; delete character, <DEL> # 不等号を全角にしてます。
引用元:
http://www.gnu.org/software/emacs/manual/html_node/elisp/Basic-Char-Syntax.html#Basic-Char-Syntax


なるほどなるほど。


> これを見て Ctrl + [ を入力することで minibuffer に ESC と表示されますね。
されます,されます。
この方法も簡単でいいですね。


うんうん,*scratch* バッファを使用してやるのが,一番気持ちいいですね。
ありがとう Plus たん。

mcomplete の件

とりあえず mcomplete-permissive-completion-map-alist のコメントに
minibuffer-local-completion-map とあるので、
その内容を C-h v minibuffer-local-completion-map
(もしくは f1 v, M-x describe-variable)で見てみると
(10 . exit-minibuffer)
(13 . exit-minibuffer)
と出てきます。
キーコード 10 は Ctrl + アルファベットの10番目、すなわち C-j です。
同様に キーコード 13 は C-m または RET です。

なんと!! そんなアプローチ方法があるんですね。
なるほど,起動中に変数対して割り当てられている値を見ちゃうよ奥義。
Plus たん,かわいいよ。Plus たん。

次にコマンド名からキーバインドを探してみます。
minibuffer 入力時に実行されるので、例えば C-x C-f した状態で
C-h w exit-minibuffer (もしくは f1 w, M-x where-is) と入力すると
minibuffer に

なるほど。minibuffer が有効になった状態で,
exit-minibuffer を探すわけですな。
今,やってみると,
exit-minibuffer is on C-j, RET, C-M-j, M-RET,
と,私の意図通りに,割り当てられているようです。

こんな方法もあるんですね。
すげぇ。
でらすげぇ。
でらべっぴん(18禁)。

補足
minibuffer 入力中に M-x 系のコマンドを入力するには
再帰入力を可能にするために事前に

(setq enable-recursive-minibuffers t)

しておかなければなりません。

これ,すげー役に立ちます。
これは助かるなぁ。
Plus たん,ありがとう。

perl で printf 関数を使う場合

%x を使うのはわかっていたのですが,関数に渡す文字の方での
エラーっぽかったので,アルファベットを1文字出力しようとしたです。


unpack さんに力を借りるわけですね。ほうほう。
perldoc -f unpack

unpack TEMPLATE,EXPR
"unpack" does the reverse of "pack": it takes a string and
expands it out into a list of values. (In scalar context, it
returns merely the first value produced.)
...

ようわからんが,レンジでチンするわけですな。
で,C で unsigned char を指定すると。
んで,
% perl -w -e 'printf("%#x\n", unpack("C", "\e"));'
で,解決と。
ありがとう,Plus たん。


おっ,下のほうになんかありました。

sub ordinal { unpack("c",$_[0]); } # same as ord() <-- このへん。

!!!
Felio 師匠キタコレ!!


perldoc -f ord っと。

ord EXPR
ord Returns the numeric (the native 8-bit encoding, like ASCII or
EBCDIC, or Unicode) value of the first character of EXPR. If
EXPR is omitted, uses $_.

For the reverse, see "chr". See perlunicode and encoding for
more about Unicode.

% perl -w -e 'printf("%#x\n", ord("\e"));' っとな。
ord の方が,簡単でいいかもですね。
というか,比較するべきものではないですね。
適材適所ですね。
chr は,逆をするとな。ほうほう。


ありがとう! Felio たん。
そして,日記更新して。


てか,perl で 1 文字を表現するのがこんなん大変だとは。
てか其の二,ordinal ってなんじゃい?

  • order の形容詞。ちゃうな,これやない。
  • 名詞で,ordinal number の略で,= numeral。 これや!!

ほいで,numeral は?

  • numeral: 数字,数詞

へー。そういう意味なんだ。
あ,名詞ね,ちなみに。


ハッピーエンドですな。
みんなありがとー。