Chinaunix首页 | 论坛 | 博客
  • 博客访问: 958301
  • 博文数量: 109
  • 博客积分: 554
  • 博客等级: 中士
  • 技术积分: 2577
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-04 12:49
文章分类

全部博文(109)

文章存档

2019年(5)

2016年(7)

2015年(9)

2014年(1)

2013年(71)

2012年(16)

分类: 嵌入式

2013-06-24 13:49:43

.emacs 添加


  1. (require 'ack-and-a-half)
  2. (defalias 'ack 'ack-and-a-half)
  3. (defalias 'ack-same 'ack-and-a-half-same)
  4. (defalias 'ack-find-file 'ack-and-a-half-find-file)
  5. (defalias 'ack-find-file-same 'ack-and-a-half-find-file-same)

网上下载ack-and-a-half.el
ack-and-a-half.rar

使用方法:
M-x ack
提示输入正则表达式,ack会从当前文件夹搜索正则表达式的字符串

在windows上用ack需要额外的一些步骤

  1. (defun ack-and-a-half-run (directory regexp pattern &rest arguments)
  2.   "Run ack in DIRECTORY with ARGUMENTS."
  3.   (let ((default-directory (if directory
  4.                                (file-name-as-directory (expand-file-name directory))
  5.                              default-directory)))
  6.     (setq arguments (append ack-and-a-half-arguments
  7.                             (ack-and-a-half-arguments-from-options regexp)
  8.                             arguments
  9.                             (list "--")
  10.                             (list (shell-quote-argument pattern))
  11.                             (if system-type 'windows-nt
  12.                               (list (concat " < " "/dev/null"))) ;;; THIS LINE WAS ADDED

  13.                             ))
  14.     (make-local-variable 'compilation-buffer-name-function)
  15.     (let ((compilation-buffer-name-function nil)
  16.           (compilation-disable-input t))
  17.       (setq compilation-buffer-name-function 'ack-buffer-name)
  18.       (compilation-start (mapconcat 'identity (nconc (list ack-and-a-half-executable) arguments) " ")
  19.                          

配置
(defcustom ack-and-a-half-executable (or (executable-find "ack")
                                         (executable-find "ack-grep"))
  "*The location of the ack executable."
  :group 'ack-and-a-half
  :type 'file)

M-x customize 配置 ack-and-a-half-executable 到 “ack”, windows下无法找到ack

阅读(2705) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~