File: devhelp.el

package info (click to toggle)
devhelp 43.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,144 kB
  • sloc: ansic: 9,775; perl: 216; javascript: 152; sh: 100; xml: 66; python: 55; lisp: 29; makefile: 13
file content (45 lines) | stat: -rw-r--r-- 1,474 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;; Emacs integration by Richard Hult <richard@imendio.com>
;;

(defun devhelp-word-at-point ()
  "Searches for the current word in Devhelp"
  (interactive)
  (start-process-shell-command "devhelp" nil (concat "devhelp -s " (current-word)))
  (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 (concat "devhelp -a " w))
  (set-process-query-on-exit-flag (get-process "devhelp") nil)
  )

(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))
)

;; 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)

(provide 'devhelp)