From: Darryl O. <da...@us...> - 2001-06-28 03:24:08
|
Update of /cvsroot/cscope/cscope/contrib/xcscope In directory usw-pr-cvs1:/tmp/cvs-serv9476 Modified Files: xcscope.el Log Message: Steven Elliott's <sel...@au...> fuzzy matching patch. Index: xcscope.el =================================================================== RCS file: /cvsroot/cscope/cscope/contrib/xcscope/xcscope.el,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** xcscope.el 2001/06/28 02:07:44 1.5 --- xcscope.el 2001/06/28 03:24:05 1.6 *************** *** 899,902 **** --- 899,909 ---- (make-variable-buffer-local 'cscope-stop-at-first-match-dir-meta) + (defvar cscope-symbol nil + "The last symbol searched for.") + + (defvar cscope-adjust-range 1000 + "How far the point should be adjusted if the symbol is not on the line + specified by the cscope database.") + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; *************** *** 1034,1038 **** Put `overlay-arrow-string' if arrow-p is non-nil. Returns the window displaying BUFFER." ! (let (buffer old-pos) (if (and (stringp file) (integerp line-number)) --- 1041,1046 ---- Put `overlay-arrow-string' if arrow-p is non-nil. Returns the window displaying BUFFER." ! (let (buffer old-pos old-point new-point forward-point backward-point ! line-end line-length) (if (and (stringp file) (integerp line-number)) *************** *** 1044,1053 **** (set-window-buffer window buffer) (setq window (display-buffer buffer))) ! (set-buffer buffer) ! (if (> line-number 0) ! (progn (setq old-pos (point)) ! (goto-line line-number) ! (set-window-point window (point)) (if arrow-p (set-marker overlay-arrow-position (point)) --- 1052,1102 ---- (set-window-buffer window buffer) (setq window (display-buffer buffer))) ! (set-buffer buffer) ! (if (> line-number 0) ! (progn (setq old-pos (point)) ! (goto-line line-number) ! (setq old-point (point)) ! (if cscope-adjust-range ! (progn ! ;; Calculate the length of the line specified by cscope. ! (end-of-line) ! (setq line-end (point)) ! (goto-char old-point) ! (setq line-length (- line-end old-point)) ! ! ;; Search forward and backward for the pattern. ! (setq forward-point (search-forward ! cscope-symbol ! (+ old-point ! cscope-adjust-range) t)) ! (goto-char old-point) ! (setq backward-point (search-backward ! cscope-symbol ! (- old-point ! cscope-adjust-range) t)) ! (if forward-point ! (progn ! (if backward-point ! (setq new-point ! ;; Use whichever of forward-point or ! ;; backward-point is closest to old-point. ! ;; Give forward-point a line-length advantage ! ;; so that if the symbol is on the currrent ! ;; line the current line is chosen. ! (if (<= (- (- forward-point line-length) ! old-point) ! (- old-point backward-point)) ! forward-point ! backward-point)) ! (setq new-point forward-point))) ! (if backward-point ! (setq new-point backward-point) ! (setq new-point old-point))) ! (goto-char new-point) ! (beginning-of-line) ! (setq new-point (point))) ! (setq new-point old-point)) ! (set-window-point window new-point) (if arrow-p (set-marker overlay-arrow-position (point)) *************** *** 1056,1060 **** (= old-pos (point)) (push-mark old-pos)) ! )) ) (message "No entry found at point.")) --- 1105,1109 ---- (= old-pos (point)) (push-mark old-pos)) ! )) ) (message "No entry found at point.")) *************** *** 1812,1815 **** --- 1861,1865 ---- )) (let () + (setq cscope-symbol symbol) (cscope-call (format "Finding symbol: %s" symbol) (list "-0" symbol) nil 'cscope-process-filter *************** *** 1824,1827 **** --- 1874,1878 ---- )) (let () + (setq cscope-symbol symbol) (cscope-call (format "Finding global definition: %s" symbol) (list "-1" symbol) nil 'cscope-process-filter *************** *** 1837,1840 **** --- 1888,1892 ---- )) (let () + (setq cscope-symbol symbol) (cscope-call (format "Finding functions called by: %s" symbol) (list "-2" symbol) nil 'cscope-process-filter *************** *** 1850,1853 **** --- 1902,1906 ---- )) (let () + (setq cscope-symbol symbol) (cscope-call (format "Finding functions calling: %s" symbol) (list "-3" symbol) nil 'cscope-process-filter *************** *** 1862,1865 **** --- 1915,1919 ---- )) (let () + (setq cscope-symbol symbol) (cscope-call (format "Finding text string: %s" symbol) (list "-4" symbol) nil 'cscope-process-filter *************** *** 1875,1878 **** --- 1929,1933 ---- )) (let () + (setq cscope-symbol symbol) (cscope-call (format "Finding egrep pattern: %s" symbol) (list "-6" symbol) nil 'cscope-process-filter *************** *** 1888,1891 **** --- 1943,1947 ---- )) (let () + (setq cscope-symbol symbol) (cscope-call (format "Finding file: %s" symbol) (list "-7" symbol) nil 'cscope-process-filter *************** *** 1902,1905 **** --- 1958,1962 ---- )) (let () + (setq cscope-symbol symbol) (cscope-call (format "Finding files #including file: %s" symbol) (list "-8" symbol) nil 'cscope-process-filter |