Created
October 12, 2011 11:41
-
-
Save minimum2scp/1281004 to your computer and use it in GitHub Desktop.
emacsのカレントバッファを標準出力に出すシェル関数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ecat (){ | |
local ecat_tempfile=`mktemp -t ecat_tempfile.XXXXXXXX` | |
emacsclient -e " | |
(with-current-buffer | |
(if (featurep 'elscreen) | |
(let* ((frame-confs (elscreen-get-frame-confs (selected-frame))) | |
(num (nth 1 (assoc 'screen-history frame-confs))) | |
(cur-window-conf (cadr (assoc num (assoc 'screen-property frame-confs)))) | |
(marker (nth 2 cur-window-conf))) | |
(marker-buffer marker)) | |
(nth 1 | |
(assoc 'buffer-list | |
(nth 1 (nth 1 (current-frame-configuration)))))) | |
(if (region-active-p) | |
(write-region (region-beginning) (region-end) \"$ecat_tempfile\") | |
(write-region (point-min) (point-max) \"$ecat_tempfile\")) | |
) | |
" | |
cat "$ecat_tempfile" | |
rm -f "$ecat_tempfile" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
メモ: e2wm対応は with-current-buffer の第1引数 (if (featurep 'elscreen) ... ) を
https://gist.github.com/1247111 の (e2wm:current-buffer) にするとできそう。