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.
29 ;; Variable `anything-c-source-ipa' is source for in place annotations
30 ;; in current buffer. And command `anything-ipa' is anything menu of
31 ;; it. `anything-c-source-ipa-global' and `anything-ipa-global' are
37 ;; Get ipa.el and anything.el from EmacsWiki
38 ;; http://www.emacswiki.org/cgi-bin/wiki/download/ipa.el
39 ;; http://www.emacswiki.org/cgi-bin/wiki/download/anything.el
41 ;; Then add the code below in your ~/.emacs.
42 ;; (require 'anything-ipa)
47 ;; $Log: anything-ipa.el,v $
48 ;; Revision 1.6 2009-03-01 22:52:44 rubikitch
49 ;; Use `ipa-annotation-face' for annotation text
51 ;; Revision 1.5 2009/02/13 01:18:32 rubikitch
54 ;; Revision 1.4 2009/02/13 00:49:36 rubikitch
55 ;; *** empty log message ***
57 ;; Revision 1.3 2009/02/13 00:48:08 rubikitch
58 ;; `anything-c-source-ipa': format change
60 ;; Revision 1.2 2009/02/13 00:46:16 rubikitch
61 ;; New variable: `anything-c-source-ipa-global'
62 ;; New command: `anything-ipa-global'
64 ;; Revision 1.1 2009/02/13 00:20:05 rubikitch
70 (defvar anything-ipa-version
"$Id: anything-ipa.el,v 1.6 2009-03-01 22:52:44 rubikitch Exp $")
71 (eval-when-compile (require 'cl
))
75 ;;;; file-local source
76 (defvar anything-c-source-ipa
77 '((name .
"In Place Annotations (Current Buffer)")
78 (candidates . anything-ipa-candidates
)
81 "`anything' source of ipa in current-buffer.")
83 (defun anything-ipa-candidates ()
85 (set-buffer anything-current-buffer
)
86 (loop for
(overlay . text
) in ipa-annotations-in-buffer
87 for pos
= (overlay-start overlay
)
88 for line
= (progn (goto-char pos
)
89 (buffer-substring (point-at-bol) (point-at-eol)))
90 for lineno
= (line-number-at-pos pos
)
92 (cons (format "%5d:[%s]%s"
93 lineno
(propertize text
'face ipa-annotation-face
) line
)
96 (defun anything-ipa ()
97 "`anything' interface of ipa."
99 (anything 'anything-c-source-ipa
))
102 (defvar anything-c-source-ipa-global
103 '((name .
"In Place Annotations (global)")
104 (init .
(lambda () (anything-candidate-buffer (ipa-find-storage-file))))
105 (get-line .
(lambda (s e
) (unless (= s e
) (cons (buffer-substring s e
) s
))))
106 (candidates-in-buffer)
108 (action ("Go To" . anything-ipa-go-to-annotation
)))
109 "`anything' source of all IPAs.")
111 (defun anything-ipa-go-to-annotation (pos)
112 (with-current-buffer (ipa-find-storage-file)
114 (ipa-go-to-annotation)))
116 (defun anything-ipa-global ()
117 "`anything' interface of ipa (global)."
119 (anything 'anything-c-source-ipa-global
))
121 (provide 'anything-ipa
)
123 ;; How to save (DO NOT REMOVE!!)
124 ;; (emacswiki-post "anything-ipa.el")
125 ;;; anything-ipa.el ends here