Created
April 20, 2012 05:07
-
-
Save guehara/2426152 to your computer and use it in GitHub Desktop.
isearch-forward-word が気に入らないので改良版
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
参考【EmacsWiki: Search At Point】 http://emacswiki.org/emacs/SearchAtPoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar isearch-initial-string nil) | |
(defun isearch-set-initial-string () | |
(remove-hook 'isearch-mode-hook 'isearch-set-initial-string) | |
(setq isearch-string isearch-initial-string) | |
(isearch-search-and-update)) | |
(defun isearch-forward-at-point (&optional regexp-p no-recursive-edit) | |
"Interactive search forward for the symbol at point." | |
(interactive "P\np") | |
(if regexp-p (isearch-forward regexp-p no-recursive-edit) | |
(let* ((end (progn (skip-syntax-forward "w_") (point))) | |
(begin (progn (skip-syntax-backward "w_") (point)))) | |
(if (eq begin end) | |
(isearch-forward regexp-p no-recursive-edit) | |
(setq isearch-initial-string (buffer-substring begin end)) | |
(add-hook 'isearch-mode-hook 'isearch-set-initial-string) | |
(isearch-forward regexp-p no-recursive-edit))))) | |
(define-key isearch-mode-map "\C-w" 'isearch-forward-at-point) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment