devhelp r1143 - in trunk: . misc



Author: rhult
Date: Mon Oct  6 15:55:38 2008
New Revision: 1143
URL: http://svn.gnome.org/viewvc/devhelp?rev=1143&view=rev

Log:
2008-10-06  Richard Hult  <richard imendio com>

	* misc/devhelp.el: Add function that uses the assistant.


Modified:
   trunk/ChangeLog
   trunk/misc/devhelp.el

Modified: trunk/misc/devhelp.el
==============================================================================
--- trunk/misc/devhelp.el	(original)
+++ trunk/misc/devhelp.el	Mon Oct  6 15:55:38 2008
@@ -1,14 +1,44 @@
-; Emacs integration by Richard Hult <richard imendio com>
+;; Emacs integration by Richard Hult <richard imendio com>
+;;
 
 (defun devhelp-word-at-point ()
-  "runs devhelp"
+  "Searches for the current word in Devhelp"
   (interactive)
   (setq w (current-word))
   (start-process-shell-command "devhelp" nil "devhelp" "-s" w)
+  (set-process-query-on-exit-flag (get-process "devhelp") nil)
+  )
+(defun devhelp-assistant-word-at-point ()
+  "Searches for the current work in the Devhelp assistant"
+  (interactive)
+  (setq w (current-word))
+  (start-process-shell-command "devhelp" nil "devhelp" "-a" w)
+  (set-process-query-on-exit-flag (get-process "devhelp") nil)
   )
 
-; Example: bind F7 to start devhelp and search for the word at the point.
-; (global-set-key [f7] 'devhelp-word-at-point)
+(defvar devhelp-timer nil)
+(defun devhelp-disable-assistant ()
+  (message "Devhelp assistant disabled")
+  (cancel-timer devhelp-timer)
+  (setq devhelp-timer nil)
+)
+(defun devhelp-enable-assistant ()
+  (message "Devhelp assistant enabled")
+  (setq devhelp-timer (run-with-idle-timer 0.6 t 'devhelp-assistant-word-at-point))
+)
+(defun devhelp-toggle-automatic-assistant ()
+  "Toggles automatic Devhelp assistant on and off"
+  (interactive)
+  (if devhelp-timer (devhelp-disable-assistant) (devhelp-enable-assistant))
+)
 
-; Tips: use -g WIDTHxHEIGHT+XOFF+YOFF to set the size and position of
-; the window
+;; Examples:
+;;
+;; Bind F7 to start devhelp and search for the word at the point.
+;; (global-set-key [f7] 'devhelp-word-at-point)
+;;
+;; Bind F6 to enable the automatic assistant.
+;; (global-set-key [f6] 'devhelp-toggle-automatic-assistant)
+;;
+;; Bind F6 to search with the assistant window.
+;; (global-set-key [f6] 'devhelp-assistant-word-at-point)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]