1 ;;; anything-config.el --- Predefined configurations for `anything.el'
3 ;; Filename: anything-config.el
5 ;; Description: Predefined configurations for `anything.el'
6 ;; Author: Tassilo Horn <tassilo@member.fsf.org>
7 ;; Maintainer: Tassilo Horn <tassilo@member.fsf.org>
8 ;; Andy Stewart <lazycat.manatee@gmail.com>
9 ;; rubikitch <rubikitch@ruby-lang.org>
10 ;; Thierry Volpiatto <thierry.volpiatto@gmail.com>
11 ;; Copyright (C) 2007 ~ 2009, Tassilo Horn, all rights reserved.
12 ;; Copyright (C) 2009, Andy Stewart, all rights reserved.
13 ;; Copyright (C) 2009, rubikitch, all rights reserved.
14 ;; Copyright (C) 2009, Thierry Volpiatto, all rights reserved.
15 ;; Created: 2009-02-16 21:38:23
17 ;; URL: http://www.emacswiki.org/emacs/download/anything-config.el
18 ;; Keywords: anything, anything-config
19 ;; Compatibility: GNU Emacs 22 ~ 23
21 ;; Features that might be required by this library:
26 ;;; This file is NOT part of GNU Emacs
30 ;; This program is free software; you can redistribute it and/or modify
31 ;; it under the terms of the GNU General Public License as published by
32 ;; the Free Software Foundation; either version 3, or (at your option)
35 ;; This program is distributed in the hope that it will be useful,
36 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
37 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 ;; GNU General Public License for more details.
40 ;; You should have received a copy of the GNU General Public License
41 ;; along with this program; see the file COPYING. If not, write to
42 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
43 ;; Floor, Boston, MA 02110-1301, USA.
47 ;; If this file does not work, upgrade anything.el!
48 ;; http://www.emacswiki.org/cgi-bin/wiki/download/anything.el
52 ;; Predefined configurations for `anything.el'
54 ;; For quick start, try `anything-for-files' to open files.
56 ;; To configure anything you should setup `anything-sources'
57 ;; with specify source, like below:
59 ;; (setq anything-sources
60 ;; '(anything-c-source-buffers
61 ;; anything-c-source-buffer-not-found
62 ;; anything-c-source-file-name-history
63 ;; anything-c-source-info-pages
64 ;; anything-c-source-info-elisp
65 ;; anything-c-source-man-pages
66 ;; anything-c-source-locate
67 ;; anything-c-source-emacs-commands
70 ;; Below are complete source list you can setup in `anything-sources':
73 ;; `anything-c-source-buffers' (Buffers)
74 ;; `anything-c-source-buffer-not-found' (Create buffer)
75 ;; `anything-c-source-buffers+' (Buffers)
77 ;; `anything-c-source-file-name-history' (File Name History)
78 ;; `anything-c-source-files-in-current-dir' (Files from Current Directory)
79 ;; `anything-c-source-files-in-current-dir+' (Files from Current Directory)
80 ;; `anything-c-source-file-cache' (File Cache)
81 ;; `anything-c-source-locate' (Locate)
82 ;; `anything-c-source-recentf' (Recentf)
83 ;; `anything-c-source-ffap-guesser' (File at point)
85 ;; `anything-c-source-man-pages' (Manual Pages)
86 ;; `anything-c-source-info-pages' (Info Pages)
87 ;; `anything-c-source-info-elisp' (Info Elisp)
89 ;; `anything-c-source-complex-command-history' (Complex Command History)
90 ;; `anything-c-source-extended-command-history' (Emacs Commands History)
91 ;; `anything-c-source-emacs-commands' (Emacs Commands)
92 ;; `anything-c-source-lacarte' (Lacarte)
94 ;; `anything-c-source-emacs-functions' (Emacs Functions)
95 ;; `anything-c-source-emacs-functions-with-abbrevs' (Emacs Functions)
97 ;; `anything-c-source-bookmarks' (Bookmarks)
98 ;; `anything-c-source-bookmark-set' (Set Bookmark)
99 ;; `anything-c-source-bookmarks-ssh' (Bookmarks-ssh)
100 ;; `anything-c-source-bookmarks-su' (Bookmarks-su)
101 ;; `anything-c-source-bookmarks-local' (Bookmarks-Local)
102 ;; `anything-c-source-w3m-bookmarks' (W3m Bookmarks)
104 ;; `anything-c-source-elisp-library-scan' (Elisp libraries (Scan))
106 ;; `anything-c-source-imenu' (Imenu)
107 ;; `anything-c-source-ctags' (Exuberant ctags)
108 ;; `anything-c-source-semantic' (Semantic Tags)
109 ;; `anything-c-source-simple-call-tree-functions-callers' (Function is called by)
110 ;; `anything-c-source-simple-call-tree-callers-functions' (Function calls)
111 ;; `anything-c-source-commands-and-options-in-file' (Commands/Options in file)
113 ;; `anything-c-source-customize-face' (Customize Face)
114 ;; `anything-c-source-colors' (Colors)
116 ;; `anything-c-source-tracker-search' (Tracker Search)
117 ;; `anything-c-source-mac-spotlight' (mdfind)
119 ;; `anything-c-source-kill-ring' (Kill Ring)
121 ;; `anything-c-source-register' (Registers)
122 ;; Headline Extraction:
123 ;; `anything-c-source-fixme' (TODO/FIXME/DRY comments)
124 ;; `anything-c-source-rd-headline' (RD HeadLine)
125 ;; `anything-c-source-oddmuse-headline' (Oddmuse HeadLine)
126 ;; `anything-c-source-emacs-source-defun' (Emacs Source DEFUN)
127 ;; `anything-c-source-emacs-lisp-expectations' (Emacs Lisp Expectations)
128 ;; `anything-c-source-emacs-lisp-toplevels' (Emacs Lisp Toplevel / Level 4 Comment / Linkd Star)
129 ;; `anything-c-source-org-headline' (Org HeadLine)
131 ;; `anything-c-source-picklist' (Picklist)
132 ;; `anything-c-source-bbdb' (BBDB)
133 ;; `anything-c-source-evaluation-result' (Evaluation Result)
134 ;; `anything-c-source-calculation-result' (Calculation Result)
135 ;; `anything-c-source-google-suggest' (Google Suggest)
136 ;; `anything-c-source-surfraw' (Surfraw)
137 ;; `anything-c-source-jabber-contacts' (Jabber Contacts)
138 ;; `anything-c-source-call-source' (Call anything source)
139 ;; `anything-c-source-occur' (Occur)
140 ;; `anything-c-source-create' (Create)
141 ;; `anything-c-source-minibuffer-history' (Minibuffer History)
143 ;; `anything-c-source-gentoo' (Portage sources)
144 ;; `anything-c-source-use-flags' (Use Flags)
145 ;; `anything-c-source-emacs-process' (Emacs Process)
149 ;; Below are complete command list:
151 ;; `anything-for-files'
152 ;; Preconfigured `anything' for opening files.
153 ;; `anything-info-at-point'
154 ;; Preconfigured `anything' for searching info at point.
155 ;; `anything-show-kill-ring'
156 ;; Show `kill-ring'. It is drop-in replacement of `yank-pop'.
157 ;; `anything-minibuffer-history'
158 ;; Show `minibuffer-history'.
160 ;; Start anything with only gentoo sources.
161 ;; `anything-insert-buffer-name'
162 ;; Insert buffer name.
163 ;; `anything-insert-symbol'
164 ;; Insert current symbol.
165 ;; `anything-insert-selection'
166 ;; Insert current selection.
167 ;; `anything-show-buffer-only'
168 ;; Only show sources about buffer.
169 ;; `anything-show-bbdb-only'
170 ;; Only show sources about BBDB.
171 ;; `anything-show-locate-only'
172 ;; Only show sources about Locate.
173 ;; `anything-show-info-only'
174 ;; Only show sources about Info.
175 ;; `anything-show-imenu-only'
176 ;; Only show sources about Imenu.
177 ;; `anything-show-files-only'
178 ;; Only show sources about File.
179 ;; `anything-show-w3m-bookmarks-only'
180 ;; Only show source about w3m bookmark.
181 ;; `anything-show-colors-only'
182 ;; Only show source about color.
183 ;; `anything-show-kill-ring-only'
184 ;; Only show source about kill ring.
185 ;; `anything-show-this-source-only'
186 ;; Only show this source.
187 ;; `anything-test-sources'
188 ;; List all anything sources for test.
189 ;; `anything-select-source'
191 ;; `anything-call-source'
192 ;; Call anything source.
193 ;; `anything-call-source-from-anything'
194 ;; Call anything source within `anything' session.
195 ;; `anything-create-from-anything'
196 ;; Run `anything-create' from `anything' as a fallback.
198 ;; Do many create actions from STRING.
199 ;; `anything-c-adaptive-save-history'
200 ;; Save history information to file given by `anything-c-adaptive-history-file'.
202 ;;; Customizable Options:
204 ;; Below are customizable option list:
206 ;; `anything-c-use-standard-keys'
207 ;; Whether use standard keybindings. (no effect)
209 ;; `anything-c-adaptive-history-file'
210 ;; Path of file where history information is stored.
211 ;; default = "~/.emacs.d/anything-c-adaptive-history"
212 ;; `anything-c-adaptive-history-length'
213 ;; Maximum number of candidates stored for a source.
215 ;; `anything-c-google-suggest-url'
216 ;; URL used for looking up suggestions.
217 ;; default = "http://www.google.com/complete/search?hl=en&js=true&qu="
218 ;; `anything-c-google-suggest-search-url'
219 ;; URL used for searching.
220 ;; default = "http://www.google.com/search?ie=utf-8&oe=utf-8&q="
221 ;; `anything-c-boring-buffer-regexp'
222 ;; The regexp that match boring buffers.
223 ;; default = (rx (or (group bos " ") "*anything" " *Echo Area" " *Minibuf"))
224 ;; `anything-c-boring-file-regexp'
225 ;; The regexp that match boring files.
226 ;; default = (rx (or (and "/" ... ...) (and line-start ".#") (and ... eol)))
227 ;; `anything-kill-ring-threshold'
228 ;; *Minimum length to be listed by `anything-c-source-kill-ring'.
230 ;; `anything-create--actions-private'
231 ;; User defined actions for `anything-create' / `anything-c-source-create'.
236 ;; Change log of this file is found at
237 ;; http://repo.or.cz/w/anything-config.git?a=shortlog;h=b30091a6bb64828eb3d70007db5b68d51b868bcc
242 ;; Tassilo Horn <tassilo@member.fsf.org>
243 ;; Vagn Johansen <gonz808@hotmail.com>
244 ;; Mathias Dahl <mathias.dahl@gmail.com>
245 ;; Bill Clementson <billclem@gmail.com>
246 ;; Stefan Kamphausen (see http://www.skamphausen.de for more informations)
247 ;; Drew Adams <drew.adams@oracle.com>
248 ;; Jason McBrayer <jmcbray@carcosa.net>
249 ;; Andy Stewart <lazycat.manatee@gmail.com>
250 ;; Thierry Volpiatto <thierry.volpiatto@gmail.com>
251 ;; rubikitch <rubikitch@ruby-lang.org>
252 ;; Scott Vokes <vokes.s@gmail.com>
257 ;; Evaluate (anything-c-insert-summary) before commit. This function
258 ;; generates anything-c-source-* list.
260 ;; Install also http://www.emacswiki.org/emacs/auto-document.el
261 ;; And eval it or run interactively.
263 ;; [EVAL IT] (anything-c-insert-summary)
264 ;; [EVAL IT] (auto-document)
266 ;; Please write details documentation about function, then others will
267 ;; read code more easier. -- Andy Stewart
273 ;; - anything-c-adaptive stores infos for sources/types that don't have
274 ;; set it as `filtered-candidate-transformer'.
276 ;; - Fix documentation, now many functions haven't documentations.
285 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Customize ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
286 (defgroup anything-config nil
287 "Predefined configurations for `anything.el'."
290 (defcustom anything-c-use-standard-keys nil
291 "Whether use standard keybindings. (no effect)
293 Key definitions in anything-config.el are removed because
294 anything.el uses Emacs-standard keys by default. e.g. M-p/M-n for
295 minibuffer history, C-s for isearch, etc.
297 If you use `iswitchb' with `anything',
298 evaluate (anything-iswitchb-setup) . Then some bindings that
299 conflict with `iswitchb', e.g. C-p/C-n for the minibuffer
300 history, are removed from `anything-map'. "
302 :group
'anything-config
)
304 (defcustom anything-c-adaptive-history-file
"~/.emacs.d/anything-c-adaptive-history"
305 "Path of file where history information is stored."
307 :group
'anything-config
)
309 (defcustom anything-c-adaptive-history-length
50
310 "Maximum number of candidates stored for a source."
312 :group
'anything-config
)
314 (defcustom anything-c-google-suggest-url
315 "http://www.google.com/complete/search?hl=en&js=true&qu="
316 "URL used for looking up suggestions."
318 :group
'anything-config
)
320 (defcustom anything-c-google-suggest-search-url
321 "http://www.google.com/search?ie=utf-8&oe=utf-8&q="
322 "URL used for searching."
324 :group
'anything-config
)
326 (defcustom anything-c-boring-buffer-regexp
332 " *Echo Area" " *Minibuf"))
333 "The regexp that match boring buffers.
334 Buffer candidates matching this regular expression will be
335 filtered from the list of candidates if the
336 `anything-c-skip-boring-buffers' candidate transformer is used, or
337 they will be displayed with face `file-name-shadow' if
338 `anything-c-shadow-boring-buffers' is used."
340 :group
'anything-config
)
341 ;; (string-match anything-c-boring-buffer-regexp "buf")
342 ;; (string-match anything-c-boring-buffer-regexp " hidden")
343 ;; (string-match anything-c-boring-buffer-regexp " *Minibuf-1*")
345 (defcustom anything-c-boring-file-regexp
347 ;; Boring directories
348 (and "/" (or ".svn" "CVS" "_darcs" ".git" ".hg") (or "/" eol
))
350 (and line-start
".#")
351 (and (or ".class" ".la" ".o" "~") eol
)))
352 "The regexp that match boring files.
353 File candidates matching this regular expression will be
354 filtered from the list of candidates if the
355 `anything-c-skip-boring-files' candidate transformer is used, or
356 they will be displayed with face `file-name-shadow' if
357 `anything-c-shadow-boring-files' is used."
359 :group
'anything-config
)
361 (defcustom anything-kill-ring-threshold
10
362 "*Minimum length to be listed by `anything-c-source-kill-ring'."
364 :group
'anything-config
)
367 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Preconfigured Anything ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
368 (defun anything-for-files ()
369 "Preconfigured `anything' for opening files.
370 ffap -> recentf -> buffer -> bookmark -> file-cache -> files-in-current-dir -> locate"
372 (anything '(anything-c-source-ffap-guesser
373 anything-c-source-recentf
374 anything-c-source-buffers
+
375 anything-c-source-bookmarks
376 anything-c-source-file-cache
377 anything-c-source-files-in-current-dir
+
378 anything-c-source-locate
)))
380 (defun anything-info-at-point ()
381 "Preconfigured `anything' for searching info at point."
383 (anything '(anything-c-source-info-elisp
384 anything-c-source-info-cl
385 anything-c-source-info-pages
)
386 (thing-at-point 'sexp
)))
388 (defun anything-show-kill-ring ()
389 "Show `kill-ring'. It is drop-in replacement of `yank-pop'.
390 You may bind this command to M-y."
392 (anything 'anything-c-source-kill-ring nil nil nil nil
"*anything kill-ring*"))
394 (defun anything-minibuffer-history ()
395 "Show `minibuffer-history'.
396 You may bind this command to C-r in minibuffer-local-map / minibuffer-local-completion-map."
398 (anything 'anything-c-source-minibuffer-history nil nil nil nil
399 "*anything minibuffer-history*"))
400 ;; (define-key minibuffer-local-map "\C-r" 'anything-minibuffer-history)
401 ;; (define-key minibuffer-local-completion-map "\C-r" 'anything-minibuffer-history)
403 (defun anything-gentoo ()
404 "Start anything with only gentoo sources."
406 (anything '(anything-c-source-gentoo
407 anything-c-source-use-flags
)))
409 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Interactive Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
411 (defun anything-insert-buffer-name ()
412 "Insert buffer name."
414 (anything-insert-string
415 (with-current-buffer anything-current-buffer
416 (if buffer-file-name
(file-name-nondirectory buffer-file-name
)
419 (defun anything-insert-symbol ()
420 "Insert current symbol."
422 (anything-insert-string
423 (with-current-buffer anything-current-buffer
425 (buffer-substring (beginning-of-thing 'symbol
)
426 (end-of-thing 'symbol
))))))
428 (defun anything-insert-selection ()
429 "Insert current selection."
431 (anything-insert-string
432 (with-current-buffer anything-current-buffer
433 (anything-get-selection))))
435 (defun anything-show-buffer-only ()
436 "Only show sources about buffer."
438 (anything-set-source-filter '("Buffers")))
440 (defun anything-show-bbdb-only ()
441 "Only show sources about BBDB."
443 (anything-set-source-filter '("BBDB")))
445 (defun anything-show-locate-only ()
446 "Only show sources about Locate."
448 (anything-set-source-filter '("Locate")))
450 (defun anything-show-info-only ()
451 "Only show sources about Info."
453 (anything-set-source-filter '("Info Pages"
455 "Info Common-Lisp")))
457 (defun anything-show-imenu-only ()
458 "Only show sources about Imenu."
460 (anything-set-source-filter '("Imenu")))
462 (defun anything-show-files-only ()
463 "Only show sources about File."
465 (anything-set-source-filter '("File Name History"
466 "Files from Current Directory"
469 (defun anything-show-w3m-bookmarks-only ()
470 "Only show source about w3m bookmark."
472 (anything-set-source-filter '("W3m Bookmarks")))
474 (defun anything-show-colors-only ()
475 "Only show source about color."
477 (anything-set-source-filter '("Colors"
480 (defun anything-show-kill-ring-only ()
481 "Only show source about kill ring."
483 (anything-set-source-filter '("Kill Ring")))
485 (defun anything-show-this-source-only ()
486 "Only show this source."
488 (setq anything-candidate-number-limit
9999)
489 (anything-set-source-filter
490 (list (assoc-default 'name
(anything-get-current-source)))))
492 (defun anything-test-sources ()
493 "List all anything sources for test.
494 The output is sexps which are evaluated by \\[eval-last-sexp]."
496 (with-output-to-temp-buffer "*Anything Test Sources*"
497 (mapc (lambda (s) (princ (format ";; (anything '%s)\n" s
)))
498 (apropos-internal "^anything-c-source" #'boundp
))
499 (pop-to-buffer standard-output
)))
501 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Utilities Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
502 (defun anything-nest (&rest same-as-anything
)
503 "Nested `anything'. If you use `anything' within `anything', use it."
504 (with-selected-window (anything-window)
505 (let (anything-current-position
506 anything-current-buffer
507 (orig-anything-buffer anything-buffer
)
511 anything-compiled-sources
512 anything-buffer-chars-modified-tick
513 (anything-samewindow t
)
514 (enable-recursive-minibuffers t
))
516 (apply #'anything same-as-anything
)
517 (anything-initialize-overlays orig-anything-buffer
)
518 (add-hook 'post-command-hook
'anything-check-minibuffer-input
)))))
520 (defun anything-displaying-source-names ()
521 "Display sources name."
522 (with-current-buffer anything-buffer
523 (goto-char (point-min))
525 while
(setq pos
(next-single-property-change (point) 'anything-header
))
527 collect
(buffer-substring-no-properties (point-at-bol)(point-at-eol))
528 do
(forward-line 1))))
530 (defun anything-select-source ()
533 (let ((default (assoc-default 'name
(anything-get-current-source)))
534 (source-names (anything-displaying-source-names))
535 (all-source-names (mapcar (lambda (s) (assoc-default 'name s
))
536 (anything-get-sources))))
537 (setq anything-candidate-number-limit
9999)
539 (let (anything-source-filter)
540 (anything-nest '(((name .
"Anything Source")
541 (candidates . source-names
)
543 ((name .
"Anything Source (ALL)")
544 (candidates . all-source-names
)
545 (action . identity
)))
547 default
"*anything select source*"))
548 (anything-set-source-filter (list it
))
549 (anything-set-source-filter nil
))))
551 (defun anything-insert-string (str)
553 (delete-minibuffer-contents)
556 (defun anything-c-match-on-file-name (candidate)
557 "Return non-nil if `anything-pattern' match the filename (without directory part) of CANDIDATE."
558 (string-match anything-pattern
(file-name-nondirectory candidate
)))
560 (defun anything-c-match-on-directory-name (candidate)
561 "Return non-nil if `anything-pattern' match the directory part of CANDIDATE (a file)."
562 (anything-aif (file-name-directory candidate
)
563 (string-match anything-pattern it
)))
565 (defun anything-c-string-match (candidate)
566 "Return non-nil if `anything-pattern' match CANDIDATE.
567 The match is done with `string-match'."
568 (string-match anything-pattern candidate
))
570 ;; `anything-c-compose' is no more needed, it is for compatibility.
571 (defalias 'anything-c-compose
'anything-compose
)
573 (defun anything-c-skip-entries (list regexp
)
574 "Remove entries which matches REGEXP from LIST."
575 (remove-if (lambda (x) (and (stringp x
) (string-match regexp x
)))
578 (defun anything-c-shadow-entries (list regexp
)
579 "Elements of LIST matching REGEXP will be displayed with the `file-name-shadow' face if available."
580 (mapcar (lambda (file)
581 ;; Add shadow face property to boring files.
582 (let ((face (if (facep 'file-name-shadow
)
584 ;; fall back to default on XEmacs
586 (if (string-match regexp file
)
587 (setq file
(propertize file
'face face
))))
591 (defsubst anything-c-stringify
(str-or-sym)
592 "Get string of STR-OR-SYM."
593 (if (stringp str-or-sym
)
595 (symbol-name str-or-sym
)))
597 (defsubst anything-c-symbolify
(str-or-sym)
598 "Get symbol of STR-OR-SYM."
599 (if (symbolp str-or-sym
)
601 (intern str-or-sym
)))
603 (defun anything-c-describe-function (func)
604 "FUNC is symbol or string."
605 (describe-function (anything-c-symbolify func
)))
607 (defun anything-c-describe-variable (var)
608 "VAR is symbol or string."
609 (describe-variable (anything-c-symbolify var
)))
611 (defun anything-c-find-function (func)
612 "FUNC is symbol or string."
613 (find-function (anything-c-symbolify func
)))
615 (defun anything-c-find-variable (var)
616 "VAR is symbol or string."
617 (find-variable (anything-c-symbolify var
)))
619 (defun anything-c-kill-new (string &optional replace yank-handler
)
620 "STRING is symbol or string."
621 (kill-new (anything-c-stringify string
) replace yank-handler
))
622 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Prefix argument in action ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
624 (defvar anything-current-prefix-arg nil
625 "`current-prefix-arg' when selecting action.
626 It is cleared after executing action.")
628 (defadvice anything-exit-minibuffer
(before anything-current-prefix-arg activate
)
629 (unless anything-current-prefix-arg
630 (setq anything-current-prefix-arg current-prefix-arg
)))
632 (add-hook 'anything-after-action-hook
633 (lambda () (setq anything-current-prefix-arg nil
)))
636 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Document Generator ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
637 (defun anything-c-create-summary ()
638 "Create `anything' summary."
640 (goto-char (point-min))
641 (loop while
(re-search-forward "^;;;; <\\(.+?\\)>$\\|^;; (anything '\\(.+?\\))$" nil t
)
642 collect
(if (match-beginning 1)
643 (cons 'section
(match-string-no-properties 1))
645 (cons (match-string-no-properties 2)
646 (assoc-default 'name
(symbol-value (intern (match-string-no-properties 2))))))))))
647 ;; (find-epp (anything-c-create-summary))
649 (defun anything-c-insert-summary ()
650 "Insert `anything' summary."
652 (goto-char (point-min))
653 (search-forward ";; Below are complete source list you can setup in")
655 (delete-region (point)
656 (progn (search-forward ";;; Change log:" nil t
)
657 (forward-line -
1) (point)))
660 for
(kind . value
) in
(anything-c-create-summary)
662 do
(cond ((eq kind
'section
)
664 (align-regexp beg
(point) "\\(\\s-*\\)(" 1 1 nil
))
665 (insert ";; " value
":\n")
668 (insert ";; `" (car value
) "' (" (cdr value
) ")\n")))
669 finally
(align-regexp beg
(point) "\\(\\s-*\\)(" 1 1 nil
))))
670 ;; (anything-c-insert-summary)
672 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Anything Sources ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
674 (defun anything-c-buffer-list ()
675 "Return the list of names of buffers with boring buffers filtered out.
676 Boring buffers is specified by `anything-c-boring-buffer-regexp'.
677 The first buffer in the list will be the last recently used
678 buffer that is not the current buffer."
679 (let ((buffers (mapcar 'buffer-name
(buffer-list))))
680 (append (cdr buffers
) (list (car buffers
)))))
682 (defvar anything-c-source-buffers
684 (candidates . anything-c-buffer-list
)
687 ;; (anything 'anything-c-source-buffers)
689 (defvar anything-c-source-buffer-not-found
690 '((name .
"Create buffer")
693 ;; (anything 'anything-c-source-buffer-not-found)
696 (defface anything-dir-heading
'((t (:foreground
"Blue" :background
"Pink")))
697 "*Face used for directory headings in dired buffers."
700 (defface anything-file-name
701 '((t (:foreground
"Blue")))
702 "*Face used for file names (without suffixes) in dired buffers."
705 (defface anything-dir-priv
706 '((t (:foreground
"DarkRed" :background
"LightGray")))
707 "*Face used for directory privilege indicator (d) in dired buffers."
710 (defvar anything-c-buffers-face1
'anything-dir-priv
)
711 (defvar anything-c-buffers-face2
'font-lock-type-face
)
712 (defvar anything-c-buffers-face3
'italic
)
713 (defun anything-c-highlight-buffers (buffers)
715 (loop for i in buffers
716 if
(rassoc (get-buffer i
) dired-buffers
)
717 collect
(propertize i
718 'face anything-c-buffers-face1
719 'help-echo
(car (rassoc (get-buffer i
) dired-buffers
)))
720 if
(buffer-file-name (get-buffer i
))
721 collect
(propertize i
722 'face anything-c-buffers-face2
723 'help-echo
(buffer-file-name (get-buffer i
)))
724 if
(and (not (rassoc (get-buffer i
) dired-buffers
))
725 (not (buffer-file-name (get-buffer i
))))
726 collect
(propertize i
727 'face anything-c-buffers-face3
)))
729 (defvar anything-c-source-buffers
+
731 (candidates . anything-c-buffer-list
)
734 (candidate-transformer anything-c-highlight-buffers
735 anything-c-skip-boring-buffers
)
736 (persistent-action . anything-c-buffers
+-persistent-action
)))
738 (defun anything-c-buffers+-persistent-action
(name)
740 (with-current-buffer item
741 (if (and (buffer-modified-p)
742 (buffer-file-name (current-buffer)))
746 (kill-buffer item
))))
748 (switch-to-buffer item
)))
749 (if current-prefix-arg
752 (anything-delete-current-selection))
755 ;; (anything 'anything-c-source-buffers+)
759 ;;; File name history
760 (defvar anything-c-source-file-name-history
761 '((name .
"File Name History")
762 (candidates . file-name-history
)
763 (match anything-c-match-on-file-name
764 anything-c-match-on-directory-name
)
766 ;; (anything 'anything-c-source-file-name-history)
768 ;;; Files in current dir
769 (defvar anything-c-source-files-in-current-dir
770 '((name .
"Files from Current Directory")
771 (init .
(lambda () (setq anything-c-default-directory default-directory
)))
772 (candidates .
(lambda () (directory-files anything-c-default-directory
)))
775 ;; (anything 'anything-c-source-files-in-current-dir)
777 (defvar anything-c-files-face1
'anything-dir-priv
)
778 (defvar anything-c-files-face2
'anything-file-name
)
779 (defun anything-c-highlight-files (files)
781 if
(file-directory-p i
)
782 collect
(propertize (file-name-nondirectory i
)
783 'face anything-c-files-face1
784 'help-echo
(expand-file-name i
))
786 collect
(propertize (file-name-nondirectory i
)
787 'face anything-c-files-face2
788 'help-echo
(expand-file-name i
))))
791 (defvar anything-c-source-files-in-current-dir
+
792 '((name .
"Files from Current Directory")
794 (setq anything-c-default-directory
795 (expand-file-name default-directory
))))
796 (candidates .
(lambda ()
798 anything-c-default-directory t
)))
799 (candidate-transformer anything-c-highlight-files
)
803 ;; (anything 'anything-c-source-files-in-current-dir+)
806 (defvar anything-c-source-file-cache-initialized nil
)
808 (defvar anything-c-file-cache-files nil
)
810 (defvar anything-c-source-file-cache
811 '((name .
"File Cache")
813 (require 'filecache nil t
)
814 (unless anything-c-source-file-cache-initialized
815 (setq anything-c-file-cache-files
816 (loop for item in file-cache-alist append
817 (destructuring-bind (base &rest dirs
) item
818 (loop for dir in dirs collect
819 (concat dir base
)))))
820 (defadvice file-cache-add-file
(after file-cache-list activate
)
821 (add-to-list 'anything-c-file-cache-files
(expand-file-name file
)))
822 (setq anything-c-source-file-cache-initialized t
))))
823 (candidates . anything-c-file-cache-files
)
824 (match anything-c-match-on-file-name
825 anything-c-match-on-directory-name
)
827 ;; (anything 'anything-c-source-file-cache)
830 (defvar anything-c-locate-options
832 ((eq system-type
'darwin
) '("locate"))
833 ((eq system-type
'berkeley-unix
) '("locate" "-i"))
834 (t '("locate" "-i" "-r")))
835 "A list where the `car' is the name of the locat program followed by options.
836 The search pattern will be appended, so the
837 \"-r\" option should be the last option.")
839 (defvar anything-c-source-locate
841 (candidates .
(lambda ()
842 (apply 'start-process
"locate-process" nil
843 (append anything-c-locate-options
844 (list anything-pattern
)))))
846 (requires-pattern .
3)
848 "Source for retrieving files matching the current input pattern with locate.")
849 ;; (anything 'anything-c-source-locate)
852 (defvar anything-c-source-recentf
856 (or recentf-mode
(recentf-mode 1))
857 ;; Big value empowers anything/recentf
858 (when (and (numberp recentf-max-saved-items
)
859 (<= recentf-max-saved-items
20))
860 (setq recentf-max-saved-items
500))))
861 (candidates . recentf-list
)
862 (match anything-c-match-on-file-name
863 anything-c-match-on-directory-name
)
865 "See (info \"(emacs)File Conveniences\").
866 if `recentf-max-saved-items' is too small, set it to 500.")
867 ;; (anything 'anything-c-source-recentf)
870 (defvar anything-c-source-ffap-guesser
871 '((name .
"File at point")
872 (init .
(lambda () (require 'ffap
)))
873 (candidates .
(lambda ()
875 (with-current-buffer anything-current-buffer
879 ;; (anything 'anything-c-source-ffap-guesser)
883 (defvar anything-c-man-pages nil
884 "All man pages on system.
885 Will be calculated the first time you invoke anything with this
888 (defvar anything-c-source-man-pages
889 `((name .
"Manual Pages")
890 (candidates .
(lambda ()
891 (if anything-c-man-pages
893 ;; XEmacs doesn't have a woman :)
894 (setq anything-c-man-pages
898 (sort (mapcar 'car woman-topic-all-completions
)
900 (action ("Show with Woman" . woman
))
901 (requires-pattern .
2)))
902 ;; (anything 'anything-c-source-man-pages)
905 (defvar anything-c-info-pages nil
906 "All info pages on system.
907 Will be calculated the first time you invoke anything with this
910 (defvar anything-c-source-info-pages
911 `((name .
"Info Pages")
912 (candidates .
(lambda ()
913 (if anything-c-info-pages
914 anything-c-info-pages
915 (setq anything-c-info-pages
916 (save-window-excursion
919 (Info-find-node "dir" "top")
920 (goto-char (point-min))
921 (let ((info-topic-regexp "\\* +\\([^:]+: ([^)]+)[^.]*\\)\\.")
923 (while (re-search-forward info-topic-regexp nil t
)
924 (add-to-list 'topics
(match-string-no-properties 1)))
925 (goto-char (point-min))
928 (action .
(("Show with Info" .
(lambda (node-str)
929 (info (replace-regexp-in-string "^[^:]+: "
932 (requires-pattern .
2)))
933 ;; (anything 'anything-c-source-info-pages)
936 (defvar anything-c-info-elisp nil
)
937 (defvar anything-c-source-info-elisp
938 `((name .
"Info Elisp")
940 (save-window-excursion
941 (unless anything-c-info-elisp
943 (Info-find-node "elisp" "Index")
944 (setq anything-c-info-elisp
(split-string (buffer-string) "\n"))
946 (candidates .
(lambda ()
947 (loop for i in anything-c-info-elisp
948 if
(string-match "^* [^ \n]+[^: ]" i
)
949 collect
(match-string 0 i
))))
950 (action .
(lambda (candidate)
951 (Info-find-node "elisp" "Index")
952 (Info-index (replace-regexp-in-string "* " "" candidate
))))
954 (requires-pattern .
2)))
955 ;; (anything 'anything-c-source-info-elisp)
958 (defvar anything-c-info-cl-fn nil
)
959 (defvar anything-c-source-info-cl
960 `((name .
"Info Common-Lisp")
962 (save-window-excursion
963 (unless anything-c-info-cl-fn
965 (Info-find-node "cl" "Function Index")
966 (setq anything-c-info-cl-fn
(split-string (buffer-string) "\n"))
968 (candidates .
(lambda ()
969 (loop for i in anything-c-info-cl-fn
970 if
(string-match "^* [^ \n]+[^: ]" i
)
971 collect
(match-string 0 i
))))
972 (action .
(("Goto Info Node" .
(lambda (candidate)
973 (Info-find-node "cl" "Function Index")
974 (Info-index (replace-regexp-in-string "* " "" candidate
))))
975 ("Find Example" .
(lambda (candidate)
976 (and (fboundp 'traverse-deep-rfind
)
977 (traverse-deep-rfind traverse-example-directory
978 (replace-regexp-in-string "* " "" candidate
)
981 (requires-pattern .
2)))
984 ;;; Complex command history
985 (defvar anything-c-source-complex-command-history
986 '((name .
"Complex Command History")
987 (candidates .
(lambda () (mapcar 'prin1-to-string command-history
)))
989 ;; (anything 'anything-c-source-complex-command-history)
992 (defvar anything-c-source-extended-command-history
993 '((name .
"Emacs Commands History")
994 (candidates . extended-command-history
)
996 ;; (anything 'anything-c-source-extended-command-history)
999 (defvar anything-c-source-emacs-commands
1000 '((name .
"Emacs Commands")
1001 (candidates .
(lambda ()
1003 (mapatoms (lambda (a)
1005 (push (symbol-name a
)
1007 (sort commands
'string-lessp
))))
1010 (requires-pattern .
2))
1011 "Source for completing and invoking Emacs commands.
1012 A command is a function with interactive spec that can
1013 be invoked with `M-x'.
1015 To get non-interactive functions listed, use
1016 `anything-c-source-emacs-functions'.")
1017 ;; (anything 'anything-c-source-emacs-commands)
1020 (defvar anything-c-source-lacarte
1021 '((name .
"Lacarte")
1022 (init .
(lambda () (require 'lacarte
)))
1023 (candidates .
(lambda () (delete '(nil) (lacarte-get-overall-menu-item-alist))))
1024 (candidate-number-limit .
9999)
1025 (action . anything-c-call-interactively
))
1028 http://www.emacswiki.org/cgi-bin/wiki/download/lacarte.el")
1029 ;; (anything 'anything-c-source-lacarte)
1033 (defvar anything-c-source-emacs-functions
1034 '((name .
"Emacs Functions")
1035 (candidates .
(lambda ()
1037 (mapatoms (lambda (a) (if (functionp a
)
1038 (push (symbol-name a
) commands
))))
1039 (sort commands
'string-lessp
))))
1042 (requires-pattern .
2))
1043 "Source for completing Emacs functions.")
1044 ;; (anything 'anything-c-source-emacs-functions)
1046 ;;; With abbrev expansion
1047 ;;; Similar to my exec-abbrev-cmd.el
1048 ;;; See http://www.tsdh.de/cgi-bin/wiki.pl/exec-abbrev-cmd.el
1049 (defvar anything-c-function-abbrev-regexp nil
1050 "The regexp for `anything-c-source-emacs-functions-with-abbrevs'.
1051 Regexp built from the current `anything-pattern' interpreting it
1053 Only for internal use.")
1055 (defun anything-c-match-function-by-abbrev (candidate)
1056 "Return non-nil if `anything-pattern' is an abbreviation of the function CANDIDATE.
1058 Abbreviations are made by taking the first character from each
1059 word in the function's name, e.g. \"bb\" is an abbrev for
1060 `bury-buffer', \"stb\" is an abbrev for `switch-to-buffer'."
1061 (string-match anything-c-function-abbrev-regexp candidate
))
1063 (defvar anything-c-source-emacs-functions-with-abbrevs
1064 (append anything-c-source-emacs-functions
1065 '((match anything-c-match-function-by-abbrev
1066 anything-c-string-match
))
1067 '((init .
(lambda ()
1068 (defadvice anything-update
1069 (before anything-c-update-function-abbrev-regexp activate
)
1070 (let ((char-list (append anything-pattern nil
))
1072 (dolist (c char-list
)
1073 (setq str
(concat str
(list c
) "[^-]*-")))
1074 (setq str
(concat (substring str
0 (1- (length str
))) "$"))
1075 (setq anything-c-function-abbrev-regexp str
))))))))
1076 ;; (anything 'anything-c-source-emacs-functions-with-abbrevs)
1080 (defvar anything-c-source-bookmarks
1081 '((name .
"Bookmarks")
1083 (require 'bookmark
)))
1084 (candidates . bookmark-all-names
)
1086 "See (info \"(emacs)Bookmarks\").")
1087 ;; (anything 'anything-c-source-bookmarks)
1090 (defvar anything-c-source-bookmark-set
1091 '((name .
"Set Bookmark")
1093 (action . bookmark-set
))
1094 "See (info \"(emacs)Bookmarks\").")
1095 ;; (anything 'anything-c-source-bookmark-set)
1097 ;;; Visible Bookmarks
1098 ;; (install-elisp "http://cvs.savannah.gnu.org/viewvc/*checkout*/bm/bm/bm.el")
1101 ;; http://d.hatena.ne.jp/grandVin/20080911/1221114327
1102 (defvar anything-c-source-bm
1103 '((name .
"Visible Bookmarks")
1104 (init . anything-c-bm-init
)
1105 (candidates-in-buffer)
1109 http://www.nongnu.org/bm/")
1111 (defun anything-c-bm-init ()
1112 "Init function for `anything-c-source-bm'."
1113 (when (require 'bm nil t
)
1115 (let ((bookmarks (bm-lists))
1116 (buf (anything-candidate-buffer 'global
)))
1117 (dolist (bm (sort* (append (car bookmarks
) (cdr bookmarks
))
1118 '< :key
'overlay-start
))
1119 (let ((start (overlay-start bm
))
1120 (end (overlay-end bm
))
1121 (annotation (or (overlay-get bm
'annotation
) "")))
1122 (unless (< (- end start
) 1) ; org => (if (< (- end start) 2)
1123 (let ((str (format "%7d: [%s]: %s\n"
1124 (line-number-at-pos start
)
1126 (buffer-substring start
(1- end
)))))
1127 (with-current-buffer buf
(insert str
))))))))))
1129 ;;; Special bookmarks
1130 (defvar anything-c-source-bookmarks-ssh
1131 '((name .
"Bookmarks-ssh")
1133 (require 'bookmark
)))
1135 (candidates .
(lambda ()
1136 (let (lis-all lis-ssh
)
1137 (setq lis-all
(bookmark-all-names))
1138 (setq lis-ssh
(loop for i in lis-all
1139 if
(string-match "^(ssh)" i
)
1141 (sort lis-ssh
'string-lessp
))))
1143 "See (info \"(emacs)Bookmarks\").")
1144 ;; (anything 'anything-c-source-bookmarks-ssh)
1146 (defvar anything-c-source-bookmarks-su
1147 '((name .
"Bookmarks-su")
1149 (require 'bookmark
)))
1151 (candidates .
(lambda ()
1152 (let (lis-all lis-su
)
1153 (setq lis-all
(bookmark-all-names))
1154 (setq lis-su
(loop for i in lis-all
1155 if
(string-match "^(su)" i
)
1157 (sort lis-su
'string-lessp
))))
1158 (candidate-transformer anything-c-highlight-bookmark-su
)
1161 "See (info \"(emacs)Bookmarks\").")
1162 ;; (anything 'anything-c-source-bookmarks-su)
1164 (defface anything-bookmarks-su-face
'((t (:foreground
"red")))
1166 :group
'traverse-faces
)
1168 (defvar anything-c-bookmarks-face1
'anything-dir-heading
)
1169 (defvar anything-c-bookmarks-face2
'anything-file-name
)
1170 (defvar anything-c-bookmarks-face3
'anything-bookmarks-su-face
)
1172 (defun tv-root-logged-p ()
1174 (dolist (i (mapcar #'buffer-name
(buffer-list)))
1175 (when (string-match "*tramp/su ." i
)
1176 (throw 'break t
)))))
1179 (defun anything-c-highlight-bookmark-su (files)
1180 (if (tv-root-logged-p)
1181 (anything-c-highlight-bookmark files
)
1182 (anything-c-highlight-not-logged files
)))
1184 (defun anything-c-highlight-not-logged (files)
1185 (loop for i in files
1186 collect
(propertize i
'face anything-c-bookmarks-face3
)))
1188 (defun anything-c-highlight-bookmark (files)
1189 (loop for i in files
1190 if
(file-directory-p (bookmark-get-filename i
))
1191 collect
(propertize i
'face anything-c-bookmarks-face1
)
1193 collect
(propertize i
'face anything-c-bookmarks-face2
)))
1195 (defvar anything-c-source-bookmarks-local
1196 '((name .
"Bookmarks-Local")
1198 (require 'bookmark
)))
1200 (candidates .
(lambda ()
1201 (let (lis-all lis-loc
)
1202 (setq lis-all
(bookmark-all-names))
1203 (setq lis-loc
(loop for i in lis-all
1204 if
(and (not (string-match "^(ssh)" i
))
1205 (not (string-match "^(su)" i
)))
1207 (sort lis-loc
'string-lessp
))))
1208 (candidate-transformer anything-c-highlight-bookmark
)
1210 "See (info \"(emacs)Bookmarks\").")
1211 ;; (anything 'anything-c-source-bookmarks-local)
1215 (unless (and (require 'w3m nil t
)
1216 (require 'w3m-bookmark nil t
))
1217 (defvar w3m-bookmark-file
"~/.w3m/bookmark.html"))
1218 ;; (defvar anything-w3m-bookmarks-regexp ">[^><]+[^</a>]+[a-z)0-9]+")
1220 (defface anything-w3m-bookmarks-face
'((t (:foreground
"cyan1" :underline t
)))
1221 "Face for w3m bookmarks" :group
'anything
)
1223 (defvar anything-w3m-bookmarks-regexp
">[^><]+.[^</a>]")
1224 (defun anything-w3m-bookmarks-to-alist ()
1225 (let (bookmarks-alist url title
)
1227 (insert-file-contents w3m-bookmark-file
) ;; or w3m-bookmark-file
1228 (goto-char (point-min))
1231 (when (re-search-forward "href=" nil t
)
1233 (when (re-search-forward "http://[^>]*" nil t
)
1234 (setq url
(concat "\"" (match-string 0))))
1236 (when (re-search-forward anything-w3m-bookmarks-regexp nil t
)
1237 (setq title
(match-string 0)))
1238 (push (cons title url
) bookmarks-alist
))))
1239 (reverse bookmarks-alist
)))
1241 (defvar anything-c-w3m-bookmarks-alist nil
)
1242 (defvar anything-c-source-w3m-bookmarks
1243 '((name .
"W3m Bookmarks")
1245 (setq anything-c-w3m-bookmarks-alist
1246 (anything-w3m-bookmarks-to-alist))))
1247 (candidates .
(lambda ()
1249 anything-c-w3m-bookmarks-alist
)))
1250 (candidate-transformer anything-c-highlight-w3m-bookmarks
)
1251 (action .
(("Browse Url" .
(lambda (candidate)
1252 (anything-c-w3m-browse-bookmark candidate
)))
1253 ("Copy Url" .
(lambda (elm)
1254 (kill-new (anything-c-w3m-bookmarks-get-value elm
))))
1255 ("Browse Url Firefox" .
(lambda (candidate)
1256 (anything-c-w3m-browse-bookmark candidate t
)))
1257 ("Delete Bookmark" .
(lambda (candidate)
1258 (anything-c-w3m-delete-bookmark candidate
)))
1259 ("Rename Bookmark" .
(lambda (candidate)
1260 (anything-c-w3m-rename-bookmark candidate
)))))
1261 (persistent-action .
(lambda (candidate)
1262 (if current-prefix-arg
1263 (anything-c-w3m-browse-bookmark candidate t
)
1264 (anything-c-w3m-browse-bookmark candidate nil t
))))
1267 ;; (anything 'anything-c-source-w3m-bookmarks)
1269 (defun anything-c-w3m-bookmarks-get-value (elm)
1270 (replace-regexp-in-string "\"" ""
1272 anything-c-w3m-bookmarks-alist
))))
1275 (defun anything-c-w3m-browse-bookmark (elm &optional use-firefox new-tab
)
1276 (let* ((fn (if use-firefox
1279 (arg (and (eq fn
'w3m-browse-url
)
1281 (funcall fn
(anything-c-w3m-bookmarks-get-value elm
) arg
)))
1284 (defun anything-c-highlight-w3m-bookmarks (books)
1285 (loop for i in books
1286 collect
(propertize i
1287 'face
'anything-w3m-bookmarks-face
1288 'help-echo
(anything-c-w3m-bookmarks-get-value i
))))
1291 (defun anything-c-w3m-delete-bookmark (elm)
1293 (find-file-literally w3m-bookmark-file
)
1294 (goto-char (point-min))
1295 (when (re-search-forward elm nil t
)
1297 (delete-region (point)
1298 (line-end-position))
1299 (delete-blank-lines))
1300 (save-buffer (current-buffer))
1301 (kill-buffer (current-buffer))))
1303 (defun anything-c-w3m-rename-bookmark (elm)
1304 (let* ((old-title (replace-regexp-in-string ">" "" elm
))
1305 (new-title (read-string "NewTitle: " old-title
)))
1307 (find-file-literally w3m-bookmark-file
)
1308 (goto-char (point-min))
1309 (when (re-search-forward (concat elm
"<") nil t
)
1310 (goto-char (1- (point)))
1311 (delete-backward-char (length old-title
))
1313 (save-buffer (current-buffer))
1314 (kill-buffer (current-buffer)))))
1317 ;;; Elisp library scan
1318 (defvar anything-c-source-elisp-library-scan
1319 '((name .
"Elisp libraries (Scan)")
1320 (init .
(anything-c-elisp-library-scan-init))
1321 (candidates-in-buffer)
1322 (action ("Find library" .
(lambda (candidate)
1323 (find-file (find-library-name candidate
))))
1324 ("Find library other window" .
(lambda (candidate)
1325 (find-file-other-window (find-library-name candidate
))))
1326 ("Load library" .
(lambda (candidate)
1327 (load-library candidate
))))))
1328 ;; (anything 'anything-c-source-elisp-library-scan)
1330 (defun anything-c-elisp-library-scan-init ()
1331 "Init anything buffer status."
1332 (let ((anything-buffer (anything-candidate-buffer 'global
))
1333 (library-list (anything-c-elisp-library-scan-list)))
1334 (with-current-buffer anything-buffer
1335 (dolist (library library-list
)
1336 (insert (format "%s\n" library
))))))
1338 (defun anything-c-elisp-library-scan-list (&optional dirs string
)
1339 "Do completion for file names passed to `locate-file'.
1340 DIRS is directory to search path.
1341 STRING is string to match."
1342 ;; Use `load-path' as path when ignore `dirs'.
1343 (or dirs
(setq dirs load-path
))
1344 ;; Init with blank when ignore `string'.
1345 (or string
(setq string
""))
1346 ;; Get library list.
1347 (let ((string-dir (file-name-directory string
))
1348 ;; File regexp that suffix match `load-file-rep-suffixes'.
1349 (match-regexp (format "^.*\\.el%s$" (regexp-opt load-file-rep-suffixes
)))
1354 (setq dir default-directory
))
1356 (setq dir
(expand-file-name string-dir dir
)))
1357 (when (file-directory-p dir
)
1358 (dolist (file (file-name-all-completions
1359 (file-name-nondirectory string
) dir
))
1360 ;; Suffixes match `load-file-rep-suffixes'.
1361 (setq name
(if string-dir
(concat string-dir file
) file
))
1362 (if (string-match match-regexp name
)
1363 (add-to-list 'names name
)))))
1368 (defvar anything-c-imenu-delimiter
" / ")
1370 (defvar anything-c-imenu-index-filter nil
)
1371 (make-variable-buffer-local 'anything-c-imenu-index-filter
)
1373 (defvar anything-c-cached-imenu-alist nil
)
1374 (make-variable-buffer-local 'anything-c-cached-imenu-alist
)
1376 (defvar anything-c-cached-imenu-candidates nil
)
1377 (make-variable-buffer-local 'anything-c-cached-imenu-candidates
)
1379 (defvar anything-c-cached-imenu-tick nil
)
1380 (make-variable-buffer-local 'anything-c-cached-imenu-tick
)
1382 (setq imenu-auto-rescan t
)
1384 (defun anything-imenu-create-candidates (entry)
1385 "Create candidates with ENTRY."
1386 (if (listp (cdr entry
))
1387 (mapcan (lambda (sub)
1388 (if (consp (cdr sub
))
1391 (concat (car entry
) anything-c-imenu-delimiter subentry
))
1392 (anything-imenu-create-candidates sub
))
1393 (list (concat (car entry
) anything-c-imenu-delimiter
(car sub
)))))
1397 (defvar anything-c-source-imenu
1399 (candidates . anything-c-imenu-candidates
)
1401 (persistent-action .
(lambda (elm)
1402 (anything-c-imenu-default-action elm
)
1403 (unless (fboundp 'semantic-imenu-tag-overlay
)
1404 (anything-match-line-color-current-line))))
1405 (action . anything-c-imenu-default-action
))
1406 "See (info \"(emacs)Imenu\")")
1408 ;; (anything 'anything-c-source-imenu)
1410 (defun anything-c-imenu-candidates ()
1411 (with-current-buffer anything-current-buffer
1412 (let ((tick (buffer-modified-tick)))
1413 (if (eq anything-c-cached-imenu-tick tick
)
1414 anything-c-cached-imenu-candidates
1415 (setq imenu--index-alist nil
)
1416 (setq anything-c-cached-imenu-tick tick
1417 anything-c-cached-imenu-candidates
1420 'anything-imenu-create-candidates
1421 (setq anything-c-cached-imenu-alist
1422 (let ((index (imenu--make-index-alist)))
1423 (if anything-c-imenu-index-filter
1424 (funcall anything-c-imenu-index-filter index
)
1427 (setq anything-c-cached-imenu-candidates
1428 (mapcar #'(lambda (x)
1432 anything-c-cached-imenu-candidates
))))))
1434 (setq imenu-default-goto-function
'imenu-default-goto-function
)
1435 (defun anything-c-imenu-default-action (elm)
1436 "The default action for `anything-c-source-imenu'."
1437 (let ((path (split-string elm anything-c-imenu-delimiter
))
1438 (alist anything-c-cached-imenu-alist
))
1439 (if (> (length path
) 1)
1441 (setq alist
(assoc (car path
) alist
))
1442 (setq elm
(cadr path
))
1443 (imenu (assoc elm alist
)))
1444 (imenu (assoc elm alist
)))))
1447 (defvar anything-c-ctags-modes
1448 '( c-mode c
++-mode awk-mode csharp-mode java-mode javascript-mode lua-mode
1449 makefile-mode pascal-mode perl-mode cperl-mode php-mode python-mode
1450 scheme-mode sh-mode slang-mode sql-mode tcl-mode
))
1452 (defun anything-c-source-ctags-init ()
1453 (when (and buffer-file-name
1454 (memq major-mode anything-c-ctags-modes
)
1455 (anything-current-buffer-is-modified))
1456 (with-current-buffer (anything-candidate-buffer 'local
)
1457 (call-process-shell-command
1458 (if (string-match "\\.el\\.gz$" anything-buffer-file-name
)
1459 (format "ctags -e -u -f- --language-force=lisp --fields=n =(zcat %s) " anything-buffer-file-name
)
1460 (format "ctags -e -u -f- --fields=n %s " anything-buffer-file-name
))
1461 nil
(current-buffer))
1462 (goto-char (point-min))
1464 (delete-region (point-min) (point))
1465 (loop while
(and (not (eobp)) (search-forward "\001" (point-at-eol) t
))
1466 for lineno-start
= (point)
1467 for lineno
= (buffer-substring lineno-start
(1- (search-forward "," (point-at-eol) t
)))
1470 (insert (format "%5s:" lineno
))
1471 (search-forward "\177" (point-at-eol) t
)
1472 (delete-region (1- (point)) (point-at-eol))
1473 (forward-line 1)))))
1475 (defvar anything-c-source-ctags
1476 '((name .
"Exuberant ctags")
1477 (init . anything-c-source-ctags-init
)
1478 (candidates-in-buffer)
1481 "Needs Exuberant Ctags.
1483 http://ctags.sourceforge.net/")
1484 ;; (anything 'anything-c-source-ctags)
1487 (defun anything-semantic-construct-candidates (tags depth
)
1488 (when (require 'semantic nil t
)
1490 (mapcar (lambda (tag)
1492 (let ((type (semantic-tag-type tag
))
1493 (class (semantic-tag-class tag
)))
1494 (if (or (and (stringp type
)
1495 (string= type
"class"))
1496 (eq class
'function
)
1497 (eq class
'variable
))
1498 (cons (cons (concat (make-string (* depth
2) ?\s
)
1499 (semantic-format-tag-summarize tag nil t
)) tag
)
1500 (anything-semantic-construct-candidates (semantic-tag-components tag
)
1504 (defun anything-semantic-default-action (candidate)
1505 (let ((tag (cdr (assoc candidate anything-semantic-candidates
))))
1506 (semantic-go-to-tag tag
)))
1508 (defvar anything-c-source-semantic
1509 '((name .
"Semantic Tags")
1511 (setq anything-semantic-candidates
1513 (anything-semantic-construct-candidates (semantic-fetch-tags) 0)
1515 (candidates .
(lambda ()
1516 (if anything-semantic-candidates
1517 (mapcar 'car anything-semantic-candidates
))))
1518 (persistent-action .
(lambda (elm)
1519 (anything-semantic-default-action elm
)
1520 (anything-match-line-color-current-line)))
1521 (action ("Goto tag" .
(lambda (candidate)
1522 (let ((tag (cdr (assoc candidate anything-semantic-candidates
))))
1523 (semantic-go-to-tag tag
))))))
1524 "Needs semantic in CEDET.
1526 http://cedet.sourceforge.net/semantic.shtml
1527 http://cedet.sourceforge.net/")
1529 ;; (anything 'anything-c-source-semantic)
1531 ;;; Function is called by
1532 (defvar anything-c-source-simple-call-tree-functions-callers
1533 '((name .
"Function is called by")
1534 (init . anything-c-simple-call-tree-functions-callers-init
)
1536 (candidates-in-buffer))
1537 "Needs simple-call-tree.el.
1538 http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el")
1540 (defun anything-c-simple-call-tree-functions-callers-init ()
1541 (require 'simple-call-tree
)
1543 (when (anything-current-buffer-is-modified)
1544 (simple-call-tree-analyze)
1545 (let ((list (simple-call-tree-invert simple-call-tree-alist
)))
1546 (with-current-buffer (anything-candidate-buffer 'local
)
1547 (dolist (entry list
)
1548 (let ((callers (mapconcat #'identity
(cdr entry
) ", ")))
1549 (insert (car entry
) " is called by "
1550 (if (string= callers
"")
1554 ;; (anything 'anything-c-source-simple-call-tree-functions-callers)
1557 (defvar anything-c-source-simple-call-tree-callers-functions
1558 '((name .
"Function calls")
1559 (init . anything-c-simple-call-tree-callers-functions-init
)
1561 (candidates-in-buffer))
1562 "Needs simple-call-tree.el.
1563 http://www.emacswiki.org/cgi-bin/wiki/download/simple-call-tree.el")
1565 (defun anything-c-simple-call-tree-callers-functions-init ()
1566 (require 'simple-call-tree
)
1568 (when (anything-current-buffer-is-modified)
1569 (simple-call-tree-analyze)
1570 (let ((list simple-call-tree-alist
))
1571 (with-current-buffer (anything-candidate-buffer 'local
)
1572 (dolist (entry list
)
1573 (let ((functions (mapconcat #'identity
(cdr entry
) ", ")))
1574 (insert (car entry
) " calls "
1575 (if (string= functions
"")
1580 ;; (anything 'anything-c-source-simple-call-tree-callers-functions)
1582 ;;; Commands/Options with doc
1583 (defvar anything-c-auto-document-data nil
)
1584 (make-variable-buffer-local 'anything-c-auto-document-data
)
1585 (defvar anything-c-source-commands-and-options-in-file
1586 '((name .
"Commands/Options in file")
1588 .
(lambda (x) (format "Commands/Options in %s"
1589 (buffer-local-value 'buffer-file-name anything-current-buffer
))))
1590 (candidates . anything-command-and-options-candidates
)
1593 "List Commands and Options with doc. It needs auto-document.el .
1595 http://www.emacswiki.org/cgi-bin/wiki/download/auto-document.el")
1597 (defun anything-command-and-options-candidates ()
1598 (with-current-buffer anything-current-buffer
1599 (when (and (require 'auto-document nil t
)
1600 (eq major-mode
'emacs-lisp-mode
)
1601 (or (anything-current-buffer-is-modified)
1602 (not anything-c-auto-document-data
)))
1603 (or imenu--index-alist
(imenu--make-index-alist t
))
1604 (setq anything-c-auto-document-data
1605 (destructuring-bind (commands options
)
1606 (adoc-construct anything-current-buffer
)
1608 (loop for
(command . doc
) in commands
1609 for cmdname
= (symbol-name command
)
1611 (cons (format "Command: %s\n %s"
1612 (propertize cmdname
'face font-lock-function-name-face
)
1613 (adoc-first-line doc
))
1614 (assoc cmdname imenu--index-alist
)))
1615 (loop with var-alist
= (cdr (assoc "Variables" imenu--index-alist
))
1616 for
(option doc default
) in options
1617 for optname
= (symbol-name option
)
1619 (cons (format "Option: %s\n %s\n default = %s"
1620 (propertize optname
'face font-lock-variable-name-face
)
1621 (adoc-first-line doc
)
1622 (adoc-prin1-to-string default
))
1625 anything-c-auto-document-data
))
1627 ;; (anything 'anything-c-source-commands-and-options-in-file)
1629 ;;;; <Color and Face>
1631 (defvar anything-c-source-customize-face
1632 '((name .
"Customize Face")
1634 (unless (anything-candidate-buffer)
1635 (save-window-excursion (list-faces-display))
1636 (anything-candidate-buffer (get-buffer "*Faces*")))))
1637 (candidates-in-buffer)
1638 (get-line . buffer-substring
)
1639 (action .
(lambda (line)
1640 (customize-face (intern (car (split-string line
))))))
1641 (requires-pattern .
3))
1642 "See (info \"(emacs)Faces\")")
1643 ;; (anything 'anything-c-source-customize-face)
1646 (defvar anything-c-source-colors
1648 (init .
(lambda () (unless (anything-candidate-buffer)
1649 (save-window-excursion (list-colors-display))
1650 (anything-candidate-buffer (get-buffer "*Colors*")))))
1651 (candidates-in-buffer)
1652 (get-line . buffer-substring
)
1653 (action ("Copy Name" .
(lambda (candidate)
1654 (kill-new (anything-c-colors-get-name candidate
))))
1655 ("Copy RGB" .
(lambda (candidate)
1656 (kill-new (anything-c-colors-get-rgb candidate
))))
1657 ("Insert Name" .
(lambda (candidate)
1658 (with-current-buffer anything-current-buffer
1659 (insert (anything-c-colors-get-name candidate
)))))
1660 ("Insert RGB" .
(lambda (candidate)
1661 (with-current-buffer anything-current-buffer
1662 (insert (anything-c-colors-get-rgb candidate
))))))
1663 (requires-pattern .
3)))
1664 ;; (anything 'anything-c-source-colors)
1666 (defun anything-c-colors-get-name (candidate)
1668 (replace-regexp-in-string
1671 (insert (capitalize candidate
))
1672 (goto-char (point-min))
1673 (search-forward-regexp "\\s-\\{2,\\}")
1677 (defun anything-c-colors-get-rgb (candidate)
1679 (replace-regexp-in-string
1682 (insert (capitalize candidate
))
1683 (goto-char (point-max))
1684 (search-backward-regexp "\\s-\\{2,\\}")
1685 (kill-region (point) (point-min))
1688 ;;;; <Search Engine>
1689 ;;; Tracker desktop search
1690 (defvar anything-c-source-tracker-search
1691 '((name .
"Tracker Search")
1692 (candidates .
(lambda ()
1693 (start-process "tracker-search-process" nil
1697 (requires-pattern .
3)
1699 "Source for retrieving files matching the current input pattern
1700 with the tracker desktop search.")
1701 ;; (anything 'anything-c-source-tracker-search)
1703 ;;; Spotlight (MacOS X desktop search)
1704 (defvar anything-c-source-mac-spotlight
1706 (candidates .
(lambda ()
1707 (start-process "mdfind-process" nil
"mdfind" anything-pattern
)))
1709 (requires-pattern .
3)
1711 "Source for retrieving files via Spotlight's command line
1713 ;; (anything 'anything-c-source-mac-spotlight)
1717 (defvar anything-c-source-kill-ring
1718 '((name .
"Kill Ring")
1719 (init .
(lambda () (anything-attrset 'last-command last-command
)))
1720 (candidates .
(lambda ()
1721 (loop for kill in kill-ring
1722 unless
(or (< (length kill
) anything-kill-ring-threshold
)
1723 (string-match "^[\\s\\t]+$" kill
))
1725 (action . anything-c-kill-ring-action
)
1729 "Source for browse and insert contents of kill-ring.")
1731 (defun anything-c-kill-ring-action (str)
1732 "Insert STR in `kill-ring' and set STR to the head.
1733 If this action is executed just after `yank', replace with STR as yanked string."
1734 (setq kill-ring
(delete str kill-ring
))
1735 (if (not (eq (anything-attr 'last-command
) 'yank
))
1736 (insert-for-yank str
)
1738 (let ((inhibit-read-only t
)
1739 (before (< (point) (mark t
))))
1741 (funcall (or yank-undo-function
'delete-region
) (point) (mark t
))
1742 (funcall (or yank-undo-function
'delete-region
) (mark t
) (point)))
1743 (setq yank-undo-function nil
)
1744 (set-marker (mark-marker) (point) (current-buffer))
1745 (insert-for-yank str
)
1746 ;; Set the window start back where it was in the yank command,
1748 (set-window-start (selected-window) yank-window-start t
)
1750 ;; This is like exchange-point-and-mark, but doesn't activate the mark.
1751 ;; It is cleaner to avoid activation, even though the command
1752 ;; loop would deactivate the mark because we inserted text.
1753 (goto-char (prog1 (mark t
)
1754 (set-marker (mark-marker) (point) (current-buffer)))))))
1757 ;; (anything 'anything-c-source-kill-ring)
1760 ;;; Insert from register
1761 (defvar anything-c-source-register
1762 '((name .
"Registers")
1763 (candidates . anything-c-register-candidates
)
1764 (action-transformer . anything-c-register-action-transformer
)
1767 "See (info \"(emacs)Registers\")")
1769 (defun anything-c-register-candidates ()
1770 "Collecting register contents and appropriate commands."
1771 (loop for
(char . val
) in register-alist
1772 for key
= (single-key-description char
)
1773 for string-actions
= (cond
1775 (list (int-to-string val
)
1777 'increment-register
))
1779 (let ((buf (marker-buffer val
)))
1781 (list "a marker in no buffer")
1783 "a buffer position:"
1786 (int-to-string (marker-position val
)))
1788 'insert-register
))))
1789 ((and (consp val
) (window-configuration-p (car val
)))
1790 (list "window configuration."
1792 ((and (consp val
) (frame-configuration-p (car val
)))
1793 (list "frame configuration."
1795 ((and (consp val
) (eq (car val
) 'file
))
1796 (list (concat "file:"
1797 (prin1-to-string (cdr val
))
1800 ((and (consp val
) (eq (car val
) 'file-query
))
1801 (list (concat "file:a file-query reference: file "
1804 (int-to-string (car (cdr (cdr val
))))
1808 (let ((lines (format "%4d" (length val
))))
1809 (list (format "%s: %s\n" lines
1810 (truncate-string-to-width
1811 (mapconcat 'identity
(list (car val
))
1812 ;; (mapconcat (lambda (y) y) val
1813 "^J") (- (window-width) 15)))
1816 (list ;; without properties
1817 (substring-no-properties val
)
1820 'prepend-to-register
))
1823 collect
(cons (format "register %3s: %s" key
(car string-actions
))
1824 (cons char
(cdr string-actions
)))))
1826 (defun anything-c-register-action-transformer (actions register-and-functions
)
1827 "Decide actions by the contents of register."
1828 (loop with func-actions
=
1831 (lambda (c) (insert-register (car c
))))
1833 "Jump to Register" .
1834 (lambda (c) (jump-to-register (car c
))))
1836 "Append Region to Register" .
1837 (lambda (c) (append-to-register (car c
) (region-beginning) (region-end))))
1838 (prepend-to-register
1839 "Prepend Region to Register" .
1840 (lambda (c) (prepend-to-register (car c
) (region-beginning) (region-end))))
1842 "Increment Prefix Arg to Register" .
1843 (lambda (c) (increment-register anything-current-prefix-arg
(car c
)))))
1844 for func in
(cdr register-and-functions
)
1845 for cell
= (assq func func-actions
)
1847 collect
(cdr cell
)))
1849 ;; (anything 'anything-c-source-register)
1851 ;;;; <Headline Extraction>
1852 (defvar anything-c-source-fixme
1853 '((name .
"TODO/FIXME/DRY comments")
1854 (headline .
"^.*\\<\\(TODO\\|FIXME\\|DRY\\)\\>.*$")
1857 "Show TODO/FIXME/DRY comments in current file.")
1858 ;; (anything 'anything-c-source-fixme)
1860 (defvar anything-c-source-rd-headline
1861 '((name .
"RD HeadLine")
1862 (headline "^= \\(.+\\)$" "^== \\(.+\\)$" "^=== \\(.+\\)$" "^==== \\(.+\\)$")
1863 (condition .
(memq major-mode
'(rdgrep-mode rd-mode
)))
1869 http://en.wikipedia.org/wiki/Ruby_Document_format")
1870 ;; (anything 'anything-c-source-rd-headline)
1872 (defvar anything-c-source-oddmuse-headline
1873 '((name .
"Oddmuse HeadLine")
1874 (headline "^= \\(.+\\) =$" "^== \\(.+\\) ==$"
1875 "^=== \\(.+\\) ===$" "^==== \\(.+\\) ====$")
1876 (condition .
(memq major-mode
'(oddmuse-mode yaoddmuse-mode
)))
1879 "Show Oddmuse headlines, such as EmacsWiki.")
1880 ;; (anything 'anything-c-source-oddmuse-headline)
1882 (defvar anything-c-source-emacs-source-defun
1883 '((name .
"Emacs Source DEFUN")
1884 (headline .
"DEFUN\\|DEFVAR")
1885 (condition .
(string-match "/emacs2[0-9].+/src/.+c$" (or buffer-file-name
""))))
1886 "Show DEFUN/DEFVAR in Emacs C source file.")
1887 ;; (anything 'anything-c-source-emacs-source-defun)
1889 (defvar anything-c-source-emacs-lisp-expectations
1890 '((name .
"Emacs Lisp Expectations")
1891 (headline .
"(desc \\|(expectations")
1892 (condition .
(eq major-mode
'emacs-lisp-mode
)))
1893 "Show descriptions (desc) in Emacs Lisp Expectations.
1895 http://www.emacswiki.org/cgi-bin/wiki/download/el-expectations.el")
1896 ;; (anything 'anything-c-source-emacs-lisp-expectations)
1898 (defvar anything-c-source-emacs-lisp-toplevels
1899 '((name .
"Emacs Lisp Toplevel / Level 4 Comment / Linkd Star")
1900 (headline .
"^(\\|(@\\*\\|^;;;;")
1901 (get-line . buffer-substring
)
1902 (condition .
(eq major-mode
'emacs-lisp-mode
))
1904 "Show top-level forms, level 4 comments and linkd stars (optional) in Emacs Lisp.
1905 linkd.el is optional because linkd stars are extracted by regexp.
1906 http://www.emacswiki.org/cgi-bin/wiki/download/linkd.el")
1907 ;; (anything 'anything-c-source-emacs-lisp-toplevels)
1909 (defvar anything-c-source-org-headline
1910 '((name .
"Org HeadLine")
1912 "^\\* \\(.+?\\)\\([ \t]*:[a-zA-Z0-9_@:]+:\\)?[ \t]*$"
1913 "^\\*\\* \\(.+?\\)\\([ \t]*:[a-zA-Z0-9_@:]+:\\)?[ \t]*$"
1914 "^\\*\\*\\* \\(.+?\\)\\([ \t]*:[a-zA-Z0-9_@:]+:\\)?[ \t]*$"
1915 "^\\*\\*\\*\\* \\(.+?\\)\\([ \t]*:[a-zA-Z0-9_@:]+:\\)?[ \t]*$"
1916 "^\\*\\*\\*\\*\\* \\(.+?\\)\\([ \t]*:[a-zA-Z0-9_@:]+:\\)?[ \t]*$"
1917 "^\\*\\*\\*\\*\\*\\* \\(.+?\\)\\([ \t]*:[a-zA-Z0-9_@:]+:\\)?[ \t]*$"
1918 "^\\*\\*\\*\\*\\*\\*\\* \\(.+?\\)\\([ \t]*:[a-zA-Z0-9_@:]+:\\)?[ \t]*$"
1919 "^\\*\\*\\*\\*\\*\\*\\*\\* \\(.+?\\)\\([ \t]*:[a-zA-Z0-9_@:]+:\\)?[ \t]*$")
1920 (condition .
(eq major-mode
'org-mode
))
1923 (persistent-action .
(lambda (elm)
1924 (anything-c-action-line-goto elm
)
1927 .
(lambda (actions candidate
)
1928 '(("Go to Line" . anything-c-action-line-goto
)
1929 ("Insert Link to This Headline" . anything-c-org-headline-insert-link-to-headline
)))))
1930 "Show Org headlines.
1931 org-mode is very very much extended text-mode/outline-mode.
1933 See (find-library \"org.el\")
1934 See http://orgmode.org for the latest version.")
1936 (defun anything-c-org-headline-insert-link-to-headline (lineno-and-content)
1939 (goto-line (car lineno-and-content
))
1940 (and (looking-at "^\\*+ \\(.+?\\)\\([ \t]*:[a-zA-Z0-9_@:]+:\\)?[ \t]*$")
1941 (org-make-link-string (concat "*" (match-string 1)))))))
1943 ;; (anything 'anything-c-source-org-headline)
1947 (defvar anything-c-source-picklist
1948 '((name .
"Picklist")
1949 (candidates .
(lambda () (mapcar 'car picklist-list
)))
1952 ;; (anything 'anything-c-source-picklist)
1955 (defun anything-c-bbdb-candidates ()
1956 "Return a list of all names in the bbdb database. The format
1957 is \"Firstname Lastname\"."
1958 (mapcar (lambda (bbdb-record)
1959 (replace-regexp-in-string
1961 (concat (aref bbdb-record
0) " " (aref bbdb-record
1))))
1964 (defun anything-c-bbdb-create-contact (actions candidate
)
1965 "Action transformer that returns only an entry to add the
1966 current `anything-pattern' as new contact. All other actions are
1968 (if (string= candidate
"*Add to contacts*")
1969 '(("Add to contacts" .
(lambda (actions)
1970 (bbdb-create-internal
1971 (read-from-minibuffer "Name: " anything-c-bbdb-name
)
1972 (read-from-minibuffer "Company: ")
1973 (read-from-minibuffer "Email: ")
1976 (read-from-minibuffer "Note: ")))))
1979 (defun anything-c-bbdb-get-record (candidate)
1980 "Return record that match CANDIDATE."
1981 (bbdb candidate nil
)
1982 (set-buffer "*BBDB*")
1983 (bbdb-current-record))
1985 (defvar anything-c-bbdb-name nil
1986 "Only for internal use.")
1988 (defvar anything-c-source-bbdb
1990 (candidates . anything-c-bbdb-candidates
)
1992 (action ("Send a mail" .
(lambda (candidate)
1993 (bbdb-send-mail (anything-c-bbdb-get-record candidate
))))
1994 ("View person's data" .
(lambda (candidate)
1995 (bbdb-redisplay-one-record (anything-c-bbdb-get-record candidate
)))))
1996 (filtered-candidate-transformer .
(lambda (candidates source
)
1997 (setq anything-c-bbdb-name anything-pattern
)
1998 (if (not candidates
)
1999 (list "*Add to contacts*")
2001 (action-transformer .
(lambda (actions candidate
)
2002 (anything-c-bbdb-create-contact actions candidate
)))))
2003 ;; (anything 'anything-c-source-bbdb)
2005 ;;; Evaluation Result
2006 (defvar anything-c-source-evaluation-result
2007 '((name .
"Evaluation Result")
2009 (match (lambda (candidate) t
))
2010 (candidates "dummy")
2011 (filtered-candidate-transformer .
(lambda (candidates source
)
2015 (eval (read anything-pattern
)))
2018 (action ("Do Nothing" . ignore
))))
2019 ;; (anything 'anything-c-source-evaluation-result)
2021 ;;; Calculation Result
2022 (defvar anything-c-source-calculation-result
2023 '((name .
"Calculation Result")
2025 (match (lambda (candidate) t
))
2026 (candidates "dummy")
2027 (filtered-candidate-transformer .
(lambda (candidates source
)
2030 (calc-eval anything-pattern
)
2033 (action ("Copy result to kill-ring" . kill-new
))))
2034 ;; (anything 'anything-c-source-calculation-result)
2036 ;;; Google Suggestions
2037 (defvar anything-c-source-google-suggest
2038 '((name .
"Google Suggest")
2039 (candidates .
(lambda ()
2040 (let ((suggestions (anything-c-google-suggest-fetch anything-input
)))
2041 (if (some (lambda (suggestion)
2042 (equal (cdr suggestion
) anything-input
))
2045 ;; if there is no suggestion exactly matching the input then
2046 ;; prepend a Search on Google item to the list
2047 (append (list (cons (concat "Search for "
2048 "'" anything-input
"'"
2052 (action .
(("Google Search" .
2054 (browse-url (concat anything-c-google-suggest-search-url
2055 (url-hexify-string candidate
)))))))
2057 (requires-pattern .
3)
2059 ;; (anything 'anything-c-source-google-suggest)
2061 (defun anything-c-google-suggest-fetch (input)
2062 "Fetch suggestions for INPUT."
2063 (let* ((result (with-current-buffer
2064 (url-retrieve-synchronously
2065 (concat anything-c-google-suggest-url
2066 (url-hexify-string input
)))
2067 (buffer-substring (point-min) (point-max))))
2068 (split (split-string result
"new Array("))
2069 (suggestions (anything-c-google-suggest-get-items (second split
)))
2070 (numbers (anything-c-google-suggest-get-items (third split
)))
2071 (longest (+ (apply 'max
0 (let (lengths)
2072 (dotimes (i (length suggestions
))
2073 (push (+ (length (nth i suggestions
))
2074 (length (nth i numbers
)))
2079 (dotimes (i (length suggestions
))
2080 (let ((suggestion (nth i suggestions
))
2081 (number (nth i numbers
)))
2082 (push (cons (concat suggestion
2083 (make-string (- longest
2092 (defun anything-c-google-suggest-get-items (str)
2093 "Extract items from STR returned by Google Suggest."
2094 (let ((start nil
) items
)
2095 (while (string-match "\"\\([^\"]+?\\)\"" str start
)
2096 (push (match-string 1 str
) items
)
2097 (setq start
(1+ (match-end 1))))
2101 ;;; Need external program surfraw.
2102 ;;; http://surfraw.alioth.debian.org/
2104 (defun anything-c-build-elvi-alist ()
2106 A list of search engines."
2109 (call-process "surfraw" nil t nil
2111 (split-string (buffer-string) "\n")))
2114 (loop for i in elvi-list
2116 (setq line
(split-string i
))
2117 collect
(cons (first line
) (mapconcat #'(lambda (x) x
) (cdr line
) " "))))))
2121 (defun anything-c-surfraw-get-url (engine pattern
)
2122 "Get search url from `engine' for `anything-pattern'."
2124 (apply #'call-process
"surfraw" nil t nil
2130 (defvar anything-c-surfraw-cache nil
)
2131 (defvar anything-c-source-surfraw
2132 '((name .
"Surfraw")
2134 (unless anything-c-surfraw-cache
2135 (let ((sr-alist (anything-c-build-elvi-alist)))
2136 (setq anything-c-surfraw-cache
2137 (loop for i in sr-alist
2139 collect
(car i
)))))))
2140 (candidates .
(lambda ()
2141 (loop for i in anything-c-surfraw-cache
2142 for s
= (anything-c-surfraw-get-url i anything-pattern
)
2143 collect
(concat (propertize i
2144 'face
'((:foreground
"green")))
2145 ">>>" (replace-regexp-in-string "\n" "" s
)))))
2146 (action .
(("Browse" .
(lambda (candidate)
2147 (let ((url (second (split-string candidate
">>>"))))
2148 (browse-url url
))))))
2150 (requires-pattern .
3)
2154 ;; (anything 'anything-c-source-surfraw)
2156 ;;; Jabber Contacts (jabber.el)
2157 (defun anything-c-jabber-online-contacts ()
2158 "List online Jabber contacts."
2161 (dolist (item (jabber-concat-rosters) jids
)
2162 (when (get item
'connected
)
2163 (push (if (get item
'name
)
2164 (cons (get item
'name
) item
)
2165 (cons (symbol-name item
) item
)) jids
))))))
2167 (defvar anything-c-source-jabber-contacts
2168 '((name .
"Jabber Contacts")
2169 (init .
(lambda () (require 'jabber
)))
2170 (candidates .
(lambda () (mapcar 'car
(anything-c-jabber-online-contacts))))
2171 (action .
(lambda (x)
2173 (jabber-read-account)
2175 (cdr (assoc x
(anything-c-jabber-online-contacts)))))))))
2176 ;; (anything 'anything-c-source-jabber-contacts)
2180 (defvar anything-source-select-buffer
"*anything source select*")
2181 (defvar anything-c-source-call-source
2182 `((name .
"Call anything source")
2183 (candidate-number-limit .
9999)
2184 (candidates .
(lambda ()
2185 (loop for vname in
(all-completions "anything-c-source-" obarray
)
2186 for var
= (intern vname
)
2187 for name
= (ignore-errors (assoc-default 'name
(symbol-value var
)))
2188 if name collect
(cons (format "%s (%s)" name vname
) var
))))
2189 (action .
(("Invoke anything with selected source" .
2191 (setq anything-candidate-number-limit
9999)
2192 (anything candidate nil nil nil nil
2193 anything-source-select-buffer
)))
2194 ("Describe variable" . describe-variable
)))
2195 (persistent-action . describe-variable
)))
2196 ;; (anything 'anything-c-source-call-source)
2198 (defun anything-call-source ()
2199 "Call anything source."
2201 (anything 'anything-c-source-call-source nil nil nil nil
2202 anything-source-select-buffer
))
2204 (defun anything-call-source-from-anything ()
2205 "Call anything source within `anything' session."
2207 (setq anything-input-idle-delay
0)
2208 (anything-set-sources '(anything-c-source-call-source)))
2211 (defvar anything-c-source-occur
2214 (setq anything-c-source-occur-current-buffer
2216 (candidates .
(lambda ()
2217 (setq anything-occur-buf
(get-buffer-create "*Anything Occur*"))
2218 (with-current-buffer anything-occur-buf
2220 (let ((count (occur-engine anything-pattern
2221 (list anything-c-source-occur-current-buffer
) anything-occur-buf
2222 list-matching-lines-default-context-lines nil
2223 list-matching-lines-buffer-name-face
2224 nil list-matching-lines-face
2225 (not (eq occur-excluded-properties t
)))))
2227 (let ((lines (split-string (buffer-string) "\n" t
)))
2229 (action .
(("Goto line" .
(lambda (candidate)
2230 (goto-line (string-to-number candidate
) anything-c-source-occur-current-buffer
)))))
2231 (requires-pattern .
1)
2233 ;; (anything 'anything-c-source-occur)
2235 ;; Do many actions for input
2236 (defvar anything-c-source-create
2240 (candidate-number-limit .
9999)
2241 (action-transformer . anything-create--actions
))
2242 "Do many create actions from `anything-pattern'.
2243 See also `anything-create--actions'.")
2244 ;; (anything 'anything-c-source-create)
2245 (defcustom anything-create--actions-private nil
2246 "User defined actions for `anything-create' / `anything-c-source-create'.
2247 It is a list of (DISPLAY . FUNCTION) pairs like `action'
2248 attribute of `anything-sources'.
2250 It is prepended to predefined pairs."
2252 :group
'anything-config
)
2254 (defun anything-create-from-anything ()
2255 "Run `anything-create' from `anything' as a fallback."
2257 (anything-run-after-quit 'anything-create nil anything-pattern
))
2259 (defun anything-create (&optional string initial-input
)
2260 "Do many create actions from STRING.
2261 See also `anything-create--actions'."
2263 (setq string
(or string
(read-string "Create Anything: " initial-input
)))
2264 (anything '(((name .
"Anything Create")
2265 (header-name .
(lambda (_) (format "Action for \"%s\"" string
)))
2266 (candidates . anything-create--actions
)
2267 (candidate-number-limit .
9999)
2268 (action .
(lambda (func) (funcall func string
)))))))
2270 (defun anything-create--actions (&rest ignored
)
2271 "Default actions for `anything-create' / `anything-c-source-create'."
2273 (lambda (pair) (and (consp pair
) (functionp (cdr pair
))))
2274 (append anything-create--actions-private
2275 '(("find-file" . find-file
)
2276 ("find-file other window" . find-file-other-window
)
2277 ("New buffer" . switch-to-buffer
)
2278 ("New buffer other window" . switch-to-buffer-other-window
)
2279 ("Bookmark Set" . bookmark-set
)
2281 (lambda (x) (set-register (read-char "Register: ") x
)))
2282 ("Insert Linkd star" . linkd-insert-star
)
2283 ("Insert Linkd Tag" . linkd-insert-tag
)
2284 ("Insert Linkd Link" . linkd-insert-link
)
2285 ("Insert Linkd Lisp" . linkd-insert-lisp
)
2286 ("Insert Linkd Wiki" . linkd-insert-wiki
)
2287 ("Google Search" . google
)))))
2289 ;; Minibuffer History
2290 (defvar anything-c-source-minibuffer-history
2291 '((name .
"Minibuffer History")
2292 (candidates . minibuffer-history
)
2296 ;; (anything 'anything-c-source-minibuffer-history)
2299 ;; Sources for gentoo users
2301 (defvar anything-c-gentoo-use-flags nil
)
2302 (defvar anything-c-gentoo-buffer
"*anything-gentoo-output*")
2303 (defvar anything-c-cache-gentoo nil
)
2304 (defvar anything-c-cache-world nil
)
2305 (defvar anything-c-source-gentoo
2306 '((name .
"Portage sources")
2308 (get-buffer-create anything-c-gentoo-buffer
)
2309 (unless anything-c-cache-gentoo
2310 (anything-c-gentoo-setup-cache))
2311 (unless anything-c-cache-world
2312 (setq anything-c-cache-world
(anything-c-gentoo-get-world)))
2313 (anything-c-gentoo-init-list)))
2314 (candidates-in-buffer)
2316 (candidate-transformer anything-c-highlight-world
)
2317 (action .
(("Show package" .
(lambda (elm)
2318 (anything-c-gentoo-eshell-action elm
"eix")))
2319 ("Show history" .
(lambda (elm)
2320 (if (member elm anything-c-cache-world
)
2321 (anything-c-gentoo-eshell-action elm
"genlop -qe")
2322 (message "No infos on packages not yet installed"))))
2323 ("Copy in kill-ring" . kill-new
)
2324 ("insert at point" . insert
)
2325 ("Browse HomePage" .
(lambda (elm)
2326 (browse-url (car (anything-c-gentoo-get-url elm
)))))
2327 ("Show extra infos" .
(lambda (elm)
2328 (if (member elm anything-c-cache-world
)
2329 (anything-c-gentoo-eshell-action elm
"genlop -qi")
2330 (message "No infos on packages not yet installed"))))
2331 ("Show use flags" .
(lambda (elm)
2332 (anything-c-gentoo-default-action elm
"equery" "-C" "u")
2333 (font-lock-add-keywords nil
'(("^\+.*" . font-lock-variable-name-face
)))
2334 (font-lock-mode 1)))
2335 ("Run emerge pretend" .
(lambda (elm)
2336 (anything-c-gentoo-eshell-action elm
"emerge -p")))
2337 ("Show dependencies" .
(lambda (elm)
2338 (anything-c-gentoo-default-action elm
"equery" "-C" "d")))
2339 ("Show related files" .
(lambda (elm)
2340 (anything-c-gentoo-default-action elm
"equery" "files")))
2341 ("Update" .
(lambda (elm)
2342 (anything-c-gentoo-setup-cache)
2343 (setq anything-c-cache-world
(anything-c-gentoo-get-world))))))))
2345 ;; (anything 'anything-c-source-gentoo)
2347 (defun anything-c-gentoo-default-action (elm command
&rest args
)
2348 "Gentoo default action that use `anything-c-gentoo-buffer'."
2349 (if (member elm anything-c-cache-world
)
2351 (switch-to-buffer anything-c-gentoo-buffer
)
2353 (let ((com-list (append args
(list elm
))))
2354 (apply #'call-process command nil t nil
2356 (message "No infos on packages not yet installed")))
2358 (defvar anything-c-source-use-flags
2359 '((name .
"Use Flags")
2361 (unless anything-c-gentoo-use-flags
2362 (anything-c-gentoo-setup-use-flags-cache))
2363 (anything-c-gentoo-get-use)))
2364 (candidates-in-buffer)
2366 (candidate-transformer anything-c-highlight-local-use
)
2367 (action .
(("Show which dep use this flag"
2369 (switch-to-buffer anything-c-gentoo-buffer
)
2371 (apply #'call-process
"equery" nil t nil
2377 (switch-to-buffer anything-c-gentoo-buffer
)
2379 (apply #'call-process
"euse" nil t nil
2382 (font-lock-add-keywords nil
`((,elm . font-lock-variable-name-face
)))
2383 (font-lock-mode 1)))))))
2386 ;; (anything 'anything-c-source-use-flags)
2388 (defun anything-c-gentoo-init-list ()
2389 "Initialize buffer with all packages in Portage."
2390 (let* ((portage-buf (get-buffer-create "*anything-gentoo*"))
2391 (buf (anything-candidate-buffer 'portage-buf
)))
2392 (with-current-buffer buf
2393 (dolist (i anything-c-cache-gentoo
)
2394 (insert (concat i
"\n"))))))
2396 (defun anything-c-gentoo-setup-cache ()
2397 "Set up `anything-c-cache-gentoo'"
2398 (setq anything-c-cache-gentoo
2399 (split-string (with-temp-buffer
2400 (call-process "eix" nil t nil
2404 (defun anything-c-gentoo-eshell-action (elm command
)
2405 (when (get-buffer "*EShell Command Output*")
2406 (kill-buffer "*EShell Command Output*"))
2407 (message "Wait searching...")
2408 (eshell-command (format "%s %s" command elm
)))
2410 (defun anything-c-gentoo-get-use ()
2411 "Initialize buffer with all use flags."
2412 (let* ((use-buf (get-buffer-create "*anything-gentoo-use*"))
2413 (buf (anything-candidate-buffer 'use-buf
)))
2414 (with-current-buffer buf
2415 (dolist (i anything-c-gentoo-use-flags
)
2416 (insert (concat i
"\n"))))))
2419 (defun anything-c-gentoo-setup-use-flags-cache ()
2420 "Setup `anything-c-gentoo-use-flags'"
2421 (setq anything-c-gentoo-use-flags
2422 (split-string (with-temp-buffer
2423 (call-process "eix" nil t nil
2424 "--print-all-useflags")
2427 (defun anything-c-gentoo-get-url (elm)
2428 "Return a list of urls from eix output."
2429 (split-string (eshell-command-result
2430 (format "eix %s | grep Homepage | awk '{print $2}'" elm
))))
2432 (defun anything-c-gentoo-get-world ()
2433 "Return list of all installed package on your system."
2434 (split-string (with-temp-buffer
2435 (call-process "qlist" nil t nil
2439 (defun anything-c-gentoo-get-local-use ()
2440 (split-string (with-temp-buffer
2441 (call-process "portageq" nil t nil
2446 (defface anything-gentoo-match-face
'((t (:foreground
"red")))
2447 "Face for anything-gentoo installed packages."
2448 :group
'traverse-faces
)
2450 (defun anything-c-highlight-world (eix)
2451 "Highlight all installed package."
2453 if
(member i anything-c-cache-world
)
2454 collect
(propertize i
'face
'anything-gentoo-match-face
)
2458 (defun anything-c-highlight-local-use (use-flags)
2459 (let ((local-uses (anything-c-gentoo-get-local-use)))
2460 (loop for i in use-flags
2461 if
(member i local-uses
)
2462 collect
(propertize i
'face
'anything-gentoo-match-face
)
2466 (defvar anything-c-source-emacs-process
2467 '((name .
"Emacs Process")
2468 (candidates .
(lambda ()
2469 (mapcar #'process-name
2471 (action .
(("Kill Process" .
(lambda (elm)
2472 (delete-process (get-process elm
))))))))
2474 ;; (anything 'anything-c-source-emacs-process)
2476 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Action Helpers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2478 (defvar anything-c-external-commands-list nil
2479 "A list of all external commands the user can execute. If this
2480 variable is not set by the user, it will be calculated
2483 (defun anything-c-external-commands-list-1 ()
2484 "Returns a list of all external commands the user can execute.
2486 If `anything-c-external-commands-list' is non-nil it will
2487 return its contents. Else it calculates all external commands
2488 and sets `anything-c-external-commands-list'.
2490 The code is ripped out of `eshell-complete-commands-list'."
2491 (if anything-c-external-commands-list
2492 anything-c-external-commands-list
2493 (setq anything-c-external-commands-list
2494 (let* ((paths (split-string (getenv "PATH") path-separator
))
2495 (cwd (file-name-as-directory
2496 (expand-file-name default-directory
)))
2497 (path "") (comps-in-path ())
2498 (file "") (filepath "") (completions ()))
2499 ;; Go thru each path in the search path, finding completions.
2501 (setq path
(file-name-as-directory
2502 (expand-file-name (or (car paths
) ".")))
2504 (and (file-accessible-directory-p path
)
2505 (file-name-all-completions "" path
)))
2506 ;; Go thru each completion found, to see whether it should be
2507 ;; used, e.g. see if it's executable.
2508 (while comps-in-path
2509 (setq file
(car comps-in-path
)
2510 filepath
(concat path file
))
2511 (if (and (not (member file completions
))
2512 (or (string-equal path cwd
)
2513 (not (file-directory-p filepath
)))
2514 (file-executable-p filepath
))
2515 (setq completions
(cons file completions
)))
2516 (setq comps-in-path
(cdr comps-in-path
)))
2517 (setq paths
(cdr paths
)))
2520 (defun anything-c-file-buffers (filename)
2521 "Returns a list of those buffer names which correspond to the
2522 file given by FILENAME."
2524 (dolist (buf (buffer-list) ret
)
2525 (let ((bfn (buffer-file-name buf
)))
2527 (string= filename bfn
))
2528 (push (buffer-name buf
) ret
)))
2531 (defun anything-c-delete-file (file)
2532 "Delete the given file after querying the user. Ask to kill
2533 buffers associated with that file, too."
2534 (if (y-or-n-p (format "Really delete file %s? " file
))
2536 (let ((buffers (anything-c-file-buffers file
)))
2538 (dolist (buf buffers
)
2539 (when (y-or-n-p (format "Kill buffer %s, too? " buf
))
2540 (kill-buffer buf
)))))
2541 (message "Nothing deleted.")))
2543 (defun anything-c-open-file-externally (file)
2544 "Open FILE with an external tool. Query the user which tool to
2546 (start-process "anything-c-open-file-externally"
2548 (completing-read "Program: "
2549 (anything-c-external-commands-list-1))
2552 (defun w32-shell-execute-open-file (file)
2553 (interactive "fOpen file:")
2555 (w32-shell-execute "open" (replace-regexp-in-string ;for UNC paths
2557 (replace-regexp-in-string ; strip cygdrive paths
2558 "/cygdrive/\\(.\\)" "\\1:" file nil nil
) nil t
))))
2559 (defun anything-c-open-file-with-default-tool (file)
2560 "Open FILE with the default tool on this platform."
2561 (if (eq system-type
'windows-nt
)
2562 (w32-shell-execute-open-file file
)
2563 (start-process "anything-c-open-file-with-default-tool"
2565 (cond ((eq system-type
'gnu
/linux
)
2567 ((or (eq system-type
'darwin
) ;; Mac OS X
2568 (eq system-type
'macos
)) ;; Mac OS 9
2572 (defun anything-c-open-dired (file)
2573 "Opens a dired buffer in FILE's directory. If FILE is a
2574 directory, open this directory."
2575 (if (file-directory-p file
)
2577 (dired (file-name-directory file
))
2578 (dired-goto-file file
)))
2580 (defun anything-c-display-to-real-line (candidate)
2581 (if (string-match "^ *\\([0-9]+\\):\\(.+\\)$" candidate
)
2582 (list (string-to-number (match-string 1 candidate
)) (match-string 2 candidate
))
2583 (error "Line number not found")))
2585 (defun anything-c-action-line-goto (lineno-and-content)
2586 (apply #'anything-goto-file-line
(anything-attr 'target-file
)
2587 (append lineno-and-content
2588 (list (if (and (anything-attr-defined 'target-file
)
2589 (not anything-in-persistent-action
))
2590 'find-file-other-window
2593 (defun* anything-c-action-file-line-goto
(file-line-content &optional
(find-file-function #'find-file
))
2594 (apply #'anything-goto-file-line file-line-content
))
2597 (defun anything-c-filtered-candidate-transformer-file-line (candidates source
)
2600 (if (not (string-match "^\\(.+?\\):\\([0-9]+\\):\\(.+\\)$" candidate
))
2601 (error "Filename and line number not found")
2602 (let ((filename (match-string 1 candidate
))
2603 (lineno (match-string 2 candidate
))
2604 (content (match-string 3 candidate
)))
2605 (cons (format "%s:%s\n %s"
2606 (propertize filename
'face compilation-info-face
)
2607 (propertize lineno
'face compilation-line-face
)
2609 (list (expand-file-name
2611 (anything-aif (anything-attr 'default-directory
)
2612 (if (functionp it
) (funcall it
) it
)
2613 (and (anything-candidate-buffer)
2616 (anything-candidate-buffer)))))
2617 (string-to-number lineno
) content
)))))
2620 (defun* anything-goto-file-line
(file lineno content
&optional
(find-file-function #'find-file
))
2621 (anything-aif (anything-attr 'before-jump-hook
)
2623 (when file
(funcall find-file-function file
))
2624 (if (anything-attr-defined 'adjust
)
2625 (anything-c-goto-line-with-adjustment lineno content
)
2627 (unless (anything-attr-defined 'recenter
)
2628 (set-window-start (get-buffer-window anything-current-buffer
) (point)))
2629 (anything-aif (anything-attr 'after-jump-hook
)
2631 (when anything-in-persistent-action
2632 (anything-persistent-highlight-point (point-at-bol) (point-at-eol))))
2634 (defun anything-find-file-as-root (candidate)
2635 (find-file (concat "/su::" (expand-file-name candidate
))))
2637 ;; borrowed from etags.el
2638 ;; (anything-c-goto-line-with-adjustment (line-number-at-pos) ";; borrowed from etags.el")
2639 (defun anything-c-goto-line-with-adjustment (line line-content
)
2642 ;; This constant is 1/2 the initial search window.
2643 ;; There is no sense in making it too small,
2644 ;; since just going around the loop once probably
2645 ;; costs about as much as searching 2000 chars.
2648 pat
(concat (if (eq selective-display t
)
2649 "\\(^\\|\^m\\) *" "^ *") ;allow indent
2650 (regexp-quote line-content
)))
2651 ;; If no char pos was given, try the given line number.
2652 (setq startpos
(progn (goto-line line
) (point)))
2653 (or startpos
(setq startpos
(point-min)))
2654 ;; First see if the tag is right at the specified location.
2655 (goto-char startpos
)
2656 (setq found
(looking-at pat
))
2657 (while (and (not found
)
2659 (goto-char (- startpos offset
))
2662 (re-search-forward pat
(+ startpos offset
) t
)
2663 offset
(* 3 offset
))) ; expand search window
2665 (re-search-forward pat nil t
)
2666 (error "not found")))
2667 ;; Position point at the right place
2668 ;; if the search string matched an extra Ctrl-m at the beginning.
2669 (and (eq selective-display t
)
2672 (beginning-of-line))
2674 (anything-document-attribute 'default-directory
"type . file-line"
2675 "`default-directory' to interpret file.")
2676 (anything-document-attribute 'before-jump-hook
"type . file-line / line"
2677 "Function to call before jumping to the target location.")
2678 (anything-document-attribute 'after-jump-hook
"type . file-line / line"
2679 "Function to call after jumping to the target location.")
2680 (anything-document-attribute 'adjust
"type . file-line"
2681 "Search around line matching line contents.")
2682 (anything-document-attribute 'recenter
"type . file-line / line"
2683 "`recenter' after jumping.")
2684 (anything-document-attribute 'target-file
"type . line"
2685 "Goto line of target-file.")
2687 (defun anything-c-call-interactively (cmd-or-name)
2688 "Execute CMD-OR-NAME as Emacs command.
2689 It is added to `extended-command-history'.
2690 `anything-current-prefix-arg' is used as the command's prefix argument."
2691 (setq extended-command-history
2692 (cons (anything-c-stringify cmd-or-name
)
2693 (delete (anything-c-stringify cmd-or-name
) extended-command-history
)))
2694 (let ((current-prefix-arg anything-current-prefix-arg
))
2695 (call-interactively (anything-c-symbolify cmd-or-name
))))
2697 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Persistent Action Helpers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2698 (defvar anything-c-persistent-highlight-overlay
2699 (make-overlay (point) (point)))
2701 (defun anything-persistent-highlight-point (start &optional end buf face rec
)
2703 (when (overlayp anything-c-persistent-highlight-overlay
)
2704 (move-overlay anything-c-persistent-highlight-overlay
2706 (or end
(line-end-position))
2708 (overlay-put anything-c-persistent-highlight-overlay
'face
(or face
'highlight
))
2712 (add-hook 'anything-cleanup-hook
2714 (when (overlayp anything-c-persistent-highlight-overlay
)
2715 (delete-overlay anything-c-persistent-highlight-overlay
))))
2717 (defvar anything-match-line-overlay-face nil
)
2718 (defvar anything-match-line-overlay nil
)
2719 (defun anything-match-line-color-current-line ()
2720 "Highlight and underline current position"
2721 (if (not anything-match-line-overlay
)
2722 (setq anything-match-line-overlay
2724 (line-beginning-position) (1+ (line-end-position))))
2725 (move-overlay anything-match-line-overlay
2726 (line-beginning-position) (1+ (line-end-position))))
2727 (overlay-put anything-match-line-overlay
2728 'face anything-match-line-overlay-face
))
2730 (defface anything-overlay-line-face
'((t (:background
"IndianRed4" :underline t
)))
2731 "Face for source header in the anything buffer." :group
'anything
)
2733 (setq anything-match-line-overlay-face
'anything-overlay-line-face
)
2735 (add-hook 'anything-cleanup-hook
#'(lambda ()
2736 (when anything-match-line-overlay
2737 (delete-overlay anything-match-line-overlay
)
2738 (setq anything-match-line-overlay nil
))))
2740 (add-hook 'anything-after-persistent-action-hook
#'(lambda ()
2741 (when anything-match-line-overlay
2742 (delete-overlay anything-match-line-overlay
)
2743 (anything-match-line-color-current-line))))
2745 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Actions Transformers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2747 (defun anything-c-transform-file-load-el (actions candidate
)
2748 "Add action to load the file CANDIDATE if it is an emacs lisp
2749 file. Else return ACTIONS unmodified."
2750 (if (or (string= (file-name-extension candidate
) "el")
2751 (string= (file-name-extension candidate
) "elc"))
2752 (append actions
'(("Load Emacs Lisp File" . load-file
)))
2755 (defun anything-c-transform-file-browse-url (actions candidate
)
2756 "Add an action to browse the file CANDIDATE if it in a html
2757 file. Else return ACTIONS unmodified."
2758 (if (or (string= (file-name-extension candidate
) "htm")
2759 (string= (file-name-extension candidate
) "html"))
2760 (append actions
'(("Browse with Browser" . browse-url
)))
2764 (defun anything-c-transform-function-call-interactively (actions candidate
)
2765 "Add an action to call the function CANDIDATE interactively if
2766 it is a command. Else return ACTIONS unmodified."
2767 (if (commandp (intern-soft candidate
))
2768 (append actions
'(("Call Interactively"
2770 anything-c-call-interactively
)))
2774 (defun anything-c-transform-sexp-eval-command-sexp (actions candidate
)
2775 "If CANDIDATE's `car' is a command, then add an action to
2776 evaluate it and put it onto the `command-history'."
2777 (if (commandp (car (read candidate
)))
2778 ;; Make it first entry
2779 (cons '("Eval and put onto command-history" .
2781 (let ((sym (read sexp
)))
2783 (setq command-history
2784 (cons sym command-history
)))))
2788 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Candidate Transformers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2790 (defun anything-c-skip-boring-buffers (buffers)
2791 (anything-c-skip-entries buffers anything-c-boring-buffer-regexp
))
2793 (defun anything-c-skip-current-buffer (buffers)
2794 (remove (buffer-name anything-current-buffer
) buffers
))
2796 (defun anything-c-shadow-boring-buffers (buffers)
2797 "Buffers matching `anything-c-boring-buffer-regexp' will be
2798 displayed with the `file-name-shadow' face if available."
2799 (anything-c-shadow-entries buffers anything-c-boring-buffer-regexp
))
2802 (defun anything-c-shadow-boring-files (files)
2803 "Files matching `anything-c-boring-file-regexp' will be
2804 displayed with the `file-name-shadow' face if available."
2805 (anything-c-shadow-entries files anything-c-boring-file-regexp
))
2807 (defun anything-c-skip-boring-files (files)
2808 "Files matching `anything-c-boring-file-regexp' will be skipped."
2809 (anything-c-skip-entries files anything-c-boring-file-regexp
))
2810 ;; (anything-c-skip-boring-files '("README" "/src/.svn/hoge"))
2812 (defun anything-c-skip-current-file (files)
2813 "Current file will be skipped."
2814 (remove (buffer-file-name anything-current-buffer
) files
))
2816 (defun anything-c-w32-pathname-transformer (args)
2817 "Change undesirable features of windows pathnames to ones more acceptable to
2818 other candidate transformers."
2819 (if (eq system-type
'windows-nt
)
2821 (replace-regexp-in-string "/cygdrive/\\(.\\)" "\\1:" x
))
2823 (replace-regexp-in-string "\\\\" "/" y
)) args
))
2826 (defun anything-c-shorten-home-path (files)
2827 "Replaces /home/user with ~."
2828 (mapcar (lambda (file)
2829 (let ((home (replace-regexp-in-string "\\\\" "/" ; stupid Windows...
2831 (if (and (stringp file
) (string-match home file
))
2832 (cons (replace-match "~" nil nil file
) file
)
2837 (defun anything-c-mark-interactive-functions (functions)
2838 "Mark interactive functions (commands) with (i) after the function name."
2840 (loop for function in functions
2841 do
(push (cons (concat function
2842 (when (commandp (intern-soft function
)) " (i)"))
2845 finally
(return (nreverse list
)))))
2847 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Adaptive Sorting of Candidates ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2848 (defvar anything-c-adaptive-done nil
2849 "nil if history information is not yet stored for the current
2852 (defvar anything-c-adaptive-history nil
2853 "Contains the stored history information.
2854 Format: ((SOURCE-NAME (SELECTED-CANDIDATE (PATTERN . NUMBER-OF-USE) ...) ...) ...)")
2856 (defadvice anything-initialize
(before anything-c-adaptive-initialize activate
)
2857 "Advise `anything-initialize' to reset `anything-c-adaptive-done'
2858 when anything is started."
2859 (setq anything-c-adaptive-done nil
))
2861 (defadvice anything-exit-minibuffer
(before anything-c-adaptive-exit-minibuffer activate
)
2862 "Advise `anything-exit-minibuffer' to store history information
2863 when a candidate is selected with RET."
2864 (anything-c-adaptive-store-selection))
2866 (defadvice anything-select-action
(before anything-c-adaptive-select-action activate
)
2867 "Advise `anything-select-action' to store history information
2868 when the user goes to the action list with TAB."
2869 (anything-c-adaptive-store-selection))
2871 (defun anything-c-adaptive-store-selection ()
2872 "Store history information for the selected candidate."
2873 (unless anything-c-adaptive-done
2874 (setq anything-c-adaptive-done t
)
2875 (let* ((source (anything-get-current-source))
2876 (source-name (or (assoc-default 'type source
)
2877 (assoc-default 'name source
)))
2878 (source-info (or (assoc source-name anything-c-adaptive-history
)
2880 (push (list source-name
) anything-c-adaptive-history
)
2881 (car anything-c-adaptive-history
))))
2882 (selection (anything-get-selection))
2883 (selection-info (progn
2886 (let ((found (assoc selection
(cdr source-info
))))
2891 ;; move entry to the beginning of the
2892 ;; list, so that it doesn't get
2893 ;; trimmed when the history is
2896 (delete found
(cdr source-info
)))
2899 (cadr source-info
)))
2900 (pattern-info (progn
2901 (setcdr selection-info
2903 (let ((found (assoc anything-pattern
(cdr selection-info
))))
2906 (cons anything-pattern
0)
2908 ;; move entry to the beginning of the
2909 ;; list, so if two patterns used the
2910 ;; same number of times then the one
2911 ;; used last appears first in the list
2912 (setcdr selection-info
2913 (delete found
(cdr selection-info
)))
2915 (cdr selection-info
)))
2916 (cadr selection-info
))))
2918 ;; increase usage count
2919 (setcdr pattern-info
(1+ (cdr pattern-info
)))
2921 ;; truncate history if needed
2922 (if (> (length (cdr selection-info
)) anything-c-adaptive-history-length
)
2923 (setcdr selection-info
2924 (subseq (cdr selection-info
) 0 anything-c-adaptive-history-length
))))))
2926 (if (file-readable-p anything-c-adaptive-history-file
)
2927 (load-file anything-c-adaptive-history-file
))
2928 (add-hook 'kill-emacs-hook
'anything-c-adaptive-save-history
)
2930 (defun anything-c-adaptive-save-history ()
2931 "Save history information to file given by `anything-c-adaptive-history-file'."
2935 ";; -*- mode: emacs-lisp -*-\n"
2936 ";; History entries used for anything adaptive display.\n")
2937 (prin1 `(setq anything-c-adaptive-history
',anything-c-adaptive-history
)
2940 (write-region (point-min) (point-max) anything-c-adaptive-history-file nil
2941 (unless (interactive-p) 'quiet
))))
2943 (defun anything-c-adaptive-sort (candidates source
)
2944 "Sort the CANDIDATES for SOURCE by usage frequency.
2945 This is a filtered candidate transformer you can use for the
2946 attribute `filtered-candidate-transformer' of a source in
2947 `anything-sources' or a type in `anything-type-attributes'."
2948 (let* ((source-name (or (assoc-default 'type source
)
2949 (assoc-default 'name source
)))
2950 (source-info (assoc source-name anything-c-adaptive-history
)))
2951 (if (not source-info
)
2952 ;; if there is no information stored for this source then do nothing
2956 ;; ... assemble a list containing the (CANIDATE . USAGE-COUNT)
2958 (mapcar (lambda (candidate-info)
2960 (dolist (pattern-info (cdr candidate-info
))
2961 (if (not (equal (car pattern-info
)
2963 (incf count
(cdr pattern-info
))
2965 ;; if current pattern is equal to the previously
2966 ;; used one then this candidate has priority
2967 ;; (that's why its count is boosted by 10000) and
2968 ;; it only has to compete with other candidates
2969 ;; which were also selected with the same pattern
2970 (setq count
(+ 10000 (cdr pattern-info
)))
2972 (cons (car candidate-info
) count
)))
2976 ;; sort the list in descending order, so candidates with highest
2977 ;; priorty come first
2978 (setq usage
(sort usage
(lambda (first second
)
2979 (> (cdr first
) (cdr second
)))))
2981 ;; put those candidates first which have the highest usage count
2982 (dolist (info usage
)
2983 (when (member* (car info
) candidates
2984 :test
'anything-c-adaptive-compare
)
2985 (push (car info
) sorted
)
2986 (setq candidates
(remove* (car info
) candidates
2987 :test
'anything-c-adaptive-compare
))))
2989 ;; and append the rest
2990 (append (reverse sorted
) candidates nil
)))))
2992 (defun anything-c-adaptive-compare (x y
)
2993 "Compare candidates X and Y taking into account that the
2994 candidate can be in (DISPLAY . REAL) format."
2995 (equal (if (listp x
)
3002 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Plug-in ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3003 ;; Plug-in: candidates-file
3004 (defun anything-compile-source--candidates-file (source)
3005 (if (assoc-default 'candidates-file source
)
3006 `((init anything-p-candidats-file-init
3007 ,@(let ((orig-init (assoc-default 'init source
)))
3008 (cond ((null orig-init
) nil
)
3009 ((functionp orig-init
) (list orig-init
))
3011 (candidates-in-buffer)
3014 (add-to-list 'anything-compile-source-functions
'anything-compile-source--candidates-file
)
3016 (defun anything-p-candidats-file-init ()
3017 (destructuring-bind (file &optional updating
)
3018 (anything-mklist (anything-attr 'candidates-file
))
3019 (with-current-buffer (anything-candidate-buffer (find-file-noselect file
))
3021 (buffer-disable-undo)
3023 (auto-revert-mode 1)))))
3025 (anything-document-attribute 'candidates-file
"candidates-file plugin"
3026 "Use a file as the candidates buffer.
3028 If optional 2nd argument is non-nil, the file opened with `auto-revert-mode'.")
3030 ;; Plug-in: headline
3031 (defun anything-compile-source--anything-headline (source)
3032 (if (assoc-default 'headline source
)
3033 (append '((init . anything-headline-init
)
3034 (get-line-fn . buffer-substring
)
3037 '((candidates-in-buffer)))
3039 (add-to-list 'anything-compile-source-functions
'anything-compile-source--anything-headline
)
3041 (defun anything-headline-init ()
3042 (when (and (anything-current-buffer-is-modified)
3043 (with-current-buffer anything-current-buffer
3044 (eval (or (anything-attr 'condition
) t
))))
3045 (anything-headline-make-candidate-buffer
3046 (anything-attr 'headline
)
3047 (anything-attr 'subexp
))))
3049 (anything-document-attribute 'headline
"Headline plug-in"
3050 "Regexp string for anything-headline to scan.")
3051 (anything-document-attribute 'condition
"Headline plug-in"
3052 "A sexp representing the condition to use anything-headline.")
3053 (anything-document-attribute 'subexp
"Headline plug-in"
3054 "Display (match-string-no-properties subexp).")
3056 (defun anything-headline-get-candidates (regexp subexp
)
3058 (set-buffer anything-current-buffer
)
3060 (goto-char (point-min))
3061 (if (functionp regexp
) (setq regexp
(funcall regexp
)))
3062 (let (hierarchy curhead
)
3064 (if (numberp subexp
)
3065 (cons (match-string-no-properties subexp
) (match-beginning subexp
))
3066 (cons (buffer-substring (point-at-bol) (point-at-eol))
3068 (hierarchies (headlines)
3069 (1+ (loop for
(_ . hierarchy
) in headlines
3070 maximize hierarchy
)))
3072 (loop for i from
0 to hierarchy
3073 collecting
(aref curhead i
)))
3074 (arrange (headlines)
3075 (loop with curhead
= (make-vector (hierarchies headlines
) "")
3076 for
((str . pt
) . hierarchy
) in headlines
3077 do
(aset curhead hierarchy str
)
3080 (mapconcat 'identity
(vector-0-n curhead hierarchy
) " / ")
3085 (loop for re in regexp
3086 for hierarchy from
0
3087 do
(goto-char (point-min))
3090 while
(re-search-forward re nil t
)
3091 collect
(cons (matched) hierarchy
)))
3092 (lambda (a b
) (> (cdar b
) (cdar a
)))))
3093 (loop while
(re-search-forward regexp nil t
)
3094 collect
(matched))))))))
3096 (defun anything-headline-make-candidate-buffer (regexp subexp
)
3097 (with-current-buffer (anything-candidate-buffer 'local
)
3098 (loop for
(content . pos
) in
(anything-headline-get-candidates regexp subexp
)
3101 (with-current-buffer anything-current-buffer
3102 (line-number-at-pos pos
))
3105 (defun anything-headline-goto-position (pos recenter
)
3108 (set-window-start (get-buffer-window anything-current-buffer
) (point))))
3111 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Setup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3114 (define-anything-type-attribute 'buffer
3117 '(("Switch to buffer other window" . switch-to-buffer-other-window
)
3118 ("Switch to buffer" . switch-to-buffer
))
3119 '(("Switch to buffer" . switch-to-buffer
)
3120 ("Switch to buffer other window" . switch-to-buffer-other-window
)
3121 ("Switch to buffer other frame" . switch-to-buffer-other-frame
)))
3122 ("Display buffer" . display-buffer
)
3123 ("Revert buffer" .
(lambda (elm)
3124 (with-current-buffer elm
3125 (when (buffer-modified-p)
3126 (revert-buffer t t
)))))
3127 ("Kill buffer" . kill-buffer
))
3128 (candidate-transformer . anything-c-skip-boring-buffers
))
3129 "Buffer or buffer name.")
3131 (define-anything-type-attribute 'file
3134 '(("Find file other window" . find-file-other-window
)
3135 ("Find file" . find-file
)
3136 ("Find file as root" . anything-find-file-as-root
))
3137 '(("Find file" . find-file
)
3138 ("Find file as root" . anything-find-file-as-root
)
3139 ("Find file other window" . find-file-other-window
)
3140 ("Find file other frame" . find-file-other-frame
)))
3141 ("Open dired in file's directory" . anything-c-open-dired
)
3142 ("Delete file" . anything-c-delete-file
)
3143 ("Open file externally" . anything-c-open-file-externally
)
3144 ("Open file with default tool" . anything-c-open-file-with-default-tool
))
3145 (action-transformer anything-c-transform-file-load-el
3146 anything-c-transform-file-browse-url
)
3147 (candidate-transformer anything-c-w32-pathname-transformer
3148 anything-c-skip-current-file
3149 anything-c-skip-boring-files
3150 anything-c-shorten-home-path
))
3153 (define-anything-type-attribute 'command
3154 `((action ("Call interactively" . anything-c-call-interactively
)
3155 ("Describe command" . anything-c-describe-function
)
3156 ("Add command to kill ring" . anything-c-kill-new
)
3157 ("Go to command's definition" . anything-c-find-function
))
3158 ;; Sort commands according to their usage count.
3159 (filtered-candidate-transformer . anything-c-adaptive-sort
))
3160 "Command. (string or symbol)")
3162 (define-anything-type-attribute 'function
3163 '((action ("Describe function" . anything-c-describe-function
)
3164 ("Add function to kill ring" . anything-c-kill-new
)
3165 ("Go to function's definition" . anything-c-find-function
))
3166 (action-transformer anything-c-transform-function-call-interactively
)
3167 (candidate-transformer anything-c-mark-interactive-functions
))
3168 "Function. (string or symbol)")
3170 (define-anything-type-attribute 'sexp
3171 '((action ("Eval s-expression" .
(lambda (c) (eval (read c
))))
3172 ("Add s-expression to kill ring" . kill-new
))
3173 (action-transformer anything-c-transform-sexp-eval-command-sexp
))
3174 "String representing S-Expressions.")
3176 (define-anything-type-attribute 'bookmark
3177 '((action ("Jump to bookmark" .
(lambda (candidate)
3178 (bookmark-jump candidate
)
3180 ("Delete bookmark" . bookmark-delete
)
3181 ("Rename bookmark" . bookmark-rename
)
3182 ("Relocate bookmark" . bookmark-relocate
)))
3185 (define-anything-type-attribute 'line
3186 '((display-to-real . anything-c-display-to-real-line
)
3187 (action ("Go to Line" . anything-c-action-line-goto
)))
3188 "LINENO:CONTENT string, eg. \" 16:foo\".")
3191 ;; (install-elisp "http://www.emacswiki.org/cgi-bin/wiki/download/el-expectations.el")
3192 ;; (install-elisp "http://www.emacswiki.org/cgi-bin/wiki/download/el-mock.el")
3194 (when (fboundp 'expectations
)
3196 (desc "candidates-file plug-in")
3197 (expect '(anything-p-candidats-file-init)
3198 (assoc-default 'init
3199 (car (anything-compile-sources
3201 (candidates-file .
"test.txt")))
3202 '(anything-compile-source--candidates-file)))))
3203 (expect '(anything-p-candidats-file-init
3205 (assoc-default 'init
3206 (car (anything-compile-sources
3208 (candidates-file .
"test.txt")
3209 (init .
(lambda () 1))))
3210 '(anything-compile-source--candidates-file)))))
3211 (expect '(anything-p-candidats-file-init
3213 (assoc-default 'init
3214 (car (anything-compile-sources
3216 (candidates-file .
"test.txt")
3217 (init (lambda () 1))))
3218 '(anything-compile-source--candidates-file)))))
3219 (desc "anything-c-source-buffers")
3220 (expect '(("Buffers" ("foo" "curbuf")))
3221 (stub buffer-list
=> '("curbuf" " hidden" "foo" "*anything*"))
3222 (let ((anything-c-boring-buffer-regexp
3227 " *Echo Area" " *Minibuf"))))
3228 (flet ((buffer-name (x) x
))
3229 (anything-test-candidates 'anything-c-source-buffers
))))
3230 (desc "anything-c-stringify")
3232 (anything-c-stringify "str1"))
3234 (anything-c-stringify 'str2
))
3235 (desc "anything-c-symbolify")
3237 (anything-c-symbolify "sym1"))
3239 (anything-c-symbolify 'sym2
)))))
3242 (provide 'anything-config
)
3244 ;;; Local Variables:
3245 ;;; time-stamp-format: "%:y-%02m-%02d %02H:%02M:%02S (%Z) %u"
3248 ;; How to save (DO NOT REMOVE!!)
3249 ;; (emacswiki-post "anything-config.el")
3250 ;;; anything-config.el ends here
3252 ;;; LocalWords: Tassilo Patrovics Vagn Johansen Dahl Clementson infos
3253 ;;; LocalWords: Kamphausen informations McBrayer Volpiatto bbdb bb
3254 ;;; LocalWords: iswitchb imenu Recentf sym samewindow pos bol eol
3255 ;;; LocalWords: aif str lst func attrib recentf lessp prin mapatoms commandp
3256 ;;; LocalWords: cmd stb Picklist picklist mapcan subentry destructuring dirs
3257 ;;; LocalWords: darwin locat MacOS mdfind Firstname Lastname calc prepend jids
3258 ;;; LocalWords: dotimes Thierry online vname
3259 ;;; LocalWords: csharp javascript lua makefile cperl zcat lineno buf
3260 ;;; LocalWords: multiline href fn cand NewTitle cwd filepath thru ret
3261 ;;; LocalWords: bfn fOpen UNC cygdrive nt xdg macos FILE's elc rx svn hg
3262 ;;; LocalWords: CANDIDATE's darcs facep pathname args pathnames subseq priorty
3263 ;;; LocalWords: Vokes rfind berkeley JST ffap lacarte bos
3264 ;;; LocalWords: Lacarte Minibuf epp LaCarte bm attrset migemo attr conf mklist
3265 ;;; LocalWords: startpos noselect dont desc