• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/progmodes/

Lines Matching +defs:help +defs:map

1 ;;; idlw-help.el --- HTML Help code for IDLWAVE
30 ;; The help link information for IDLWAVE's online help feature for
33 ;; information, in the file idlw-rinfo.el. The HTML help file
46 (defvar idlwave-help-browse-url-available nil
49 (setq idlwave-help-browse-url-available
54 (defgroup idlwave-online-help nil
58 (defcustom idlwave-html-help-pre-v6 nil
59 "Whether pre or post-v6.0 IDL help documents are being used."
60 :group 'idlwave-online-help
64 (if idlwave-html-help-pre-v6 "#" "#wp"))
66 (defcustom idlwave-html-system-help-location "help/online_help/"
68 HTML help files live, for IDL 6.2 and later. This location, if found,
69 is used in preference to the old idlwave-html-help-location."
70 :group 'idlwave-online-help
73 (defcustom idlwave-html-help-location
78 6.2 or later (see idlwave-html-system-help-location)."
79 :group 'idlwave-online-help
82 (defvar idlwave-help-use-hh nil
85 (defcustom idlwave-help-use-assistant t
86 "Whether to use the IDL Assistant as the help browser."
87 :group 'idlwave-online-help
90 (defcustom idlwave-help-browser-function browse-url-browser-function
91 "Function to use to display html help.
93 :group 'idlwave-online-help
96 (defcustom idlwave-help-browser-generic-program browse-url-generic-program
98 :group 'idlwave-online-help
103 (defcustom idlwave-help-browser-generic-args
107 :group 'idlwave-online-help
110 (defcustom idlwave-help-browser-is-local nil
116 `idlwave-help-use-dedicated-frame' to function."
117 :group 'idlwave-online-help
120 (defvar idlwave-help-directory ""
121 "Obsolete variable. See idlwave-html-help-location.")
123 (defcustom idlwave-help-use-dedicated-frame t
125 :group 'idlwave-online-help
128 (defcustom idlwave-help-frame-parameters
131 See also `idlwave-help-use-dedicated-frame'.
133 `idlw-help.el' will be used."
134 :group 'idlwave-online-help
140 Currently only used for class selection during completion help."
141 :group 'idlwave-online-help
144 (defcustom idlwave-extra-help-function 'idlwave-help-with-source
145 "The function to call for online help if the normal help fails.
146 Online help works only for system routines which are described in the
147 IDL manuals. A function may be specified to access help from other sources.
150 The Help buffer is current when this function is called, and the help
151 text should be loaded into this buffer. If help is found, the
153 `window-start' in the help window. Also, the variable
154 `idlwave-help-mode-line-indicator' should be set to a useful string,
155 which will be displayed in the mode line of the help window. If
156 should also set the variable `idlwave-help-min-frame-width' to a
157 positive integer. IDLWAVE will ensure that the help frame is at least
158 that many columns wide. Failure to find help should be indicated by
161 When this variable is non-nil, IDLWAVE will allow the mouse-3 help click
165 The default value for this function is `idlwave-help-with-source' which
166 loads the routine source file into the help buffer. If you try to write
167 a different function which accesses a special help file or so, it is
169 :group 'idlwave-online-help
172 (defcustom idlwave-help-fontify-source-code nil
173 "*Non-nil means, fontify source code displayed as help like normal code."
174 :group 'idlwave-online-help
177 (defcustom idlwave-help-source-try-header t
178 "*Non-nil means, try to find help in routine header when displaying source.
180 help text. When this variable is non-nil, we try to find a description of
181 the help item in the first routine doclib header above the routine definition.
184 :group 'idlwave-online-help
188 (defcustom idlwave-help-doclib-name "name"
192 :group 'idlwave-online-help
195 (defcustom idlwave-help-doclib-keyword "KEYWORD"
199 :group 'idlwave-online-help
202 (defface idlwave-help-link
205 "Face for highlighting links into IDLWAVE online help."
206 :group 'idlwave-online-help)
208 (defvar idlwave-help-activate-links-aggressively nil
211 (defvar idlwave-completion-help-info)
213 (defvar idlwave-help-frame nil
214 "The frame for display of IDL online help.")
215 (defvar idlwave-help-frame-width 102
216 "The default width of the help frame.")
218 (defvar idlwave-html-help-is-available nil
219 "Is the system online help text avaiable?")
221 (defvar idlwave-help-mode-line-indicator ""
222 "Used for the special mode line in the idlwave-help-mode.")
224 (defvar idlwave-help-window-configuration nil)
225 (defvar idlwave-help-special-topic-words nil) ; defined by get_rinfo
229 (defvar idlwave-help-mode-map (make-sparse-keymap)
230 "The keymap used in idlwave-help-mode.")
232 (define-key idlwave-help-mode-map "q" 'idlwave-help-quit)
233 (define-key idlwave-help-mode-map "w" 'widen)
234 (define-key idlwave-help-mode-map "\C-m" (lambda (arg)
237 (define-key idlwave-help-mode-map " " 'scroll-up)
238 (define-key idlwave-help-mode-map [delete] 'scroll-down)
239 (define-key idlwave-help-mode-map "h" 'idlwave-help-find-header)
240 (define-key idlwave-help-mode-map "H" 'idlwave-help-find-first-header)
241 (define-key idlwave-help-mode-map "." 'idlwave-help-toggle-header-match-and-def)
242 (define-key idlwave-help-mode-map "F" 'idlwave-help-fontify)
243 (define-key idlwave-help-mode-map "\M-?" 'idlwave-help-return-to-calling-frame)
244 (define-key idlwave-help-mode-map "x" 'idlwave-help-return-to-calling-frame)
249 idlwave-help-menu idlwave-help-mode-map
252 ["Definition <-> Help Text" idlwave-help-toggle-header-match-and-def t]
253 ["Find DocLib Header" idlwave-help-find-header t]
254 ["Find First DocLib Header" idlwave-help-find-first-header t]
255 ["Fontify help buffer" idlwave-help-fontify t]
257 ["Quit" idlwave-help-quit t]))
259 (defvar idlwave-help-def-pos)
260 (defvar idlwave-help-args)
261 (defvar idlwave-help-in-header)
263 (defun idlwave-help-mode ()
268 expect a fully hyper-linked help.
282 \\{idlwave-help-mode-map}"
285 (setq major-mode 'idlwave-help-mode
287 (use-local-map idlwave-help-mode-map)
288 (easy-menu-add idlwave-help-menu idlwave-help-mode-map)
295 ": " 'idlwave-help-mode-line-indicator
298 (set (make-local-variable 'idlwave-help-def-pos) nil)
299 (set (make-local-variable 'idlwave-help-args) nil)
300 (set (make-local-variable 'idlwave-help-in-header) nil)
301 (run-hooks 'idlwave-help-mode-hook))
303 (defun idlwave-html-help-location ()
304 "Return the help directory where HTML files are, or nil if that is unknown."
306 idlwave-html-system-help-location (idlwave-sys-dir)))
307 (help-dir (or (and (stringp idlwave-html-help-location)
308 (> (length idlwave-html-help-location) 0)
309 idlwave-html-help-location)
313 (if help-dir
315 (setq help-dir (expand-file-name "idl_html_help" help-dir))
316 (if (file-directory-p help-dir) help-dir))))))
318 (defvar idlwave-help-assistant-available nil)
320 (defun idlwave-help-check-locations ()
321 ;; Check help locations and assistant.
323 (help-loc (idlwave-html-help-location)))
325 (not help-loc)
326 (not (file-directory-p help-loc)))
328 "HTML help location not found: try setting `idlwave-system-directory' and/or `idlwave-html-help-location'."))
330 (when (and idlwave-help-use-assistant
331 (not (eq (idlwave-help-assistant-available) t)))
333 (setq idlwave-help-use-assistant nil)
334 (unless idlwave-help-browse-url-available
335 (error "browse-url is not available; install it or IDL Assistant to use HTML help.")))))
339 (defvar idlwave-help-diagnostics)
341 (defvar idlwave-last-context-help-pos)
342 (defun idlwave-do-context-help (&optional arg)
346 (idlwave-help-diagnostics nil))
348 ;; at the same position, we try to switch to the help frame
352 (equal idlwave-last-context-help-pos marker))
353 (idlwave-help-select-help-frame)
355 (setq idlwave-last-context-help-pos marker)
357 (if idlwave-help-diagnostics
359 (nreverse idlwave-help-diagnostics)
362 (defvar idlwave-help-do-class-struct-tag nil)
364 (defvar idlwave-help-do-struct-tag nil)
369 "The work-horse version of `idlwave-context-help', which see."
382 idlwave-help-special-topic-words t))
410 ;; A special topic -- only system help
414 ;; A system variable -- only system help
432 ;; An executive command -- only system help
440 ;; A class -- system OR in-text help (via class__define).
454 ;; A class structure tag (self.BLAH) -- only in-text help available
465 (error "No help available for system class tags"))
466 (setq idlwave-help-do-class-struct-tag t)
482 (setq idlwave-help-do-struct-tag
486 ;; A routine keyword -- in text or system help
498 (idlwave-help-diagnostics
505 (idlwave-help-diagnostics
533 (apply 'idlwave-online-help mod1)
535 (apply 'idlwave-online-help mod2)
536 (error (apply 'idlwave-online-help mod3)))))
539 (apply 'idlwave-online-help mod1)
540 (error (apply 'idlwave-online-help mod2)))
542 (apply 'idlwave-online-help mod1)
543 (error "Don't know which item to show help for")))))))
545 (defun idlwave-do-mouse-completion-help (ev)
546 "Display online help on an item in the *Completions* buffer.
547 Needs additional info stored in global `idlwave-completion-help-info'."
549 (info idlwave-completion-help-info) ; global passed in
561 ;; See if we can also find help somewhere, e.g. for multiple classes
564 (error "No help item selected"))
623 (t (error "Cannot help with this item")))
625 (error "Cannot help with this item"))
626 (idlwave-online-help link (or name word) type class kwd)))
628 (defvar idlwave-highlight-help-links-in-completion)
629 (defvar idlwave-completion-help-links)
631 "Highlight all completions for which help is available and attach link.
632 Those words in `idlwave-completion-help-links' have links. The
633 `idlwave-help-link' face is used for this."
634 (if idlwave-highlight-help-links-in-completion
638 (props (list 'face 'idlwave-help-link))
639 (info idlwave-completion-help-info) ; global passed in
653 ;; Look for special link property passed in help-links
654 (if idlwave-completion-help-links
656 word idlwave-completion-help-links t))))
668 (defvar idlwave-help-return-frame nil
669 "The frame to return to from the help frame.")
671 (defun idlwave-help-quit ()
674 (cond ((and idlwave-help-use-dedicated-frame
675 (eq (selected-frame) idlwave-help-frame))
677 (frame-live-p idlwave-help-return-frame))
680 ;; we kill the help frame before the return-frame is selected.
685 (select-frame idlwave-help-return-frame)
688 idlwave-help-return-frame))
690 (delete-frame idlwave-help-frame))
691 ((window-configuration-p idlwave-help-window-configuration)
692 (set-window-configuration idlwave-help-window-configuration)
694 (t (kill-buffer (idlwave-help-get-help-buffer)))))
699 (defun idlwave-help-display-help-window (&optional pos-or-func)
700 "Display the help window.
702 if passed as a function. See `idlwave-help-use-dedicated-frame'."
704 (buf (idlwave-help-get-help-buffer)))
705 (if (and window-system idlwave-help-use-dedicated-frame)
707 (idlwave-help-show-help-frame)
711 (setq idlwave-help-window-configuration
723 (defun idlwave-help-select-help-frame ()
724 "Select the help frame."
725 (if (and (frame-live-p idlwave-help-frame)
726 (not (eq (selected-frame) idlwave-help-frame)))
728 (setq idlwave-help-return-frame (selected-frame))
729 (select-frame idlwave-help-frame))))
731 (defun idlwave-help-return-to-calling-frame ()
732 "Select the frame from which the help frame was selected."
734 (if (and (frame-live-p idlwave-help-return-frame)
735 (not (eq (selected-frame) idlwave-help-return-frame)))
736 (select-frame idlwave-help-return-frame)))
738 (defun idlwave-online-help (link &optional name type class keyword)
739 "Display HTML or other special help on a certain topic.
740 Either loads an HTML link, if LINK is non-nil, or gets special-help on
741 the optional arguments, if any special help is defined. If LINK is
743 see if a link is set for it. Try extra help functions if necessary."
755 (t (setq link (idlwave-entry-has-help entry))))
758 ;; Check for system class help
764 ", falling back on class help.")
770 (idlwave-help-html-link link))
772 ;; Any extra help
773 (idlwave-extra-help-function
774 (idlwave-help-get-special-help name type class keyword))
777 (t (idlwave-help-error name type class keyword))))
780 (defun idlwave-help-get-special-help (name type class keyword)
781 "Call the function given by `idlwave-extra-help-function'."
783 (help-pos (save-excursion
784 (set-buffer (idlwave-help-get-help-buffer))
786 (funcall idlwave-extra-help-function
788 (if help-pos
789 (idlwave-help-display-help-window help-pos)
790 (idlwave-help-error name type class keyword))
793 (defun idlwave-help-html-link (link)
794 "Get html help on a given LINK."
795 (let ((browse-url-browser-function idlwave-help-browser-function)
796 (help-loc (idlwave-html-help-location))
797 (browse-url-generic-program idlwave-help-browser-generic-program)
798 ;(browse-url-generic-args idlwave-help-browser-generic-args)
802 (unless (and (stringp help-loc)
803 (file-directory-p help-loc))
804 (error "Invalid help location."))
805 (setq full-link (browse-url-file-url (expand-file-name link help-loc)))
809 (idlwave-help-use-assistant
810 (idlwave-help-assistant-open-link link))
812 ((or idlwave-help-browser-is-local
813 (string-match "w3" (symbol-name idlwave-help-browser-function)))
814 (idlwave-help-display-help-window '(lambda () (browse-url full-link))))
818 ;; A special help routine for source-level syntax help in files.
819 (defvar idlwave-help-fontify-source-code)
820 (defvar idlwave-help-source-try-header)
823 (defun idlwave-help-with-source (name type class keyword)
824 "Provide help for routines not documented in the IDL manuals. Works
825 by loading the routine source file into the help buffer. Depending on
826 the value of `idlwave-help-source-try-header', it attempts to show the
828 `idlwave-help-do-class-struct-tag' is non-nil, keyword is a tag to
829 show help on from the class definition structure. If
830 `idlwave-help-do-struct-tag' is non-nil, show help from the matching
833 This function can be used as `idlwave-extra-help-function'."
834 (let* ((class-struct-tag idlwave-help-do-class-struct-tag)
835 (struct-tag idlwave-help-do-struct-tag)
849 (setq idlwave-help-def-pos nil
850 idlwave-help-args (list name type class keyword)
851 idlwave-help-in-header nil
852 idlwave-help-do-struct-tag nil
853 idlwave-help-do-class-struct-tag nil)
870 (idlwave-help-error name type class keyword)))
872 (if (and idlwave-help-fontify-source-code (not in-buf))
873 (idlwave-help-fontify)))
874 (idlwave-help-error name type class keyword))
875 (setq idlwave-help-mode-line-indicator file)
906 (idlwave-help-find-routine-definition name type class keyword))))
907 idlwave-help-def-pos def-pos)
909 (if (and idlwave-help-source-try-header
914 (setq header-pos (idlwave-help-find-in-doc-header
916 idlwave-help-in-header header-pos)))
920 (if (boundp 'idlwave-help-min-frame-width)
921 (setq idlwave-help-min-frame-width 80))
923 (idlwave-help-error name type class keyword))
928 (defun idlwave-help-find-routine-definition (name type class keyword)
947 (defun idlwave-help-find-in-doc-header (name type class keyword
949 "Find the requested help in the doc-header above point.
953 given. Returns the point which should be window start of the help
954 window. If EXACT is non-nil, the full help position must be found -
955 down to the keyword requested. This setting is for context help, if
996 idlwave-help-doclib-name
1012 idlwave-help-doclib-keyword
1056 (idlwave-help-diagnostics
1063 (idlwave-help-diagnostics "Could not find doclib header")
1066 (defun idlwave-help-diagnostics (string &optional ding)
1069 (if (boundp 'idlwave-help-diagnostics)
1071 (setq idlwave-help-diagnostics
1072 (cons string idlwave-help-diagnostics))
1075 (defun idlwave-help-toggle-header-top-and-def (arg)
1078 (if idlwave-help-in-header
1081 (setq idlwave-help-in-header nil)
1082 (setq pos idlwave-help-def-pos))
1084 (setq pos (idlwave-help-find-in-doc-header
1085 (nth 0 idlwave-help-args)
1086 (nth 1 idlwave-help-args)
1087 (nth 2 idlwave-help-args)
1090 (setq idlwave-help-in-header t)
1092 (idlwave-make-full-name (nth 2 idlwave-help-args)
1093 (nth 0 idlwave-help-args)))))
1099 (defun idlwave-help-find-first-header (arg)
1112 (defun idlwave-help-find-header (arg)
1116 (idlwave-help-find-first-header nil)
1117 (setq idlwave-help-in-header nil)
1118 (idlwave-help-toggle-header-match-and-def arg 'top)))
1120 (defun idlwave-help-toggle-header-match-and-def (arg &optional top)
1122 (let ((args idlwave-help-args)
1124 (if idlwave-help-in-header
1127 (setq idlwave-help-in-header nil)
1128 (setq pos idlwave-help-def-pos))
1130 (setq pos (apply 'idlwave-help-find-in-doc-header
1135 (setq idlwave-help-in-header t)
1137 (idlwave-make-full-name (nth 2 idlwave-help-args)
1138 (nth 0 idlwave-help-args)))))
1147 (defun idlwave-help-fontify ()
1149 Useful when source code is displayed as help. See the option
1150 `idlwave-help-fontify-source-code'."
1166 (defun idlwave-help-error (name type class keyword)
1167 (error "Can't find help on %s%s %s"
1171 (if idlwave-html-help-location
1173 "(help location unknown)")))
1175 (defun idlwave-help-show-help-frame ()
1176 "Show the help frame, creating it if necessary"
1178 (unless (frame-live-p idlwave-help-frame)
1179 (setq idlwave-help-frame
1180 (make-frame idlwave-help-frame-parameters))
1185 (let ((sval (cons idlwave-help-frame nil)))
1189 (modify-frame-parameters idlwave-help-frame
1192 (select-frame idlwave-help-frame))
1194 (defun idlwave-help-get-help-buffer ()
1202 (idlwave-help-mode)))
1213 (defun idlwave-entry-has-help (entry)
1216 (defun idlwave-has-help (name type class)
1217 "Does this have help associated with it?"
1219 (idlwave-entry-has-help entry)))
1222 (defvar idlwave-help-assistant-process nil)
1223 (defvar idlwave-help-assistant-socket nil)
1228 (defvar idlwave-help-assistant-command
1235 (defun idlwave-help-assistant-available ()
1236 (if idlwave-help-assistant-available
1237 (eq idlwave-help-assistant-available t)
1238 (setq idlwave-help-assistant-available
1239 (if (file-executable-p (idlwave-help-assistant-command))
1243 (defun idlwave-help-assistant-command ()
1244 (expand-file-name idlwave-help-assistant-command (idlwave-sys-dir)))
1246 (defun idlwave-help-assistant-start (&optional full-link)
1248 (when (or (not idlwave-help-assistant-socket)
1249 (not (eq (process-status idlwave-help-assistant-socket) 'open)))
1250 (let* ((help-loc (idlwave-html-help-location))
1251 (command (idlwave-help-assistant-command))
1255 `("-profile" ,(expand-file-name "idl.adp" help-loc)))
1258 (if idlwave-help-assistant-socket
1259 (delete-process idlwave-help-assistant-socket))
1261 (setq idlwave-help-assistant-process
1265 (set-process-filter idlwave-help-assistant-process
1268 (unless (accept-process-output idlwave-help-assistant-process 15)
1272 (set-process-filter idlwave-help-assistant-process nil)
1273 (setq idlwave-help-assistant-socket
1276 (if (eq (process-status idlwave-help-assistant-socket) 'open)
1278 (process-send-string idlwave-help-assistant-socket
1279 (concat "setHelpPath " help-loc "\n"))
1281 (idlwave-help-assistant-close)
1284 (defun idlwave-help-assistant-raise ()
1285 (idlwave-help-assistant-start)
1286 (process-send-string idlwave-help-assistant-socket "raise\n"))
1288 (defun idlwave-help-assistant-open-link (&optional link)
1290 (let ((help-loc (idlwave-html-help-location))
1296 (error "Malformed help link."))
1298 (setq file (expand-file-name (concat topic ".html") help-loc))
1302 (concat (upcase topic) ".html") help-loc))
1306 just-started (idlwave-help-assistant-start (if exists full-link)))
1310 (process-send-string idlwave-help-assistant-socket
1312 (process-send-string idlwave-help-assistant-socket
1314 (process-send-string idlwave-help-assistant-socket
1316 (idlwave-help-assistant-raise))
1318 (defvar idlwave-help-assistant-help-with-topic-history nil
1319 "The history of help topics selected with the minibuffer.")
1321 (defun idlwave-help-assistant-help-with-topic (&optional topic)
1322 "Prompt for and provide help with TOPIC."
1338 'idlwave-help-assistant-help-with-topic-history)))
1340 (idlwave-help-assistant-open-link (concat topic ".html")))))
1342 (defun idlwave-help-assistant-close ()
1343 (when (and idlwave-help-assistant-process
1344 (eq (process-status idlwave-help-assistant-process) 'run))
1345 (when idlwave-help-assistant-socket
1346 (process-send-string idlwave-help-assistant-socket "quit\n")
1347 (delete-process idlwave-help-assistant-socket))
1348 (stop-process idlwave-help-assistant-process)
1349 (delete-process idlwave-help-assistant-process)
1350 (setq idlwave-help-assistant-socket nil
1351 idlwave-help-assistant-process nil)))
1354 (provide 'idlw-help)
1355 (provide 'idlwave-help)
1358 ;;; idlw-help.el ends here