1 ;;; anything-ipa.el --- Anything interface of In Place Annotation
2 ;; $Id: anything-ipa.el,v 1.6 2009-03-01 22:52:44 rubikitch Exp $
4 ;; Copyright (C) 2009 rubikitch
6 ;; Author: rubikitch <rubikitch@ruby-lang.org>
7 ;; Keywords: convenience, anything
8 ;; URL: http://www.emacswiki.org/cgi-bin/wiki/download/anything-ipa.el
10 ;; This file is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; This file is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
27 ;; Anything interface of in place annotations.
31 ;; Below are complete command list:
34 ;; `anything' interface of ipa.
35 ;; `anything-ipa-global'
36 ;; `anything' interface of ipa (global).
38 ;;; Customizable Options:
40 ;; Below are customizable option list:
43 ;; Variable `anything-c-source-ipa' is source for in place annotations
44 ;; in current buffer. And command `anything-ipa' is anything menu of
45 ;; it. `anything-c-source-ipa-global' and `anything-ipa-global' are
51 ;; Get ipa.el and anything.el from EmacsWiki
52 ;; http://www.emacswiki.org/cgi-bin/wiki/download/ipa.el
53 ;; http://www.emacswiki.org/cgi-bin/wiki/download/anything.el
55 ;; Then add the code below in your ~/.emacs.
56 ;; (require 'anything-ipa)
61 ;; $Log: anything-ipa.el,v $
62 ;; Revision 1.6 2009-03-01 22:52:44 rubikitch
63 ;; Use `ipa-annotation-face' for annotation text
65 ;; Revision 1.5 2009/02/13 01:18:32 rubikitch
68 ;; Revision 1.4 2009/02/13 00:49:36 rubikitch
69 ;; *** empty log message ***
71 ;; Revision 1.3 2009/02/13 00:48:08 rubikitch
72 ;; `anything-c-source-ipa': format change
74 ;; Revision 1.2 2009/02/13 00:46:16 rubikitch
75 ;; New variable: `anything-c-source-ipa-global'
76 ;; New command: `anything-ipa-global'
78 ;; Revision 1.1 2009/02/13 00:20:05 rubikitch
84 (defvar anything-ipa-version
"$Id: anything-ipa.el,v 1.6 2009-03-01 22:52:44 rubikitch Exp $")
85 (eval-when-compile (require 'cl
))
89 ;;;; file-local source
90 (defvar anything-c-source-ipa
91 '((name .
"In Place Annotations (Current Buffer)")
92 (candidates . anything-ipa-candidates
)
95 "`anything' source of ipa in current-buffer.")
97 (defun anything-ipa-candidates ()
99 (set-buffer anything-current-buffer
)
100 (loop for
(overlay . text
) in ipa-annotations-in-buffer
101 for pos
= (overlay-start overlay
)
102 for line
= (progn (goto-char pos
)
103 (buffer-substring (point-at-bol) (point-at-eol)))
104 for lineno
= (line-number-at-pos pos
)
106 (cons (format "%5d:[%s]%s"
107 lineno
(propertize text
'face ipa-annotation-face
) line
)
110 (defun anything-ipa ()
111 "`anything' interface of ipa."
113 (anything 'anything-c-source-ipa
))
116 (defvar anything-c-source-ipa-global
117 '((name .
"In Place Annotations (global)")
118 (init .
(lambda () (anything-candidate-buffer (ipa-find-storage-file))))
119 (get-line .
(lambda (s e
) (unless (= s e
) (cons (buffer-substring s e
) s
))))
120 (candidates-in-buffer)
122 (action ("Go To" . anything-ipa-go-to-annotation
)))
123 "`anything' source of all IPAs.")
125 (defun anything-ipa-go-to-annotation (pos)
126 (with-current-buffer (ipa-find-storage-file)
128 (ipa-go-to-annotation)))
130 (defun anything-ipa-global ()
131 "`anything' interface of ipa (global)."
133 (anything 'anything-c-source-ipa-global
))
135 (provide 'anything-ipa
)
137 ;; How to save (DO NOT REMOVE!!)
138 ;; (progn (magit-push) (emacswiki-post "anything-ipa.el"))
139 ;;; anything-ipa.el ends here