aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-09-21 17:49:07 +0000
committerChong Yidong2009-09-21 17:49:07 +0000
commit16feddc402fad45e207560c25e6274de348f0782 (patch)
tree84a90139dd2f87fdbdc5f42633f5016b3debf61a
parentaf7b5a91b2c7e4f3ee18f72192d7baa572d03735 (diff)
downloademacs-16feddc402fad45e207560c25e6274de348f0782.tar.gz
emacs-16feddc402fad45e207560c25e6274de348f0782.zip
* help-fns.el (describe-function-1): Call
overload-docstring-extension for mode-local functions. * cedet/mode-local.el: * cedet/semantic/mru-bookmark.el: * cedet/pulse.el: Remove advice. * cedet/semantic.el: Add autoloads for semantic/idle functions.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/cedet/mode-local.el47
-rw-r--r--lisp/cedet/pulse.el71
-rw-r--r--lisp/cedet/semantic/mru-bookmark.el23
-rw-r--r--lisp/help-fns.el17
5 files changed, 23 insertions, 142 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e9805247938..6f903511edb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,12 @@
12009-09-21 Chong Yidong <cyd@stupidchicken.com> 12009-09-21 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * help-fns.el (describe-function-1): Call
4 overload-docstring-extension for mode-local functions.
5
6 * cedet/mode-local.el:
7 * cedet/semantic/mru-bookmark.el:
8 * cedet/pulse.el: Remove advice.
9
3 * cedet/semantic.el: Add autoloads for semantic/idle functions. 10 * cedet/semantic.el: Add autoloads for semantic/idle functions.
4 11
5 * cedet/semantic/util.el (semantic--completion-cache): New var. 12 * cedet/semantic/util.el (semantic--completion-cache): New var.
diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el
index 4712c9309ff..d6668385f33 100644
--- a/lisp/cedet/mode-local.el
+++ b/lisp/cedet/mode-local.el
@@ -50,42 +50,6 @@
50;;; Code: 50;;; Code:
51(eval-when-compile (require 'cl)) 51(eval-when-compile (require 'cl))
52 52
53;;; Compatibility
54;;
55(defun mode-local-define-derived-mode-needed-p ()
56 "Return non-nil if mode local has to fix `define-derived-mode'.
57That is, if `define-derived-mode' does not set `derived-mode-parent'."
58 (let ((body (cdr (macroexpand '(define-derived-mode c p ""))))
59 (bad t))
60 (while (and body bad)
61 (if (equal (car body) '(put 'c 'derived-mode-parent 'p))
62 (setq bad nil)
63 (setq body (cdr body))))
64 bad))
65
66(when (mode-local-define-derived-mode-needed-p)
67 ;; Workaround a bug in some (XEmacs) versions of
68 ;; `define-derived-mode' that don't set the `derived-mode-parent'
69 ;; property, and break mode-local.
70 (defadvice define-derived-mode
71 (after mode-local-define-derived-mode activate)
72 "Fix missing `derived-mode-parent' property on child."
73 (unless (eq 'fundamental-mode (ad-get-arg 1))
74 (let ((form (cdr ad-return-value)))
75 (setq ad-return-value nil)
76 (while form
77 (and (eq 'defun (car-safe (car form)))
78 (eq (ad-get-arg 0) (car (cdr-safe (car form))))
79 (push `(or (get ',(ad-get-arg 0) 'derived-mode-parent)
80 (put ',(ad-get-arg 0) 'derived-mode-parent
81 ',(ad-get-arg 1)))
82 ad-return-value))
83 (push (car form) ad-return-value)
84 (setq form (cdr form)))
85 (setq ad-return-value `(progn ,@(nreverse ad-return-value)))
86 )))
87 )
88
89;;; Misc utilities 53;;; Misc utilities
90;; 54;;
91(defun mode-local-map-file-buffers (function &optional predicate buffers) 55(defun mode-local-map-file-buffers (function &optional predicate buffers)
@@ -629,7 +593,7 @@ PROMPT, INITIAL, HIST, and DEFAULT are the same as for `completing-read'."
629(defun overload-docstring-extension (overload) 593(defun overload-docstring-extension (overload)
630 "Return the doc string that augments the description of OVERLOAD." 594 "Return the doc string that augments the description of OVERLOAD."
631 (let ((doc "\n\This function can be overloaded\ 595 (let ((doc "\n\This function can be overloaded\
632 (see `define-mode-local-override' for details).") 596 with `define-mode-local-override'.")
633 (sym (overload-obsoleted-by overload))) 597 (sym (overload-obsoleted-by overload)))
634 (when sym 598 (when sym
635 (setq doc (format "%s\nIt makes the overload `%s' obsolete." 599 (setq doc (format "%s\nIt makes the overload `%s' obsolete."
@@ -659,15 +623,6 @@ SYMBOL is a function that can be overridden."
659 ) 623 )
660 (toggle-read-only 1)))) 624 (toggle-read-only 1))))
661 625
662;; Help for Overload functions. Need to advise help.
663(defadvice describe-function (around mode-local-help activate)
664 "Display the full documentation of FUNCTION (a symbol).
665Returns the documentation as a string, also."
666 (prog1
667 ad-do-it
668 (if (function-overload-p (ad-get-arg 0))
669 (mode-local-augment-function-help (ad-get-arg 0)))))
670
671;; Help for mode-local bindings. 626;; Help for mode-local bindings.
672(defun mode-local-print-binding (symbol) 627(defun mode-local-print-binding (symbol)
673 "Print the SYMBOL binding." 628 "Print the SYMBOL binding."
diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
index e8a9b11dd2f..aa9003e682c 100644
--- a/lisp/cedet/pulse.el
+++ b/lisp/cedet/pulse.el
@@ -314,75 +314,8 @@ Optional argument FACE specifies the fact to do the highlighting."
314 (pulse-momentary-highlight-overlay o face))) 314 (pulse-momentary-highlight-overlay o face)))
315 315
316;;; Random integration with other tools 316;;; Random integration with other tools
317;;
318(defvar pulse-command-advice-flag nil
319 "Non-nil means pulse advice is active.
320To active pulse advice, use `pulse-enable-integration-advice'.")
321
322(defun pulse-toggle-integration-advice (arg)
323 "Toggle activation of advised functions that will now pulse.
324Wint no ARG, toggle the pulse advice.
325With a negative ARG, disable pulse advice.
326With a positive ARG, enable pulse advice.
327Currently advised functions include:
328 `goto-line'
329 `exchange-point-and-mark'
330 `find-tag'
331 `tags-search'
332 `tags-loop-continue'
333 `pop-tag-mark'
334 `imenu-default-goto-function'
335Pulsing via `pulse-line-hook-function' has also been added to
336the following hook:
337 `next-error-hook'"
338 (interactive "P")
339 (if (null arg)
340 (setq pulse-command-advice-flag (not pulse-command-advice-flag))
341 (if (< (prefix-numeric-value arg) 0)
342 (setq pulse-command-advice-flag nil)
343 (setq pulse-command-advice-flag t)
344 )
345 )
346 (if pulse-command-advice-flag
347 (message "Pulse advice enabled")
348 (message "Pulse advice disabled"))
349 )
350
351(defadvice goto-line (after pulse-advice activate)
352 "Cause the line that is `goto'd to pulse when the cursor gets there."
353 (when (and pulse-command-advice-flag (interactive-p))
354 (pulse-momentary-highlight-one-line (point))))
355 317
356(defadvice exchange-point-and-mark (after pulse-advice activate) 318(defvar pulse-command-advice-flag nil)
357 "Cause the line that is `goto'd to pulse when the cursor gets there."
358 (when (and pulse-command-advice-flag (interactive-p)
359 (> (abs (- (point) (mark))) 400))
360 (pulse-momentary-highlight-one-line (point))))
361
362(defadvice find-tag (after pulse-advice activate)
363 "After going to a tag, pulse the line the cursor lands on."
364 (when (and pulse-command-advice-flag (interactive-p))
365 (pulse-momentary-highlight-one-line (point))))
366
367(defadvice tags-search (after pulse-advice activate)
368 "After going to a hit, pulse the line the cursor lands on."
369 (when (and pulse-command-advice-flag (interactive-p))
370 (pulse-momentary-highlight-one-line (point))))
371
372(defadvice tags-loop-continue (after pulse-advice activate)
373 "After going to a hit, pulse the line the cursor lands on."
374 (when (and pulse-command-advice-flag (interactive-p))
375 (pulse-momentary-highlight-one-line (point))))
376
377(defadvice pop-tag-mark (after pulse-advice activate)
378 "After going to a hit, pulse the line the cursor lands on."
379 (when (and pulse-command-advice-flag (interactive-p))
380 (pulse-momentary-highlight-one-line (point))))
381
382(defadvice imenu-default-goto-function (after pulse-advice activate)
383 "After going to a tag, pulse the line the cursor lands on."
384 (when pulse-command-advice-flag
385 (pulse-momentary-highlight-one-line (point))))
386 319
387(defun pulse-line-hook-function () 320(defun pulse-line-hook-function ()
388 "Function used in hooks to pulse the current line. 321 "Function used in hooks to pulse the current line.
@@ -390,8 +323,6 @@ Only pulses the line if `pulse-command-advice-flag' is non-nil."
390 (when pulse-command-advice-flag 323 (when pulse-command-advice-flag
391 (pulse-momentary-highlight-one-line (point)))) 324 (pulse-momentary-highlight-one-line (point))))
392 325
393(add-hook 'next-error-hook 'pulse-line-hook-function)
394
395(provide 'pulse) 326(provide 'pulse)
396 327
397;;; pulse.el ends here 328;;; pulse.el ends here
diff --git a/lisp/cedet/semantic/mru-bookmark.el b/lisp/cedet/semantic/mru-bookmark.el
index e1307c68a06..66da681e3b4 100644
--- a/lisp/cedet/semantic/mru-bookmark.el
+++ b/lisp/cedet/semantic/mru-bookmark.el
@@ -411,29 +411,6 @@ Jumps to the tag and highlights it briefly."
411 (semantic-mrub-visit tagmark) 411 (semantic-mrub-visit tagmark)
412 ) 412 )
413 413
414;;; ADVICE
415;;
416;; Advise some commands to help set tag marks.
417;; (defadvice push-mark (around semantic-mru-bookmark activate)
418;; "Push a mark at LOCATION with NOMSG and ACTIVATE passed to `push-mark'.
419;; If `semantic-mru-bookmark-mode' is active, also push a tag onto
420;; the mru bookmark stack."
421;; (semantic-mrub-push semantic-mru-bookmark-ring
422;; (point)
423;; 'mark)
424;; ad-do-it)
425
426;(defadvice set-mark-command (around semantic-mru-bookmark activate)
427; "Set this buffer's mark to POS.
428;If `semantic-mru-bookmark-mode' is active, also push a tag onto
429;the mru bookmark stack."
430; (when (and semantic-mru-bookmark-mode (interactive-p))
431; (semantic-mrub-push semantic-mru-bookmark-ring
432; (point)
433; 'mark))
434; ad-do-it)
435
436
437;;; Debugging 414;;; Debugging
438;; 415;;
439(defun semantic-adebug-mrub () 416(defun semantic-adebug-mrub ()
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index b9530d89be9..ba5c32d5373 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -323,6 +323,8 @@ suitable file is found, return nil."
323 (and src-file (file-readable-p src-file) src-file)))))) 323 (and src-file (file-readable-p src-file) src-file))))))
324 324
325(declare-function ad-get-advice-info "advice" (function)) 325(declare-function ad-get-advice-info "advice" (function))
326(declare-function function-overload-p "mode-local")
327(declare-function overload-docstring-extension function "mode-local")
326 328
327;;;###autoload 329;;;###autoload
328(defun describe-function-1 (function) 330(defun describe-function-1 (function)
@@ -480,6 +482,8 @@ suitable file is found, return nil."
480 (insert (car high) "\n") 482 (insert (car high) "\n")
481 (fill-region fill-begin (point))) 483 (fill-region fill-begin (point)))
482 (setq doc (cdr high)))) 484 (setq doc (cdr high))))
485
486 ;; Note if function is obsolete.
483 (let* ((obsolete (and 487 (let* ((obsolete (and
484 ;; function might be a lambda construct. 488 ;; function might be a lambda construct.
485 (symbolp function) 489 (symbolp function)
@@ -492,9 +496,16 @@ suitable file is found, return nil."
492 (insert (cond ((stringp use) (concat ";\n" use)) 496 (insert (cond ((stringp use) (concat ";\n" use))
493 (use (format ";\nuse `%s' instead." use)) 497 (use (format ";\nuse `%s' instead." use))
494 (t ".")) 498 (t "."))
495 "\n")) 499 "\n")))
496 (insert "\n" 500
497 (or doc "Not documented.")))))))) 501 ;; Note if function is overloadable (see the `mode-local'
502 ;; package in CEDET).
503 (when (and (featurep 'mode-local)
504 (symbolp function)
505 (function-overload-p function))
506 (insert (overload-docstring-extension function) "\n"))
507
508 (insert "\n" (or doc "Not documented.")))))))
498 509
499 510
500;; Variables 511;; Variables