(defcustom nsearch-symbol-chars "_-" "*A string containing legal characters in a symbol.The current syntax table should really be used for this." :type 'string :group 'netsearch)
(defcustom nsearch-filename-chars "-.,/A-Za-z0-9_~!@#$%&+=\\" "*A string containing legal characters in a symbol.The current syntax table should really be used for this." :type 'string :group 'nsearch)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(defconst nsearch-running-in-xemacs (string-match "XEmacs\|Lucid" emacs-version))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(defcustom nsearch-no-mouse-prompts nil "*If non-nil, use the symbol under the cursor instead of prompting.Do not prompt for a value, except for when seaching for a egrep patternor a file." :type 'boolean :group 'nsearch)
(defun eskip-chars-backward (symbol) (if (re-search-backward symbol 20 t) (eskip-chars-backward symbol) nil) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(defun nsearch-extract-symbol-at-cursor (extract-filename) (let* ( (symbol-chars (if extract-filename nsearch-filename-chars nsearch-symbol-chars)) (symbol-char-regexp (concat "[" symbol-chars "]")) ) (save-excursion (progn (buffer-substring-no-properties (progn (if (not (looking-at symbol-char-regexp)) (re-search-backward "" nil t)) (skip-chars-backward symbol-chars ) (point)) (progn (skip-chars-forward symbol-chars ) (point) )) (if (or (not sym) (string-match " " sym)) (setq sym (current-word)) sym) )) ))
(defun nsearch-prompt-for-symbol (prompt extract-filename) "prompt the user for a cscope symbol." (let (sym) (setq sym (nsearch-extract-symbol-at-cursor extract-filename)) (if (or (not sym) (string= sym "") (not (and nsearch-running-in-xemacs nsearch-no-mouse-prompts current-mouse-event (or (mouse-event-p current-mouse-event) (misc-user-event-p current-mouse-event)))) ;; Always prompt for symbol in dired mode. (eq major-mode 'dired-mode) ) (setq sym (read-from-minibuffer prompt sym)) sym) ))
(defun nsearch-find (symbol) "Find a symbol's global definition." (interactive (list (nsearch-prompt-for-symbol "Find this: " nil) )) (let ((nsearch-symbol symbol)) (setq nsearch-symbol (concat "=" nsearch-symbol)) (message "%s" nsearch-symbol) (start-process "iexplorer" (get-buffer-create "temp" ) "C:/Program Files/Internet Explorer/iexplore.exe" nsearch-symbol) ))
(global-set-key (kbd "C-c n") 'nsearch-find)
本文地址:http://sjzytwl.xhstdz.com/quote/68549.html 物流园资讯网 http://sjzytwl.xhstdz.com/ , 查看更多