Back ...
Last modified: "2003/07/28 11:04:29"
(defun delete-eol-spaces-selection ()
(interactive)
(exec-selection 'delete-eol-spaces
"バッファ全体の行末のホワイトスペースを削除しますよ。"))
(defun delete-eol-spaces ()
(goto-char (point-min))
(replace-regexp "[ \t]*$" "" t))
(defun delete-bol-spaces-selection ()
(interactive)
(exec-selection 'delete-bol-spaces
"バッファ全体の行頭のホワイトスペースを削除しますよ。"))
(defun delete-bol-spaces ()
(goto-char (point-min))
(replace-regexp "^[ \t]*" "" t))
(defun delete-both-sides-spaces-selection ()
(interactive)
(exec-selection 'delete-both-sides-spaces
"バッファ全体の行頭行末のホワイトスペースを削除しますよ。"))
(defun delete-both-sides-spaces ()
(goto-char (point-min))
(replace-regexp "^[ \t]*\\(.*?\\)[ \t]*$" "\\1" t))
(defun delete-unnecessary-line-selection ()
(interactive)
(exec-selection 'delete-unnecessary-line
"バッファ全体の空行を削除しますよ。"))
(defun delete-unnecessary-line ()
(goto-char (point-min))
(replace-regexp "^[ \t]*\n" "" t))
(defun exec-selection (func &optional str)
(if (get-selection-type)
(selection-start-end (start end)
(save-excursion
(save-restriction
(narrow-to-region start end)
(funcall func)
(widen))))
(save-excursion
(if str
(and (yes-or-no-p str)(funcall func))
(funcall func)))))
Back ...