�e�L�X�g���w�肵�������Ő܂�Ԃ��i�w�肵������������ɉ��s��}������F�l�ߍ��݁j�́A M-q (fill-paragraph) �Ŏ��s����邪�A�܂�Ԃ��������w�肷��ɂ́A �܂�Ԃ������J�����܂ŃJ�[�\�����ړ����� C-x f (set-fill-column) ����B �������́AESC ���� C-x f ����B C-x f �́A���s�����o�b�t�@�݂̂ŗL���ɂȂ�B [xyzzy:00698]�i�T�䂳��j���B
�܂�Ԃ������̊���l�́A72 �B�����ύX�������ꍇ�́A.xyzzy �Ƃ��ɁA
(setq-default fill-column 62)
�Ƃ����Ă����B
�쑽����� flex-fill.l ���g���ƁA�Ƃ��Ă��֗��B
filter-region, filter-buffer �ŊO���R�}���h sort �����s���Ă���B
���[�W�������\�[�g --- C-x | sort
�o�b�t�@�S�̂��\�[�g --- C-x # sort
M-\ (delete-horizontal-spaces) �ŁA�J�[�\���̑O��ɂ���A�������X�y�[�X���폜����B [xyzzy:08467]���B
�ǂ����炩�������������́B
(defun my-kill-line (&optional arg) (interactive "*p") (cond ((bolp) (let ((point (point)) (lines (cond ((or (null arg) (<= arg 1)) 0) (t (- arg 1))))) (kill-region point (progn (forward-line lines) (goto-eol) (forward-char) (point))))) (t (kill-line arg)))) (define-key *global-keymap* #\C-k 'my-kill-line)
�J�[�\���̑O�̕�������A�s���܂ł��폜����B���������Ƃ��֗��Ɏv���Ă���R�}���h�̂ЂƂB
C-BackSpace �Ɋ��蓖�ĂĂ���B
�{�c����̂[�����B
�L�[�o�C���h�� C-BackSpace �Ɋ��蓖�Ă�ƁAIME �́u�m�������v�ƏՓ˂���̂ŁA ���̏ꍇ�A�g�p����p�x�̂����ƒႢIME �́u�m�������v�� C-S-BackSpace �ɕύX���Ă���B
(defun backward-kill-line () (interactive) (kill-region (point) (progn (goto-bol) (point)))) (set-extended-key-translate-table exkey-C-backspace #\F13) (global-set-key #\F13 'backward-kill-line)
Toy ����̂[�����B������Ƃ��Ă��֗��B�ix680x0 ???�j
�J�[�\���s�����Ɉړ�����BS-M-Down �ɂ��Ă݂��B
(defun transpose-lines-down (&optional (n 1)) (interactive "*p") (when (save-excursion (forward-line n)) (let ((column (current-column)) (beg (progn (goto-bol) (point))) (end (progn (or (forward-line 1) (progn (goto-eol) (insert #\LFD))) (point)))) (insert (prog1 (buffer-substring beg end) (delete-region beg end) (forward-line n))) (forward-line -1) (goto-column column)))) (global-set-key #\S-M-Down 'transpose-lines-down)
�J�[�\���s����Ɉړ�����BS-M-Up �ɂ��Ă݂��B
(defun transpose-lines-up (&optional (n 1)) (interactive "*p") (transpose-lines-down (- n))) (global-set-key #\S-M-Up 'transpose-lines-up)
�ʏ�� C-y (yank) �ł́A�Z���N�V�����������Ă���������A �J�[�\���ʒu�ɓ\��t�����邪�A���̊����g���ƃZ���N�V�������㏑�����Ă����B �Z���N�V�����𑽗p����l�ɂ͂��ꂵ���@�\�B
Toy ����̂[�����B
(defun yank-overwrite (prefix &optional (arg 0)) (interactive "*P\np") (when (pre-selection-p) (delete-region (selection-mark) (selection-point)) (stop-selection)) (setq *this-command* 'yank) (yank prefix arg)) (global-set-key #\C-y 'yank-overwrite)
�L�������O�̗������ꗗ����I�����ē\��t���邱�Ƃ��ł���B
�{�c����̂[�����Q�l�ɂ��������̂� clipselect.l �ɂ��Ă݂��B
[xyzzy:06776]�i���c ���s����j���Q�l�ɁB
(defun copy-current-word () (interactive) (save-excursion (copy-to-clipboard (buffer-substring (progn (or (looking-at "\\<") (backward-word 1)) (point)) (progn (forward-word) (point))))))
(defun my-paste-with-quote () (interactive "*") (unless (clipboard-empty-p) (let ((lines (split-string (get-clipboard-data) #\LFD))) (dolist (l lines) (insert (format nil "~A~A~%" *quotation-prefix* l))))))
�o�b�t�@�S�̂̍s���s���̃z���C�g�X�y�[�X�Ƃ���s�Ƃ����폜����ꍇ�́A����Ȋ����B
(defun delete-foo () (interactive) (save-excursion (goto-char (point-min)) (�폜����) ))
(�폜����)�̕����́A����Ȋ����Breplace-regexp ���Œu�������s�Ȃ��B
�s���z���C�g�X�y�[�X���폜����ꍇ�B
(replace-regexp "[ \t]*$" "" t)
�s���z���C�g�X�y�[�X���폜����ꍇ�B
(replace-regexp "^[ \t]*" "" t)
�s���s���z���C�g�X�y�[�X���폜����ꍇ�B
(replace-regexp "^[ \t]*\\(.*?\\)[ \t]*$" "\\1" t)
��s���폜����ꍇ�B
(replace-regexp "^\n" "" t)
��s���폜�i�X�y�[�X��^�u�����̍s���܂ށj����ꍇ�B
(replace-regexp "^[ \t]*\n" "" t)
�u���́Areplace-buffer ���ł��ł���݂����B�u��s���폜�v�̏ꍇ���Ƃ���Ȋ����B
(replace-buffer "^\n" "" :regexp t)
���́A�Z���N�V�����ɑ��ď��������邱�Ƃ������̂ŁA ����ȕ��ɂ��Ă݂��B
���\���C�ɓ���Ȃ��́B
(defun insert-str-bol-selection () (interactive "*") (ed::map-selection #'(lambda (start end) (let ((*quotation-prefix* (read-string "�}������: "))) (quote-region start end)))))
���t��}����}������B
(defun insert-date() (interactive) (insert (format-date-string "%Y/%m/%d"))) (global-set-key '(#\C-x #\t #\d) 'insert-my-date-string)
�t�H�[�}�b�g��ύX����ƁA���낢��ł���B
���t�Ǝ�����}������ꍇ�B
"%Y/%m/%d %H:%M:%S %Z"
���t�Ɨj����}������ꍇ�B
"%Y/%m/%d(%v)"
�ڂ����́Alisp/timestmp.l �Q�ƁB
�Z���N�V����������A�I��͈͂̍s���ɕ������}���A�Ȃ���A��������g�O������B
�R�����g������}���܂��̓g�O���p�ɁA�������̃��[�h�₱�����̃��[�h�Ŏg���Ă���B [xyzzy:06776]�i���c ���s����j�ƁA bat-mode.l�iOHKUBO Hiroshi ����j���Q�l�ɁB
key --- �R�����g�w�蕶��
key-regexp --- �s���̃R�����g�w�蕶����\�����K�\���i�g�O�����̍폜�p�j
(encomment-selection-or-comment-toggle-line ";") �Ƃ����Ă����Ă���B
(defun encomment-selection-or-comment-toggle-line (key &optional key-regexp) (if (pre-selection-p) (let ((from (selection-mark)) (to (selection-point))) (if (> from to) (rotatef from to)) (save-excursion (save-restriction (narrow-to-region from to) (goto-char from) (insert key) (while (forward-line 1) (insert key))))) (save-excursion (let (bol eol keyreg) (goto-eol) (setq eol (point)) (goto-bol) (setq bol (point)) (if key-regexp (setq keyreg key-regexp) (setq keyreg (format nil "^[ \t]*\\~A+" key))) (if (string-match keyreg (buffer-substring bol eol)) (delete-region (+ bol (match-beginning 0)) (+ bol (match-end 0))) (insert key))))))
�R�����g������폜�p�ɁA�������̃��[�h�₱�����̃��[�h�Ŏg���Ă���B [xyzzy:06789]�i���c ���s����j���Q�l�ɁB
key --- �R�����g�w�蕶��
(defun outcomment-selection (key) (or (pre-selection-p) (error "selection���Ȃ��B")) (let ((from (selection-mark)) (to (selection-point))) (if (> from to) (rotatef from to)) (save-excursion (save-restriction (narrow-to-region from to) (goto-char from) (replace-buffer (concat "^" key) "" :regexp t)))))
kia ������ comment.l ���g���āC�Z���N�V�������R�����g�A�E�g����B C-x ; �Ɋ��蓖�ĂĂ���B�R�����g���O���ꍇ�́CC-u C-x ; �B xyzzy Part8 987 ���Bautoload �O���ƃG���[�ɂȂ��Ă��܂��̂ŁCrequire ��lj������̂�����ǂ��C �����Ɨǂ����@�����邩���B
(defun comment-out-selection-or-region (&optional count) (interactive "p") (require "comment") (let (beg end) (if (pre-selection-p) (setq beg (selection-point) end (selection-mark)) (setq beg (point) end (mark))) (let ((fn (cond ((eq *prefix-args* 'universal-argument) (setq count (list count)) 'comment-do-uncomment) ((and (numberp count) (> 0 count)) 'comment-do-uncomment) (t 'comment-do-comment)))) (funcall fn beg end count)))) (define-key ctl-x-map #\; 'comment-out-selection-or-region)
�u���b�N�P�ʂ̃R�����g�A�E�g���A���R�����g�́C kia ������ comment.l ���g���悤�ɂȂ����̂�����ǂ��C ���[�h���Ɉ�s�P�ʂ̃R�����g�A�E�g���A���R�����g����y�ɂ����������̂ł����Ă݂��B �C���f���g�́C���̂܂c���Ă������B OHKUBO ������ bat-mode �́Cbat-comment-toggle-line ���Q�l�ɂ����Ă��������܂����B
*one-line-comment-alist* �̐ݒ�́C�e���[�h�̐ݒ����ɋL�q����K�v������̂��Ǝv���܂��B
(defvar *one-line-comment-alist* '( (awk-mode . ("#")) (css-mode . ("/* " " */")) (html+-mode . ("<!-- " " -->")) (lisp-mode . (";")) (lisp-interaction-mode . (";")) (perl-mode . ("#")) (php-mode . ("//")) (sql-mode . ("--")) )) (defun toggle-one-line-comment () (interactive) (let ((li (cdr (assoc buffer-mode *one-line-comment-alist*))) bol eol str keyreg) (when li (save-excursion (goto-eol) (setq eol (point)) (back-to-indentation) (setq bol (point)) (setq str (buffer-substring bol eol)) (if (= (length li) 1) (let ((key (car li))) (setq keyreg (format nil "^~A+[ \t]*" (regexp-quote key))) (if (string-match keyreg str) (delete-region (+ bol (match-beginning 0)) (+ bol (match-end 0))) (progn (back-to-indentation) (insert key)))) (let ((key1 (car li)) (key2 (cadr li))) (setq keyreg (format nil "^\\(~A\\)+[ \t]*\\(.*\\)[ \t]*\\(~A\\)+$" (regexp-quote key1) (regexp-quote key2))) (if (string-match keyreg str) (progn (setq str (string-replace-match str "\\2")) (delete-region (+ bol (match-beginning 0)) (+ bol (match-end 0))) (insert str)) (progn (back-to-indentation) (insert key1) (goto-eol) (insert key2)))))))))
���ǂ���ɗ������������B kia ������ comment.l �ƁCtoggle-one-line-comment ���g���āB
(defun comment-out-selection-or-one-line (&optional count) (interactive "p") (if (pre-selection-p) (progn (require "comment") (let ((fn (cond ((eq *prefix-args* 'universal-argument) (setq count (list count)) 'comment-do-uncomment) ((and (numberp count) (> 0 count)) 'comment-do-uncomment) (t 'comment-do-comment))) beg end) (setq beg (selection-point) end (selection-mark)) (funcall fn beg end count))) (toggle-one-line-comment))) (global-set-key #\C-\; 'comment-out-selection-or-one-line)
�o�b�t�@�S�̂��C���f���g����ꍇ�B
(defun indent-whole-buffer () (interactive) (save-excursion (indent-region (point-min) (point-max))))
�Z���N�V�������C���f���g����ꍇ�B�Z���N�V�������Ȃ���A�o�b�t�@�S�̂��C���f���g����B
(defun indent-selection () (interactive) (if (get-selection-type) (indent-region (selection-mark) (selection-point)) (save-excursion (and (yes-or-no-p "�o�b�t�@�S�̂��ꔭ�C���f���g���܂���B") (indent-region (point-min) (point-max))))))
���[�W�������C���f���g����ꍇ�́AM-x indent-region �ł����B
�Z���N�V�����̍s���s���̃z���C�g�X�y�[�X���폜���āA���s�������B �u�����͈��̏����łł���̂�������Ȃ����A���ɂ͂ł��Ȃ������B
(defun join-line () (interactive) (when (get-selection-type) (selection-start-end (start end) (narrow-to-region start end) (goto-char (point-min)) (replace-buffer "^[ \t]*\\(.*?\\)[ \t]*" "\\1" :regexp t) (goto-char (point-min)) (replace-buffer "^\\(.*?\\)\n" "\\1" :regexp t) (widen))))
�Z���N�V����������Z���N�V���������A�Ȃ���Ε��ʂ� fill-paragraph �B
(defun fill-selection () (interactive) (if (get-selection-type) (selection-start-end (start end) (fill-region start end)) (fill-paragraph))) (global-set-key #\M-q 'fill-selection)
���m�O�T�ȂЂƂ� TAB �L�[�����łł��邻���ł��B OHKUBO Hiroshi ����̂[�����B�i�����������܂ł��B�j
(defun lisp-indent-line-and-complete-symbol () (interactive) (lisp-indent-line) (if (looking-at "\\_>") (lisp-complete-symbol))) (define-key ed::*lisp-mode-map* #\TAB 'lisp-indent-line-and-complete-symbol) (define-key ed::*lisp-interaction-mode-map* #\TAB 'lisp-indent-line-and-complete-symbol)
xyzzy Part8 368 ���B
(defun revseq-region (from to) (interactive "*r") (let (insseq) (save-excursion (setq insseq (reverse (buffer-substring from to))) (delete-region from to) (goto-char from) (insert insseq) )))
��v�ۂ��� *scratch* ���B
(defun reverse-selection () (interactive "*") (when (member (get-selection-type) '(1 2)) (selection-start-end (from to) (insert (prog1 (reverse (buffer-substring from to)) (delete-region from to))))))
���j���[�̍쐬���@�́A���킵�Ƃ���� siteinit.l ���Q�l�ɂ����Ē����܂����B
(defun insert-character-references () (interactive) (message " 1�F< 2�F> 3�F& 4�F\"") (let ((b_ime (get-ime-mode))) (toggle-ime nil) (case (read-char) ((#\1 #\<) (insert "<")) ((#\2 #\>) (insert ">")) ((#\3 #\&) (insert "&")) ((#\4 #\") (insert """)) ) (toggle-ime b_ime)) (clear-message)(stop-selection))
html+-mode �� indent-region ����ƁA�f�[�^�̂Ȃ��s�̓C���f���g����Ȃ��B �̂ŁAhtml+-indent-line ���P�s�����s����悤�ɂ����B M-i �Ɋ��蓖�ĂĂ���B
(in-package "editor") (defun html+-indent-region (from to) (interactive "*r") (narrow-to-region from to) (goto-char (point-min)) (html+-indent-line) (while (forward-line 1) (html+-indent-line)) (widen)) (add-hook '*html+-mode-hook* #'(lambda ()(interactive) (define-key *html+-mode-map* #\M-i 'html+-indent-region))) (in-package "user")
�Z���N�V�����ɑ��ẮA����Ȋ����ł��Ă���B �ihtml+-mode �ł́AM-h M-i �Ƃ����Ȃ��̂ŁA���͂����炾���ł����̂����B�j
(defun html+-indent-selection () (interactive) (if (get-selection-type) (selection-start-end (start end) (narrow-to-region start end) (my-html+-indent) (widen)) (save-excursion (and (yes-or-no-p "�o�b�t�@�S�̂��ꔭ�C���f���g���܂���B") (my-html+-indent)))))
xyzzy�Ń^�O�ł��Ă�l�̐� �� 347 ���B�L�[�o�C���h�͈ꉞ C-S-Insert �i���D�݂Łj�B
(defun paste-clipboard-with-br () (interactive) (when (get-clipboard-data) (insert (substitute-string (get-clipboard-data) "\n" "<br>\n")))) (global-set-key #\C-\S-\Insert 'paste-clipboard-with-br)
�e�[�u��������̂��ʓ|�ȂƂ��Ɏg���Ă���B�Z���N�V�����̃^�u���f�[�^��ϊ�����B �e�s�̗Ƃ��̓`�F�b�N���ĂȂ��̂ŁA���s�^�u�� + 1 �̗ł���B
�����Ƃ��� csv (or tsv) �t�@�C���̕ϊ��Ƃ��A�������l�Ƃ��́A csv-mode ���g���܂��傤�B
(defun tab2table-selection () (interactive "*") (when (get-selection-type) (selection-start-end (start end) (narrow-to-region start end) (goto-char (point-min)) (while (not (eobp)) (insert "<tr><td>") (goto-eol)(insert "</td></tr>") (unless (forward-line 1) (return))) (goto-char (point-min)) (replace-regexp "\t" "</td><td>" t) (widen))))
xyzzy�Ń^�O�ł��Ă�l�̐� �� 366, 367, 369 ���B
(defun insert-url-with-link () (interactive "*") (let ((cb (get-clipboard-data))) (cond ((and (stringp cb) (string-match "^\\(ht\\|f\\)tp://.+" cb)) (insert (format nil "<a href=\"~A\">~A</a>" cb cb))) (t (message "URL�ł͂Ȃ��悤�ł�")))))
�~�j�o�b�t�@������͂�����������A <!-- --> �ň͂�ő}������B xyzzy�Ń^�O�ł��Ă�l�̐� �� 371 ���B
(defun html-insert-comment (&optional (comment "")) (interactive "*sComment: ") (insert "<!-- " comment " -->"))
���[�W�����̕������ <!-- --> �ň͂ށB xyzzy�Ń^�O�ł��Ă�l�̐� �� 371 ���B
(defun html-region-to-comment () (interactive "*") (let ((begin (mark)) (end (point))) (unless (eq end (max begin end)) (let ((tmp begin)) (setq begin end end tmp))) (save-excursion (goto-char end) (insert " -->") (goto-char begin) (insert "<!-- "))))
xyzzy�Ń^�O�ł��Ă�l�̐� �� 374, 375 ���B
(defun html-quote-region-by-tag (&optional (quotetag "")) (interactive "*sTag: ") (let ((begin (mark)) (end (point))) (when (> begin end) (let ((tmp begin)) (setq begin end end tmp))) (save-excursion (goto-char end) (insert "</" quotetag ">") (goto-char begin) (insert "<" quotetag ">"))))
���̋@�\�́A�{�̂Ŏ������Ă��������܂����B
���[�W�����̃f�[�^�� buf2html �ɓn���āA���ʂ��N���b�v�{�[�h�ɃR�s�[����B ���́A�ǂ����Ă��������Ďg�������B(-_-)
�� �����I�v�V�������܂������A�ꉞ�p���������R�[�h�̈��Ƃ��Ďc���Ƃ��܂��B
(^_^)
(defun my-buf2html-region (from to) (interactive "*r") (buf2html-region from to) (selection-whole-buffer) (copy-selection-to-clipboard) (close-selected-buffer))
�����I�v�V����
�������Ă����������̂ŁA�lj��B
������̕��� lisp �炵��(?)����������B
�m���� "*" �́A����Ȃ���Ȃ��B
�Ō�̉��s�͂����蓮�ŏ����Ă��̂ŁA1- �����Ă��������܂����B
�� buf2html-region �ō쐬�����\�[�X���L�������O�փR�s�[
(defun buf2html-copy-region-as-kill (from to) (interactive "r") (save-window-excursion (buf2html-region from to) (copy-region-as-kill (point-min) (1- (point-max))) (close-selected-buffer)))
�� buf2html-region �ō쐬�����\�[�X���N���b�v�{�[�h�փR�s�[
(defun buf2html-copy-region-to-clipboard (from to) (interactive "r") (save-window-excursion (buf2html-region from to) (copy-region-to-clipboard (point-min) (1- (point-max))) (close-selected-buffer)))