comparison lisp/emacs-lisp/eieio-speedbar.el @ 105474:0a64442c10e3

Fix typos. * emacs-lisp/chart.el, emacs-lisp/eieio.el, emacs-lisp/eieio-base.el * emacs-lisp/eieio-comp.el, emacs-lisp/eieio-custom.el * emacs-lisp/eieio-datadebug.el, emacs-lisp/eieio-opt.el * emacs-lisp/eieio-speedbar.el
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 05 Oct 2009 15:32:08 +0000
parents 7f4c7f5c0eba
children 1d1d5d9bd884
comparison
equal deleted inserted replaced
105473:07f6674a0832 105474:0a64442c10e3
111 ;; Some object based things 111 ;; Some object based things
112 (define-key map "C" 'eieio-speedbar-customize-line) 112 (define-key map "C" 'eieio-speedbar-customize-line)
113 map)) 113 map))
114 114
115 (defvar eieio-speedbar-key-map (eieio-speedbar-make-map) 115 (defvar eieio-speedbar-key-map (eieio-speedbar-make-map)
116 "A Generic object based speedbar display keymap.") 116 "A generic object based speedbar display keymap.")
117 117
118 (defvar eieio-speedbar-menu 118 (defvar eieio-speedbar-menu
119 '([ "Edit Object/Field" speedbar-edit-line t] 119 '([ "Edit Object/Field" speedbar-edit-line t]
120 [ "Expand Object" speedbar-expand-line 120 [ "Expand Object" speedbar-expand-line
121 (save-excursion (beginning-of-line) 121 (save-excursion (beginning-of-line)
148 (eieio-speedbar-create-engine map-fn map-var menu-var modename fetcher))) 148 (eieio-speedbar-create-engine map-fn map-var menu-var modename fetcher)))
149 149
150 (defun eieio-speedbar-create-engine (map-fn map-var menu-var modename fetcher) 150 (defun eieio-speedbar-create-engine (map-fn map-var menu-var modename fetcher)
151 "Create a speedbar mode for displaying an object hierarchy. 151 "Create a speedbar mode for displaying an object hierarchy.
152 Called from `eieio-speedbar-create', or the speedbar load-hook. 152 Called from `eieio-speedbar-create', or the speedbar load-hook.
153 MAP-FN, MAP-VAR, MENU-VAR, MODENAME, and FETCHER are the same as 153 MAP-FN, MAP-VAR, MENU-VAR, MODENAME, and FETCHER are the same as in
154 `eieio-speedbar-create'." 154 `eieio-speedbar-create'."
155 ;; make sure the keymap exists 155 ;; make sure the keymap exists
156 (funcall map-fn) 156 (funcall map-fn)
157 ;; Add to the expansion list. 157 ;; Add to the expansion list.
158 (speedbar-add-expansion-list 158 (speedbar-add-expansion-list
169 '(speedbar-line-directory . eieio-speedbar-line-path)))) 169 '(speedbar-line-directory . eieio-speedbar-line-path))))
170 170
171 (defun eieio-speedbar-buttons (dir-or-object depth fetcher) 171 (defun eieio-speedbar-buttons (dir-or-object depth fetcher)
172 "Create buttons for the speedbar display. 172 "Create buttons for the speedbar display.
173 Start in directory DIR-OR-OBJECT. If it is an object, just display that 173 Start in directory DIR-OR-OBJECT. If it is an object, just display that
174 objects subelements. 174 object's subelements.
175 Argument DEPTH specifies how far down we have already been displayed. 175 Argument DEPTH specifies how far down we have already been displayed.
176 If it is a directory, use FETCHER to fetch all objects associated with 176 If it is a directory, use FETCHER to fetch all objects associated with
177 that path." 177 that path."
178 (let ((objlst (cond ((eieio-object-p dir-or-object) 178 (let ((objlst (cond ((eieio-object-p dir-or-object)
179 (list dir-or-object)) 179 (list dir-or-object))
261 :type boolean 261 :type boolean
262 :documentation 262 :documentation
263 "State of an object being expanded in speedbar.") 263 "State of an object being expanded in speedbar.")
264 ) 264 )
265 "Class which provides basic speedbar support for child classes. 265 "Class which provides basic speedbar support for child classes.
266 Add one of thie child classes to this class to the parent list of a class." 266 Add one of the child classes to this class to the parent list of a class."
267 :method-invocation-order :depth-first 267 :method-invocation-order :depth-first
268 :abstract t) 268 :abstract t)
269 269
270 (defclass eieio-speedbar-directory-button (eieio-speedbar) 270 (defclass eieio-speedbar-directory-button (eieio-speedbar)
271 ((buttontype :initform angle) 271 ((buttontype :initform angle)
275 :abstract t) 275 :abstract t)
276 276
277 (defclass eieio-speedbar-file-button (eieio-speedbar) 277 (defclass eieio-speedbar-file-button (eieio-speedbar)
278 ((buttontype :initform bracket) 278 ((buttontype :initform bracket)
279 (buttonface :initform speedbar-file-face)) 279 (buttonface :initform speedbar-file-face))
280 "Class providing support for objects which behave like a directory." 280 "Class providing support for objects which behave like a file."
281 :method-invocation-order :depth-first 281 :method-invocation-order :depth-first
282 :abstract t) 282 :abstract t)
283 283
284 284
285 ;;; Methods to eieio-speedbar-* which do not need to be overriden 285 ;;; Methods to eieio-speedbar-* which do not need to be overriden
286 ;; 286 ;;
287 (defmethod eieio-speedbar-make-tag-line ((object eieio-speedbar) 287 (defmethod eieio-speedbar-make-tag-line ((object eieio-speedbar)
288 depth) 288 depth)
289 "Insert a tag line into speedbar at point for OBJECT. 289 "Insert a tag line into speedbar at point for OBJECT.
290 All objects a child of symbol `eieio-speedbar' can be created from this 290 All objects a child of symbol `eieio-speedbar' can be created from
291 method. Override this if you need non-traditional tag lines. 291 this method. Override this if you need non-traditional tag lines.
292 Argument DEPTH is the depth at which the tag line is inserted." 292 Argument DEPTH is the depth at which the tag line is inserted."
293 (let ((children (eieio-speedbar-object-children object)) 293 (let ((children (eieio-speedbar-object-children object))
294 (exp (oref object expanded))) 294 (exp (oref object expanded)))
295 (if (not children) 295 (if (not children)
296 (if (eq (oref object buttontype) 'expandtag) 296 (if (eq (oref object buttontype) 'expandtag)
343 "Handle a user click on TEXT representing object TOKEN. 343 "Handle a user click on TEXT representing object TOKEN.
344 The object is at indentation level INDENT." 344 The object is at indentation level INDENT."
345 (eieio-speedbar-handle-click token)) 345 (eieio-speedbar-handle-click token))
346 346
347 (defun eieio-speedbar-object-expand (text token indent) 347 (defun eieio-speedbar-object-expand (text token indent)
348 "Expand object represented by TEXT. TOKEN is the object. 348 "Expand object represented by TEXT.
349 INDENT is the current indentation level." 349 TOKEN is the object. INDENT is the current indentation level."
350 (cond ((string-match "+" text) ;we have to expand this file 350 (cond ((string-match "+" text) ;we have to expand this file
351 (speedbar-change-expand-button-char ?-) 351 (speedbar-change-expand-button-char ?-)
352 (oset token expanded t) 352 (oset token expanded t)
353 (speedbar-with-writable 353 (speedbar-with-writable
354 (save-excursion 354 (save-excursion
410 410
411 411
412 ;;; Methods to the eieio-speedbar-* classes which need to be overriden. 412 ;;; Methods to the eieio-speedbar-* classes which need to be overriden.
413 ;; 413 ;;
414 (defmethod eieio-speedbar-object-children ((object eieio-speedbar)) 414 (defmethod eieio-speedbar-object-children ((object eieio-speedbar))
415 "Return a list of children to be displayed in SPEEDBAR. 415 "Return a list of children to be displayed in speedbar.
416 If the return value is a list of OBJECTs, then those objects are 416 If the return value is a list of OBJECTs, then those objects are
417 queried for details. If the return list is made of strings, 417 queried for details. If the return list is made of strings,
418 then this object will be queried for the details needed 418 then this object will be queried for the details needed
419 to create a speedbar button." 419 to create a speedbar button."
420 nil) 420 nil)