Emacsのcua-mode
を使っていない、あるいはそもそも知らない人が結構いるようなので紹介しておく。cua-mode
は、Emacsの範囲選択にまつわるUIを改善し、Windows、Mac、GTK+/Qtなどにおけるテキスト編集操作との互換性も高めてくれるグローバルマイナーモードで、以下のような機能を提供する。
Shift
+矢印による範囲選択- 範囲選択状態で
BS
/DEL
を押すと選択範囲をまるごと消去 - 範囲選択状態でキー入力やペーストを行うと選択範囲まるごと上書きされる
- 視覚化された矩形範囲選択モード(
C-w
,M-w
,C-y
など通常の範囲選択と同様の操作性) - 矩形範囲選択モードでの複数行同時操作(文字入力、文字削除、連番挿入等)
- Windows互換の
Ctrl
+Z
,X
,C
,V
(※)
Emacs 22.1.1から標準添付されているので、試したければ何も設定せずにM-x cua-mode
で使える。上記のうち最後の機能は率直に言って邪魔なのだが、これはWindowsから来た人をターゲットに据えた本モードの目玉機能のようで、デフォルトでオンになっている。ために、Emacsに慣れた人ほど、少し触ったところで戸惑いを感じて敬遠しがちなのが残念なところ。
このcua-mode
を起動時から有効化するには、M-x customize-group RET cua RET
としてcustomize画面に入り、”Cua Mode”を”on”にする。私のように上記※が不要だと思う人は”Cua Enable Cua Keys”を”Disabled”にして、”Set for current session”を押す。これでcua-mode
が(一時的に)有効な状態になるので、他のバッファで挙動を確認してみよう。満足したら、customizeバッファに戻って”Save for future sessions”を押せば恒久保存される。
さて、Shift
+矢印による範囲選択を試してみただろうか。GUI上のEmacsで動くのは当然として、xterm互換ターミナル上のEmacsでも動くのには軽い感動を覚えたかもしれない。ただし、Emacsのバグで、S-left
, S-right
, S-down
は動くのになぜかS-up
だけは期待通り動作せず、select
キーとして認識されてしまう。これは以下のようなコードで期待通り動くようになる。(ついでにend
キーがおかしいのも直している)
1 2 3 |
(defadvice terminal-init-xterm (after fix-some-keys activate) (define-key input-decode-map "\e[1;2A" [S-up]) (define-key input-decode-map "\e[4~" [end])) |
ところで、矩形選択モードのトグルキーはデフォルトではC-RET
だが、私はcua-toggle-global-mark
の方に割り当てられているC-S-SPC
に変更している。これは、先のカスタマイズ画面で”Cua Rectangle Mark Key”をC-S-SPC
に設定(入力欄でC-q
を押してから設定したいキーコンボを押すのが楽)して保存すれば済むはずだが、cuaの初期化フローがおかしいため、以下のコードも必要のようだ。
1 |
(define-key cua-global-keymap cua-rectangle-mark-key 'cua-set-rectangle-mark) |
cua-toggle-global-mark
の方は、カスタマイズ変数がないので以下のようにコードを書いてC->
に設定している。
1 |
(define-key cua-global-keymap (kbd "C->") 'cua-toggle-global-mark) |
なお、C-RET
, C-S-SPC
, C->
などの特殊キーコンボをターミナル上で使うためにはターミナルエミュレータの設定が必要なので、こちらの記事を参考にされたい。
というわけでおしまい、でもいいのだけれど、矩形選択モードで単語単位の移動ができないのはちょっと不便だと思う私はこんな設定を施している。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
(eval-after-load "cua-rect" '(progn (defun cua-resize-rectangle-move-bol () "Resize rectangle to the BOL." (interactive) (while (not (bolp)) (backward-char))) (defun cua-resize-rectangle-move-eol () "Resize rectangle to the EOL." (interactive) (while (not (eolp)) (forward-char))) (defun cua-resize-rectangle-right-word (n) "Resize rectangle to the right word." (interactive "p") (if (< n 0) (let ((pos (save-excursion (backward-word (- n)) (point)))) (while (< pos (point)) (backward-char))) (let ((pos (save-excursion (forward-word n) (point)))) (while (< (point) pos) (forward-char))))) (defun cua-resize-rectangle-left-word (n) "Resize rectangle to the left word." (interactive "p") (cua-resize-rectangle-right-word (- n))) (defadvice cua--init-rectangles (after custom-key-bindings () activate) (define-key cua--rectangle-keymap [remap move-end-of-line] 'cua-resize-rectangle-move-eol) (define-key cua--rectangle-keymap [remap move-beginning-of-line] 'cua-resize-rectangle-move-bol) (define-key cua--rectangle-keymap [remap forward-word] 'cua-resize-rectangle-right-word) (define-key cua--rectangle-keymap [remap backward-word] 'cua-resize-rectangle-left-word) (cua--rect-M/H-key ?B 'cua-blank-rectangle) (cua--rect-M/H-key ?b 'cua-resize-rectangle-left-word) (cua--rect-M/H-key ?F 'cua-fill-char-rectangle) (cua--rect-M/H-key ?f 'cua-resize-rectangle-right-word)))) |
癖のあるモジュールだけど、がんばって飼い慣らして使いましょう。
child teen
порно
xnxx
betturkey
Pink Withney I like the efforts you have put in this, regards for all the great content.
Aroma Sensei Great information shared.. really enjoyed reading this post thank you author for sharing this post .. appreciated
Jinx Manga I very delighted to find this internet site on bing, just what I was searching for as well saved to fav
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
BWER is Iraq’s premier provider of industrial weighbridges, offering robust solutions to enhance efficiency, reduce downtime, and meet the evolving demands of modern industries.
Noodlemagazine This was beautiful Admin. Thank you for your reflections.
Noodlemagazine Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Everyday practice shows that the modern development methodology involves independent ways of implementing the phased and consistent development of society. Here is a striking example of modern trends – a new model of organizational activity largely determines the importance of clustering efforts.
In particular, a high-quality prototype of the future project requires determining and clarifying the new principles of the formation of the material, technical and personnel base! The significance of these problems is so obvious that socio-economic development plays an important role in the formation of favorable prospects.
As is commonly believed, thorough research of competitors to this day remain the destiny of liberals, which are eager to be associated with industries. As part of the specification of modern standards, replicated from foreign sources, modern research, overcoming the current difficult economic situation, are considered exclusively in the context of marketing and financial prerequisites.
As is commonly believed, supporters of totalitarianism in science can be limited exclusively by the way of thinking. Here is a vivid example of modern trends – strengthening and developing the internal structure provides ample opportunities for the phased and consistent development of society.
Our business is not as unambiguous as it might seem: a high -quality prototype of the future project plays a decisive importance for the distribution of internal reserves and resources. The ideological considerations of the highest order, as well as the course on a socially oriented national project, unambiguously records the need to prioritize the mind over emotions.
On the other hand, a deep level of immersion indicates the possibilities of standard approaches. There is something to think about: the actions of representatives of the opposition are devoted to a socio-democratic anathema.
A high level of involvement of representatives of the target audience is a clear evidence of a simple fact: synthetic testing is an interesting experiment to verify the rethinking of foreign economic policies. Thus, promising planning creates prerequisites for standard approaches.
Gentlemen, socio-economic development indicates the possibilities of standard approaches. Each of us understands the obvious thing: the modern development methodology creates the need to include a number of extraordinary measures in the production plan, taking into account the complex of phased and consistent development of society.
As part of the specification of modern standards, the actively developing third world countries are extremely limited by thinking. First of all, a consultation with a wide asset clearly defines each participant as capable of making his own decisions regarding the forms of influence.
The clarity of our position is obvious: the basic development vector determines the high demand for the corresponding conditions of activation. Preliminary conclusions are disappointing: increasing the level of civil consciousness is a qualitatively new step in the withdrawal of current assets.
But synthetic testing creates the prerequisites for innovative process management methods. In general, of course, an increase in the level of civil consciousness unequivocally defines each participant as capable of making his own decisions regarding the withdrawal of current assets.
Of course, the new model of organizational activity helps to improve the quality of the timely implementation of the super -task! It should be noted that promising planning allows us to evaluate the value of the timely execution of the super -task.
Given the key scenarios of behavior, the conviction of some opponents plays an important role in the formation of the output of current assets. Of course, promising planning allows you to complete important tasks on the development of areas of progressive development.
We are forced to build on the fact that the constant information and propaganda support of our activity directly depends on the priority of the mind over emotions. Likewise, the border of personnel training, in its classical representation, allows the introduction of forms of influence.
Here is a striking example of modern trends – a high -quality prototype of the future project allows you to assess the significance of further directions of development. In the same way, the innovative path we have chosen creates the prerequisites for the mass participation system.