Update of /cvsroot/cscope/cscope/contrib/xcscope
In directory usw-pr-cvs1:/tmp/cvs-serv28870
Modified Files:
xcscope.el
Log Message:
Code cleanup.
Arrow overlays are now optional, and the overlay string is now an
option.
Quitting the cscope buffer now kills the overlay arrow.
Index: xcscope.el
===================================================================
RCS file: /cvsroot/cscope/cscope/contrib/xcscope/xcscope.el,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** xcscope.el 2001/06/28 03:26:46 1.7
--- xcscope.el 2001/06/28 04:45:05 1.8
***************
*** 7,11 ****
; Author: Darryl Okahata
; Created: Wed Apr 19 17:03:38 2000
! ; Modified: Tue Mar 13 11:48:17 2001 (Darryl Okahata) darrylo@...
; Language: Emacs-Lisp
; Package: N/A
--- 7,11 ----
; Author: Darryl Okahata
; Created: Wed Apr 19 17:03:38 2000
! ; Modified: Wed Jun 27 20:59:17 2001
; Language: Emacs-Lisp
; Package: N/A
***************
*** 19,23 ****
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
! ;; ALPHA VERSION 0.94
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
--- 19,23 ----
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
! ;; ALPHA VERSION 0.95
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
***************
*** 679,682 ****
--- 679,703 ----
+ (defcustom cscope-allow-arrow-overlays t
+ "*If non-nil, use an arrow overlay to show target lines.
+ Arrow overlays are only used when the following functions are used:
+
+ cscope-show-entry-other-window
+ cscope-show-next-entry-other-window
+ cscope-show-prev-entry-other-window
+
+ The arrow overlay is removed when other cscope functions are used.
+ Note that the arrow overlay is not an actual part of the text, and can
+ be removed by quitting the cscope buffer."
+ :type 'boolean
+ :group 'cscope)
+
+
+ (defcustom cscope-overlay-arrow-string "=>"
+ "*The overlay string to use when displaying arrow overlays."
+ :type 'string
+ :group 'cscope)
+
+
(defvar cscope-minor-mode-hooks nil
"List of hooks to call when entering cscope-minor-mode.")
***************
*** 767,773 ****
(define-key cscope-list-entry-keymap "n" 'cscope-show-next-entry-other-window)
(define-key cscope-list-entry-keymap "p" 'cscope-show-prev-entry-other-window)
! (define-key cscope-list-entry-keymap "q" 'bury-buffer)
(define-key cscope-list-entry-keymap "Q" 'cscope-quit)
(define-key cscope-list-entry-keymap "h" 'cscope-help)
(define-key cscope-list-entry-keymap "s" 'cscope-find-this-symbol)
(define-key cscope-list-entry-keymap "g" 'cscope-find-global-definition)
--- 788,795 ----
(define-key cscope-list-entry-keymap "n" 'cscope-show-next-entry-other-window)
(define-key cscope-list-entry-keymap "p" 'cscope-show-prev-entry-other-window)
! (define-key cscope-list-entry-keymap "q" 'cscope-bury-buffer)
(define-key cscope-list-entry-keymap "Q" 'cscope-quit)
(define-key cscope-list-entry-keymap "h" 'cscope-help)
+ (define-key cscope-list-entry-keymap "?" 'cscope-help)
(define-key cscope-list-entry-keymap "s" 'cscope-find-this-symbol)
(define-key cscope-list-entry-keymap "g" 'cscope-find-global-definition)
***************
*** 799,803 ****
mode-name "cscope"
major-mode 'cscope-list-entry-mode
! overlay-arrow-string "=>")
(or overlay-arrow-position
(setq overlay-arrow-position (make-marker)))
--- 821,825 ----
mode-name "cscope"
major-mode 'cscope-list-entry-mode
! overlay-arrow-string cscope-overlay-arrow-string)
(or overlay-arrow-position
(setq overlay-arrow-position (make-marker)))
***************
*** 970,974 ****
:style toggle :selected cscope-index-recursively ]
[ "Suppress empty matches" (setq cscope-suppress-empty-matches
! (not cscope-suppress-empty-matches))
:style toggle :selected cscope-suppress-empty-matches ]
[ "Use relative paths" (setq cscope-use-relative-paths
--- 992,996 ----
:style toggle :selected cscope-index-recursively ]
[ "Suppress empty matches" (setq cscope-suppress-empty-matches
! (not cscope-suppress-empty-matches))
:style toggle :selected cscope-suppress-empty-matches ]
[ "Use relative paths" (setq cscope-use-relative-paths
***************
*** 976,980 ****
:style toggle :selected cscope-use-relative-paths ]
[ "No mouse prompts" (setq cscope-no-mouse-prompts
! (not cscope-no-mouse-prompts))
:style toggle :selected cscope-no-mouse-prompts ]
))
--- 998,1002 ----
:style toggle :selected cscope-use-relative-paths ]
[ "No mouse prompts" (setq cscope-no-mouse-prompts
! (not cscope-no-mouse-prompts))
:style toggle :selected cscope-no-mouse-prompts ]
))
***************
*** 1004,1008 ****
plist (plist-put plist 'cscope-file filename))
(if line-number
! (progn
(if (stringp line-number)
(setq line-number (string-to-number line-number)))
--- 1026,1030 ----
plist (plist-put plist 'cscope-file filename))
(if line-number
! (progn
(if (stringp line-number)
(setq line-number (string-to-number line-number)))
***************
*** 1031,1035 ****
(select-window window))
(recenter n)))
! )
--- 1053,1057 ----
(select-window window))
(recenter n)))
! )
***************
*** 1101,1105 ****
(setq new-point old-point))
(set-window-point window new-point)
! (if arrow-p
(set-marker overlay-arrow-position (point))
(set-marker overlay-arrow-position nil))
--- 1123,1127 ----
(setq new-point old-point))
(set-window-point window new-point)
! (if (and cscope-allow-arrow-overlays arrow-p)
(set-marker overlay-arrow-position (point))
(set-marker overlay-arrow-position nil))
***************
*** 1141,1145 ****
(select-window window)
(sit-for 0) ;; Redisplay hack to allow delete-other-windows
! ;; to continue displaying the correct location.
(delete-other-windows window)
))
--- 1163,1167 ----
(select-window window)
(sit-for 0) ;; Redisplay hack to allow delete-other-windows
! ;; to continue displaying the correct location.
(delete-other-windows window)
))
***************
*** 1207,1215 ****
"Help")))
(defun cscope-quit ()
(interactive)
(kill-buffer cscope-output-buffer-name)
- (setq overlay-arrow-position nil
- overlay-arrow-string nil)
)
--- 1229,1249 ----
"Help")))
+
+ (defun cscope-bury-buffer ()
+ "Clean up cscope, if necessary, and bury the buffer."
+ (interactive)
+ (let ()
+ (if overlay-arrow-position
+ (set-marker overlay-arrow-position nil))
+ (setq overlay-arrow-position nil
+ overlay-arrow-string nil)
+ (bury-buffer (get-buffer cscope-output-buffer-name))
+ ))
+
+
(defun cscope-quit ()
(interactive)
+ (cscope-bury-buffer)
(kill-buffer cscope-output-buffer-name)
)
***************
*** 1218,1225 ****
(defun cscope-canonicalize-directory (dir)
(or dir
! (setq dir default-directory))
! (setq dir (file-name-as-directory
! (expand-file-name (substitute-in-file-name dir))))
! dir
)
--- 1252,1259 ----
(defun cscope-canonicalize-directory (dir)
(or dir
! (setq dir default-directory))
! (setq dir (file-name-as-directory
! (expand-file-name (substitute-in-file-name dir))))
! dir
)
***************
*** 1288,1292 ****
;; Should we add any more places to look?
! ) ;; end catch
(if (not info)
(setq info (list (list top-directory))))
--- 1322,1326 ----
;; Should we add any more places to look?
! ) ;; end catch
(if (not info)
(setq info (list (list top-directory))))
***************
*** 1313,1317 ****
beg (- end (length line)))
(put-text-property beg end 'face 'cscope-line-face str)
! ))
str))
--- 1347,1351 ----
beg (- end (length line)))
(put-text-property beg end 'face 'cscope-line-face str)
! ))
str))
***************
*** 1367,1381 ****
(match-end 4))
)
! ;; If the current file is not the same as the previous
! ;; one ...
! (if (not (and cscope-last-file
! (string= file cscope-last-file)))
! (progn
! ;; The current file is different.
! ;; Insert a separating blank line if
! ;; necessary.
(if cscope-last-file (insert "\n"))
! ;; Insert the file name
(setq str (concat "*** " file ":"))
(if cscope-use-face
--- 1401,1415 ----
(match-end 4))
)
! ;; If the current file is not the same as the previous
! ;; one ...
! (if (not (and cscope-last-file
! (string= file cscope-last-file)))
! (progn
! ;; The current file is different.
! ;; Insert a separating blank line if
! ;; necessary.
(if cscope-last-file (insert "\n"))
! ;; Insert the file name
(setq str (concat "*** " file ":"))
(if cscope-use-face
***************
*** 1385,1411 ****
(cscope-insert-with-text-properties
str
! (expand-file-name file)
! ;; Yes, -1 is intentional
! -1)
(insert "\n")
! ))
! (if (not cscope-first-match)
! (setq cscope-first-match-point (point)))
! ;; ... and insert the line, with the
! ;; appropriate indentation.
(cscope-insert-with-text-properties
(cscope-make-entry-line function-name
line-number
! line)
(expand-file-name file)
line-number)
(insert "\n")
! (setq cscope-last-file file)
! (if cscope-first-match
! (setq cscope-matched-multiple t)
! (setq cscope-first-match
! (cons (expand-file-name file)
! (string-to-number line-number))))
! ))
(insert line "\n")
))
--- 1419,1445 ----
(cscope-insert-with-text-properties
str
! (expand-file-name file)
! ;; Yes, -1 is intentional
! -1)
(insert "\n")
! ))
! (if (not cscope-first-match)
! (setq cscope-first-match-point (point)))
! ;; ... and insert the line, with the
! ;; appropriate indentation.
(cscope-insert-with-text-properties
(cscope-make-entry-line function-name
line-number
! line)
(expand-file-name file)
line-number)
(insert "\n")
! (setq cscope-last-file file)
! (if cscope-first-match
! (setq cscope-matched-multiple t)
! (setq cscope-first-match
! (cons (expand-file-name file)
! (string-to-number line-number))))
! ))
(insert line "\n")
))
***************
*** 1564,1568 ****
cscope-program options))
(set-process-filter cscope-process cscope-filter-func)
- ;; (set-process-sentinel cscope-process 'cscope-process-sentinel)
(set-process-sentinel cscope-process cscope-sentinel-func)
(set-marker (process-mark cscope-process) (point))
--- 1598,1601 ----
***************
*** 1571,1576 ****
(setq modeline-process ": Searching ..."))
(setq buffer-read-only t)
! )
! (apply 'call-process cscope-program nil outbuf t options)
)
t
--- 1604,1609 ----
(setq modeline-process ": Searching ..."))
(setq buffer-read-only t)
! )
! (apply 'call-process cscope-program nil outbuf t options)
)
t
***************
*** 1836,1840 ****
(point)
)))
! ))
--- 1869,1873 ----
(point)
)))
! ))
|