top  Index  Search  Changes  RSS  Login

DeleteOutsideRectangle

よくある 3 列レイアウトな web page を w3m から切り貼りするときにほしくなった.

(defun my-delete-outside-rectangle (start end)
  "指定した矩形範囲を残し, 左右の外側を削除"
  (interactive "r")
  (undo-boundary)
  (let ((lines (extract-rectangle start end)))
    (delete-region (progn
                     (goto-char start)
                     (line-beginning-position))
                   (progn
                     (goto-char end)
                     (line-end-position)))
    (insert (mapconcat #'identity lines "\n"))))

todo: 切り捨て範囲の自動推測


(Please LogIn to post comments.)

Last modified:2008/03/09 14:09:05
Keyword(s):
References:[併用ツール]