;;; -*- Emacs-Lisp -*- ;;; vz-misc.el ;;; Copyright (C) 1994, 1995 ;;; 古江 秀之 (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-misc.el ;;; ;;; Function ``vz-goto-matching-paren'' based on: ;;; ;;; simple.el --- basic editing commands for Emacs ;; Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. (defun vz-goto-matching-paren () "Vz:対応する()[]{}<>" ;; blink-matching-openをマネしました (^_^; ;;[]「」『』【】でも移動してくれるのはよしとしましょう。 (interactive) (and (not (eobp)) (or (bobp) (not (memq (char-syntax (char-before (point))) '(?/ ?\\ )))) (let (blinkpos mismatch (oldpos (point)) (ch (char-syntax (char-after (point))))) (cond ((char-equal ch ?\() (condition-case () (setq blinkpos (1- (scan-sexps oldpos 1))) (error nil))) ((char-equal ch ?\)) (condition-case () (setq blinkpos (scan-sexps (1+ oldpos) -1)) (error nil)))) (and blinkpos (/= (char-syntax (char-after blinkpos)) ?\$) (setq mismatch (/= (char-after oldpos) (matching-paren (char-after blinkpos))))) (if (or mismatch (not blinkpos)) (message "括弧が見つかりません") (goto-char blinkpos))))) ;;; ;;; Function ``vz-compare-windows'' is based on: ;;; ;;; compare-w.el --- compare text between windows for Emacs. ;; Copyright (C) 1986, 1989, 1993 Free Software Foundation, Inc. ;; Maintainer: FSF ;; This file is part of GNU Emacs. (defun vz-compare-windows () "Vz:テキストの比較" (interactive) ;; modified by FURUE Hideyuki, 95.8.13 (let* (p1 p2 maxp1 maxp2 b1 b2 w2 success size (opoint1 (point)) opoint2 (omc-flag1 mc-flag) omc-flag2) (setq p1 (point) b1 (current-buffer)) ;;modified by FURUE Hideyuki, 95.8.13 (setq w2 (next-window (selected-window))) (if (eq w2 (selected-window)) (setq b2 (other-buffer) p2 (save-excursion (set-buffer b2) (point))) (setq p2 (window-point w2) b2 (window-buffer w2))) (setq opoint2 p2) (setq maxp1 (point-max)) (save-excursion (set-buffer b2) (setq omc-flag2 mc-flag) (setq maxp2 (point-max))) (unwind-protect (progn ;; set mc-flags to nil, to move point to the middle of character. (setq mc-flag nil) (save-excursion (set-buffer b2) (setq mc-flag nil)) (setq success t) (while success (setq success nil) ;; if interrupted, show how far we've gotten (set-buffer b2) ; modified by FURUE Hideyuki, 95.8.13 (goto-char p2) (set-buffer b1) (goto-char p1) ;; Try advancing comparing 1000 chars at a time. ;; When that fails, go 500 chars at a time, and so on. (let ((size 1000) success-1 (case-fold-search nil)) (while (> size 0) (setq success-1 t) ;; Try comparing SIZE chars at a time, repeatedly, till ;; that fails. (while success-1 (setq size (min size (- maxp1 p1) (- maxp2 p2))) (setq success-1 (and (> size 0) (= 0 (compare-buffer-substrings b2 p2 (+ size p2) b1 p1 (+ size p1))))) (if success-1 (setq p1 (+ p1 size) p2 (+ p2 size) success t))) ;; If SIZE chars don't match, try fewer. (setq size (/ size 2)))))) ;; restore mc-flags. (setq mc-flag omc-flag1) (save-excursion (set-buffer b2) (setq mc-flag omc-flag2))) ;; adjust char-boundary. if we are sure that we began to compare ;; with char boundary, we can test (/= opoint1 p1) once, but no. (if (and omc-flag1 omc-flag2) (while (and (< opoint1 p1) (not (eobp)) ;added by FURUE Hideyuki, 95.8.13 (not (char-boundary-p p1))) (setq p1 (1- p1) p2 (1- p2)))) ;; modified by FURUE Hideyuki, 95.8.13 (if (and (= maxp1 p1) (= maxp2 p2)) (progn (goto-char opoint1) (if (not (eq w2 (selected-window))) (set-window-point w2 opoint2) (set-buffer b2) (goto-char opoint2) (set-buffer b1)) (message "一致しました")) (goto-char p1) (if (not (eq w2 (selected-window))) (set-window-point w2 p2) (set-buffer b2) (goto-char p2) (set-buffer b1)) (message "相違があります")) )) ;; end of vz-misc.el