;;; -*- Emacs-Lisp -*- ;;; vz.el --- Vz-like commands for Mule ;;; version 0.7.4 (96.1.16) ;;; Copyright (C) 1994, 1995, 1996 ;;; 古江 秀之 (PXB04553@niftyserve.or.jp) ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either versions 2, or (at your option) ;;; any later version. ;; beginning of vz.el ;;; ;;; ユーザ・オプション ;;; ;; ;; vz.defにないもの ;; (defvar vz-inhibit-add-hook nil "*Vz インジケータ&ブロック非表示 ※vz.elを読み込む前に設定すること") (defvar vz-mode-hook nil "*Vz モードフック") (defvar vz-ss-wait-sec 1 "*Vz スムーススクロールウェイト(秒)") (defvar vz-ss-wait-msec nil "*Vz スムーススクロールウェイト(ミリ秒)") ;; ;; vz.defにあるもの ;; (defvar vz-auto-indent t "*Vz:オートインデント") ;Ei (defvar vz-indent-zenkaku-space nil "*Vz:全角スペースのオートインデント") ;Ej (defvar vz-tab-width 8 "*Vz:タブカラム数") ;Ta (defvar vz-tab-width-for-c 4 "*Vz:.c .h ファイルのタブカラム数") ;Tb (defvar vz-case-fold-search nil "*Vz:文字列検索時に英大文字と小文字を同一視") ;Ec (defvar vz-regexp-search nil "*Vz:正規表現検索") ;RX (defvar vz-zenhan-search nil "*Vz:全角/半角文字") ;ZH(未対応) (defvar vz-word-search nil "*Vz:文字列検索時のワードサーチ") ;Ew (defvar vz-half-screen-scroll nil "*Vz:ページング単位") ;Eh(未対応) ;;; ;;; 内部変数・定数 ;;; ;added by FURUE Hideyuki, 95.8.12 (defconst vz-mode-version "0.7.3" "Vz風コマンド集vz.elのバージョン") (defvar vz-mode-syntax-table nil "Vz風キーバインドモードのsyntax-table ※これを用いてEmacsのワードを定義しているわけではない") (defvar vz-indicator (make-string 16 ?-) "インジケータを構成する文字列") (defvar vz-block-mark-pos nil "バッファ内のブロック開始位置: nil : 非ブロックモード 数値 : ブロック開始位置") (defvar vz-block-mark-line nil "バッファ内のブロック開始位置の行頭の位置: nil : 非ブロックモード 数値 : ブロック開始位置の行頭の位置") (defvar vz-block-overlay nil "ブロック反転のためのオーバーレイ: nil : 非ブロックモード オーバーレイ : ブロック反転のためのオーバーレイ") (defvar vz-last-cursorp nil "直前のカーソル位置(マーカー 0)") (defvar vz-last-paste-region (cons 0 0) "直前のペーストにおけるリージョン") (defvar vz-goal-column 0 "Vz風ゴールカラム") (make-variable-buffer-local 'vz-indicator) (make-variable-buffer-local 'vz-block-mark-pos) (make-variable-buffer-local 'vz-block-mark-line) (make-variable-buffer-local 'vz-block-overlay) (make-variable-buffer-local 'vz-last-cursorp) (make-variable-buffer-local 'vz-last-paste-region) (make-variable-buffer-local 'vz-goal-column) (defvar vz-window-configuration 0 "ウィンドウ分割状態: 0:画面全体 1:横分割 2:縦分割") (defvar vz-undo-stack nil "削除文字(列)を貯えているリスト") (defconst vz-kbd-macro-name-prefix "vz-kbd-macro-" "キーボードマクロの登録で自動的に作成されるキーボードマクロ名のプレフィクス") (defvar vz-switch-to-buffer-function-prefix "vz-switch-to-buffer-" "編集テキストの切り替えで内部的に作成される関数名のプレフィクス") (defvar vz-mark-1 nil "マーカー 1") (defvar vz-mark-2 nil "マーカー 2") (defvar vz-mark-3 nil "マーカー 3") (defvar vz-mark-4 nil "マーカー 4") (defvar vz-search-flag nil "ページングモード: nil :[P]ページング t :[S]文字列検索") ;;(make-variable-buffer-local 'vz-search-flag) (defvar vz-last-replace-from nil "直前の文字列置換における検索文字列") (defvar vz-last-replace-to nil "直前の文字列置換における置換文字列") (defvar vz-replace-direction 'all "直前の文字列置換における検索方向: all : テキスト全体 forward : カーソル以降 backward : カーソル以前") (defvar vz-replace-with-prompt t "直前の文字列置換における一括置換フラグ nil : 一括置換 t : 逐次置換") (defvar vz-end-of-search-string-pos nil "直前の検索文字列取得が取得した 文字列末尾のバッファ内における位置") ;added by FURUE Hideyuki, 95.8.12 ;;(defvar vz-last-window-configuration (current-window-configuration)) (defconst vz-zenkaku-paren-alist '((?\[ . ?\]) (?\「 . ?\」) (?\〔 . ?\〕) (?\『 . ?\』) (?\【 . ?\】) (?\《 . ?\》)) "全角括弧挿入に用いられる括弧の連想リスト") ;modified by FURUE Hideyuki, 95.8.12 (defconst vz-resize-mode-message "カーソルキーで位置を動かして[リターン]" "特殊モード(インデントの変更・ウィンドウサイズの変更)におけるエコー文字列") (defvar vz-ss-lines 4 "スムーススクロール行数") (defconst vz-max-buffer-number 9 "バッファメニューに表示できる最大バッファ数") ;modified by FURUE Hideyuki, 95.8.16 ;;; ;;; ロード時の初期化 ;;; ;; ;; check GNU Emacs version ;; ;;added by FURUE Hideyuki, 95.8.12 ;;modified for executing emacs20 (by Fujii san?) ;(if (not (and (boundp 'MULE) ; (boundp 'emacs-major-version) ; (<= emacs-major-version 19))) ;for sure ; (error "たぶん、このEmacsではvz-modeを使えません(__)")) ;; ;; ファイル位置インジケータとブロック反転のため。 ;; (or (featurep 'vz) vz-inhibit-add-hook (add-hook 'post-command-hook 'vz-update-cursor)) ;; ;; syntax-table ;; ;;別の目的で使ってます。 (if vz-mode-syntax-table () (setq vz-mode-syntax-table (make-syntax-table)) (let ((c 0)) (while (<= c 32) (modify-syntax-entry c " " vz-mode-syntax-table) (setq c (1+ c)))) (modify-syntax-entry ?$ "w" vz-mode-syntax-table) (modify-syntax-entry ?_ "w" vz-mode-syntax-table) (modify-syntax-entry ?< "(>" vz-mode-syntax-table) (modify-syntax-entry ?> ")<" vz-mode-syntax-table) (modify-syntax-entry ?{ "(}" vz-mode-syntax-table) (modify-syntax-entry ?} "){" vz-mode-syntax-table) ;;(modify-syntax-entry ?  " " vz-mode-syntax-table) ) ;; ;; key-map ;; (load "vz-keys" nil) ;;; ;;; vz-modeの初期化 ;;; (defun vz-mode () "Vz風キーバインドモード \\{vz-mode-map}" (interactive) (kill-all-local-variables) (use-local-map vz-mode-map) (setq mode-name "Vz風") (setq major-mode 'vz-mode) (set-syntax-table vz-mode-syntax-table) (make-local-variable 'scroll-step) (make-local-variable 'next-line-add-newlines) (make-local-variable 'blink-matching-paren) (make-local-variable 'case-replace) (make-local-variable 'mode-line-format) (make-local-variable 'auto-mode-alist) (make-local-variable 'default-major-mode) (make-local-variable 'enable-local-variables) (make-local-variable 'truncate-lines) (setq scroll-step 1) (setq next-line-add-newlines nil) (setq blink-matching-paren nil) (setq case-replace nil) (setq truncate-lines nil) ;;(setq truncate-partial-width-windows nil) (setq auto-mode-alist '(("^.*$" . vz-mode))) (setq default-major-mode 'vz-mode) (setq enable-local-variables nil) (setq mode-line-format (` ("" "[" (vz-search-flag "S" "P") "]" "[" (vz-block-mark-pos "B" " ") "]" "[" (overwrite-mode "O" " ") "] " (, (if (string< "19.29" emacs-version) "(L%5l:%5c)" "(L%5l)")) " [" vz-indicator "] " ;; 2002.03.12 modified by [yoh] ;; mode-line-mc-status mode-line-mule-info "%1*%1+ %15b" ))) (run-hooks 'vz-mode-hook)) ;;; ;;; vz風コマンド集 ;;; ;;; ;;; サブルーチン ;;; (defmacro vz-bol-pos () (list 'save-excursion (list 'beginning-of-line) (list 'point))) (defmacro vz-end-block-mode () (list 'progn (list 'delete-overlay 'vz-block-overlay) ;;(list 'setq 'transient-mark-mode nil) (list 'setq 'vz-block-mark-pos nil 'vz-block-mark-line nil 'vz-block-overlay nil) (list 'force-mode-line-update))) (defmacro vz-set-search-flag (val) (list 'progn (list 'setq 'vz-search-flag val) (list 'force-mode-line-update t))) ;(defmacro vz-beginning-of-block () ; (list 'if ; (list 'eq 'last-command ''vz-next-line) ; 'vz-block-mark-line ; 'vz-block-mark-pos)) ;(defmacro vz-end-of-block () ; (list 'if ; (list 'eq 'last-command ''vz-next-line) ; (list 'save-excursion (list 'beginning-of-line) (list 'point)) ; (list 'point))) (defmacro vz-update-last-cursorp () (list 'setq 'vz-last-cursorp (list 'point-marker))) (defmacro vz-whitespace-chars () (list 'if 'vz-indent-zenkaku-space " \t " " \t")) ;;modified by FURUE Hideyuki, 95.8.18 (defun vz-update-cursor () (and (eq major-mode 'vz-mode) ;; Is ``make-string'' faster than ``copy-sequence''? (aset (setq vz-indicator (make-string 16 ?-)) (/ (lsh (1- (point)) 4) (1+ (buffer-size))) ?+) (and vz-block-overlay (move-overlay vz-block-overlay vz-block-mark-line (vz-bol-pos))) ;・文字単位ブロック(ペースト時の判断がめんどうなのでパス) ; (and vz-block-overlay ; (move-overlay (vz-beginning-of-block) (vz-end-of-block))) )) (defun vz-char-type (ch) (let ((s (char-syntax ch)) (c (string-to-char (char-category ch)))) (if (or (eq c ?a) (eq c 0)) (cond ;;((eq ch ?\C-j) 1) ((eq s ? ) 2) ((eq s ?w) 6) (t 3)) (cond ((eq ch ? ) 2) ;;((memq ch '(?゛ ?゜)) 3) ((eq ch ?ー) 6) ; 手抜き。mule-init.elに依存。 ((eq c ?H) 4) ; ((string-match "H" (char-category ch)) 4) ;; modified by [yoh] 2002.03.10 ; ((eq c ?S) 3) ; ((string-match "S" (char-category ch)) 3) ((eq c ?j) 3) ; ((string-match "j" (char-category ch)) 3) (t 6))))) ;; ;; 語 ;; (defun vz-forward-word () "Vz:1語→" (interactive) (or (eobp) (let (pre (cur (vz-char-type (following-char)))) (while (and (prog1 (not (eolp)) (setq pre cur) (forward-char 1)) (not (eolp)) (>= pre (setq cur (vz-char-type (following-char))))))))) (defun vz-backward-word () "Vz:1語←" (interactive) (or (bobp) (let (cur (post (vz-char-type (char-before (point))))) (while (and (prog1 (not (bolp)) (backward-char 1) (setq cur post)) (not (bolp)) (<= cur (setq post (vz-char-type (char-before (point)))))))))) ;;added by FURUE Hideyuki, 95.8.12 (defun vz-get-search-string () "Vz:検索文字列の取得" (interactive) (vz-set-search-flag t) (if vz-block-mark-pos ;;あえて未対応 (error "ブロックモード中の検索文字列取得は未対応です(__)") (let ((beg (point)) (end nil)) (or (eq last-command this-command) (setq vz-end-of-search-string-pos beg)) (save-excursion (goto-char vz-end-of-search-string-pos) (let (pre cur) ;;promote weight of whitespace (and (= 2 (setq cur (vz-char-type (following-char)))) (setq cur 999)) (while (and (not (eolp)) (progn (setq pre cur) (forward-char 1) ;;promote weight of whitespace (and (= 2 (setq cur (vz-char-type (following-char)))) (setq cur 999)) ;;truncate last (but not first) whitespaces (if (/= pre 999) (setq end (point))) (<= pre cur))))) (setq vz-end-of-search-string-pos (point))) (setq search-ring (cons (buffer-substring beg (or end vz-end-of-search-string-pos)) search-ring)) (message (car search-ring))))) ;; ;; 削除 ;; (defun vz-kill-word () "Vz:語の終りまで削除" (interactive) (let (word (org (vz-char-type (following-char)))) (while (and (not (eobp)) (prog1 (not (eolp)) (setq word (concat word (char-to-string (following-char)))) (delete-char 1)) (not (eolp)) (= org (vz-char-type (following-char))))) (if word (setq vz-undo-stack (cons (cons word nil) vz-undo-stack))) )) (defun vz-backward-kill-word () "Vz:語の先頭まで削除" (interactive) (or (bobp) (let (word (org (vz-char-type (char-before (point))))) (while (and (not (bobp)) (prog1 (not (bolp)) (setq word (concat (char-to-string (char-before (point))) word)) (delete-backward-char 1)) (not (bolp)) (= org (vz-char-type (char-before (point)))))) (if word (setq vz-undo-stack (cons (cons word t) vz-undo-stack))) ))) (defun vz-delete-char () "Vz:1文字削除" (interactive) (if (eobp) () (setq vz-undo-stack (cons (cons (char-to-string (char-after (point))) nil) vz-undo-stack)) (delete-char 1))) (defun vz-delete-backward-char () "Vz:バックスペース" (interactive) (if (bobp) () (setq vz-undo-stack (cons (cons (char-to-string (char-before (point))) t) vz-undo-stack)) (delete-backward-char 1))) (defun vz-kill-eol () "Vz:行末まで削除" (interactive) (let ((p (point))) (end-of-line) (setq vz-undo-stack (cons (cons (buffer-substring p (point)) nil) vz-undo-stack)) (delete-region p (point)))) (defun vz-kill-bol () "Vz:行頭まで削除" (interactive) (let ((p (point))) (beginning-of-line) (setq vz-undo-stack (cons (cons (buffer-substring p (point)) t) vz-undo-stack)) (delete-region (point) p))) (defun vz-undo () "Vz:削除文字(列)復活" ;; 無理して実装することもなかったが... (interactive) (if vz-undo-stack (let ((pair (car vz-undo-stack))) (if (cdr pair) (insert (car pair)) (save-excursion (insert (car pair)))) (setq vz-undo-stack (cdr vz-undo-stack))))) ;; ;; 移動 ;; (defun vz-next-line () "Vz:↓" (interactive) (if truncate-lines (next-line 1) (or (eq last-command 'vz-next-line) (setq vz-goal-column (% (current-column) (1- (window-width))))) (if (eolp) (progn (forward-char 1) (move-to-column vz-goal-column)) (vertical-motion 1) (move-to-column (+ vz-goal-column (current-column)))))) (defun vz-previous-line () "Vz:↑" (interactive) (if truncate-lines (previous-line 1) (or (eq last-command 'vz-next-line) (setq vz-goal-column (% (current-column) (1- (window-width))))) (let ((ncol (- vz-goal-column (window-width) -1))) (vertical-motion -1) (if (<= 0 ncol) (move-to-column ncol) (move-to-column (+ vz-goal-column (current-column)))))) (setq this-command 'vz-next-line)) ;fake (defun vz-set-mark () "Vz:カーソル位置マーク" (interactive) (vz-update-last-cursorp) (message "マークしました")) (defun vz-goto-mark () "Vz マーク位置へジャンプ" (interactive) (if vz-last-cursorp (goto-char vz-last-cursorp))) (defun vz-goto-last-cursorp () "Vz:直前のカーソル位置" (interactive) (let ((p vz-last-cursorp)) (vz-update-last-cursorp) (goto-char p))) (defun vz-goto-mark-1 () "Vz マーク位置へジャンプ[#1]" (interactive) (vz-update-last-cursorp) (if vz-mark-1 (goto-char vz-mark-1))) (defun vz-goto-mark-2 () "Vz マーク位置へジャンプ[#2]" (interactive) (vz-update-last-cursorp) (if vz-mark-2 (goto-char vz-mark-2))) (defun vz-goto-mark-3 () "Vz マーク位置へジャンプ[#3]" (interactive) (vz-update-last-cursorp) (if vz-mark-3 (goto-char vz-mark-3))) (defun vz-goto-mark-4 () "Vz マーク位置へジャンプ[#4]" (interactive) (vz-update-last-cursorp) (if vz-mark-4 (goto-char vz-mark-4))) (defun vz-set-mark-1 () "Vz マーク[#1]" (interactive) (setq vz-mark-1 (point-marker)) (message "マーク #1")) (defun vz-set-mark-2 () "Vz マーク[#2]" (interactive) (setq vz-mark-2 (point-marker)) (message "マーク #2")) (defun vz-set-mark-3 () "Vz マーク[#3]" (interactive) (setq vz-mark-3 (point-marker)) (message "マーク #3")) (defun vz-set-mark-4 () "Vz マーク[#4]" (interactive) (setq vz-mark-4 (point-marker)) (message "マーク #4")) (defun vz-beginning-of-buffer () "Vz:ファイルの先頭" (interactive) (vz-update-last-cursorp) (goto-char (point-min)) (setq this-command 'vz-next-line)) ;fake (defun vz-end-of-buffer () "Vz:ファイルの最後" (interactive) (vz-update-last-cursorp) (goto-char (point-max)) (setq this-command 'vz-next-line)) (defun vz-goto-line () "Vz:指定行番号ジャンプ" (interactive) (let ((n (vz-popup-window-for-number "行番号"))) (and (integerp n) (progn (vz-update-last-cursorp) (goto-line n) (setq this-command 'vz-next-line))))) (defun vz-goto-beginning-of-block () "Vz:ブロックの先頭/最後" (interactive) (let ((p vz-block-mark-pos)) (if p (progn (setq vz-block-mark-pos (point)) (setq vz-block-mark-line (vz-bol-pos)) (goto-char p))))) (defun vz-top-of-screen () "Vz:画面の上端" (interactive) (let ((col (current-column))) (goto-char (window-start)) (move-to-column col))) (defun vz-bottom-of-screen () "Vz:画面の下端" (interactive) (let ((col (current-column))) (goto-char (1- (window-end))) (move-to-column col))) (defun vz-right-of-screen () "Vz 画面の右端" (interactive) (vertical-motion 1) (backward-char 1)) (defun vz-left-of-screen () "Vz 画面の左端" (interactive) (vertical-motion 0)) (defun vz-scroll-down-line () "Vz:ロールアップ" (interactive) (condition-case () (scroll-down 1) (error nil)) (setq this-command 'vz-next-line) ;fake (vz-previous-line)) (defun vz-scroll-up-line () "Vz:ロールダウン" (interactive) (condition-case () (scroll-up 1) (error nil)) (setq this-command 'vz-next-line) (vz-next-line)) (defun vz-scroll-down-2-lines () "Vz:ロールアップ2行" (interactive) (condition-case () (scroll-up 2) (error nil)) (setq this-command 'vz-next-line) ;fake (vz-previous-line)) (defun vz-scroll-up-2-lines () "Vz:ロールダウン2行" (interactive) (condition-case () (scroll-down 2) (error nil)) (setq this-command 'vz-next-line) (vz-next-line)) (defun vz-smooth-scroll-down () "Vz:スムースアップ" ;;全然スムースではないが (interactive) (condition-case () (let (ev) (while (not ev) (while (sit-for vz-ss-wait-sec vz-ss-wait-msec) (scroll-down vz-ss-lines)) (setq ev (read-event)) (and (integerp ev) (cond ((and (< ?0 ev) (<= ev ?4)) (setq vz-ss-lines (- ev ?0)) (setq ev nil)) ((eq ev ?0) (setq vz-ss-lines (window-height)) (setq ev nil)) ((eq ev ? ) (let ((echo-keystrokes 0))(read-event)) (setq ev nil)))))) (error nil))) (defun vz-smooth-scroll-up () "Vz:スムースダウン" ;;全然スムースではないが (interactive) (condition-case () (let (ev) (while (not ev) (while (sit-for vz-ss-wait-sec vz-ss-wait-msec) (scroll-up vz-ss-lines)) (setq ev (read-event)) (and (integerp ev) (cond ((and (< ?0 ev) (<= ev ?4)) (setq vz-ss-lines (- ev ?0)) (setq ev nil)) ((eq ev ?0) (setq vz-ss-lines (window-height)) (setq ev nil)) ((eq ev ? ) (let ((echo-keystrokes 0))(read-event)) (setq ev nil)))))) (error nil))) ;; ;; 検索・置換 ;; (defun vz-window-point-at-xy (x y) (let ((cm (compute-motion (window-start) '(0 . 0) (point-max) (cons x y) (window-width) (cons (window-hscroll) 0) (selected-window)))) (if (nth 4 cm) (1- (car cm)) (car cm)))) (defun vz-window-x () (let ((x (current-column))) (if truncate-lines x (if (< (save-excursion (end-of-line) (current-column)) (window-width)) x (% x (1- (window-width))))))) (defun vz-window-y () (let ((y -1)) (save-excursion (while (and (pos-visible-in-window-p) (< (vertical-motion -1) 0)) (setq y (1+ y))) (if (pos-visible-in-window-p) (1+ y) y)))) (defun vz-scroll-up () "Vz:ページダウン" (interactive) (if (not vz-search-flag) ;;ページングモード (let ((col (current-column))) (or (eq last-command 'vz-next-line) (setq vz-goal-column (% col (1- (window-width))))) (let ((i (vz-window-y))) (condition-case () (let ((next-screen-context-lines 1)) (scroll-up) (vertical-motion i)) (error (goto-char (point-max)))) (if truncate-lines (move-to-column col) (move-to-column (+ (current-column) vz-goal-column))) (setq this-command 'vz-next-line))) ;;検索モード (let ((s (car search-ring))) (if s (let ((yo (vz-window-y))) (setq case-fold-search vz-case-fold-search) (if (condition-case () (save-excursion (forward-char 1) (if vz-regexp-search (re-search-forward s (point-max) t) (if vz-word-search (word-search-forward s (point-max) t) (search-forward s (point-max) t)))) (error nil)) (progn (goto-char (match-beginning 0)) (or (pos-visible-in-window-p) (progn (recenter 0) (scroll-up 0))) ;??? (scroll-up (- (vz-window-y) yo))) (message "文字列が見つかりません"))))))) (defun vz-scroll-down () "Vz:ページアップ" (interactive) (if (not vz-search-flag) ;;ページングモード (let ((col (current-column))) (or (eq last-command 'vz-next-line) (setq vz-goal-column (% col (1- (window-width))))) (let ((i (vz-window-y))) (condition-case () (let ((next-screen-context-lines 1)) (scroll-down) (goto-char (window-start)) (vertical-motion i)) (error (goto-char (point-min)))) (if truncate-lines (move-to-column col) (move-to-column (+ (current-column) vz-goal-column))) (setq this-command 'vz-next-line))) ;fake ;;検索モード (let ((s (car search-ring))) (if s (let ((yo (vz-window-y))) (setq case-fold-search vz-case-fold-search) (if (condition-case () (if vz-regexp-search (re-search-backward s (point-min) t) (if vz-word-search (word-search-backward s (point-min) t) (search-backward s (point-min) t))) (error nil)) (progn (or (pos-visible-in-window-p) (progn (recenter 0) (scroll-up 0))) ;??? (or (= (window-start) 1) (scroll-up (- (vz-window-y) yo)))) (message "文字列が見つかりません"))))))) (defun vz-toggle-search-flag () "Vz:ページングモード" (interactive) (and (car search-ring) (vz-set-search-flag (not vz-search-flag)))) (defun vz-set-search-string () "Vz:検索文字列の設定" (interactive) (if (string= (vz-read-search-string) "") (progn (setq search-ring (cdr search-ring)) (vz-set-search-flag nil)) (vz-set-search-flag t)) (vz-update-last-cursorp)) (defun vz-query-replace () "Vz:文字列の置換" (interactive) (if (string= (setq vz-last-replace-from (vz-read-search-string)) "") () (setq vz-last-replace-to (vz-popup-window-for-search-string "置換文字列")) (setq vz-replace-with-prompt t) (vz-replace-menu))) (defun vz-repeat-last-replace () "Vz:直前の置換の再実行" (interactive) (if vz-replace-with-prompt (setq vz-replace-with-prompt (not (vz-y-or-n-p "一度に置換しますか?")))) (setq case-fold-search vz-case-fold-search) ; Vzではグローバル変数 (let ((count)) (save-restriction (and vz-block-mark-pos (narrow-to-region vz-block-mark-line (vz-bol-pos))) (setq count (cond ((eq vz-replace-direction 'all) (save-excursion (goto-char (point-min)) (vz-perform-replace (if vz-regexp-search 're-search-forward (if vz-word-search 'word-search-forward 'search-forward))))) ((eq vz-replace-direction 'forward) (save-excursion (vz-perform-replace (if vz-regexp-search 're-search-forward (if vz-word-search 'word-search-forward 'search-forward))))) ((eq vz-replace-direction 'backward) (save-excursion (vz-perform-replace (if vz-regexp-search 're-search-backward (if vz-word-search 'word-search-backward 'search-backward))))))) (and vz-block-mark-pos (widen))) (message (format "%d個の文字列を置換しました" count)) count)) ;;added FURUE Hideyuki, 95.8.13 (defun vz-read-search-string () (vz-popup-window-for-search-string (format "検索文字列" (if vz-word-search "W" "") (if vz-case-fold-search "C" "") "" (if vz-regexp-search "X" "")))) (defun vz-replace-all () "Vz テキスト全体" (interactive) (setq vz-replace-direction 'all) (vz-repeat-last-replace)) (defun vz-replace-forward () "Vz カーソル以降" (interactive) (setq vz-replace-direction 'forward) (vz-repeat-last-replace)) (defun vz-replace-backward () "Vz カーソル以前" (interactive) (setq vz-replace-direction 'backward) (vz-repeat-last-replace)) (defun vz-perform-replace (func) (let ((c 0)) (condition-case () (while (funcall func vz-last-replace-from nil t) (if (or (not vz-replace-with-prompt) (vz-y-or-n-p "置換しますか?")) (progn ;; 2002/02/13 modified by [yoh] (matsuda@palnet.or.jp) ;; わかってしまえばごくごく単純なバグでした。 ; (replace-match vz-last-replace-to nil t) (replace-match vz-last-replace-to t t) (setq c (1+ c))))) (quit c)) c)) ;; ;; カット&ペースト ;; (defun vz-block-mode () "Vz:ブロックモード" (interactive) (if vz-block-mark-pos (vz-end-block-mode) (setq vz-block-mark-pos (point) vz-block-mark-line (vz-bol-pos) vz-block-overlay (make-overlay (point) (point))) (force-mode-line-update) (overlay-put vz-block-overlay 'face 'region) ;;(setq transient-mark-mode t) )) (defun vz-copy-current-line () "Vz:カーソル行の複写" (interactive) (vz-copy) (vz-pop-kill-ring)) (defun vz-copy () "Vz:行・ブロック複写" (interactive) (or (eq last-command 'vz-next-line) (setq vz-goal-column (% (current-column) (1- (window-width))))) (if vz-block-mark-pos (progn ;; こんなプライベートな(?)関数呼び出していいのだろうか? (kill-new (buffer-substring vz-block-mark-line (vz-bol-pos))) (vz-end-block-mode) ) (save-excursion (beginning-of-line) (let ((beg (point))) (forward-line 1) (kill-new (buffer-substring beg (point))) ))) (setq this-command 'vz-next-line)) (defun vz-cut () "Vz:行・ブロック削除" (interactive) (let ((col (current-column))) (or (eq last-command 'vz-next-line) (setq vz-goal-column (% col (1- (window-width))))) (if vz-block-mark-pos (progn (kill-new (buffer-substring vz-block-mark-line (vz-bol-pos))) (delete-region vz-block-mark-line (vz-bol-pos)) (vz-end-block-mode) ) (beginning-of-line) (let ((p (point))) (forward-line 1) (kill-new (buffer-substring p (point))) (delete-region p (point)))) (if truncate-lines (move-to-column col) (move-to-column vz-goal-column)) (setq this-command 'vz-next-line) )) (defun vz-pop-kill-ring () "Vz:行・ブロック挿入" (interactive) (vz-paste) (setq kill-ring (cdr kill-ring))) (defun vz-paste () "Vz:行・ブロック複写" (interactive) (or (eq last-command 'vz-next-line) (setq vz-goal-column (% (current-column) (1- (window-width))))) (let ((s (car kill-ring)) (col (% (current-column) (1- (window-width))))) (if s (progn (beginning-of-line) (setcar vz-last-paste-region (point)) (save-excursion (insert s) (setcdr vz-last-paste-region (point))) (move-to-column vz-goal-column)))) (setq this-command 'vz-next-line)) ;fake (defun vz-undo-paste () "Vz ペーストのアンドゥ" (interactive) (condition-case () (let ((beg (car vz-last-paste-region)) (end (cdr vz-last-paste-region))) (kill-new (buffer-substring beg end)) (delete-region beg end)) (error nil))) (defun vz-erase-kill-ring () "Vz:スタックの消去" (interactive) (if (vz-y-or-n-p "テキストスタックを消去しますか?") (setq kill-ring nil))) ;; ;; 挿入 ;; (defun vz-insert-search-string () "Vz:文字列の複写" (interactive) (insert (car search-ring))) (defun vz-select-insert-string () "Vz:文字列の選択複写" (interactive) ;;デフォルト文字は挿入しない (insert (vz-popup-window-for-search-string "複写文字列"))) (defun vz-insert-buffer-file-name () "Vz:ファイル名の複写" (interactive) (insert (or (buffer-file-name) ""))) ;; ;; キーボードマクロ ;; (defun vz-start-kbd-macro () "Vz:キーボードマクロ" (interactive) (if defining-kbd-macro (end-kbd-macro) (start-kbd-macro nil) (message "m") ;;(message "キーボードマクロ登録中...") )) (defun vz-insert-kbd-macro () "Vz:キーボードマクロ文挿入" (interactive) (beginning-of-line) (save-excursion (mapcar (function (lambda (name) (insert-kbd-macro (intern name)))) (all-completions vz-kbd-macro-name-prefix obarray 'commandp)))) (defun vz-end-kbd-macro () (interactive) (let ((sym (vz-make-symbol-kbd-macro (this-command-keys)))) (if defining-kbd-macro (progn (end-kbd-macro) (message "OK!") (fset sym last-kbd-macro)) (if (fboundp sym) (execute-kbd-macro sym))))) (defun vz-make-symbol-kbd-macro (string) ;;意味不明な仕様の関数。 (intern (concat vz-kbd-macro-name-prefix (mapconcat (function single-key-description) string nil)))) ;; ;; ウィンドウ ;; (defun vz-change-window-size () "Vz:分割位置の変更" (interactive) ;; できるだけ、上(左)ウィンドウにいるときにやってください。 (vz-split-window t) (let ((ch nil) (echo-keystrokes 0)) (while (not (or (eq ch ?\C-m) (eq ch 'return))) (cond ((or (eq ch ?\C-x) (eq ch 'down)) (and (= vz-window-configuration 1) (enlarge-window 1))) ((or (eq ch ?\C-e) (eq ch 'up)) (and (= vz-window-configuration 1) (shrink-window 1))) ((or (eq ch ?\C-d) (eq ch 'right)) (and (= vz-window-configuration 2) (enlarge-window-horizontally 1))) ((or (eq ch ?\C-s) (eq ch 'left)) (and (= vz-window-configuration 2) (shrink-window-horizontally 1)))) (message vz-resize-mode-message) (setq ch (read-event)))) (message "")) (defun vz-other-window () "Vz:ウィンドウ切替え" (interactive) ;;(set-window-configuration vz-last-window-configuration) (if (one-window-p) (switch-to-buffer nil) (other-window 1)) ;;(setq vz-last-window-configuration (current-window-configuration)) ) (defun vz-split-window (&optional resplit) "Vz:分割モード切替え" (interactive) ;; 協調性のない窓割。 ;;(set-window-configuration vz-last-window-configuration) (or resplit (setq vz-window-configuration (% (1+ vz-window-configuration) 3))) (delete-other-windows) (cond ((= vz-window-configuration 1) (let ((w (selected-window))) (select-window (split-window (selected-window) nil nil)) (switch-to-buffer nil) (select-window w))) ((= vz-window-configuration 2) (let ((w (selected-window))) (select-window (split-window (selected-window) nil t)) (switch-to-buffer nil) (select-window w)))) ;;(setq vz-last-window-configuration (current-window-configuration)) ) (defun vz-duplicate-window () "Vz テキストの二重化" (interactive) (setq vz-window-configuration 1) ;modified by FURUE Hideyuki, 95.8.15 (delete-other-windows) (let ((w (selected-window)) (b (current-buffer))) (select-window (split-window (selected-window))) (switch-to-buffer (get-buffer-create (generate-new-buffer-name (buffer-name b)))) (and (buffer-file-name b) (file-exists-p (buffer-file-name b)) (insert-file-contents (buffer-file-name b))) (set-buffer-modified-p nil) (setq buffer-read-only t) (select-window w))) ;; ;; ファイル操作(Vz互換のポップアップウィンドウじゃないけど...) ;; (autoload 'vz-dired "vz-dired" nil) (defun vz-close-file () "Vz:ファイルのクローズ" (interactive) (if (and (buffer-file-name) (buffer-modified-p)) (if (vz-y-or-n-p (format "%sを出力しますか?" (buffer-file-name))) (save-buffer) (set-buffer-modified-p nil))) (kill-buffer (current-buffer))) (defun vz-open-file () "Vz:ファイルのオープン" (interactive) (let ((filename (vz-popup-window-for-file "入力ファイル"))) (if (car (file-attributes filename)) (vz-dired filename) (switch-to-buffer (find-file-noselect filename))))) (defun vz-open-file-read-only () "Vz:Read onlyオープン" (interactive) (vz-open-file) (setq buffer-read-only t)) (defun vz-create-new-file () "Vz:新規ファイルオープン" (interactive) (let ((filename (vz-popup-window-for-file "新規ファイル"))) (if (string= filename "") () (if (car (file-attributes filename)) (vz-dired filename) (switch-to-buffer (find-file-noselect filename)))))) (defun vz-write-file () "Vz:ファイル名の変更" (interactive) (let ((filename "")) (while (string= filename "") (setq filename (vz-popup-window-for-file "ファイル名" (buffer-name)))) ; (buffer-file-name) ; t))) (setq buffer-file-name filename) ;added again by FURUE Hideyuki, 95.8.16 (rename-buffer filename) ;modified by FURUE Hideyuki, 95.8.13 )) (defun vz-append-to-file () "Vz:既存ファイルへ追加" (interactive) (let ((filename (vz-popup-window-for-file "追加ファイル"))) (if (or (file-exists-p filename) (vz-y-or-n-p (format "%sは存在しません。アペンドしますか?" filename))) (if vz-block-mark-pos (progn (append-to-file vz-block-mark-line (vz-bol-pos) filename) (vz-end-block-mode)) (append-to-file (point-min) (point-max) filename))))) (defun vz-save-file () "Vz:ファイルのセーブ" (interactive) (let ((filename "")) (while (string= filename "") (setq filename (vz-popup-window-for-file "出力ファイル" (if vz-block-mark-pos "" (buffer-name))) ; (if vz-block-mark-pos "" (buffer-file-name)) ; t) ; too long... )) (if vz-block-mark-pos (progn (write-region vz-block-mark-line (vz-bol-pos) filename) (vz-end-block-mode)) (write-file filename)))) (defun vz-insert-file () "Vz カーソル位置へ挿入" (interactive) (let ((filename (vz-popup-window-for-file "入力ファイル"))) (if (string= filename "") () (if vz-block-mark-pos (progn (delete-region vz-block-mark-line (vz-bol-pos)) (vz-end-block-mode))) (insert-file-contents filename)))) (defun vz-revert-file () "Vz 編集のやり直し" (interactive) (if (and (buffer-file-name) (buffer-modified-p) (vz-y-or-n-p "編集テキストを放棄しますか?")) (revert-buffer nil t))) (defun vz-open-alternate-file () "Vz:クローズ・オープン" (interactive) (vz-close-file) (vz-open-file)) (defun vz-close-all-files () "Vz 全ファイルのクローズ" (interactive) (mapcar (function (lambda (buf) (if (buffer-file-name buf) (progn (switch-to-buffer buf) (vz-close-file))))) (buffer-list))) (defun vz-quit () "Vz:エディタを終了" (interactive) (if (and (memq t (mapcar (function (lambda (buf) (and (buffer-file-name buf) (buffer-modified-p buf)))) (buffer-list))) (vz-y-or-n-p "修正テキストを出力しますか?")) (save-some-buffers t)) (if (vz-y-or-n-p "エディタを終了しますか?") (kill-emacs))) ;; ;; その他 ;; (defun vz-newline-and-indent () "Vz:リターン" (interactive) (if vz-auto-indent (let (beg end) (save-excursion (beginning-of-line) (setq beg (point)) (setq end (+ beg (skip-chars-forward (vz-whitespace-chars))))) (if (< (point) end) (newline) (newline) (insert (buffer-substring beg end)))) (newline))) (defun vz-toggle-tab-width () "Vz タブの切替え" (interactive) (if (= tab-width vz-tab-width) (setq tab-width vz-tab-width-for-c) (setq tab-width vz-tab-width)) (redraw-display)) (defun vz-toggle-case-word () "Vz:英大文字/小文字変換" (interactive) (let ((char (following-char))) (cond ((and (<= ?a char) (<= char ?z)) (save-excursion (upcase-word 1))) ((and (<= ?A char) (<= char ?Z)) (save-excursion (downcase-word 1))) ))) (defun vz-switch-to-shell-command-buffer () "Vz:DOS画面出力の参照" (interactive) (switch-to-buffer (get-buffer-create "*Shell Command Output*"))) (defun vz-shell-command () "Vz:DOSコマンド実行" (interactive) (let ((command (vz-popup-window-for-shell-command (format "シェルコマンド<%s>" default-directory)))) (if (string= command "") () (shell-command command)))) (defun vz-help () "Vz:ヘルプ" (interactive) (let* ((key (read-key-sequence "ヘルプ: ")) (sym (key-binding key))) (message "%s : %s" (key-description key) (if sym (documentation sym) "未定義")))) ;;added by FURUE Hideyuki, 95.8.12 (defun vz-change-indent () "Vz:インデントの変更" (interactive) (let (beg lines (indent 999)) ;; ;; count lines in region ;; (if vz-block-mark-pos (setq beg vz-block-mark-line lines (count-lines vz-block-mark-line (vz-bol-pos))) (setq beg (vz-bol-pos) lines 1)) ;; ;; untabify and get minimum indentation in region ;; (save-excursion (goto-char beg) (let ((i 0)) (while (< i lines) (let (b e w) (setq b (point)) (save-excursion (skip-chars-forward (vz-whitespace-chars)) (setq e (point)) (setq w (current-column)) (setq indent (min w indent)) (delete-region b e) (insert (make-string w ? ))) (forward-line 1) ; This will signal error at eob... (setq i (1+ i)) ))) ;; ;; loop; exits by event RET ;; (let ((ch nil) (echo-keystrokes 0)) (while (not (or (eq ch ?\C-m) (eq ch 'return))) (cond ((or (eq ch ?\C-d) (eq ch 'right)) (setq indent (1+ indent)) (goto-char beg) (let ((i 0)) (while (< i lines) (insert ? ) (forward-line 1) (setq i (1+ i))))) ((or (eq ch ?\C-s) (eq ch 'left)) (if (< 0 indent) (progn (setq indent (1- indent)) (goto-char beg) (let ((i 0)) (while (< i lines) (delete-char 1) (forward-line 1) (setq i (1+ i)))))))) (message vz-resize-mode-message) (setq ch (read-event)))) ;; ;; tabify again ;; (goto-char beg) (let ((i 0) (s (make-string tab-width ? ))) (while (< i lines) (save-excursion (while (looking-at s) (delete-region (match-beginning 0) (match-end 0)) (insert ?\t))) (forward-line 1) (setq i (1+ i)))) (if vz-block-mark-pos (vz-end-block-mode)) (message "")))) (defun vz-zenkaku-paren () "Vz 全角括弧" ;; これはほとんど使ったことがない (interactive) (let ((mc-flag t) (n (length vz-zenkaku-paren-alist)) (ch (following-char)) i s) ;;開き括弧? (setq i 0) (while (and (< i n) (not (eq ch (car (nth i vz-zenkaku-paren-alist))))) (setq i (1+ i))) (if (< i n) (let ((parens (nth (% (1+ i) n) vz-zenkaku-paren-alist))) (delete-char 2) (insert (car parens) (cdr parens)) (backward-char 1)) ;;閉じ括弧? (setq i 0) (while (and (< i n) (not (eq ch (cdr (nth i vz-zenkaku-paren-alist))))) (setq i (1+ i))) (if (< i n) (let ((parens (nth (% (1+ i) n) vz-zenkaku-paren-alist))) (backward-char 1) (delete-char 2) (insert (car parens) (cdr parens)) (backward-char 1)) ;;added by FURUE Hideyuki, 95.8.12 ;;新規括弧 (insert (car (car vz-zenkaku-paren-alist)) (cdr (car vz-zenkaku-paren-alist))) (backward-char 1) )))) (defun vz-toggle-zenhan () "Vz:全角/半角変換" (interactive) ;; めんどくさいのでegg.elにやってもらおう... ;; Emacs20 以降だと要らないんです。< egg by [yoh] 2002/02/12 ; (or (featurep 'egg) ; (let ((mode-line-format (default-value 'mode-line-format))) ; (require 'egg))) ;;modified by FURUE Hideyuki, 95.8.12 (if vz-block-mark-pos (vz-zenhan-menu) (let ((ch (char-category (following-char))) beg end) (setq beg (point)) (setq end (save-excursion (let ((org (vz-char-type (following-char)))) (while (and (not (eolp)) (progn (forward-char 1) (= org (vz-char-type (following-char))))))) (point))) (let ((case-fold-search nil)) ;; modified by [yoh] 2002.03.10 ;; 敢えてカタカナ変換は半角->全角の片方向のみとした。 ;; メニューで切替えられるようにするのはそのうち、ということで。^^; (cond ((string-match "[ak]" ch) ;半角カナ(JISX201片仮名) ; (zenkaku-region beg end)) ; ↓↑ (japanese-zenkaku-region beg end)) ; ↓↑ ; ((string-match "[AKSH]" ch) ;全角カナ(JISX208漢字) ((string-match "[AKj]+|" ch) ; (hankaku-region beg end)) ;は、やってくれないみたい... (japanese-hankaku-region beg end t)) ))))) ;; memo: ;; vz-toggle-zenhan のワードサーチに vz-char-type が使われている。 ;; この関数の実行結果が半角記号を誤って区別するので、記号の半角->全角 ;; 変換が中断してしまう。 ;; しかし、この区別のロジックが文節ジャンプには非常に好都合である。 ;; 理想的には、 vz-toggle-zenhan 専用の文字区別関数が必要ではないかと ;; 思う。 ;; 2002.03.25 [yoh] (defun vz-hankaku-region () (interactive) ;; modified by [yoh] 2002.03.10 ;; (hankaku-region vz-block-mark-line (vz-bol-pos)) (japanese-hankaku-region vz-block-mark-line (vz-bol-pos) t) (vz-end-block-mode)) (defun vz-zenkaku-region () (interactive) ;; modified by [yoh] 2002.03.10 ;; (zenkaku-region vz-block-mark-line (vz-bol-pos)) (japanese-zenkaku-region vz-block-mark-line (vz-bol-pos)) (vz-end-block-mode)) (defun vz-find-tag () (interactive) (let (filename lineno) (save-excursion (beginning-of-line) (and (looking-at "\\([^:]*\\): *\\([0-9]*\\):") (setq filename (buffer-substring (match-beginning 1) (match-end 1)) lineno (string-to-int (buffer-substring (match-beginning 2) (match-end 2)))))) (vz-next-line) (and (file-exists-p filename) (find-file-other-window filename) (goto-line lineno)))) ;; ;; 他のソースをベースにしたコマンド(ウィンドウ比較・対応する括弧へジャンプ) ;; ;;modified by FURUE Hideyuki, 95.8.16 (autoload 'vz-compare-windows "vz-misc" "Vz:テキストの比較") (autoload 'vz-goto-matching-paren "vz-misc" "Vz:対応する()[]{}<>") ;; ;; 各種メニュー ;; (eval-and-compile (load "vz-menu" nil)) ;;added FURUE Hideyuki, 95.8.14 (def-vz-menu-in-minibuffer vz-search-option-menu '((?W . vz-word-search) (?C . vz-case-fold-search) (?Z . vz-zenhan-search) (?X . vz-regexp-search)) "検索オプション") ;;(put 'vz-word-search 'vz-label "ワードサーチ") ;;(put 'vz-case-fold-search 'vz-label "英大/小文字") ;;(put 'vz-zenhan-search 'vz-label "全角/半角文字") ;;(put 'vz-regexp-search 'vz-label "正規表現") (put 'vz-word-search 'vz-label "ワード") (put 'vz-case-fold-search 'vz-label "英大小") ;;(put 'vz-zenhan-search 'vz-label "全半角") (put 'vz-zenhan-search 'vz-label " ---- ") (put 'vz-regexp-search 'vz-label "正規EX") (put 'vz-case-fold-search 'vz-sublabel '("同一視" . " 区別 ")) (put 'vz-zenhan-search 'vz-sublabel '("同一視" . " 区別 ")) (def-vz-menu-in-minibuffer vz-zenhan-menu '((?Z . vz-zenkaku-region) (?H . vz-hankaku-region)) "全角/半角変換") (put 'vz-zenkaku-region 'vz-label "半角→全角") (put 'vz-hankaku-region 'vz-label "全角→半角") (def-vz-menu-in-minibuffer vz-replace-menu '((?A . vz-replace-all) (?F . vz-replace-forward) (?B . vz-replace-backward)) "置換範囲") (put 'vz-replace-all 'vz-label "テキスト全体") (put 'vz-replace-forward 'vz-label "カーソル以降") (put 'vz-replace-backward 'vz-label "カーソル以前") (def-vz-menu vz-file-menu '((?O . vz-open-file) (?C . vz-close-file) (?S . vz-save-file) (?N . vz-create-new-file) (?R . vz-open-file-read-only) (?L . vz-open-alternate-file) (?A . vz-append-to-file) (?P . vz-switch-to-shell-command-buffer) (?D . vz-duplicate-window) (?U . vz-revert-file) (?I . vz-insert-file) (?X . vz-close-all-files) (?E . vz-shell-command) (?Q . vz-quit)) "ファイルメニュー") (def-vz-menu vz-mode-menu '((?A . vz-auto-indent) (?H . vz-half-screen-scroll) (?B . make-backup-files)) "モードメニュー") (put 'vz-auto-indent 'vz-label "オートインデント") ;;(put 'vz-half-screen-scroll 'vz-label "ページング単位") (put 'vz-half-screen-scroll 'vz-label " -------- ") (put 'vz-half-screen-scroll 'vz-sublabel '("半画面" . "全画面")) (put 'make-backup-files 'vz-label "バックアップ") (def-vz-menu vz-sub-menu '((?J . vz-goto-line) (?B . vz-goto-beginning-of-block) (?V . toggle-read-only) (?I . vz-change-indent) (?T . vz-toggle-tab-width) (?P . vz-switch-to-shell-command-buffer)) "サブメニュー") (put 'toggle-read-only 'vz-label "Viewモード") ;; ;; バッファメニュー(こんなんで正常に動くんだろうか?) ;; ;; renamed vz-buffer-menu -> vz-INTERNAL-buffer-menu ;; vz-make-buffer-menu -> vz-buffer-menu ;; by FURUE Hideyuki, 95.8.16 (def-vz-menu vz-INTERNAL-buffer-menu '((?1 . undefined)) "編集テキスト") (defun vz-buffer-menu () "Vz:編集テキスト切替え" (interactive) (let ((i 0) n buflist menu) (mapcar (function (lambda (buf) (or (eq (string-to-char (buffer-name buf)) ? ) (setq buflist (cons buf buflist))))) (buffer-list)) (setq buflist (reverse buflist)) (setq n (min (length buflist) vz-max-buffer-number)) (put 'vz-INTERNAL-buffer-menu 'vz-default-pos 0) (while (< i n) (let ((func (intern (concat vz-switch-to-buffer-function-prefix (int-to-string (1+ i))))) (buf (nth i buflist)) bufname bufmod bufsize bufro bufmaj) (save-excursion (set-buffer buf) (setq bufname (buffer-name) bufmod (buffer-modified-p) bufsize (buffer-size) bufro buffer-read-only bufmaj major-mode)) (fset func (list 'lambda nil (list 'switch-to-buffer bufname))) (put func 'vz-label (format "%c %-16s %8d %s" (if bufmod ?* (if bufro ?% ? )) bufname bufsize (if (eq bufmaj 'vz-mode) "(VZ)" ""))) (and (string= (buffer-name) bufname) (put 'vz-INTERNAL-buffer-menu 'vz-default-pos i)) (setq menu (cons (cons (+ i ?1) func) menu))) (setq i (1+ i))) (setq vz-INTERNAL-buffer-menu (reverse menu)) (vz-INTERNAL-buffer-menu))) ;(fset 'vz-make-buffer-menu 'vz-bufer-menu) (provide 'vz) ;; end of vz.el