[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp ChangeLog cedet/semantic/idle.el
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] emacs/lisp ChangeLog cedet/semantic/idle.el |
Date: |
Sun, 15 Nov 2009 15:37:21 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Chong Yidong <cyd> 09/11/15 15:37:21
Modified files:
lisp : ChangeLog
lisp/cedet/semantic: idle.el
Log message:
* cedet/semantic/idle.el (semantic-idle-summary-mode)
(semantic-idle-summary-mode): Define using define-minor-mode
instead of define-semantic-idle-service.
(semantic-idle-summary-mode): New function.
(semantic-idle-summary-mode-setup): Use pre-command-hook to ensure
that mouse motion does not reset the echo area.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16636&r2=1.16637
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/cedet/semantic/idle.el?cvsroot=emacs&r1=1.9&r2=1.10
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16636
retrieving revision 1.16637
diff -u -b -r1.16636 -r1.16637
--- ChangeLog 15 Nov 2009 15:32:15 -0000 1.16636
+++ ChangeLog 15 Nov 2009 15:37:17 -0000 1.16637
@@ -1,3 +1,12 @@
+2009-11-15 Chong Yidong <address@hidden>
+
+ * cedet/semantic/idle.el (semantic-idle-summary-mode)
+ (semantic-idle-summary-mode): Define using define-minor-mode
+ instead of define-semantic-idle-service.
+ (semantic-idle-summary-mode): New function.
+ (semantic-idle-summary-mode-setup): Use pre-command-hook to ensure
+ that mouse motion does not reset the echo area.
+
2009-11-15 Juri Linkov <address@hidden>
* simple.el (set-mark-default-inactive): Add :type, :group
Index: cedet/semantic/idle.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/cedet/semantic/idle.el,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- cedet/semantic/idle.el 3 Nov 2009 21:45:33 -0000 1.9
+++ cedet/semantic/idle.el 15 Nov 2009 15:37:20 -0000 1.10
@@ -46,6 +46,7 @@
;; For the semantic-find-tags-by-name macro.
(eval-when-compile (require 'semantic/find))
+(defvar eldoc-last-message)
(declare-function eldoc-message "eldoc")
(declare-function semantic-analyze-interesting-tag "semantic/analyze")
(declare-function semantic-complete-analyze-inline-idle "semantic/complete")
@@ -151,7 +152,7 @@
'semantic-idle-scheduler-mode arg)))
(defcustom semantic-idle-scheduler-mode-hook nil
- "*Hook run at the end of function `semantic-idle-scheduler-mode'."
+ "Hook run at the end of function `semantic-idle-scheduler-mode'."
:group 'semantic
:type 'hook)
@@ -695,7 +696,9 @@
(defcustom semantic-idle-summary-function
'semantic-format-tag-summarize-with-file
- "*Function to use when displaying tag information during idle time.
+ "Function to call when displaying tag information during idle time.
+This function should take a single argument, a Semantic tag, and
+return a string to display.
Some useful functions are found in `semantic-format-tag-functions'."
:group 'semantic
:type semantic-format-tag-custom-list)
@@ -797,7 +800,12 @@
'semantic-idle-summary-current-symbol-info
"23.2")
-(define-semantic-idle-service semantic-idle-summary
+(defcustom semantic-idle-summary-mode-hook nil
+ "Hook run at the end of `semantic-idle-summary'."
+ :group 'semantic
+ :type 'hook)
+
+(defun semantic-idle-summary-idle-function ()
"Display a tag summary of the lexical token under the cursor.
Call `semantic-idle-summary-current-symbol-info' for getting the
current tag to display information."
@@ -807,10 +815,8 @@
(str (cond ((stringp found) found)
((semantic-tag-p found)
(funcall semantic-idle-summary-function
- found nil t))))
- )
+ found nil t)))))
;; Show the message with eldoc functions
- (require 'eldoc)
(unless (and str (boundp 'eldoc-echo-area-use-multiline-p)
eldoc-echo-area-use-multiline-p)
(let ((w (1- (window-width (minibuffer-window)))))
@@ -818,6 +824,56 @@
(setq str (substring str 0 w)))))
(eldoc-message str))))
+(define-minor-mode semantic-idle-summary-mode
+ "Toggle Semantic Idle Summary mode.
+When Semantic Idle Summary mode is enabled, the echo area
+displays a summary of the lexical token under the cursor whenever
+Emacs is idle."
+ :group 'semantic
+ :group 'semantic-modes
+ (semantic-idle-summary-mode-setup)
+ (semantic-mode-line-update))
+
+(defun semantic-idle-summary-refresh-echo-area ()
+ (and semantic-idle-summary-mode
+ eldoc-last-message
+ (if (and (not executing-kbd-macro)
+ (not (and (boundp 'edebug-active) edebug-active))
+ (not cursor-in-echo-area)
+ (not (eq (selected-window) (minibuffer-window))))
+ (eldoc-message eldoc-last-message)
+ (setq eldoc-last-message nil))))
+
+(defun semantic-idle-summary-mode-setup ()
+ "Set up `semantic-idle-summary-mode'."
+ (if semantic-idle-summary-mode
+ ;; Enable the mode
+ (progn
+ (unless (and (featurep 'semantic) (semantic-active-p))
+ ;; Disable minor mode if semantic stuff not available
+ (setq semantic-idle-summary-mode nil)
+ (error "Buffer %s was not set up for parsing"
+ (buffer-name)))
+ (require 'eldoc)
+ (semantic-idle-scheduler-add 'semantic-idle-summary-idle-function)
+ (add-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t))
+ ;; Disable the mode
+ (semantic-idle-scheduler-remove 'semantic-idle-summary-idle-function)
+ (remove-hook 'pre-command-hook 'semantic-idle-summary-refresh-echo-area t))
+ semantic-idle-summary-mode)
+
+(semantic-add-minor-mode 'semantic-idle-summary-mode "")
+
+(define-minor-mode global-semantic-idle-summary-mode
+ "Toggle global use of `semantic-idle-summary-mode'."
+ :global t
+ :group 'semantic
+ :group 'semantic-modes
+ (semantic-toggle-minor-mode-globally
+ 'semantic-idle-summary-mode
+ (if global-semantic-idle-summary-mode 1 -1)))
+
+
;;; Current symbol highlight
;;
;; This mode will use context analysis to perform highlighting
- [Emacs-diffs] emacs/lisp ChangeLog cedet/semantic/idle.el,
Chong Yidong <=