Skip to content
Newer
Older
100644 103 lines (79 sloc) 2.93 KB
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
1 ;;; rudel-speedbar.el --- Speedbar rendering of Rudel objects
2 ;;
f2f18f2 * obby/rudel-obby.el (header): fixed license text
jan authored
3 ;; Copyright (C) 2008, 2009 Jan Moringen
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
4 ;;
db7e4de * rudel.el, rudel-util.el, rudel-telepathy.el, rudel-speedbar.el,
jan authored
5 ;; Author: Jan Moringen <scymtym@users.sourceforge.net>
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
6 ;; Keywords: rudel, collaboration, speedbar
e1ab85c @scymtym * rudel-speedbar.el (header): fixed history
authored
7 ;; X-RCS: $Id:$
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
8 ;;
f2f18f2 * obby/rudel-obby.el (header): fixed license text
jan authored
9 ;; This file is part of Rudel.
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
10 ;;
f2f18f2 * obby/rudel-obby.el (header): fixed license text
jan authored
11 ;; Rudel is free software: you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
15 ;;
16 ;; Rudel is distributed in the hope that it will be useful, but
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
20 ;;
391fafc initial revision
jan authored
21 ;; You should have received a copy of the GNU General Public License
f2f18f2 * obby/rudel-obby.el (header): fixed license text
jan authored
22 ;; along with Rudel. If not, see <http://www.gnu.org/licenses>.
391fafc initial revision
jan authored
23
24 ;;; Commentary:
25 ;;
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
26 ;; This implements rendering of Rudel objects in speedbar.
27
28
29 ;;; History:
391fafc initial revision
jan authored
30 ;;
e1ab85c @scymtym * rudel-speedbar.el (header): fixed history
authored
31 ;; 0.1 - Initial version
391fafc initial revision
jan authored
32
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
33
391fafc initial revision
jan authored
34 ;;; Code:
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
35 ;;
36
391fafc initial revision
jan authored
37 (require 'speedbar)
38 (require 'eieio-speedbar)
39
40
41 ;;; Class rudel-user methods
42 ;;
43
44 (defmethod eieio-speedbar-description ((this rudel-user))
45 "Provide a speedbar description for OBJ."
46 (format "User %s" (object-name-string this)))
47
48 (defmethod eieio-speedbar-object-buttonname ((this rudel-user))
49 "Return a string to use as a speedbar button for OBJECT."
0ec060f * rudel-speedbar.el (whole file): cleanup; improved comments
jan authored
50 (format "%s" (object-name-string this)))
391fafc initial revision
jan authored
51
52
53 ;;; Class rudel-document methods
54 ;;
55
56 (defmethod eieio-speedbar-description ((this rudel-document))
57 "Construct a description for from the name of document object THIS."
58 (format "Document %s" (object-name-string this)))
59
60 (defmethod eieio-speedbar-object-buttonname ((this rudel-document))
61 "Return a string to use as a speedbar button for OBJECT."
6ee592f * rudel-speedbar.el (eieio-speedbar-object-buttonname): use
jan authored
62 (rudel-unique-name this))
391fafc initial revision
jan authored
63
e1ab85c @scymtym * rudel-speedbar.el (header): fixed history
authored
64
391fafc initial revision
jan authored
65 ;;; Speedbar support mode
66 ;;
e1ab85c @scymtym * rudel-speedbar.el (header): fixed history
authored
67
391fafc initial revision
jan authored
68 (defun rudel-speedbar-make-map ()
69 "Make the generic object based speedbar keymap."
70 (speedbar-make-specialized-keymap))
71
72 (defvar rudel-speedbar-key-map
73 (rudel-speedbar-make-map)
e1ab85c @scymtym * rudel-speedbar.el (header): fixed history
authored
74 "A generic object based speedbar display keymap.")
391fafc initial revision
jan authored
75
76 (defvar rudel-speedbar-menu
e1ab85c @scymtym * rudel-speedbar.el (header): fixed history
authored
77 '([ "Subscribe" #'ignore t])
391fafc initial revision
jan authored
78 "Menu part in easymenu format used in speedbar while browsing objects.")
79
80 (defun rudel-speedbar-toplevel-buttons (dir)
81 "Return a list of objects to display in speedbar.
82 Argument DIR is the directory from which to derive the list of objects."
83 (when rudel-current-session
84 (with-slots (users documents) rudel-current-session
85 (append users documents))))
86
87 (eieio-speedbar-create 'rudel-speedbar-make-map
88 'rudel-speedbar-key-map
89 'rudel-speedbar-menu
90 "Collaboration Session"
91 'rudel-speedbar-toplevel-buttons)
92
93 ;;;###autoload
94 (defun rudel-speedbar ()
95 "Show connected users and available documents of Rudel session in speedbar."
96 (interactive)
97 (speedbar-frame-mode 1)
98 (speedbar-change-initial-expansion-list "Collaboration Session")
99 (speedbar-get-focus))
100
101 (provide 'rudel-speedbar)
102 ;;; rudel-speedbar.el ends here
Something went wrong with that request. Please try again.