Selaa lähdekoodia

add view-mode-search-word, not tested with gtags yet

pull/1/head
10sr 11 vuotta sitten
vanhempi
commit
541caed66a
1 muutettua tiedostoa jossa 22 lisäystä ja 1 poistoa
  1. +22
    -1
      emacs.el

+ 22
- 1
emacs.el Näytä tiedosto

@@ -889,10 +889,31 @@ found, otherwise returns nil."
(define-key view-mode-map "?" 'isearch-backward-regexp)
(define-key view-mode-map "n" 'isearch-repeat-forward)
(define-key view-mode-map "N" 'isearch-repeat-backward)
(define-key view-mode-map (kbd "C-m") 'my-view-mode-search-word)
))
(global-set-key "\M-r" 'view-mode)
(setq view-read-only t)

(defun my-view-mode-search-word (word)
"Search for word current directory and subdirectories.
If called intearctively, find word at point."
(interactive (list (thing-at-point 'symbol)))
(if word
(if (and (require 'gtags nil t)
(gtags-get-rootpath))
(gtags-goto-tag word "s")
(if (eq 0
(shell-command "git rev-parse --git-dir"))
(compilation-start (format "git --no-pager grep -nH -e '%s'"
word)
'grep-mode)
;; TODO: handle ack
(grep (format "%s '%s' -r ."
grep-command
word))))
(message "No word at point.")
nil))

(add-hook 'Man-mode-hook
(lambda ()
(view-mode 1)
@@ -1796,7 +1817,7 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer."
;; misc funcs

(defun my-grep ()
"Use git-grep if avaliable.."
"Use git-grep if avaliable. Only called interactively."
(interactive)
(require 'grep)
(let ((--grep-command-bak grep-command)


Ladataan…
Peruuta
Tallenna