comparison lisp/cedet/semantic/format.el @ 104470:6ccad1511df1

Minor whitespace changes and `require' fixes.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 06 Sep 2009 21:22:05 +0000
parents 273e528a9f9b
children 25e047f7f6a2
comparison
equal deleted inserted replaced
104469:ce081012a7d6 104470:6ccad1511df1
32 ;; the user choose their default format type are also provided. 32 ;; the user choose their default format type are also provided.
33 ;; 33 ;;
34 34
35 ;;; Code: 35 ;;; Code:
36 (require 'semantic) 36 (require 'semantic)
37 (require 'semantic/tag)
38 (require 'semantic/tag-ls) 37 (require 'semantic/tag-ls)
39 (require 'ezimage) 38 (require 'ezimage)
40 39
41 (eval-when-compile 40 (eval-when-compile
42 (require 'font-lock) 41 (require 'font-lock)
100 (define-overloadable-function semantic-format-tag-name (tag &optional parent color) 99 (define-overloadable-function semantic-format-tag-name (tag &optional parent color)
101 "Return the name string describing TAG. 100 "Return the name string describing TAG.
102 The name is the shortest possible representation. 101 The name is the shortest possible representation.
103 Optional argument PARENT is the parent type if TAG is a detail. 102 Optional argument PARENT is the parent type if TAG is a detail.
104 Optional argument COLOR means highlight the prototype with font-lock colors.") 103 Optional argument COLOR means highlight the prototype with font-lock colors.")
104
105 (defun semantic-format-tag-name-default (tag &optional parent color)
106 "Return an abbreviated string describing TAG.
107 Optional argument PARENT is the parent type if TAG is a detail.
108 Optional argument COLOR means highlight the prototype with font-lock colors."
109 (let ((name (semantic-tag-name tag))
110 (destructor
111 (if (eq (semantic-tag-class tag) 'function)
112 (semantic-tag-function-destructor-p tag))))
113 (when destructor
114 (setq name (concat "~" name)))
115 (if color
116 (setq name (semantic--format-colorize-text name (semantic-tag-class tag))))
117 name))
105 118
106 ;;;###autoload 119 ;;;###autoload
107 (define-overloadable-function semantic-format-tag-prototype (tag &optional parent color) 120 (define-overloadable-function semantic-format-tag-prototype (tag &optional parent color)
108 "Return a prototype for TAG. 121 "Return a prototype for TAG.
109 This function should be overloaded, though it need not be used. 122 This function should be overloaded, though it need not be used.
295 (setq ans (semantic-format-tag-type anything color))) 308 (setq ans (semantic-format-tag-type anything color)))
296 ans)) 309 ans))
297 ((and (listp anything) 310 ((and (listp anything)
298 (stringp (car anything))) 311 (stringp (car anything)))
299 (semantic--format-colorize-text (car anything) colorhint)))) 312 (semantic--format-colorize-text (car anything) colorhint))))
300
301 (defun semantic-format-tag-name-default (tag &optional parent color)
302 "Return an abbreviated string describing TAG.
303 Optional argument PARENT is the parent type if TAG is a detail.
304 Optional argument COLOR means highlight the prototype with font-lock colors."
305 (let ((name (semantic-tag-name tag))
306 (destructor
307 (if (eq (semantic-tag-class tag) 'function)
308 (semantic-tag-function-destructor-p tag))))
309 (when destructor
310 (setq name (concat "~" name)))
311 (if color
312 (setq name (semantic--format-colorize-text name (semantic-tag-class tag))))
313 name))
314 313
315 (declare-function semantic-go-to-tag "semantic/tag-file") 314 (declare-function semantic-go-to-tag "semantic/tag-file")
316 315
317 (defun semantic--format-tag-parent-tree (tag parent) 316 (defun semantic--format-tag-parent-tree (tag parent)
318 "Under Consideration. 317 "Under Consideration.
475 474
476 (defun semantic-format-tag-short-doc-default (tag &optional parent color) 475 (defun semantic-format-tag-short-doc-default (tag &optional parent color)
477 "Display a short form of TAG's documentation. (Comments, or docstring.) 476 "Display a short form of TAG's documentation. (Comments, or docstring.)
478 Optional argument PARENT is the parent type if TAG is a detail. 477 Optional argument PARENT is the parent type if TAG is a detail.
479 Optional argument COLOR means highlight the prototype with font-lock colors." 478 Optional argument COLOR means highlight the prototype with font-lock colors."
480
481 (let* ((fname (or (semantic-tag-file-name tag) 479 (let* ((fname (or (semantic-tag-file-name tag)
482 (when parent (semantic-tag-file-name parent)))) 480 (when parent (semantic-tag-file-name parent))))
483 (buf (or (semantic-tag-buffer tag) 481 (buf (or (semantic-tag-buffer tag)
484 (when parent (semantic-tag-buffer parent)))) 482 (when parent (semantic-tag-buffer parent))))
485 (doc (semantic-tag-docstring tag buf))) 483 (doc (semantic-tag-docstring tag buf)))
505 (setq doc (semantic--format-colorize-text doc 'documentation))) 503 (setq doc (semantic--format-colorize-text doc 'documentation)))
506 doc 504 doc
507 )) 505 ))
508 506
509 ;;; Prototype generation 507 ;;; Prototype generation
510 ;; 508
511 (defun semantic-format-tag-prototype-default (tag &optional parent color) 509 (defun semantic-format-tag-prototype-default (tag &optional parent color)
512 "Default method for returning a prototype for TAG. 510 "Default method for returning a prototype for TAG.
513 This will work for C like languages. 511 This will work for C like languages.
514 Optional argument PARENT is the parent type if TAG is a detail. 512 Optional argument PARENT is the parent type if TAG is a detail.
515 Optional argument COLOR means highlight the prototype with font-lock colors." 513 Optional argument COLOR means highlight the prototype with font-lock colors."