;;; -*- Emacs-Lisp -*- ;;; vz-misc.el ;;; Copyright (C) 1994, 1995 ;;; 古江 秀之 (PXB04553@niftyserve.or.jp) ;;; ;;; Copyright (C) 2002 ;;; 松田 陽一 (matsuda@palnet.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, 1997 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 ;; modified by [yoh] 2002/02/12 (let* (p1 p2 maxp1 maxp2 b1 b2 w2 (progress 1) (opoint1 (point)) opoint2 (skip-func nil)) ;modified by [yoh] 2002/02/12 ; (skip-func (if ignore-whitespace ; (if (stringp compare-windows-whitespace) ; 'compare-windows-skip-whitespace ; compare-windows-whitespace)))) (setq p1 (point) b1 (current-buffer)) (setq w2 (next-window (selected-window))) (if (eq w2 (selected-window)) (setq w2 (next-window (selected-window) nil 'visible))) ;; modified by [yoh] 2002/02/12 ; (if (eq w2 (selected-window)) ; (error "No other window")) ; (setq p2 (window-point w2) ; b2 (window-buffer w2)) ;; appended from Furue-san's code by [yoh] 2002/02/12 (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) (push-mark p2 t) (setq maxp2 (point-max))) (push-mark) (while (> progress 0) ;; If both buffers have whitespace next to point, ;; optionally skip over it. (and skip-func (save-excursion (let (p1a p2a w1 w2 result1 result2) (setq result1 (funcall skip-func opoint1)) (setq p1a (point)) (set-buffer b2) (goto-char p2) (setq result2 (funcall skip-func opoint2)) (setq p2a (point)) (if (or (stringp compare-windows-whitespace) (and result1 result2 (eq result1 result2))) (setq p1 p1a p2 p2a))))) (let ((size (min (- maxp1 p1) (- maxp2 p2))) ; (case-fold-search compare-ignore-case)) (case-fold-search nil)) (setq progress (compare-buffer-substrings b2 p2 (+ size p2) b1 p1 (+ size p1))) (setq progress (if (zerop progress) size (1- (abs progress)))) (setq p1 (+ p1 progress) p2 (+ p2 progress))) ;; Advance point now rather than later, in case we're interrupted. ;; appended from Furue-san's code by [yoh] 2002/02/12 (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 "相違があります") ) ; (set-window-point w2 p2) )) (if (= (point) opoint1) (ding)))) ;; end of vz-misc.el