\C-k で vi の J コマンドのように行を連結する。
\C-e\C-k で間に空白1個残して行を連結する。
当然次行のインデント部分(空白部分)も圧縮されて空白1個に集約される。
(defadvice kill-line (after kill-end-of-line activate)
"When point is end of line, join this line to next and fix up whitespace
at join."
(if (and (not (bolp)) (not (eolp)))
(save-excursion
(fixup-whitespace))))
emacs で複数フレームを開いて使っていて、
最後の window で \C-x o した時に、他の frame に移る関数。
window manager によってはまともに動きません。
\C-x 5 o (other-frame) が効けば大丈夫だけど
(defun other-window-frame (arg)
(interactive "p")
"Select the ARG'th different window on all frames.
All windows on all frames are arranged in a cyclic order.
This command selects the window ARG steps away in that order.
A negative ARG moves in the opposite order."
(let ((frame (selected-frame)))
(other-window arg t)
(select-frame (window-frame (selected-window)))
(if (not (equal (selected-frame) frame))
(progn
(raise-frame (selected-frame))
(set-mouse-position
(if (featurep 'xemacs) (selected-window) (selected-frame))
(1- (frame-width)) 0))) ))
(global-set-key [?\C-x ?o] 'other-window-frame)
emacs で複数フレームを開いて使っていて、
最後の window で \C-x o した時に、他の frame に移る設定。
window manager によってはまともに動きません。
\C-x 5 o (other-frame) が効けば大丈夫だけど
(defadvice other-window (around other-window-all-frames activate) (interactive "p") (ad-set-arg 1 t) ad-do-it (other-frame 0))
emacs で複数フレームを使っていて、 ひとつのフレームを閉じたときに次のフレームにポインタを移動させる設定。
(defadvice delete-frame (around next-raise activate) (interactive "p") (ad-set-arg 0 (selected-frame)) (other-frame 1) ad-do-it)
\C-p を連打してバッファの先頭に達したときにピーピーうるさいので、 beepしないようにする設定。
(defadvice previous-line (around previous-line-bob activate)
(interactive "p")
(if (save-excursion (/= 0 (progn (beginning-of-line 1) (preceding-char))))
ad-do-it
(beginning-of-line 1)))
\C-n を連打してバッファの最後に達したときにピーピーうるさいので、 beepしないようにする設定。
(defadvice next-line (around next-line-eob activate)
(interactive "p")
(if (or next-line-add-newlines
(save-excursion (/= 0 (progn (end-of-line 1) (following-char)))))
ad-do-it
(end-of-line 1)))
next-line-add-newlines を t にしていても 1 つしか newline をいれないようにする設定。
(defadvice next-line (around next-line-eob activate)
(interactive "p")
(if (or (save-excursion (/= 0 (progn (end-of-line 1) (following-char))))
(and next-line-add-newlines (not (bolp))))
ad-do-it
(end-of-line 1)))