推广 热搜: 可以  企业  page  百度  搜索引擎    个数  使用  设备  选择 

文件内容关键字网页快速搜索

   日期:2024-12-18     移动:http://ww.kub2b.com/mobile/quote/6363.html

 

(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 pattern
or 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://ww.kub2b.com/quote/6363.html     企库往 http://ww.kub2b.com/ ,  查看更多

特别提示:本信息由相关用户自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


0相关评论
相关最新动态
推荐最新动态
点击排行
网站首页  |  关于我们  |  联系方式  |  使用协议  |  版权隐私  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报  |  鄂ICP备2020018471号