Mercurial > emacs
comparison lisp/progmodes/idlw-help.el @ 106697:ac408704629c
lisp/*: Fix typos in docstrings and messages.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sat, 02 Jan 2010 02:05:44 +0100 |
parents | df4934f25eef |
children | 1d1d5d9bd884 |
comparison
equal
deleted
inserted
replaced
106696:9084997e41f6 | 106697:ac408704629c |
---|---|
39 | 39 |
40 | 40 |
41 | 41 |
42 ;;; Code: | 42 ;;; Code: |
43 (defvar idlwave-help-browse-url-available t | 43 (defvar idlwave-help-browse-url-available t |
44 "Whether browse-url is available") | 44 "Whether browse-url is available.") |
45 | 45 |
46 (require 'browse-url) | 46 (require 'browse-url) |
47 | 47 |
48 (defgroup idlwave-online-help nil | 48 (defgroup idlwave-online-help nil |
49 "Online Help options for IDLWAVE mode." | 49 "Online Help options for IDLWAVE mode." |
56 | 56 |
57 (defvar idlwave-html-link-sep | 57 (defvar idlwave-html-link-sep |
58 (if idlwave-html-help-pre-v6 "#" "#wp")) | 58 (if idlwave-html-help-pre-v6 "#" "#wp")) |
59 | 59 |
60 (defcustom idlwave-html-system-help-location "help/online_help/" | 60 (defcustom idlwave-html-system-help-location "help/online_help/" |
61 "The directory, relative to idlwave-system-directory, where the idl | 61 "The directory, relative to `idlwave-system-directory', where the IDL |
62 HTML help files live, for IDL 6.2 and later. This location, if found, | 62 HTML help files live, for IDL 6.2 and later. This location, if found, |
63 is used in preference to the old idlwave-html-help-location." | 63 is used in preference to the old `idlwave-html-help-location'." |
64 :group 'idlwave-online-help | 64 :group 'idlwave-online-help |
65 :type 'directory) | 65 :type 'directory) |
66 | 66 |
67 (defcustom idlwave-html-help-location | 67 (defcustom idlwave-html-help-location |
68 (if (memq system-type '(ms-dos windows-nt)) | 68 (if (memq system-type '(ms-dos windows-nt)) |
69 nil | 69 nil |
70 "/usr/local/etc/") | 70 "/usr/local/etc/") |
71 "The directory where the idl_html_help/ dir lives. Obsolete for IDL | 71 "The directory where the idl_html_help/ dir lives. Obsolete for IDL |
72 6.2 or later (see idlwave-html-system-help-location)." | 72 6.2 or later (see `idlwave-html-system-help-location')." |
73 :group 'idlwave-online-help | 73 :group 'idlwave-online-help |
74 :type 'directory) | 74 :type 'directory) |
75 | 75 |
76 (defvar idlwave-help-use-hh nil | 76 (defvar idlwave-help-use-hh nil |
77 "Obsolete variable.") | 77 "Obsolete variable.") |
80 "Whether to use the IDL Assistant as the help browser." | 80 "Whether to use the IDL Assistant as the help browser." |
81 :group 'idlwave-online-help | 81 :group 'idlwave-online-help |
82 :type 'boolean) | 82 :type 'boolean) |
83 | 83 |
84 (defcustom idlwave-help-browser-function browse-url-browser-function | 84 (defcustom idlwave-help-browser-function browse-url-browser-function |
85 "Function to use to display html help. | 85 "Function to use to display HTML help. |
86 Defaults to `browse-url-browser-function', which see." | 86 Defaults to `browse-url-browser-function', which see." |
87 :group 'idlwave-online-help | 87 :group 'idlwave-online-help |
88 :type 'function) | 88 :type 'function) |
89 | 89 |
90 (defcustom idlwave-help-browser-generic-program browse-url-generic-program | 90 (defcustom idlwave-help-browser-generic-program browse-url-generic-program |
91 "Program to run if using browse-url-generic-program." | 91 "Program to run if using `browse-url-generic-program'." |
92 :group 'idlwave-online-help | 92 :group 'idlwave-online-help |
93 :type 'string) | 93 :type 'string) |
94 | 94 |
95 (defvar browse-url-generic-args) | 95 (defvar browse-url-generic-args) |
96 | 96 |
97 (defcustom idlwave-help-browser-generic-args | 97 (defcustom idlwave-help-browser-generic-args |
98 (if (boundp 'browse-url-generic-args) | 98 (if (boundp 'browse-url-generic-args) |
99 browse-url-generic-args "") | 99 browse-url-generic-args "") |
100 "Program args to use if using browse-url-generic-program." | 100 "Program args to use if using `browse-url-generic-program'." |
101 :group 'idlwave-online-help | 101 :group 'idlwave-online-help |
102 :type 'string) | 102 :type 'string) |
103 | 103 |
104 (defcustom idlwave-help-browser-is-local nil | 104 (defcustom idlwave-help-browser-is-local nil |
105 "Whether the browser will display locally in an Emacs window. | 105 "Whether the browser will display locally in an Emacs window. |
110 `idlwave-help-use-dedicated-frame' to function." | 110 `idlwave-help-use-dedicated-frame' to function." |
111 :group 'idlwave-online-help | 111 :group 'idlwave-online-help |
112 :type 'boolean) | 112 :type 'boolean) |
113 | 113 |
114 (defvar idlwave-help-directory "" | 114 (defvar idlwave-help-directory "" |
115 "Obsolete variable. See idlwave-html-help-location.") | 115 "Obsolete variable. See `idlwave-html-help-location'.") |
116 | 116 |
117 (defcustom idlwave-help-use-dedicated-frame t | 117 (defcustom idlwave-help-use-dedicated-frame t |
118 "*Non-nil means, use a separate frame for Online Help if possible." | 118 "*Non-nil means, use a separate frame for Online Help if possible." |
119 :group 'idlwave-online-help | 119 :group 'idlwave-online-help |
120 :type 'boolean) | 120 :type 'boolean) |
208 "The frame for display of IDL online help.") | 208 "The frame for display of IDL online help.") |
209 (defvar idlwave-help-frame-width 102 | 209 (defvar idlwave-help-frame-width 102 |
210 "The default width of the help frame.") | 210 "The default width of the help frame.") |
211 | 211 |
212 (defvar idlwave-html-help-is-available nil | 212 (defvar idlwave-html-help-is-available nil |
213 "Is the system online help text avaiable?") | 213 "Is the system online help text available?") |
214 | 214 |
215 (defvar idlwave-help-mode-line-indicator "" | 215 (defvar idlwave-help-mode-line-indicator "" |
216 "Used for the special mode line in the idlwave-help-mode.") | 216 "Used for the special mode line in the `idlwave-help-mode'.") |
217 | 217 |
218 (defvar idlwave-help-window-configuration nil) | 218 (defvar idlwave-help-window-configuration nil) |
219 (defvar idlwave-help-special-topic-words nil) ; defined by get_rinfo | 219 (defvar idlwave-help-special-topic-words nil) ; defined by get_rinfo |
220 | 220 |
221 ;; Define the key bindings for the Help application | 221 ;; Define the key bindings for the Help application |
222 | 222 |
223 (defvar idlwave-help-mode-map (make-sparse-keymap) | 223 (defvar idlwave-help-mode-map (make-sparse-keymap) |
224 "The keymap used in idlwave-help-mode.") | 224 "The keymap used in `idlwave-help-mode'.") |
225 | 225 |
226 (define-key idlwave-help-mode-map "q" 'idlwave-help-quit) | 226 (define-key idlwave-help-mode-map "q" 'idlwave-help-quit) |
227 (define-key idlwave-help-mode-map "w" 'widen) | 227 (define-key idlwave-help-mode-map "w" 'widen) |
228 (define-key idlwave-help-mode-map "\C-m" (lambda (arg) | 228 (define-key idlwave-help-mode-map "\C-m" (lambda (arg) |
229 (interactive "p") | 229 (interactive "p") |
301 When the hep text is a source file, the following commands are available | 301 When the hep text is a source file, the following commands are available |
302 | 302 |
303 Fontification: [F]ontify the buffer like source code | 303 Fontification: [F]ontify the buffer like source code |
304 Jump: [h] to function doclib header | 304 Jump: [h] to function doclib header |
305 [H] to file doclib header | 305 [H] to file doclib header |
306 [.] back and forward between header and definition | 306 [.] back and forth between header and definition |
307 | 307 |
308 Here are all keybindings. | 308 Here are all keybindings. |
309 \\{idlwave-help-mode-map}" | 309 \\{idlwave-help-mode-map}" |
310 (kill-all-local-variables) | 310 (kill-all-local-variables) |
311 (buffer-disable-undo) | 311 (buffer-disable-undo) |
365 (defvar idlwave-current-obj_new-class) | 365 (defvar idlwave-current-obj_new-class) |
366 (defvar idlwave-help-diagnostics) | 366 (defvar idlwave-help-diagnostics) |
367 (defvar idlwave-experimental) | 367 (defvar idlwave-experimental) |
368 (defvar idlwave-last-context-help-pos) | 368 (defvar idlwave-last-context-help-pos) |
369 (defun idlwave-do-context-help (&optional arg) | 369 (defun idlwave-do-context-help (&optional arg) |
370 "Wrapper around the call to idlwave-context-help1. | 370 "Wrapper around the call to `idlwave-do-context-help1'. |
371 It collects and prints the diagnostics messages." | 371 It collects and prints the diagnostics messages." |
372 (let ((marker (list (current-buffer) (point))) | 372 (let ((marker (list (current-buffer) (point))) |
373 (idlwave-help-diagnostics nil)) | 373 (idlwave-help-diagnostics nil)) |
374 ;; Check for frame switching. When the command is invoked twice | 374 ;; Check for frame switching. When the command is invoked twice |
375 ;; at the same position, we try to switch to the help frame | 375 ;; at the same position, we try to switch to the help frame |
764 | 764 |
765 (defun idlwave-online-help (link &optional name type class keyword) | 765 (defun idlwave-online-help (link &optional name type class keyword) |
766 "Display HTML or other special help on a certain topic. | 766 "Display HTML or other special help on a certain topic. |
767 Either loads an HTML link, if LINK is non-nil, or gets special-help on | 767 Either loads an HTML link, if LINK is non-nil, or gets special-help on |
768 the optional arguments, if any special help is defined. If LINK is | 768 the optional arguments, if any special help is defined. If LINK is |
769 `t', first look up the optional arguments in the routine info list to | 769 t, first look up the optional arguments in the routine info list to |
770 see if a link is set for it. Try extra help functions if necessary." | 770 see if a link is set for it. Try extra help functions if necessary." |
771 ;; Lookup link | 771 ;; Lookup link |
772 (if (eq link t) | 772 (if (eq link t) |
773 (let ((entry (idlwave-best-rinfo-assoc name type class | 773 (let ((entry (idlwave-best-rinfo-assoc name type class |
774 (idlwave-routines) nil t))) | 774 (idlwave-routines) nil t))) |
815 (idlwave-help-display-help-window help-pos) | 815 (idlwave-help-display-help-window help-pos) |
816 (idlwave-help-error name type class keyword)) | 816 (idlwave-help-error name type class keyword)) |
817 (select-window cw))) | 817 (select-window cw))) |
818 | 818 |
819 (defun idlwave-help-html-link (link) | 819 (defun idlwave-help-html-link (link) |
820 "Get html help on a given LINK." | 820 "Get HTML help on a given LINK." |
821 (let ((browse-url-browser-function idlwave-help-browser-function) | 821 (let ((browse-url-browser-function idlwave-help-browser-function) |
822 (help-loc (idlwave-html-help-location)) | 822 (help-loc (idlwave-html-help-location)) |
823 (browse-url-generic-program idlwave-help-browser-generic-program) | 823 (browse-url-generic-program idlwave-help-browser-generic-program) |
824 ;(browse-url-generic-args idlwave-help-browser-generic-args) | 824 ;(browse-url-generic-args idlwave-help-browser-generic-args) |
825 full-link) | 825 full-link) |
845 (defvar idlwave-help-fontify-source-code) | 845 (defvar idlwave-help-fontify-source-code) |
846 (defvar idlwave-help-source-try-header) | 846 (defvar idlwave-help-source-try-header) |
847 (defvar idlwave-current-tags-buffer) | 847 (defvar idlwave-current-tags-buffer) |
848 (defvar idlwave-current-tags-class) | 848 (defvar idlwave-current-tags-class) |
849 (defun idlwave-help-with-source (name type class keyword) | 849 (defun idlwave-help-with-source (name type class keyword) |
850 "Provide help for routines not documented in the IDL manuals. Works | 850 "Provide help for routines not documented in the IDL manuals. |
851 by loading the routine source file into the help buffer. Depending on | 851 Works by loading the routine source file into the help buffer. |
852 the value of `idlwave-help-source-try-header', it attempts to show the | 852 Depending on the value of `idlwave-help-source-try-header', it |
853 routine definition or the header description. If | 853 attempts to show the routine definition or the header description. |
854 `idlwave-help-do-class-struct-tag' is non-nil, keyword is a tag to | 854 If `idlwave-help-do-class-struct-tag' is non-nil, keyword is a tag |
855 show help on from the class definition structure. If | 855 to show help on from the class definition structure. |
856 `idlwave-help-do-struct-tag' is non-nil, show help from the matching | 856 If `idlwave-help-do-struct-tag' is non-nil, show help from the |
857 structure tag definition. | 857 matching structure tag definition. |
858 | 858 |
859 This function can be used as `idlwave-extra-help-function'." | 859 This function can be used as `idlwave-extra-help-function'." |
860 (let* ((class-struct-tag idlwave-help-do-class-struct-tag) | 860 (let* ((class-struct-tag idlwave-help-do-class-struct-tag) |
861 (struct-tag idlwave-help-do-struct-tag) | 861 (struct-tag idlwave-help-do-struct-tag) |
862 (case-fold-search t) | 862 (case-fold-search t) |
951 (point))) | 951 (point))) |
952 | 952 |
953 | 953 |
954 (defun idlwave-help-find-routine-definition (name type class keyword) | 954 (defun idlwave-help-find-routine-definition (name type class keyword) |
955 "Find the definition of routine CLASS::NAME in current buffer. | 955 "Find the definition of routine CLASS::NAME in current buffer. |
956 KEYWORD is ignored. Returns the point of match if successful, nil otherwise." | 956 Returns the point of match if successful, nil otherwise. |
957 KEYWORD is ignored." | |
957 (save-excursion | 958 (save-excursion |
958 (goto-char (point-max)) | 959 (goto-char (point-max)) |
959 (if (re-search-backward | 960 (if (re-search-backward |
960 (concat "^[ \t]*" | 961 (concat "^[ \t]*" |
961 (if (eq type 'pro) "pro" | 962 (if (eq type 'pro) "pro" |
1197 (if idlwave-html-help-location | 1198 (if idlwave-html-help-location |
1198 "" | 1199 "" |
1199 "(help location unknown)"))) | 1200 "(help location unknown)"))) |
1200 | 1201 |
1201 (defun idlwave-help-show-help-frame () | 1202 (defun idlwave-help-show-help-frame () |
1202 "Show the help frame, creating it if necessary" | 1203 "Show the help frame, creating it if necessary." |
1203 ;; Use a special frame for this | 1204 ;; Use a special frame for this |
1204 (unless (frame-live-p idlwave-help-frame) | 1205 (unless (frame-live-p idlwave-help-frame) |
1205 (setq idlwave-help-frame | 1206 (setq idlwave-help-frame |
1206 (make-frame idlwave-help-frame-parameters)) | 1207 (make-frame idlwave-help-frame-parameters)) |
1207 ;; Strip menubar (?) and toolbar from the Help frame. | 1208 ;; Strip menubar (?) and toolbar from the Help frame. |
1252 ;; we must pass the -profile argument as well. | 1253 ;; we must pass the -profile argument as well. |
1253 (defvar idlwave-help-assistant-command | 1254 (defvar idlwave-help-assistant-command |
1254 (if (memq system-type '(ms-dos windows-nt)) | 1255 (if (memq system-type '(ms-dos windows-nt)) |
1255 "bin/bin.x86/idl_assistant.exe" | 1256 "bin/bin.x86/idl_assistant.exe" |
1256 "bin/idl_assistant") | 1257 "bin/idl_assistant") |
1257 "The command, rooted at idlwave-system-directory, which invokes the | 1258 "The command, rooted at `idlwave-system-directory', which invokes the |
1258 IDL assistant.") | 1259 IDL assistant.") |
1259 | 1260 |
1260 (defun idlwave-help-assistant-available () | 1261 (defun idlwave-help-assistant-available () |
1261 (if idlwave-help-assistant-available | 1262 (if idlwave-help-assistant-available |
1262 (eq idlwave-help-assistant-available t) | 1263 (eq idlwave-help-assistant-available t) |
1291 (lambda (proc string) | 1292 (lambda (proc string) |
1292 (setq port (string-to-number string)))) | 1293 (setq port (string-to-number string)))) |
1293 (unless (accept-process-output idlwave-help-assistant-process 15) | 1294 (unless (accept-process-output idlwave-help-assistant-process 15) |
1294 (error "Failed binding IDL_ASSISTANT socket")) | 1295 (error "Failed binding IDL_ASSISTANT socket")) |
1295 (if (not port) | 1296 (if (not port) |
1296 (error "Unable to open IDL_ASSISTANT.") | 1297 (error "Unable to open IDL_ASSISTANT") |
1297 (set-process-filter idlwave-help-assistant-process nil) | 1298 (set-process-filter idlwave-help-assistant-process nil) |
1298 (setq idlwave-help-assistant-socket | 1299 (setq idlwave-help-assistant-socket |
1299 (open-network-stream "IDL_ASSISTANT_SOCK" | 1300 (open-network-stream "IDL_ASSISTANT_SOCK" |
1300 nil "localhost" port)) | 1301 nil "localhost" port)) |
1301 (if (eq (process-status idlwave-help-assistant-socket) 'open) | 1302 (if (eq (process-status idlwave-help-assistant-socket) 'open) |