top  Index  Search  Changes  RSS  Login

howm wiki - DeleteOutsideRectangle Diff

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

よくある 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: 切り捨て範囲の自動推測

----
{{comment}}
----