Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Allow multiple types.

  • Loading branch information...
commit 64f63c215afc56db4205840345b66760f41c58dc 1 parent 9fefde4
Nikolaj Schumacher authored

Showing 1 changed file with 67 additions and 65 deletions. Show diff stats Hide diff stats

  1. +67 65 full-ack.el
132 full-ack.el
@@ -56,12 +56,11 @@
56 56 (defcustom ack-mode-type-alist nil
57 57 "*Matches major modes to searched file types.
58 58 This overrides values in `ack-mode-default-type-alist'. The car in each
59   -list element is a major mode, the cdr is a string, which represents
  59 +list element is a major mode, the rest are strings representing values of
60 60 the --type argument used by `ack-same'."
61 61 :group 'full-ack
62 62 :type '(repeat (cons (symbol :tag "Major mode")
63   - (choice (string :tag "ack type")
64   - (const :tag "Search all" nil)))))
  63 + (repeat (string :tag "ack type")))))
65 64
66 65 (defcustom ack-mode-extension-alist nil
67 66 "*Matches major modes to searched file extensions.
@@ -169,57 +168,56 @@ used without confirmation."
169 168
170 169 (defconst ack-mode-default-type-alist
171 170 ;; Some of these names are guessed. More should be constantly added.
172   - '((actionscript-mode . "actionscript")
173   - (LaTeX-mode . "tex")
174   - (TeX-mode . "tex")
175   - (asm-mode . "asm")
176   - (batch-file-mode . "batch")
177   - (c++-mode . "cpp")
178   - (c-mode . "cc")
179   - (cfmx-mode . "cfmx")
180   - (cperl-mode . "perl")
181   - (csharp-mode . "csharp")
182   - (css-mode . "css")
183   - (emacs-lisp-mode . "elisp")
184   - (erlang-mode . "erlang")
185   - (espresso-mode . "js")
186   - (fortran-mode . "fortran")
187   - (haskell-mode . "haskell")
188   - (hexl-mode . "binary")
189   - (html-mode . "html")
190   - (java-mode . "java")
191   - (javascript-mode . "js")
192   - (jde-mode . "java")
193   - (js2-mode . "js")
194   - (jsp-mode . "jsp")
195   - (latex-mode . "tex")
196   - (lisp-mode . "lisp")
197   - (lua-mode . "lua")
198   - (makefile-mode . "make")
199   - (mason-mode . "mason")
200   - (nxml-mode . "xml")
201   - (objc-mode . "objc")
202   - ;; (objc++-mode . "objcpp")
203   - (ocaml-mode . "ocaml")
204   - (parrot-mode . "parrot")
205   - (perl-mode . "perl")
206   - (php-mode . "php")
207   - (plone-mode . "plone")
208   - (python-mode . "python")
209   - (ruby-mode . "ruby")
210   - (scheme-mode . "scheme")
211   - (shell-script-mode . "shell")
212   - (skipped-mode . "skipped")
213   - (smalltalk-mode . "smalltalk")
214   - (sql-mode . "sql")
215   - (tcl-mode . "tcl")
216   - (tex-mode . "tex")
217   - (text-mode . "text")
218   - (tt-mode . "tt")
219   - (vb-mode . "vb")
220   - (vim-mode . "vim")
221   - (xml-mode . "xml")
222   - (yaml-mode . "yaml"))
  171 + '((actionscript-mode "actionscript")
  172 + (LaTeX-mode "tex")
  173 + (TeX-mode "tex")
  174 + (asm-mode "asm")
  175 + (batch-file-mode "batch")
  176 + (c++-mode "cpp")
  177 + (c-mode "cc")
  178 + (cfmx-mode "cfmx")
  179 + (cperl-mode "perl")
  180 + (csharp-mode "csharp")
  181 + (css-mode "css")
  182 + (emacs-lisp-mode "elisp")
  183 + (erlang-mode "erlang")
  184 + (espresso-mode "js")
  185 + (fortran-mode "fortran")
  186 + (haskell-mode "haskell")
  187 + (hexl-mode "binary")
  188 + (html-mode "html")
  189 + (java-mode "java")
  190 + (javascript-mode "js")
  191 + (jde-mode "java")
  192 + (js2-mode "js")
  193 + (jsp-mode "jsp")
  194 + (latex-mode "tex")
  195 + (lisp-mode "lisp")
  196 + (lua-mode "lua")
  197 + (makefile-mode "make")
  198 + (mason-mode "mason")
  199 + (nxml-mode "xml")
  200 + (objc-mode "objc" "objcpp")
  201 + (ocaml-mode "ocaml")
  202 + (parrot-mode "parrot")
  203 + (perl-mode "perl")
  204 + (php-mode "php")
  205 + (plone-mode "plone")
  206 + (python-mode "python")
  207 + (ruby-mode "ruby")
  208 + (scheme-mode "scheme")
  209 + (shell-script-mode "shell")
  210 + (skipped-mode "skipped")
  211 + (smalltalk-mode "smalltalk")
  212 + (sql-mode "sql")
  213 + (tcl-mode "tcl")
  214 + (tex-mode "tex")
  215 + (text-mode "text")
  216 + (tt-mode "tt")
  217 + (vb-mode "vb")
  218 + (vim-mode "vim")
  219 + (xml-mode "xml")
  220 + (yaml-mode "yaml"))
223 221 "Default values for `ack-mode-type-alist', which see.")
224 222
225 223 (defconst ack-mode-default-extension-alist
@@ -228,19 +226,23 @@ used without confirmation."
228 226
229 227 (defun ack-type-for-major-mode (mode)
230 228 "Return the --type and --type-set arguments for major mode MODE."
231   - (let ((type (cdr (or (assoc mode ack-mode-type-alist)
232   - (assoc mode ack-mode-default-type-alist))))
  229 + (let ((types (cdr (or (assoc mode ack-mode-type-alist)
  230 + (assoc mode ack-mode-default-type-alist))))
233 231 (ext (cdr (or (assoc mode ack-mode-extension-alist)
234   - (assoc mode ack-mode-default-extension-alist)))))
  232 + (assoc mode ack-mode-default-extension-alist))))
  233 + result)
  234 + (dolist (type types)
  235 + (push type result)
  236 + (push "--type" result))
235 237 (if ext
236   - (if type
237   - (list "--type-add" (concat type "=" (mapconcat 'identity ext ","))
238   - "--type" type)
239   - (setq type "full-ack-custom-type")
240   - (list "--type-set" (concat type "=" (mapconcat 'identity ext ","))
241   - "--type" type))
242   - (when type
243   - (list "--type" type)))))
  238 + (if types
  239 + `("--type-add" ,(concat (car types)
  240 + "=" (mapconcat 'identity ext ","))
  241 + . ,result)
  242 + (list "--type-set" (concat "full-ack-custom-type="
  243 + (mapconcat 'identity ext ","))
  244 + "--type" "full-ack-custom-type"))
  245 + result)))
244 246
245 247 ;;; root ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
246 248

0 comments on commit 64f63c2

Please sign in to comment.
Something went wrong with that request. Please try again.