• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/progmodes/

Lines Matching +defs:idlwave +defs:in +defs:quote

0 ;; idlwave.el --- IDL editing mode for GNU Emacs
20 ;; GNU Emacs is distributed in the hope that it will be useful,
44 ;; See the mode description ("C-h m" in idlwave-mode or "C-h f idlwave-mode")
46 ;; Also, Info format documentation is available with `M-x idlwave-info'
50 ;; http://idlwave.org
55 ;; Follow the instructions in the INSTALL file of the distribution.
59 ;; (autoload 'idlwave-mode "idlwave" "IDLWAVE Mode" t)
60 ;; (autoload 'idlwave-shell "idlw-shell" "IDLWAVE Shell" t)
61 ;; (setq auto-mode-alist (cons '("\\.pro\\'" . idlwave-mode) auto-mode-alist))
70 ;; http://idlwave.org
75 ;; IDLWAVE is documented online in info format. A printable version
107 ;; idlwave-customize'.
110 ;; code in .emacs. For an example of what to put into .emacs, check
120 ;; even have "WAVE" in its title, but it's catchy, and was required
123 ;; Moving the point backwards in conjunction with abbrev expansion
129 ;; using a temporary function in `post-command-hook' - not pretty,
134 ;; replaced by spaces in the text surrounding the paragraph, which
137 ;; paragraph is filled via `idlwave-fill-paragraph'.
186 (defgroup idlwave nil
190 "http://idlwave.org")
191 :link '(emacs-commentary-link :tag "Commentary in idlw-shell.el"
193 :link '(emacs-commentary-link :tag "Commentary in idlwave.el" "idlwave.el")
194 :link '(custom-manual "(idlwave)Top")
195 :prefix "idlwave"
201 (defgroup idlwave-code-formatting nil
203 :group 'idlwave)
205 (defcustom idlwave-main-block-indent 2
209 :group 'idlwave-code-formatting
212 (defcustom idlwave-block-indent 3
214 If you change this, you probably also want to change `idlwave-end-offset'."
215 :group 'idlwave-code-formatting
218 (defcustom idlwave-end-offset -3
220 A value equal to negative `idlwave-block-indent' will make END lines
222 :group 'idlwave-code-formatting
225 (defcustom idlwave-continuation-indent 3
229 :group 'idlwave-code-formatting
232 (defcustom idlwave-max-extra-continuation-indent 40
235 lines in routine calls or definitions, other statements with
240 indentation, or to a large number (like 100) to enable it in all
241 cases. See also `idlwave-indent-to-open-paren', which can override
243 :group 'idlwave-code-formatting
246 (defcustom idlwave-indent-to-open-paren t
249 `idlwave-max-extra-continuation-indent'. Matching parens and the
267 :group 'idlwave-code-formatting
270 (defcustom idlwave-indent-parens-nested nil
273 :group 'idlwave-code-formatting
277 (defcustom idlwave-hanging-indent t
279 hanging indent given by `idlwave-hang-indent-regexp' match in the first line
281 :group 'idlwave-code-formatting
284 (defcustom idlwave-hang-indent-regexp "- "
286 in the first line of a comment paragraph. The size of the indent
288 :group 'idlwave-code-formatting
291 (defcustom idlwave-use-last-hang-indent nil
292 "*If non-nil then use last match on line for `idlwave-indent-regexp'."
293 :group 'idlwave-code-formatting
296 (defcustom idlwave-fill-comment-line-only t
298 :group 'idlwave-code-formatting
301 (defcustom idlwave-auto-fill-split-string t
307 This variable is ignored when `idlwave-fill-comment-line-only' is
308 non-nil, since in this case code is not auto-filled."
309 :group 'idlwave-code-formatting
312 (defcustom idlwave-split-line-string t
313 "*If non-nil then `idlwave-split-line' will split strings with `+'.
317 :group 'idlwave-code-formatting
320 (defcustom idlwave-no-change-comment ";;;"
324 :group 'idlwave-code-formatting
327 (defcustom idlwave-begin-line-comment nil
333 :group 'idlwave-code-formatting
337 (defcustom idlwave-code-comment ";;[^;]"
341 :group 'idlwave-code-formatting
349 (defgroup idlwave-routine-info nil
351 :group 'idlwave)
353 (defcustom idlwave-use-library-catalogs t
360 :group 'idlwave-routine-info
363 (defcustom idlwave-init-rinfo-when-idle-after 10
365 initialized. Initializing the routine info can take a long time, in
369 five steps, in order to keep work interruption as short as possible.
370 If one of the steps finishes, and no user input has arrived in the
373 take in your setup. So if you have a fast machine and no problems
378 :group 'idlwave-routine-info
381 (defcustom idlwave-scan-all-buffers-for-routine-info t
383 The scanning is done by the command `idlwave-update-routine-info'.
387 t Scan all idlwave-mode buffers in the current editing session.
389 :group 'idlwave-routine-info
395 (defcustom idlwave-query-shell-for-routine-info t
400 :group 'idlwave-routine-info
403 (defcustom idlwave-auto-routine-info-updates
413 compile-buffer Update shell info after `idlwave-shell-save-and...'"
414 :group 'idlwave-routine-info
424 (defcustom idlwave-rinfo-max-source-lines 5
425 "*Maximum number of source files displayed in the Routine Info window.
428 :group 'idlwave-routine-info
431 (defcustom idlwave-library-path nil
442 `idlwave-system-directory'."
443 :group 'idlwave-routine-info
446 (defcustom idlwave-system-directory ""
448 UNIX. Set this to the value of the `!DIR' system variable in IDL.
452 in this directory. On UNIX systems, IDLWAVE queries the shell for the
453 value of `!DIR'. See also `idlwave-library-path'."
454 :group 'idlwave-routine-info
458 (defcustom idlwave-config-directory
459 (convert-standard-filename "~/.idlwave")
461 :group 'idlwave-routine-info
464 (defvar idlwave-user-catalog-file "idlusercat.el")
465 (defvar idlwave-xml-system-rinfo-converted-file "idl_xml_rinfo.el")
466 (defvar idlwave-path-file "idlpath.el")
468 (defvar idlwave-libinfo-file nil
471 (defcustom idlwave-special-lib-alist nil
475 for routines in the system library `!DIR/lib' and `Library' for anything
480 :group 'idlwave-routine-info
484 (defcustom idlwave-auto-write-paths t
490 :group 'idlwave-routine-info
493 (defgroup idlwave-completion nil
495 :prefix "idlwave"
496 :group 'idlwave)
499 (defconst idlwave-tmp
507 (defcustom idlwave-completion-case '((routine . upcase)
527 case of characters in a string.
530 identical to the way it was written in the definition statement of the
531 routine. This was implemented to allow for mixed-case completion, in
533 If a completable word is defined in multiple locations, the meaning of
539 Note that a lowercase-only string in the buffer will always be completed in
540 lower case (but see the variable `idlwave-completion-force-default-case').
544 :group 'idlwave-completion
547 ,idlwave-tmp)))
549 (defcustom idlwave-completion-force-default-case nil
550 "*Non-nil means, completion will always honor `idlwave-completion-case'.
552 will honor the default settings in `idlwave-completion-case', while
553 the completion of lower case strings will be completed entirely in
555 :group 'idlwave-completion
558 (defcustom idlwave-complete-empty-string-as-lower-case nil
560 The case of what is already in the buffer determines the case of completions.
564 :group 'idlwave-completion
567 (defvar idlwave-default-completion-case-is-down nil
568 "Obsolete variable. See `idlwave-complete-empty-string-as-lower-case' and
569 `idlwave-completion-case'.")
571 (defcustom idlwave-buffer-case-takes-precedence nil
572 "*Non-nil means, the case of tokens in buffers dominates over system stuff.
575 The default is to consider the case given in the system and library files
577 :group 'idlwave-completion
580 (defcustom idlwave-highlight-help-links-in-completion t
584 :group 'idlwave-completion
587 (defcustom idlwave-support-inheritance t
591 :group 'idlwave-routine-info
594 (defcustom idlwave-keyword-class-inheritance '("^[gs]etproperty$" "^init$")
601 :group 'idlwave-routine-info
605 (defcustom idlwave-completion-show-classes 1
618 item is displayed in the echo area. If the value of this variable is a
620 :group 'idlwave-completion
624 (defcustom idlwave-completion-fontify-classes t
625 "*Non-nil means, fontify the classes in completions buffer.
627 class info listed. See `idlwave-completion-show-classes'."
628 :group 'idlwave-completion
631 (defcustom idlwave-query-class '((method-default . nil)
640 `idlwave-shell-query-for-class'):
645 a keyword, all keywords allowed for this method in any class are
650 `idlwave-completion-show-classes'.
654 property on the object operator `->'. For a given object in the
659 explicitly with the variable `idlwave-store-inquired-class'.
672 :group 'idlwave-completion
684 (defcustom idlwave-store-inquired-class t
688 `idlwave-routine-info' and `idlwave-complete', depending upon the
689 value of the variable `idlwave-query-class'.
692 property on the `->' arrow in the source code, so that during the same
695 The class stored can be checked and removed with `\\[idlwave-routine-info]'
703 `idlwave-class-arrow-face'. The command \\[idlwave-routine-info]
706 :group 'idlwave-completion
709 (defcustom idlwave-class-arrow-face 'bold
712 \(see variable `idlwave-store-inquired-class', it highlights the arrow
713 with this font in order to remind the user that this arrow is special."
714 :group 'idlwave-completion
717 (defcustom idlwave-resize-routine-help-window t
719 :group 'idlwave-completion
722 (defcustom idlwave-keyword-completion-adds-equal t
724 :group 'idlwave-completion
727 (defcustom idlwave-function-completion-adds-paren t
732 :group 'idlwave-completion
737 (defcustom idlwave-completion-restore-window-configuration t
742 :group 'idlwave-completion
747 (defgroup idlwave-abbrev-and-indent-action nil
749 The variables in this group govern this."
750 :group 'idlwave)
752 (defcustom idlwave-do-actions nil
754 The actions that can be performed are listed in `idlwave-indent-action-table'."
755 :group 'idlwave-abbrev-and-indent-action
758 (defcustom idlwave-abbrev-start-char "\\"
759 "*A single character string used to start abbreviations in abbrev mode.
762 field names act like abbrevs in certain circumstances.
764 Changes to this in `idlwave-mode-hook' will have no effect. Instead a user
765 must set it directly using `setq' in the .emacs file before idlwave.el
767 :group 'idlwave-abbrev-and-indent-action
770 (defcustom idlwave-surround-by-blank nil
771 "*Non-nil means, enable `idlwave-surround'.
773 `idlwave-surround'.
774 See help for `idlwave-indent-action-table' for symbols using `idlwave-surround'.
776 Also see the default key bindings for keys using `idlwave-surround'.
777 Keys are bound and made into actions calling `idlwave-surround' with
778 `idlwave-action-and-binding'.
779 See help for `idlwave-action-and-binding' for examples.
781 Also see help for `idlwave-surround'."
782 :group 'idlwave-abbrev-and-indent-action
785 (defcustom idlwave-pad-keyword t
786 "*Non-nil means pad '=' in keywords (routine calls or defs) like assignment.
787 Whenever `idlwave-surround' is non-nil then this affects how '=' is
791 :group 'idlwave-abbrev-and-indent-action
797 (defcustom idlwave-show-block t
798 "*Non-nil means point blinks to block beginning for `idlwave-show-begin'."
799 :group 'idlwave-abbrev-and-indent-action
802 (defcustom idlwave-expand-generic-end nil
804 :group 'idlwave-abbrev-and-indent-action
807 (defcustom idlwave-reindent-end t
809 :group 'idlwave-abbrev-and-indent-action
812 (defcustom idlwave-abbrev-move t
814 Set to nil by `idlwave-expand-region-abbrevs'. To see the abbrev
819 See `idlwave-check-abbrev'."
820 :group 'idlwave-abbrev-and-indent-action
823 (defcustom idlwave-abbrev-change-case nil
828 If `idlwave-reserved-word-upcase' is non-nil, reserved words will always be
830 :group 'idlwave-abbrev-and-indent-action
833 (defcustom idlwave-reserved-word-upcase nil
835 If nil case of reserved words is controlled by `idlwave-abbrev-change-case'.
836 Has effect only if in abbrev-mode."
837 :group 'idlwave-abbrev-and-indent-action
843 ;; can be modified/set in idlwave-mode-hook, but it is easier to use
844 ;; idlwave-action-and-binding. See help for idlwave-action-and-binding for
847 ;; The action table is used by `idlwave-indent-line' whereas both the
848 ;; action and expand tables are used by `idlwave-indent-and-action'. In
850 ;; indented. Whereas, in addition to being used when the expand table
857 ;; (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)
860 ;; (idlwave-action-and-binding "\\<\\(pro\\|function\\)\\>[ \t]*\\<"
864 ;; (idlwave-action-and-binding "\\<common\\>[ \t]+\\<"
867 ;; (idlwave-action-and-binding (concat "^[ \t]*" idlwave-label)
870 (defvar idlwave-indent-action-table nil
872 and function as a cdr. This table is used by `idlwave-indent-line'.
873 See documentation for `idlwave-do-action' for a complete description of
876 Additions to the table are made with `idlwave-action-and-binding' when a
878 See help on `idlwave-action-and-binding' for examples.")
880 (defvar idlwave-indent-expand-table nil
883 `idlwave-indent-and-action' function. See documentation for
884 `idlwave-do-action' for a complete description of the action lists.
886 Additions to the table are made with `idlwave-action-and-binding' when a
888 See help on `idlwave-action-and-binding' for examples.")
892 (defgroup idlwave-documentation nil
894 :group 'idlwave)
897 (defvar idlwave-file-header
964 lib_template.pro file included in the IDL distribution.")
966 (defcustom idlwave-header-to-beginning-of-file t
969 the current routine and the code, allowing several routine headers in
971 :group 'idlwave-documentation
974 (defcustom idlwave-timestamp-hook 'idlwave-default-insert-timestamp
976 :group 'idlwave-documentation
979 (defcustom idlwave-doc-modifications-keyword "HISTORY"
984 :group 'idlwave-documentation
987 (defcustom idlwave-doclib-start "^;+\\+"
989 :group 'idlwave-documentation
992 (defcustom idlwave-doclib-end "^;+-"
994 :group 'idlwave-documentation
999 (defgroup idlwave-external-programs nil
1001 :group 'idlwave)
1003 (defcustom idlwave-shell-explicit-file-name "idl"
1007 for the idl program, use `idlwave-shell-command-line-options'.
1011 :group 'idlwave-external-programs
1014 (defcustom idlwave-shell-command-line-options nil
1024 :group 'idlwave-external-programs)
1026 (defcustom idlwave-help-application "idlhelp"
1029 :group 'idlwave-external-programs
1034 (defcustom idlwave-shell-debug-modifiers '()
1036 Will be used to bind debugging commands in the shell buffer and in all
1042 :group 'idlwave-shell-general-setup
1051 (defcustom idlwave-shell-automatic-start nil
1052 "*If non-nil attempt invoke idlwave-shell if not already running.
1055 :group 'idlwave-shell-general-setup
1060 (defgroup idlwave-misc nil
1063 :group 'idlwave)
1065 (defcustom idlwave-startup-message t
1066 "*Non-nil displays a startup message when `idlwave-mode' is first called."
1067 :group 'idlwave-misc
1070 (defcustom idlwave-default-font-lock-items
1071 '(pros-and-functions batch-files idlwave-idl-keywords label goto
1081 idlwave-idl-keywords IDL Keywords
1085 keyword-parameters Keyword Parameters in routine definitions and calls
1087 fixme FIXME: Warning in comments (on XEmacs only v. 21.0 and up)
1089 :group 'idlwave-misc
1094 (const :tag "IDL Keywords (reserved words)" idlwave-idl-keywords)
1097 (const :tag "Tags in Structure Definition" structtag)
1105 (defcustom idlwave-mode-hook nil
1106 "Normal hook. Executed when a buffer is put into `idlwave-mode'."
1107 :group 'idlwave-misc
1110 (defcustom idlwave-load-hook nil
1111 "Normal hook. Executed when idlwave.el is loaded."
1112 :group 'idlwave-misc
1115 (defvar idlwave-experimental nil
1131 ;; The following are the reserved words in IDL. Maybe we should
1134 (defvar idlwave-idl-keywords
1196 ;; Tags in structure definitions. Note that this definition
1211 ;; fontification. Slow, use it only in fancy fontification.
1229 ;; Arrows with text property `idlwave-class'
1231 '(idlwave-match-class-arrows (0 idlwave-class-arrow-face))))
1233 (defconst idlwave-font-lock-keywords-1
1237 (defconst idlwave-font-lock-keywords-2
1238 (mapcar 'symbol-value idlwave-default-font-lock-items)
1241 (defconst idlwave-font-lock-keywords-3
1244 idlwave-idl-keywords
1254 (defun idlwave-match-class-arrows (limit)
1256 (and idlwave-store-inquired-class
1258 (get-text-property (match-beginning 0) 'idlwave-class)))
1260 (defvar idlwave-font-lock-keywords idlwave-font-lock-keywords-2
1261 "Default expressions to highlight in IDLWAVE mode.")
1263 (defvar idlwave-font-lock-defaults
1264 '((idlwave-font-lock-keywords
1265 idlwave-font-lock-keywords-1
1266 idlwave-font-lock-keywords-2
1267 idlwave-font-lock-keywords-3)
1272 (put 'idlwave-mode 'font-lock-defaults
1273 idlwave-font-lock-defaults) ; XEmacs
1275 (defconst idlwave-comment-line-start-skip "^[ \t]*;"
1280 (defconst idlwave-begin-block-reg
1283 not matter. The search skips matches in comments.")
1285 (defconst idlwave-begin-unit-reg "^\\s-*\\(pro\\|function\\)\\>\\|\\`"
1289 (defconst idlwave-end-unit-reg "^\\s-*\\(pro\\|function\\)\\>\\|\\'"
1292 not matter. The search skips matches in comments.")
1294 (defconst idlwave-continue-line-reg "\\<\\$"
1297 (defconst idlwave-end-block-reg
1300 not matter. The search skips matches found in comments.")
1302 (defconst idlwave-block-matches
1319 (defconst idlwave-block-match-regexp
1323 `idlwave-block-matches'")
1325 (defconst idlwave-identifier "[a-zA-Z_][a-zA-Z0-9$_]*"
1328 (defconst idlwave-sysvar (concat "!" idlwave-identifier)
1331 (defconst idlwave-variable (concat idlwave-identifier "\\|" idlwave-sysvar)
1334 (defconst idlwave-label (concat idlwave-identifier ":")
1337 (defconst idlwave-method-call (concat idlwave-identifier "\\s *->"
1338 "\\(\\s *" idlwave-identifier "::\\)?"
1341 (defconst idlwave-statement-match
1347 (cons 'end (list idlwave-end-block-reg nil))
1357 (cons 'call (list (concat "\\(" idlwave-variable "\\) *= *"
1358 "\\(" idlwave-method-call "\\s *\\)?"
1359 idlwave-identifier
1362 "\\(" idlwave-method-call "\\s *\\)?"
1363 idlwave-identifier
1366 "\\(" idlwave-variable "\\) *=") nil)))
1381 (defvar idlwave-fill-function 'auto-fill-function
1384 (defvar idlwave-comment-indent-function 'comment-indent-function
1387 ;; Note that this is documented in the v18 manuals as being a string
1389 ;; The code in this file accepts either format for compatibility.
1390 (defvar idlwave-comment-indent-char ?\
1394 (defconst idlwave-continuation-char ?$
1396 \\[idlwave-split-line] to begin a continuation line. Normally $.")
1398 (defconst idlwave-mode-version "6.1_em22")
1400 (defmacro idlwave-keyword-abbrev (&rest args)
1401 "Creates a function for abbrev hooks to call `idlwave-check-abbrev' with args."
1402 `(quote (lambda ()
1403 ,(append '(idlwave-check-abbrev) args))))
1405 ;; If I take the time I can replace idlwave-keyword-abbrev with
1406 ;; idlwave-code-abbrev and remove the quoted abbrev check from
1407 ;; idlwave-check-abbrev. Then, e.g, (idlwave-keyword-abbrev 0 t) becomes
1408 ;; (idlwave-code-abbrev idlwave-check-abbrev 0 t). In fact I should change
1409 ;; the name of idlwave-check-abbrev to something like idlwave-modify-abbrev.
1411 (defmacro idlwave-code-abbrev (&rest args)
1413 Specifically, if the abbrev is in a comment or string it is unexpanded.
1415 `(quote (lambda ()
1416 ,(prin1-to-string args) ;; Puts the code in the doc string
1417 (if (idlwave-quoted)
1421 (defvar idlwave-mode-map (make-sparse-keymap)
1422 "Keymap used in IDL mode.")
1424 (defvar idlwave-mode-syntax-table (make-syntax-table)
1425 "Syntax table in use in `idlwave-mode' buffers.")
1427 (modify-syntax-entry ?+ "." idlwave-mode-syntax-table)
1428 (modify-syntax-entry ?- "." idlwave-mode-syntax-table)
1429 (modify-syntax-entry ?* "." idlwave-mode-syntax-table)
1430 (modify-syntax-entry ?/ "." idlwave-mode-syntax-table)
1431 (modify-syntax-entry ?^ "." idlwave-mode-syntax-table)
1432 (modify-syntax-entry ?# "." idlwave-mode-syntax-table)
1433 (modify-syntax-entry ?= "." idlwave-mode-syntax-table)
1434 (modify-syntax-entry ?% "." idlwave-mode-syntax-table)
1435 (modify-syntax-entry ?< "." idlwave-mode-syntax-table)
1436 (modify-syntax-entry ?> "." idlwave-mode-syntax-table)
1437 (modify-syntax-entry ?\' "\"" idlwave-mode-syntax-table)
1438 (modify-syntax-entry ?\" "\"" idlwave-mode-syntax-table)
1439 (modify-syntax-entry ?\\ "." idlwave-mode-syntax-table)
1440 (modify-syntax-entry ?_ "_" idlwave-mode-syntax-table)
1441 (modify-syntax-entry ?{ "(}" idlwave-mode-syntax-table)
1442 (modify-syntax-entry ?} "){" idlwave-mode-syntax-table)
1443 (modify-syntax-entry ?$ "_" idlwave-mode-syntax-table)
1444 (modify-syntax-entry ?. "." idlwave-mode-syntax-table)
1445 (modify-syntax-entry ?\; "<" idlwave-mode-syntax-table)
1446 (modify-syntax-entry ?\n ">" idlwave-mode-syntax-table)
1447 (modify-syntax-entry ?\f ">" idlwave-mode-syntax-table)
1449 (defvar idlwave-find-symbol-syntax-table
1450 (copy-syntax-table idlwave-mode-syntax-table)
1453 (modify-syntax-entry ?$ "w" idlwave-find-symbol-syntax-table)
1454 (modify-syntax-entry ?_ "w" idlwave-find-symbol-syntax-table)
1455 (modify-syntax-entry ?! "w" idlwave-find-symbol-syntax-table)
1456 (modify-syntax-entry ?. "w" idlwave-find-symbol-syntax-table)
1458 (defmacro idlwave-with-special-syntax (&rest body)
1463 (set-syntax-table idlwave-find-symbol-syntax-table)
1467 ;(defmacro idlwave-with-special-syntax1 (&rest body)
1472 ; (set-syntax-table idlwave-find-symbol-syntax-table)
1476 (defun idlwave-action-and-binding (key cmd &optional select)
1480 KEY in `idlwave-mode-map' by defining an anonymous function calling
1484 \(KEY . CMD\) is also placed in the `idlwave-indent-expand-table',
1486 will instead be placed in `idlwave-indent-action-table'.
1496 (idlwave-action-and-binding \",\" '(idlwave-surround 0 1))
1497 A minimum of 1 space before and after `=' (see `idlwave-expand-equal').
1498 (idlwave-action-and-binding \"=\" '(idlwave-expand-equal -1 -1))
1500 (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)"
1503 (let* ((table (if select 'idlwave-indent-action-table
1504 'idlwave-indent-expand-table))
1505 (table-key (regexp-quote key))
1516 (define-key idlwave-mode-map key
1524 (fset 'idlwave-debug-map (make-sparse-keymap))
1526 (define-key idlwave-mode-map "\C-c " 'idlwave-hard-tab)
1527 (define-key idlwave-mode-map [(control tab)] 'idlwave-hard-tab)
1528 ;(define-key idlwave-mode-map "\C-c\C- " 'idlwave-hard-tab)
1529 (define-key idlwave-mode-map "'" 'idlwave-show-matching-quote)
1530 (define-key idlwave-mode-map "\"" 'idlwave-show-matching-quote)
1531 (define-key idlwave-mode-map "\C-g" 'idlwave-keyboard-quit)
1532 (define-key idlwave-mode-map "\C-c;" 'idlwave-toggle-comment-region)
1533 (define-key idlwave-mode-map "\C-\M-a" 'idlwave-beginning-of-subprogram)
1534 (define-key idlwave-mode-map "\C-\M-e" 'idlwave-end-of-subprogram)
1535 (define-key idlwave-mode-map "\C-c{" 'idlwave-beginning-of-block)
1536 (define-key idlwave-mode-map "\C-c}" 'idlwave-end-of-block)
1537 (define-key idlwave-mode-map "\C-c]" 'idlwave-close-block)
1538 (define-key idlwave-mode-map [(meta control h)] 'idlwave-mark-subprogram)
1539 (define-key idlwave-mode-map "\M-\C-n" 'idlwave-forward-block)
1540 (define-key idlwave-mode-map "\M-\C-p" 'idlwave-backward-block)
1541 (define-key idlwave-mode-map "\M-\C-d" 'idlwave-down-block)
1542 (define-key idlwave-mode-map "\M-\C-u" 'idlwave-backward-up-block)
1543 (define-key idlwave-mode-map "\M-\r" 'idlwave-split-line)
1544 (define-key idlwave-mode-map "\M-\C-q" 'idlwave-indent-subprogram)
1545 (define-key idlwave-mode-map "\C-c\C-p" 'idlwave-previous-statement)
1546 (define-key idlwave-mode-map "\C-c\C-n" 'idlwave-next-statement)
1547 ;; (define-key idlwave-mode-map "\r" 'idlwave-newline)
1548 ;; (define-key idlwave-mode-map "\t" 'idlwave-indent-line)
1549 (define-key idlwave-mode-map [(shift iso-lefttab)] 'idlwave-indent-statement)
1550 (define-key idlwave-mode-map "\C-c\C-a" 'idlwave-auto-fill-mode)
1551 (define-key idlwave-mode-map "\M-q" 'idlwave-fill-paragraph)
1552 (define-key idlwave-mode-map "\M-s" 'idlwave-edit-in-idlde)
1553 (define-key idlwave-mode-map "\C-c\C-h" 'idlwave-doc-header)
1554 (define-key idlwave-mode-map "\C-c\C-m" 'idlwave-doc-modification)
1555 (define-key idlwave-mode-map "\C-c\C-c" 'idlwave-case)
1556 (define-key idlwave-mode-map "\C-c\C-d" 'idlwave-debug-map)
1557 (when (and (boundp 'idlwave-shell-debug-modifiers)
1558 (listp idlwave-shell-debug-modifiers)
1559 (not (equal idlwave-shell-debug-modifiers '())))
1561 (let ((shift (memq 'shift idlwave-shell-debug-modifiers))
1563 (copy-sequence idlwave-shell-debug-modifiers))))
1564 (define-key idlwave-mode-map
1566 'idlwave-shell-save-and-run)
1567 (define-key idlwave-mode-map
1569 'idlwave-shell-break-here)
1570 (define-key idlwave-mode-map
1572 'idlwave-shell-run-region)))
1573 (define-key idlwave-mode-map "\C-c\C-d\C-c" 'idlwave-shell-save-and-run)
1574 (define-key idlwave-mode-map "\C-c\C-d\C-b" 'idlwave-shell-break-here)
1575 (define-key idlwave-mode-map "\C-c\C-d\C-e" 'idlwave-shell-run-region)
1576 (define-key idlwave-mode-map "\C-c\C-f" 'idlwave-for)
1577 ;; (define-key idlwave-mode-map "\C-c\C-f" 'idlwave-function)
1578 ;; (define-key idlwave-mode-map "\C-c\C-p" 'idlwave-procedure)
1579 (define-key idlwave-mode-map "\C-c\C-r" 'idlwave-repeat)
1580 (define-key idlwave-mode-map "\C-c\C-w" 'idlwave-while)
1581 (define-key idlwave-mode-map "\C-c\C-k" 'idlwave-kill-autoloaded-buffers)
1582 (define-key idlwave-mode-map "\C-c\C-s" 'idlwave-shell)
1583 (define-key idlwave-mode-map "\C-c\C-l" 'idlwave-shell-recenter-shell-window)
1584 (define-key idlwave-mode-map "\C-c\C-b" 'idlwave-list-buffer-load-path-shadows)
1585 (autoload 'idlwave-shell "idlw-shell"
1586 "Run an inferior IDL, with I/O through buffer `(idlwave-shell-buffer)'." t)
1587 (autoload 'idlwave-shell-send-command "idlw-shell")
1588 (autoload 'idlwave-shell-recenter-shell-window "idlw-shell"
1589 "Run `idlwave-shell' and switch back to current window" t)
1590 (autoload 'idlwave-shell-save-and-run "idlw-shell"
1592 (autoload 'idlwave-shell-break-here "idlw-shell"
1593 "Set breakpoint in current line." t)
1594 (autoload 'idlwave-shell-run-region "idlw-shell"
1596 (define-key idlwave-mode-map "\C-c\C-v" 'idlwave-find-module)
1597 (define-key idlwave-mode-map "\C-c\C-t" 'idlwave-find-module-this-file)
1598 (define-key idlwave-mode-map "\C-c?" 'idlwave-routine-info)
1599 (define-key idlwave-mode-map "\M-?" 'idlwave-context-help)
1600 (define-key idlwave-mode-map [(control meta ?\?)]
1601 'idlwave-help-assistant-help-with-topic)
1603 (define-key idlwave-mode-map [(meta tab)] 'idlwave-complete)
1604 (define-key idlwave-mode-map [?\e?\t] 'idlwave-complete)
1605 (define-key idlwave-mode-map "\M-\C-i" 'idlwave-complete)
1606 (define-key idlwave-mode-map "\C-c\C-i" 'idlwave-update-routine-info)
1607 (define-key idlwave-mode-map "\C-c=" 'idlwave-resolve)
1608 (define-key idlwave-mode-map
1610 'idlwave-mouse-context-help)
1613 ;; See description of the function `idlwave-action-and-binding'.
1617 (idlwave-action-and-binding "&" 'idlwave-custom-ampersand-surround)
1621 (idlwave-action-and-binding "=" '(idlwave-expand-equal -1 -1))
1624 (idlwave-action-and-binding "<" '(idlwave-custom-ltgtr-surround nil))
1625 (idlwave-action-and-binding ">" '(idlwave-custom-ltgtr-surround 'gtr))
1627 (idlwave-action-and-binding "," '(idlwave-surround 0 -1 1))
1637 (defvar idlwave-mode-abbrev-table nil
1639 (define-abbrev-table 'idlwave-mode-abbrev-table ())
1641 (defun idlwave-define-abbrev (name expansion hook &optional noprefix table)
1645 idlwave-mode-abbrev-table unless TABLE is non-nil."
1647 (args (list (or table idlwave-mode-abbrev-table)
1648 (if noprefix name (concat idlwave-abbrev-start-char name))
1656 (modify-syntax-entry (string-to-char idlwave-abbrev-start-char)
1657 "w" idlwave-mode-syntax-table)
1663 (idlwave-define-abbrev "c" "" (idlwave-code-abbrev idlwave-case))
1664 (idlwave-define-abbrev "sw" "" (idlwave-code-abbrev idlwave-switch))
1665 (idlwave-define-abbrev "f" "" (idlwave-code-abbrev idlwave-for))
1666 (idlwave-define-abbrev "fu" "" (idlwave-code-abbrev idlwave-function))
1667 (idlwave-define-abbrev "pr" "" (idlwave-code-abbrev idlwave-procedure))
1668 (idlwave-define-abbrev "r" "" (idlwave-code-abbrev idlwave-repeat))
1669 (idlwave-define-abbrev "w" "" (idlwave-code-abbrev idlwave-while))
1670 (idlwave-define-abbrev "i" "" (idlwave-code-abbrev idlwave-if))
1671 (idlwave-define-abbrev "elif" "" (idlwave-code-abbrev idlwave-elif))
1675 (idlwave-define-abbrev "ap" "arg_present()" (idlwave-keyword-abbrev 1))
1676 (idlwave-define-abbrev "b" "begin" (idlwave-keyword-abbrev 0 t))
1677 (idlwave-define-abbrev "co" "common" (idlwave-keyword-abbrev 0 t))
1678 (idlwave-define-abbrev "cb" "byte()" (idlwave-keyword-abbrev 1))
1679 (idlwave-define-abbrev "cx" "fix()" (idlwave-keyword-abbrev 1))
1680 (idlwave-define-abbrev "cl" "long()" (idlwave-keyword-abbrev 1))
1681 (idlwave-define-abbrev "cf" "float()" (idlwave-keyword-abbrev 1))
1682 (idlwave-define-abbrev "cs" "string()" (idlwave-keyword-abbrev 1))
1683 (idlwave-define-abbrev "cc" "complex()" (idlwave-keyword-abbrev 1))
1684 (idlwave-define-abbrev "cd" "double()" (idlwave-keyword-abbrev 1))
1685 (idlwave-define-abbrev "e" "else" (idlwave-keyword-abbrev 0 t))
1686 (idlwave-define-abbrev "ec" "endcase" 'idlwave-show-begin)
1687 (idlwave-define-abbrev "es" "endswitch" 'idlwave-show-begin)
1688 (idlwave-define-abbrev "ee" "endelse" 'idlwave-show-begin)
1689 (idlwave-define-abbrev "ef" "endfor" 'idlwave-show-begin)
1690 (idlwave-define-abbrev "ei" "endif else if" 'idlwave-show-begin)
1691 (idlwave-define-abbrev "el" "endif else" 'idlwave-show-begin)
1692 (idlwave-define-abbrev "en" "endif" 'idlwave-show-begin)
1693 (idlwave-define-abbrev "er" "endrep" 'idlwave-show-begin)
1694 (idlwave-define-abbrev "ew" "endwhile" 'idlwave-show-begin)
1695 (idlwave-define-abbrev "g" "goto," (idlwave-keyword-abbrev 0 t))
1696 (idlwave-define-abbrev "h" "help," (idlwave-keyword-abbrev 0))
1697 (idlwave-define-abbrev "k" "keyword_set()" (idlwave-keyword-abbrev 1))
1698 (idlwave-define-abbrev "n" "n_elements()" (idlwave-keyword-abbrev 1))
1699 (idlwave-define-abbrev "on" "on_error," (idlwave-keyword-abbrev 0))
1700 (idlwave-define-abbrev "oi" "on_ioerror," (idlwave-keyword-abbrev 0 1))
1701 (idlwave-define-abbrev "ow" "openw," (idlwave-keyword-abbrev 0))
1702 (idlwave-define-abbrev "or" "openr," (idlwave-keyword-abbrev 0))
1703 (idlwave-define-abbrev "ou" "openu," (idlwave-keyword-abbrev 0))
1704 (idlwave-define-abbrev "p" "print," (idlwave-keyword-abbrev 0))
1705 (idlwave-define-abbrev "pt" "plot," (idlwave-keyword-abbrev 0))
1706 (idlwave-define-abbrev "re" "read," (idlwave-keyword-abbrev 0))
1707 (idlwave-define-abbrev "rf" "readf," (idlwave-keyword-abbrev 0))
1708 (idlwave-define-abbrev "ru" "readu," (idlwave-keyword-abbrev 0))
1709 (idlwave-define-abbrev "rt" "return" (idlwave-keyword-abbrev 0))
1710 (idlwave-define-abbrev "sc" "strcompress()" (idlwave-keyword-abbrev 1))
1711 (idlwave-define-abbrev "sn" "strlen()" (idlwave-keyword-abbrev 1))
1712 (idlwave-define-abbrev "sl" "strlowcase()" (idlwave-keyword-abbrev 1))
1713 (idlwave-define-abbrev "su" "strupcase()" (idlwave-keyword-abbrev 1))
1714 (idlwave-define-abbrev "sm" "strmid()" (idlwave-keyword-abbrev 1))
1715 (idlwave-define-abbrev "sp" "strpos()" (idlwave-keyword-abbrev 1))
1716 (idlwave-define-abbrev "st" "strput()" (idlwave-keyword-abbrev 1))
1717 (idlwave-define-abbrev "sr" "strtrim()" (idlwave-keyword-abbrev 1))
1718 (idlwave-define-abbrev "t" "then" (idlwave-keyword-abbrev 0 t))
1719 (idlwave-define-abbrev "u" "until" (idlwave-keyword-abbrev 0 t))
1720 (idlwave-define-abbrev "wu" "writeu," (idlwave-keyword-abbrev 0))
1721 (idlwave-define-abbrev "iap" "if arg_present() then" (idlwave-keyword-abbrev 6))
1722 (idlwave-define-abbrev "ik" "if keyword_set() then" (idlwave-keyword-abbrev 6))
1723 (idlwave-define-abbrev "ine" "if n_elements() eq 0 then" (idlwave-keyword-abbrev 11))
1724 (idlwave-define-abbrev "inn" "if n_elements() ne 0 then" (idlwave-keyword-abbrev 11))
1725 (idlwave-define-abbrev "np" "n_params()" (idlwave-keyword-abbrev 0))
1726 (idlwave-define-abbrev "s" "size()" (idlwave-keyword-abbrev 1))
1727 (idlwave-define-abbrev "wi" "widget_info()" (idlwave-keyword-abbrev 1))
1728 (idlwave-define-abbrev "wc" "widget_control," (idlwave-keyword-abbrev 0))
1729 (idlwave-define-abbrev "pv" "ptr_valid()" (idlwave-keyword-abbrev 1))
1730 (idlwave-define-abbrev "ipv" "if ptr_valid() then" (idlwave-keyword-abbrev 6))
1734 (idlwave-define-abbrev "and" "and" (idlwave-keyword-abbrev 0 t) t)
1735 (idlwave-define-abbrev "begin" "begin" (idlwave-keyword-abbrev 0 t) t)
1736 (idlwave-define-abbrev "break" "break" (idlwave-keyword-abbrev 0 t) t)
1737 (idlwave-define-abbrev "case" "case" (idlwave-keyword-abbrev 0 t) t)
1738 (idlwave-define-abbrev "common" "common" (idlwave-keyword-abbrev 0 t) t)
1739 (idlwave-define-abbrev "continue" "continue" (idlwave-keyword-abbrev 0 t) t)
1740 (idlwave-define-abbrev "do" "do" (idlwave-keyword-abbrev 0 t) t)
1741 (idlwave-define-abbrev "else" "else" (idlwave-keyword-abbrev 0 t) t)
1742 (idlwave-define-abbrev "end" "end" 'idlwave-show-begin-check t)
1743 (idlwave-define-abbrev "endcase" "endcase" 'idlwave-show-begin-check t)
1744 (idlwave-define-abbrev "endelse" "endelse" 'idlwave-show-begin-check t)
1745 (idlwave-define-abbrev "endfor" "endfor" 'idlwave-show-begin-check t)
1746 (idlwave-define-abbrev "endif" "endif" 'idlwave-show-begin-check t)
1747 (idlwave-define-abbrev "endrep" "endrep" 'idlwave-show-begin-check t)
1748 (idlwave-define-abbrev "endswitch" "endswitch" 'idlwave-show-begin-check t)
1749 (idlwave-define-abbrev "endwhi" "endwhi" 'idlwave-show-begin-check t)
1750 (idlwave-define-abbrev "endwhile" "endwhile" 'idlwave-show-begin-check t)
1751 (idlwave-define-abbrev "eq" "eq" (idlwave-keyword-abbrev 0 t) t)
1752 (idlwave-define-abbrev "for" "for" (idlwave-keyword-abbrev 0 t) t)
1753 (idlwave-define-abbrev "function" "function" (idlwave-keyword-abbrev 0 t) t)
1754 (idlwave-define-abbrev "ge" "ge" (idlwave-keyword-abbrev 0 t) t)
1755 (idlwave-define-abbrev "goto" "goto" (idlwave-keyword-abbrev 0 t) t)
1756 (idlwave-define-abbrev "gt" "gt" (idlwave-keyword-abbrev 0 t) t)
1757 (idlwave-define-abbrev "if" "if" (idlwave-keyword-abbrev 0 t) t)
1758 (idlwave-define-abbrev "le" "le" (idlwave-keyword-abbrev 0 t) t)
1759 (idlwave-define-abbrev "lt" "lt" (idlwave-keyword-abbrev 0 t) t)
1760 (idlwave-define-abbrev "mod" "mod" (idlwave-keyword-abbrev 0 t) t)
1761 (idlwave-define-abbrev "ne" "ne" (idlwave-keyword-abbrev 0 t) t)
1762 (idlwave-define-abbrev "not" "not" (idlwave-keyword-abbrev 0 t) t)
1763 (idlwave-define-abbrev "of" "of" (idlwave-keyword-abbrev 0 t) t)
1764 (idlwave-define-abbrev "on_ioerror" "on_ioerror" (idlwave-keyword-abbrev 0 t) t)
1765 (idlwave-define-abbrev "or" "or" (idlwave-keyword-abbrev 0 t) t)
1766 (idlwave-define-abbrev "pro" "pro" (idlwave-keyword-abbrev 0 t) t)
1767 (idlwave-define-abbrev "repeat" "repeat" (idlwave-keyword-abbrev 0 t) t)
1768 (idlwave-define-abbrev "switch" "switch" (idlwave-keyword-abbrev 0 t) t)
1769 (idlwave-define-abbrev "then" "then" (idlwave-keyword-abbrev 0 t) t)
1770 (idlwave-define-abbrev "until" "until" (idlwave-keyword-abbrev 0 t) t)
1771 (idlwave-define-abbrev "while" "while" (idlwave-keyword-abbrev 0 t) t)
1772 (idlwave-define-abbrev "xor" "xor" (idlwave-keyword-abbrev 0 t) t)
1780 (defvar idlwave-mode-menu)
1781 (defvar idlwave-mode-debug-menu)
1784 (defun idlwave-mode ()
1794 To start a continuation line, use \\[idlwave-split-line]. This
1795 function can also be used in the middle of a line to split the line
1805 The indentation of comments starting in column 0 is never changed.
1807 Use \\[idlwave-fill-paragraph] to refill a paragraph inside a
1810 \\[idlwave-auto-fill-mode] to toggle auto-fill mode for these
1811 comments. When the variable `idlwave-fill-comment-line-only' is
1816 \\[idlwave-expand-region-abbrevs]. Then mark the entire buffer
1823 \\[idlwave-routine-info]. \\[idlwave-find-module] jumps to the
1825 routines, all routines in idlwave-mode buffers and (when the
1826 idlwave-shell is active) about all modules currently compiled under
1829 default. Use \\[idlwave-update-routine-info] to update this
1835 \\[idlwave-context-help] displays the IDL documentation relevant
1837 key stroke gets you directly to the right place in the docs. See
1842 \\[idlwave-complete] completes the names of procedures, functions
1846 strings are completed in lower case, other strings in mixed or
1865 For a full list, use \\[idlwave-list-abbrevs]. Some templates also
1868 \\[idlwave-doc-header] inserts a documentation header at the
1871 \\[idlwave-doc-modification].
1876 `idlwave-reserved-word-upcase' and `idlwave-abbrev-change-case'.
1880 If the variable `idlwave-expand-generic-end' is non-nil, each END typed
1885 Loading idlwave.el runs `idlwave-load-hook'.
1886 Turning on `idlwave-mode' runs `idlwave-mode-hook'.
1891 \\[idlwave-info] to display (complain to your sysadmin if that does
1893 documentation, check IDLWAVE's homepage at `http://idlwave.org'.
1894 IDLWAVE has customize support - see the group `idlwave'.
1902 \\{idlwave-mode-map}"
1907 (if idlwave-startup-message
1908 (message "Emacs IDLWAVE mode version %s." idlwave-mode-version))
1909 (setq idlwave-startup-message nil)
1911 (setq local-abbrev-table idlwave-mode-abbrev-table)
1912 (set-syntax-table idlwave-mode-syntax-table)
1914 (set (make-local-variable 'indent-line-function) 'idlwave-indent-and-action)
1916 (make-local-variable idlwave-comment-indent-function)
1917 (set idlwave-comment-indent-function 'idlwave-comment-hook)
1927 (use-local-map idlwave-mode-map)
1930 (easy-menu-add idlwave-mode-menu idlwave-mode-map)
1931 (easy-menu-add idlwave-mode-debug-menu idlwave-mode-map))
1934 (setq major-mode 'idlwave-mode)
1937 (set (make-local-variable idlwave-fill-function) 'idlwave-auto-fill)
1948 'idlwave-current-routine-fullname)
1956 ;; on the `idlwave-mode' symbol.
1957 (set (make-local-variable 'font-lock-defaults) idlwave-font-lock-defaults)
1959 'idlwave-mark-subprogram)
1961 'idlwave-font-lock-fontify-region)
1967 'idlwave-unit-name)
1969 'idlwave-prev-index-position)
1973 (list 'idlwave-mode
1974 idlwave-begin-block-reg
1975 idlwave-end-block-reg
1977 'idlwave-forward-block nil))
1982 (add-hook 'post-command-hook 'idlwave-command-hook nil 'local)
1987 (add-hook 'kill-buffer-hook 'idlwave-kill-buffer-update nil 'local)
1989 (add-hook 'after-save-hook 'idlwave-save-buffer-update nil 'local)
1990 (add-hook 'after-save-hook 'idlwave-revoke-license-to-kill nil 'local)
1993 (idlwave-setup)
1996 (idlwave-new-buffer-update)
1999 (idlwave-help-check-locations)
2002 (run-mode-hooks 'idlwave-mode-hook))
2004 (defvar idlwave-setup-done nil)
2005 (defun idlwave-setup ()
2006 (unless idlwave-setup-done
2007 (if (not (file-directory-p idlwave-config-directory))
2008 (make-directory idlwave-config-directory))
2010 idlwave-user-catalog-file (expand-file-name
2011 idlwave-user-catalog-file
2012 idlwave-config-directory)
2013 idlwave-xml-system-rinfo-converted-file
2015 idlwave-xml-system-rinfo-converted-file
2016 idlwave-config-directory)
2017 idlwave-path-file (expand-file-name
2018 idlwave-path-file
2019 idlwave-config-directory))
2020 (idlwave-read-paths) ; we may need these early
2021 (setq idlwave-setup-done t)))
2023 (defun idlwave-font-lock-fontify-region (beg end &optional verbose)
2029 (when (setq pos (idlwave-is-continuation-line))
2031 (idlwave-beginning-of-statement)
2039 (defun idlwave-hard-tab ()
2040 "Inserts TAB in buffer in current position."
2046 (defvar idlwave-command-hook nil
2048 It is evaluated in the lisp function `idlwave-command-hook' which is
2049 placed in `post-command-hook'.")
2051 (defun idlwave-command-hook ()
2053 Evaluates a non-nil value of the *variable* `idlwave-command-hook' and
2055 (and idlwave-command-hook
2056 (listp idlwave-command-hook)
2058 (eval idlwave-command-hook)
2060 (setq idlwave-command-hook nil))
2067 (defun idlwave-check-abbrev (arg &optional reserved)
2068 "Reverses abbrev expansion if in comment or string.
2070 backward if `idlwave-abbrev-move' is non-nil.
2073 `idlwave-reserved-word-upcase' is non-nil.
2074 Otherwise, the abbrev will be capitalized if `idlwave-abbrev-change-case'
2075 is non-nil, unless its value is \`down in which case the abbrev will be
2078 (if (idlwave-quoted)
2081 (if (and reserved idlwave-reserved-word-upcase)
2084 ((equal idlwave-abbrev-change-case 'down)
2086 (idlwave-abbrev-change-case
2088 (if (and idlwave-abbrev-move (> arg 0))
2090 (setq idlwave-command-hook (list 'backward-char (1+ arg)))
2094 (defun idlwave-in-comment ()
2098 (and (idlwave-goto-comment) (> here (point))))))
2100 (defun idlwave-goto-comment ()
2103 Ignores comment delimiters in strings.
2108 ;; Look for first comment delimiter not in a string
2111 (while (and found (idlwave-in-quote))
2114 (and found (not (idlwave-in-quote))
2122 (defun idlwave-region-active-p ()
2129 (defun idlwave-show-matching-quote ()
2130 "Insert quote and show matching quote if this is end of a string."
2132 (let ((bq (idlwave-in-quote))
2134 (if (and bq (not (idlwave-in-comment)))
2144 (defun idlwave-show-begin-check ()
2145 "Ensure that the previous word was a token before `idlwave-show-begin'.
2147 (if (not (idlwave-quoted))
2153 (idlwave-show-begin))))
2155 (defun idlwave-show-begin ()
2166 (if idlwave-reindent-end (idlwave-indent-line))
2168 (when (and (idlwave-check-abbrev 0 t)
2169 idlwave-show-block)
2173 (idlwave-block-jump-out -1 'nomark)
2175 (idlwave-block-jump-out 1 'nomark)
2186 (when (setq end1 (cdr (idlwave-block-master)))
2193 (if idlwave-expand-generic-end
2207 (defun idlwave-block-master ()
2212 (assoc (downcase (match-string 0)) idlwave-block-matches))
2215 (idlwave-beginning-of-statement)
2221 ((re-search-backward idlwave-block-match-regexp limit t)
2223 idlwave-block-matches))
2229 (defun idlwave-close-block ()
2232 ;; Start new line if we are not in a new line
2236 (let ((idlwave-show-block nil))
2240 (idlwave-show-begin)))
2242 (defun idlwave-custom-ampersand-surround (&optional is-action)
2250 (idlwave-surround -1 (if (or is-action amp-left) -1) len))))
2252 (defun idlwave-custom-ltgtr-surround (gtr &optional is-action)
2260 (idlwave-surround -1 (if (or is-action method-invoke) -1) len))))
2262 (defun idlwave-surround (&optional before after length is-action)
2266 after the characters (see also description of `idlwave-make-space'):
2274 - `idlwave-surround-by-blank' is nil
2276 (when (and idlwave-surround-by-blank (not (idlwave-quoted)))
2285 (move-to-column (idlwave-calculate-indent))
2289 (idlwave-make-space before))
2292 (idlwave-make-space after)
2298 (defun idlwave-make-space (n)
2318 (idlwave-indent-to (+ start-col n))
2321 (idlwave-indent-to end-col (- n))
2326 (defun idlwave-newline ()
2331 ;; If not in a comment and in a string then insertion of a newline
2334 (if (and (not (idlwave-in-comment)) (idlwave-in-quote))
2348 (idlwave-indent-line)
2350 (idlwave-indent-line))
2357 (defun idlwave-comment-hook ()
2359 (if (or (looking-at idlwave-no-change-comment)
2360 (if idlwave-begin-line-comment
2361 (looking-at idlwave-begin-line-comment)
2364 (if (looking-at idlwave-code-comment)
2367 (let ((tem (idlwave-calculate-indent)))
2375 (defun idlwave-split-line ()
2379 Splits strings with the IDL operator `+' if `idlwave-split-line-string' is
2385 (if (not (idlwave-in-comment))
2389 (if (setq beg (idlwave-in-quote))
2390 (if idlwave-split-line-string
2393 idlwave-continuation-char beg)
2400 (insert " " idlwave-continuation-char))
2404 (insert idlwave-continuation-char)
2410 (idlwave-indent-line)
2413 (idlwave-indent-line)))
2415 (defun idlwave-beginning-of-subprogram (&optional nomark)
2419 (idlwave-find-key idlwave-begin-unit-reg -1 nomark))
2421 (defun idlwave-end-of-subprogram (&optional nomark)
2425 (idlwave-end-of-statement)
2426 (idlwave-find-key idlwave-end-unit-reg 1 nomark))
2428 (defun idlwave-mark-statement ()
2431 (idlwave-end-of-statement)
2433 (idlwave-beginning-of-statement)
2436 (defun idlwave-mark-block ()
2439 (idlwave-end-of-statement)
2440 (idlwave-backward-up-block -1)
2441 (idlwave-end-of-statement)
2443 (idlwave-backward-block)
2444 (idlwave-beginning-of-statement)
2448 (defun idlwave-mark-subprogram ()
2452 (idlwave-end-of-statement)
2453 (idlwave-beginning-of-subprogram)
2455 (idlwave-forward-block)
2459 (defun idlwave-backward-up-block (&optional arg)
2463 (idlwave-block-jump-out (- arg) 'nomark))
2465 (defun idlwave-beginning-of-block ()
2468 (idlwave-block-jump-out -1 'nomark)
2471 (defun idlwave-end-of-block ()
2474 (idlwave-block-jump-out 1 'nomark)
2477 (defun idlwave-forward-block (&optional arg)
2481 (if (idlwave-down-block arg)
2482 (idlwave-block-jump-out arg 'nomark))))
2484 (defun idlwave-backward-block ()
2487 (if (idlwave-down-block -1)
2488 (idlwave-block-jump-out -1 'nomark)))
2490 (defun idlwave-down-block (&optional arg)
2499 (idlwave-block-jump-out -1 'nomark)
2501 (if (setq status (idlwave-find-key
2502 idlwave-end-block-reg -1 'nomark eos))
2503 (idlwave-beginning-of-statement)
2507 (idlwave-block-jump-out 1 'nomark)
2509 (if (setq status (idlwave-find-key
2510 idlwave-begin-block-reg 1 'nomark eos))
2511 (idlwave-end-of-statement)
2515 (defun idlwave-mark-doclib ()
2522 (if (re-search-backward idlwave-doclib-start nil t)
2525 (if (re-search-forward idlwave-doclib-end nil t)
2533 (defun idlwave-current-routine-fullname ()
2534 (let ((name (idlwave-current-routine)))
2535 (idlwave-make-full-name (nth 2 name) (car name))))
2537 (defun idlwave-current-routine ()
2539 (idlwave-routines)
2541 (idlwave-beginning-of-subprogram 'nomark)
2545 (class (idlwave-sintern-class (match-string 3)))
2546 (name (idlwave-sintern-routine-or-method (match-string 4) class)))
2549 (defvar idlwave-shell-prompt-pattern)
2550 (defun idlwave-beginning-of-statement ()
2557 ((eq major-mode 'idlwave-shell-mode)
2558 (if (re-search-backward idlwave-shell-prompt-pattern nil t)
2561 (if (save-excursion (forward-line -1) (idlwave-is-continuation-line))
2562 (idlwave-previous-statement)
2565 (defun idlwave-previous-statement ()
2568 the first non-comment statement in the file, and nil otherwise."
2572 ;; first line in file
2580 (looking-at idlwave-comment-line-start-skip)
2582 (looking-at (concat "[ \t]*" idlwave-label "[ \t]*$"))
2589 (idlwave-is-continuation-line))
2593 (defun idlwave-end-of-statement ()
2595 If not in a statement just moves to end of line. Returns position."
2597 (while (and (idlwave-is-continuation-line)
2599 (while (and (idlwave-is-comment-or-empty-line)
2604 (defun idlwave-end-of-statement0 ()
2606 If not in a statement just moves to end of line. Returns position."
2608 (while (and (idlwave-is-continuation-line)
2613 (defun idlwave-next-statement ()
2616 non-comment IDL statement in the file, and nil otherwise."
2619 (idlwave-end-of-statement)
2626 (looking-at idlwave-comment-line-start-skip)
2628 (looking-at (concat "[ \t]*" idlwave-label "[ \t]*$"))
2632 (defun idlwave-skip-multi-commands (&optional lim)
2637 (if (idlwave-quoted)
2642 (defun idlwave-skip-label-or-case ()
2647 ;; So we find the first colon in the line and make sure
2649 ;; - it is not in a comment
2650 ;; - not in a string constant
2651 ;; - not in parenthesis (like a[0:3])
2652 ;; - not followed by another ":" in explicit class, ala a->b::c
2653 ;; As many in this mode, this function is heuristic and not an exact
2656 (eos (save-excursion (idlwave-end-of-statement) (point)))
2657 (end (idlwave-find-key ":" 1 'nomark eos)))
2668 (defun idlwave-start-of-substatement (&optional pre)
2676 (eos (idlwave-end-of-statement))
2679 (idlwave-beginning-of-statement)
2680 (idlwave-skip-label-or-case)
2682 (idlwave-skip-multi-commands orig))
2687 (setq nst (nth 1 (cdr (setq st (car (idlwave-statement-type))))))
2690 (idlwave-find-key nst 1 'nomark eos))
2692 ((and (> ifnest 0) (idlwave-find-key "\\<else\\>" 1 'nomark eos))
2696 (idlwave-next-statement))))
2703 (defun idlwave-statement-type ()
2705 Uses `idlwave-statement-match' to return a cons of (type . point) with
2707 association from `idlwave-statement-match', i.e. the cons cell from the
2716 (let ((st idlwave-statement-match)
2723 (defun idlwave-expand-equal (&optional before after is-action)
2726 `idlwave-start-of-substatement' and `idlwave-statement-type'. The
2728 `idlwave-pad-keyword' is t then keyword assignment is treated just
2731 Limits in for loops are treated as keyword assignment.
2746 See `idlwave-surround'."
2747 (if idlwave-surround-by-blank
2766 (if (eq t idlwave-pad-keyword)
2768 (idlwave-surround before after len)
2771 (idlwave-start-of-substatement t)
2772 (idlwave-statement-type)))
2775 (nth 2 (idlwave-where)))))
2779 ((null idlwave-pad-keyword)
2780 (idlwave-surround 0 0)
2783 (t (idlwave-surround before after len))))))))
2786 (defun idlwave-indent-and-action (&optional arg)
2787 "Call `idlwave-indent-line' and do expand actions.
2791 (if (and idlwave-expand-generic-end
2798 (idlwave-show-begin)))))
2803 (idlwave-indent-statement)
2804 (idlwave-indent-line t)))
2806 (defun idlwave-indent-line (&optional expand)
2808 The actions in `idlwave-indent-action-table' are performed.
2809 If the optional argument EXPAND is non-nil then the actions in
2810 `idlwave-indent-expand-table' are performed."
2820 (if (looking-at idlwave-comment-line-start-skip)
2824 (idlwave-indent-left-margin (idlwave-comment-hook)))
2830 (if (and expand idlwave-do-actions)
2831 (mapcar 'idlwave-do-action idlwave-indent-expand-table))
2833 (if idlwave-do-actions
2834 (mapcar 'idlwave-do-action idlwave-indent-action-table))
2844 (looking-at (concat "^" idlwave-label "[ \t]*$"))
2850 (idlwave-indent-left-margin (idlwave-calculate-indent)))
2853 (if (idlwave-in-comment)
2863 (defun idlwave-do-action (action)
2874 (while (idlwave-look-at action-key)
2879 (defun idlwave-indent-to (col &optional min)
2886 (defun idlwave-indent-left-margin (col)
2893 (idlwave-indent-to col)))
2895 (defun idlwave-indent-subprogram ()
2899 (idlwave-end-of-statement)
2900 (idlwave-beginning-of-subprogram)
2902 (idlwave-forward-block)
2907 (defun idlwave-indent-statement ()
2911 (idlwave-beginning-of-statement)
2913 (idlwave-end-of-statement)
2916 (defun idlwave-calculate-indent ()
2923 ((idlwave-look-at idlwave-begin-unit-reg)
2928 (idlwave-is-continuation-line)))
2929 (idlwave-calculate-cont-indent))
2938 (idlwave-previous-statement)
2942 ((idlwave-look-at idlwave-begin-unit-reg t)
2943 (+ (idlwave-current-statement-indent)
2944 idlwave-main-block-indent))
2946 ((idlwave-look-at idlwave-begin-block-reg t)
2947 (+ (idlwave-min-current-statement-indent)
2948 idlwave-block-indent))
2950 ((idlwave-look-at idlwave-end-block-reg t)
2954 (idlwave-block-jump-out -1 'nomark) ; go to begin block
2955 (idlwave-min-current-statement-indent)))
2956 ;; idlwave-end-offset
2957 ;; idlwave-block-indent))
2960 ((idlwave-current-statement-indent))))))
2964 ((idlwave-look-at idlwave-end-block-reg)
2965 (+ the-indent idlwave-end-offset))
2972 (defun idlwave-calculate-paren-indent (beg-reg end-reg close-exp)
2984 (idlwave-indent-parens-nested
2985 (+ idlwave-continuation-indent (idlwave-current-indent)))
3003 (defun idlwave-calculate-cont-indent ()
3013 (beg-last-statement (save-excursion (idlwave-previous-statement)
3015 (beg-reg (progn (idlwave-start-of-substatement 'pre)
3019 (basic-indent (+ (idlwave-min-current-statement-indent end-reg)
3020 idlwave-continuation-indent))
3039 (idlwave-find-key cont-re -1 'nomark beg-last-statement)))
3041 (- (idlwave-current-indent)
3042 (+ idlwave-block-indent idlwave-end-offset))
3043 (idlwave-current-indent)))
3045 ;; Indent in from the previous line for continuing statements
3060 (+ idlwave-continuation-indent (idlwave-current-indent)))
3071 (while (setq indent-cons (idlwave-calculate-paren-indent
3075 idlwave-indent-to-open-paren
3076 idlwave-indent-parens-nested
3079 idlwave-max-extra-continuation-indent))
3086 (> idlwave-max-extra-continuation-indent 0)
3090 (while (idlwave-look-at "&")) ; skip continued statements
3094 (idlwave-look-at "^[ \t]*\\(pro\\|function\\)") ;skip over
3106 (if (null (idlwave-what-function beg-reg))
3109 (idlwave-in-quote)
3113 (eq (caar (idlwave-statement-type)) 'for)))
3116 idlwave-max-extra-continuation-indent))
3118 (+ fancy-nonparen-indent idlwave-continuation-indent)
3126 (defun idlwave-find-key (key-re &optional dir nomark limit)
3134 Return value is the beginning of the match or (in case of failure) nil."
3139 (idlwave-with-special-syntax
3143 (if (not (idlwave-quoted))
3155 (defun idlwave-block-jump-out (&optional dir nomark)
3157 current block using the `idlwave-begin-block-reg' and `idlwave-end-block-reg'
3169 idlwave-begin-block-reg
3170 idlwave-end-block-reg))
3172 (block-reg (concat idlwave-begin-block-reg "\\|"
3173 idlwave-end-block-reg))
3176 (idlwave-find-key
3177 idlwave-begin-unit-reg dir t limit)
3179 (idlwave-find-key
3180 idlwave-end-unit-reg dir t limit)))
3182 (if (>= dir 0) (end-of-line)) ;Make sure we are in current block
3183 (if (setq found (idlwave-find-key block-reg dir t unit-limit))
3186 (idlwave-block-jump-out dir t)
3187 (setq found (idlwave-find-key block-reg dir t unit-limit))))
3192 (defun idlwave-min-current-statement-indent (&optional end-reg)
3193 "The minimum indent in the current statement."
3194 (idlwave-beginning-of-statement)
3195 (if (not (idlwave-is-continuation-line))
3196 (idlwave-current-indent)
3197 (let ((min (idlwave-current-indent)) comm-or-empty)
3199 (or (setq comm-or-empty (idlwave-is-comment-or-empty-line))
3200 (idlwave-is-continuation-line))
3202 (unless comm-or-empty (setq min (min min (idlwave-current-indent)))))
3205 (min min (idlwave-current-indent))))))
3207 (defun idlwave-current-statement-indent (&optional last-line)
3209 If in a statement, moves to beginning of statement before finding indent."
3211 (idlwave-end-of-statement)
3212 (idlwave-beginning-of-statement))
3213 (idlwave-current-indent))
3215 (defun idlwave-current-indent ()
3225 (defun idlwave-is-continuation-line ()
3232 (idlwave-look-at "\\<\\$")
3236 (if (setq p (idlwave-look-at "\\<\\$")) (throw 'loop p))))))))
3238 (defun idlwave-is-comment-line ()
3244 (defun idlwave-is-comment-or-empty-line ()
3250 (defun idlwave-look-at (regexp &optional cont beg)
3256 Ignores matches that end in a comment or inside a string expression.
3264 (if cont (idlwave-end-of-statement) (end-of-line))
3267 (idlwave-with-special-syntax
3268 (if beg (idlwave-beginning-of-statement))
3270 (idlwave-quoted))))
3274 (defun idlwave-fill-paragraph (&optional nohang)
3275 "Fills paragraphs in comments.
3284 matching `idlwave-hang-indent-regexp' on the paragraph's first line . If the
3297 ;; Change tabs to spaces in the surrounding paragraph.
3299 ;; contiguous line comments. Thus, we may be changing tabs in
3327 (regexp-quote
3365 ;; point will be at the beginning of a line in which case
3371 (if (and (not nohang) idlwave-hanging-indent
3375 (idlwave-calc-hanging-indent))))
3439 (subst-char-in-region start (+ start first-indent -1) ?\ ?~ nil)
3453 (defun idlwave-calc-hanging-indent ()
3456 with the `idlwave-hang-indent-regexp'. If `idlwave-use-last-hang-indent' is
3457 non-nil then use last occurrence matching `idlwave-hang-indent-regexp' on
3460 (if idlwave-use-last-hang-indent
3464 idlwave-hang-indent-regexp
3467 (+ (current-column) (length idlwave-hang-indent-regexp))))
3471 idlwave-hang-indent-regexp
3476 (defun idlwave-auto-fill ()
3477 "Called to break lines in auto fill mode.
3478 Only fills non-comment lines if `idlwave-fill-comment-line-only' is
3480 not in a comment. Splits strings with IDL concatenation operator `+'
3481 if `idlwave-auto-fill-split-string' is non-nil."
3484 (if (or (not idlwave-fill-comment-line-only)
3488 (looking-at idlwave-comment-line-start-skip)))
3490 (idlwave-indent-line)
3492 (let (idlwave-do-actions
3495 (if (and (idlwave-in-quote)
3496 idlwave-auto-fill-split-string)
3504 (idlwave-indent-line))
3507 (looking-at idlwave-comment-line-start-skip))
3511 (if idlwave-hanging-indent
3516 (idlwave-calc-hanging-indent))))
3526 (idlwave-indent-to indent)
3532 (idlwave-in-comment))
3543 (buffer-substring (idlwave-goto-comment)
3547 (idlwave-indent-line))
3552 (if (and (setq beg (idlwave-in-quote))
3553 idlwave-auto-fill-split-string)
3560 (if idlwave-auto-fill-split-string
3570 ;; idlwave-indent-line for the new line, re-indent again
3572 (idlwave-indent-line))
3575 (defun idlwave-auto-fill-mode (arg)
3581 (prog1 (set idlwave-fill-function
3583 (not (symbol-value idlwave-fill-function))
3585 'idlwave-auto-fill
3590 ;(defun idlwave-fill-routine-call ()
3592 ; (let ((where (idlwave-where)))))
3595 (defun idlwave-doc-header (&optional nomark )
3597 Inserts the value of the variable idlwave-file-header. Sets mark before
3603 (if idlwave-header-to-beginning-of-file
3606 (idlwave-beginning-of-subprogram)
3609 (if (idlwave-look-at "\\<\\(pro\\|function\\)\\>")
3611 (idlwave-end-of-statement)
3614 (if idlwave-file-header
3615 (cond ((car idlwave-file-header)
3616 (insert-file-contents (car idlwave-file-header)))
3617 ((stringp (car (cdr idlwave-file-header)))
3618 (insert (car (cdr idlwave-file-header))))))
3621 (defun idlwave-default-insert-timestamp ()
3629 (idlwave-fill-paragraph)
3634 (defun idlwave-doc-modification ()
3637 `idlwave-doc-modifications-keyword' if non-nil. Inserts time and user name
3643 (if (and (or (re-search-backward idlwave-doclib-start nil t)
3646 (re-search-forward idlwave-doclib-start nil t)))
3648 (re-search-forward idlwave-doclib-end nil t)
3653 (concat idlwave-doc-modifications-keyword ":")
3659 (insert comment-start " " idlwave-doc-modifications-keyword ":"))
3661 (run-hooks 'idlwave-timestamp-hook))
3669 ;;; The original would enter an infinite loop in attempting to expand
3675 (defun idlwave-expand-region-abbrevs (start end)
3676 "Expand each abbrev occurrence in the region.
3681 (let ((idlwave-show-block nil) ;Do not blink
3682 (idlwave-abbrev-move nil)) ;Do not move
3685 (defun idlwave-quoted ()
3686 "Returns t if point is in a comment or quoted string.
3688 (or (idlwave-in-comment) (idlwave-in-quote)))
3690 (defun idlwave-in-quote ()
3691 "Returns location of the opening quote
3692 if point is in a IDL string constant, nil otherwise.
3695 constants - a double quote followed by an octal digit."
3697 ;;; double quote followed by an octal digit to be an octal constant
3699 ;;; quote.
3701 ;; Because single and double quotes can quote each other we must
3712 ;; Don't find an octal constant beginning with a double quote
3717 ;; escape for the delimiter in the string.
3721 ;; Move to position after quote
3743 (defun idlwave-is-pointer-dereference (&optional limit)
3748 (not (idlwave-in-quote))
3751 (re-search-backward (concat "\\(" idlwave-idl-keywords
3761 (defun idlwave-template (s1 s2 &optional prompt noindent)
3767 adjusted according to `idlwave-abbrev-change-case'. If optional argument
3768 PROMPT is a string then it is displayed as a message in the
3774 (if (eq major-mode 'idlwave-shell-mode)
3776 ;; in the shell. FIXME: This is a dirty hack.
3780 (error "No templates in idlwave-shell"))
3781 (cond ((eq idlwave-abbrev-change-case 'down)
3783 (idlwave-abbrev-change-case
3798 (defun idlwave-rw-case (string)
3799 "Make STRING have the case required by `idlwave-reserved-word-upcase'."
3800 (if idlwave-reserved-word-upcase
3804 (defun idlwave-elif ()
3807 (idlwave-template
3808 (idlwave-rw-case "if")
3809 (idlwave-rw-case " then begin\n\nendif else begin\n\nendelse")
3812 (defun idlwave-case ()
3815 (idlwave-template
3816 (idlwave-rw-case "case")
3817 (idlwave-rw-case " of\n\nendcase")
3820 (defun idlwave-switch ()
3823 (idlwave-template
3824 (idlwave-rw-case "switch")
3825 (idlwave-rw-case " of\n\nendswitch")
3828 (defun idlwave-for ()
3831 (idlwave-template
3832 (idlwave-rw-case "for")
3833 (idlwave-rw-case " do begin\n\nendfor")
3836 (defun idlwave-if ()
3839 (idlwave-template
3840 (idlwave-rw-case "if")
3841 (idlwave-rw-case " then begin\n\nendif")
3844 (defun idlwave-procedure ()
3846 (idlwave-template
3847 (idlwave-rw-case "pro")
3848 (idlwave-rw-case "\n\nreturn\nend")
3851 (defun idlwave-function ()
3853 (idlwave-template
3854 (idlwave-rw-case "function")
3855 (idlwave-rw-case "\n\nreturn\nend")
3858 (defun idlwave-repeat ()
3860 (idlwave-template
3861 (idlwave-rw-case "repeat begin\n\nendrep until")
3862 (idlwave-rw-case "")
3865 (defun idlwave-while ()
3867 (idlwave-template
3868 (idlwave-rw-case "while")
3869 (idlwave-rw-case " do begin\n\nendwhile")
3872 (defun idlwave-split-string (string &optional pattern)
3883 (defun idlwave-replace-string (string replace_string replace_with)
3894 (defun idlwave-get-buffer-visiting (file)
3902 (t (error "This should not happen (idlwave-get-buffer-visiting)"))))
3904 (defvar idlwave-outlawed-buffers nil
3905 "List of buffer pulled up by idlwave for special reasons.
3906 Buffers in this list may be killed by `idlwave-kill-autoloaded-buffers'.")
3908 (defun idlwave-find-file-noselect (file &optional why)
3910 (or (idlwave-get-buffer-visiting file)
3912 (if why (add-to-list 'idlwave-outlawed-buffers (cons buf why)))
3915 (defun idlwave-kill-autoloaded-buffers ()
3920 f Buffers created by the command \\[idlwave-find-module] or mouse
3921 clicks in the routine info window.
3928 (if (null idlwave-outlawed-buffers)
3931 (idlwave-count-outlawed-buffers 'find)
3932 (idlwave-count-outlawed-buffers 'shell)))
3936 (idlwave-do-kill-autoloaded-buffers 'find))
3938 (idlwave-do-kill-autoloaded-buffers 'shell))
3940 (idlwave-do-kill-autoloaded-buffers t))
3943 (defun idlwave-count-outlawed-buffers (tag)
3948 idlwave-outlawed-buffers))))
3950 (defun idlwave-do-kill-autoloaded-buffers (&rest reasons)
3952 (let* ((list (copy-sequence idlwave-outlawed-buffers))
3961 (setq idlwave-outlawed-buffers
3962 (delq entry idlwave-outlawed-buffers)))
3963 (setq idlwave-outlawed-buffers
3964 (delq entry idlwave-outlawed-buffers))))
3967 (defun idlwave-revoke-license-to-kill ()
3969 Killing would be done by `idlwave-do-kill-autoloaded-buffers'.
3972 (entry (assq buf idlwave-outlawed-buffers)))
3975 (setq idlwave-outlawed-buffers
3976 (delq entry idlwave-outlawed-buffers)))
3978 (remove-hook 'after-save-hook 'idlwave-revoke-license-to-kill 'local)))
3980 (defvar idlwave-path-alist)
3981 (defun idlwave-locate-lib-file (file)
3983 (let* ((dirs idlwave-path-alist)
3991 (defun idlwave-expand-lib-file-name (file)
3997 (t (idlwave-locate-lib-file file))))
3999 (defun idlwave-make-tags ()
4000 "Creates the IDL tags file IDLTAGS in the current directory from
4001 the list of directories specified in the minibuffer. Directories may be
4013 (setq directories (idlwave-split-string directory "[ \t]+"))
4041 (setq files (idlwave-split-string
4042 (idlwave-replace-string
4088 (defun idlwave-toggle-comment-region (beg end &optional n)
4089 "Comment the lines in the region if the first non-blank line is
4138 ;; This is only done afterwards. Therefore in these functions it is
4145 (defvar idlwave-sint-routines '(nil))
4146 (defvar idlwave-sint-keywords '(nil))
4147 (defvar idlwave-sint-methods '(nil))
4148 (defvar idlwave-sint-classes '(nil))
4149 (defvar idlwave-sint-dirs '(nil))
4150 (defvar idlwave-sint-libnames '(nil))
4152 (defun idlwave-reset-sintern (&optional what)
4161 (let ((entries '((idlwave-sint-routines 1000 10)
4162 (idlwave-sint-keywords 1000 10)
4163 (idlwave-sint-methods 100 10)
4164 (idlwave-sint-classes 10 10))))
4167 (loop for entry in entries
4173 (null (cdr idlwave-sint-routines)))
4174 (loop for entry in entries
4178 (setq idlwave-sint-dirs nil
4179 idlwave-sint-libnames nil))
4183 (null (car idlwave-sint-routines)))
4184 (loop for entry in entries
4189 (defun idlwave-sintern-routine-or-method (name &optional class set)
4191 (idlwave-sintern-method name set)
4192 (idlwave-sintern-routine name set)))
4194 (defun idlwave-sintern (stype &rest args)
4195 (apply (intern (concat "idlwave-sintern-" (symbol-name stype))) args))
4197 ;;(defmacro idlwave-sintern (type var)
4201 ;; (set (idlwave-sintern-set name ,type ,var set))
4204 (defun idlwave-sintern-routine (name &optional set)
4206 ((gethash (downcase name) (cdr idlwave-sint-routines)))
4207 ((gethash (downcase name) (car idlwave-sint-routines)))
4208 (set (idlwave-sintern-set name 'routine idlwave-sint-routines set))
4210 (defun idlwave-sintern-keyword (name &optional set)
4212 ((gethash (downcase name) (cdr idlwave-sint-keywords)))
4213 ((gethash (downcase name) (car idlwave-sint-keywords)))
4214 (set (idlwave-sintern-set name 'keyword idlwave-sint-keywords set))
4216 (defun idlwave-sintern-method (name &optional set)
4218 ((gethash (downcase name) (cdr idlwave-sint-methods)))
4219 ((gethash (downcase name) (car idlwave-sint-methods)))
4220 (set (idlwave-sintern-set name 'method idlwave-sint-methods set))
4222 (defun idlwave-sintern-class (name &optional set)
4224 ((gethash (downcase name) (cdr idlwave-sint-classes)))
4225 ((gethash (downcase name) (car idlwave-sint-classes)))
4226 (set (idlwave-sintern-set name 'class idlwave-sint-classes set))
4229 (defun idlwave-sintern-dir (dir &optional set)
4230 (car (or (member dir idlwave-sint-dirs)
4231 (setq idlwave-sint-dirs (cons dir idlwave-sint-dirs)))))
4232 (defun idlwave-sintern-libname (name &optional set)
4233 (car (or (member name idlwave-sint-libnames)
4234 (setq idlwave-sint-libnames (cons name idlwave-sint-libnames)))))
4236 (defun idlwave-sintern-set (name type tables set)
4237 (let* ((func (or (cdr (assq type idlwave-completion-case))
4244 (defun idlwave-sintern-keyword-list (kwd-list &optional set)
4247 (setcar x (idlwave-sintern-keyword (car x) set)))
4251 (defun idlwave-sintern-rinfo-list (list &optional set default-dir)
4252 "Sintern all strings in the rinfo LIST. With optional parameter
4270 (setq class (idlwave-sintern-class class set))
4271 (setq name (idlwave-sintern-method name set)))
4272 (setq name (idlwave-sintern-routine name set)))
4282 (setq source-dir (idlwave-sintern-dir source-dir set)))
4284 (setq source-lib (idlwave-sintern-libname source-lib set)))
4289 (idlwave-sintern-keyword-list x set))
4299 (defun idlwave-new-sintern-type (tag)
4301 This defines the function `idlwave-sintern-TAG' and the variable
4302 `idlwave-sint-TAGs'."
4305 (var (intern (concat "idlwave-sint-" names)))
4306 (func (intern (concat "idlwave-sintern-" name))))
4317 (defun idlwave-reset-sintern-type (tag)
4319 (set (intern (concat "idlwave-sint-" (symbol-name tag) "s")) nil))
4325 (defvar idlwave-system-routines nil
4327 (defvar idlwave-buffer-routines nil
4329 (defvar idlwave-compiled-routines nil
4331 (defvar idlwave-unresolved-routines nil
4333 (defvar idlwave-user-catalog-routines nil
4335 (defvar idlwave-library-catalog-routines nil
4337 (defvar idlwave-library-catalog-libname nil
4339 (defvar idlwave-path-alist nil
4341 been scanned in a user catalog ('user) or discovered in a library
4343 (defvar idlwave-true-path-alist nil
4344 "Like `idlwave-path-alist', but with true filenames.")
4345 (defvar idlwave-routines nil
4347 (defvar idlwave-class-alist nil
4349 (defvar idlwave-class-history nil
4351 (defvar idlwave-force-class-query nil)
4352 (defvar idlwave-before-completion-wconf nil
4354 (defvar idlwave-last-system-routine-info-cons-cell nil
4355 "The last cons cell in the system routine info.")
4360 (defvar idlwave-system-routines)
4361 (defvar idlwave-catalog-process nil
4364 (defun idlwave-routines ()
4368 (if (and idlwave-catalog-process
4369 (processp idlwave-catalog-process))
4372 ((equal (process-status idlwave-catalog-process) 'exit)
4374 (setq idlwave-catalog-process nil)
4375 (idlwave-update-routine-info '(4)))
4376 ((equal (process-status idlwave-catalog-process) 'run)
4383 (kill-process idlwave-catalog-process)
4385 (setq idlwave-catalog-process nil)))))
4386 (or idlwave-routines
4388 (idlwave-update-routine-info)
4390 idlwave-routines)))
4392 (defvar idlwave-update-rinfo-hook nil
4396 (defun idlwave-rescan-catalog-directories ()
4398 (idlwave-update-routine-info '(16)))
4400 (defun idlwave-rescan-asynchronously ()
4401 "Dispatch another Emacs instance to update the idlwave catalog.
4405 (if (processp idlwave-catalog-process)
4406 (if (eq (process-status idlwave-catalog-process) 'run)
4410 (kill-process idlwave-catalog-process)
4415 (kill-process idlwave-catalog-process)
4417 (if (or (not idlwave-user-catalog-file)
4418 (not (stringp idlwave-user-catalog-file))
4419 (not (file-regular-p idlwave-user-catalog-file)))
4424 "-l" "idlwave"
4425 "-f" "idlwave-rescan-catalog-directories"))
4428 (setq idlwave-catalog-process process)
4433 (setq idlwave-routines nil
4434 idlwave-system-routines nil
4435 idlwave-catalog-process nil)
4436 (or (idlwave-start-load-rinfo-timer)
4437 (idlwave-update-routine-info '(4))))))
4451 ;; complete filepath, in which case DIR is unnecessary. HELPFILE can
4455 (defvar idlwave-load-rinfo-idle-timer)
4456 (defvar idlwave-shell-path-query)
4458 (defun idlwave-update-routine-info (&optional arg no-concatenate)
4460 These lists are used by `idlwave-routine-info' (\\[idlwave-routine-info])
4461 and by `idlwave-complete' (\\[idlwave-complete]) to provide information
4465 1. IDL programs in the current editing session
4466 2. Compiled modules in an IDL shell running as Emacs subprocess
4471 `idlwave-scan-all-buffers-for-routine-info').
4487 (itimerp idlwave-load-rinfo-idle-timer))
4489 (timerp idlwave-load-rinfo-idle-timer)))
4490 (cancel-timer idlwave-load-rinfo-idle-timer))
4494 (idlwave-rescan-asynchronously))
4497 (idlwave-create-user-catalog-file t))
4500 idlwave-buffer-case-takes-precedence
4501 (null idlwave-routines)))
4504 (override-idle (or arg idlwave-buffer-case-takes-precedence)))
4506 (setq idlwave-buffer-routines nil
4507 idlwave-compiled-routines nil
4508 idlwave-unresolved-routines nil)
4510 (if (get 'idlwave-reset-sintern 'done-by-idle)
4511 ;; reset was already done in idle time, so skip this step now once
4512 (put 'idlwave-reset-sintern 'done-by-idle nil)
4513 (idlwave-reset-sintern (cond (load t)
4514 ((null idlwave-system-routines) t)
4517 (if idlwave-buffer-case-takes-precedence
4520 (idlwave-update-buffer-routine-info)
4521 (and load (idlwave-load-all-rinfo override-idle)))
4523 (and load (idlwave-load-all-rinfo override-idle))
4524 (idlwave-update-buffer-routine-info))
4527 (let* ((shell-is-running (and (fboundp 'idlwave-shell-is-running)
4528 (idlwave-shell-is-running)))
4530 idlwave-query-shell-for-routine-info)))
4535 (idlwave-shell-send-command idlwave-shell-path-query
4537 (idlwave-shell-get-path-info)
4538 (idlwave-scan-library-catalogs))
4540 (idlwave-scan-library-catalogs)))
4549 ;; *delayed*, so not in time for the current command.
4552 (idlwave-concatenate-rinfo-lists nil 'run-hooks))
4557 (idlwave-shell-update-routine-info nil t)))))))
4560 (defvar idlwave-load-rinfo-steps-done (make-vector 6 nil))
4561 (defvar idlwave-load-rinfo-idle-timer nil)
4562 (defun idlwave-start-load-rinfo-timer ()
4564 (itimerp idlwave-load-rinfo-idle-timer))
4566 (timerp idlwave-load-rinfo-idle-timer)))
4567 (cancel-timer idlwave-load-rinfo-idle-timer))
4568 (setq idlwave-load-rinfo-steps-done (make-vector 6 nil))
4569 (setq idlwave-load-rinfo-idle-timer nil)
4570 (if (and idlwave-init-rinfo-when-idle-after
4571 (numberp idlwave-init-rinfo-when-idle-after)
4572 (not (equal 0 idlwave-init-rinfo-when-idle-after))
4573 (not idlwave-routines))
4576 (setq idlwave-load-rinfo-idle-timer
4578 idlwave-init-rinfo-when-idle-after
4579 nil 'idlwave-load-rinfo-next-step)))
4582 (defvar idlwave-library-routines nil "Obsolete variable.")
4585 (defun idlwave-load-system-routine-info ()
4590 (unless (and (load idlwave-xml-system-rinfo-converted-file
4592 (idlwave-xml-system-routine-info-up-to-date))
4595 (idlwave-convert-xml-system-routine-info)
4597 (unless (load idlwave-xml-system-rinfo-converted-file
4599 (if idlwave-system-routines
4608 (defun idlwave-xml-system-routine-info-up-to-date()
4610 (expand-file-name "help/online_help" (idlwave-sys-dir))))
4613 idlwave-xml-system-rinfo-converted-file
4616 (defvar idlwave-system-class-info nil) ; Gathered from idlw-rinfo
4617 (defvar idlwave-system-variables-alist nil
4619 Gets set in cached XML rinfo, or `idlw-rinfo.el'.")
4620 (defvar idlwave-executive-commands-alist nil
4622 (defvar idlwave-help-special-topic-words nil)
4625 (defun idlwave-shorten-syntax (syntax name &optional class)
4639 (defun idlwave-xml-create-class-method-lists (xml-entry)
4689 (nconc (idlwave-xml-create-rinfo-list pelem class extra-kwds)
4694 ; (message "Failed to match Init in class %s" class))
4696 ; (message "Failed to match GetProperty in class %s" class))
4698 ; (message "Failed to match SetProperty in class %s" class))
4705 (defun idlwave-xml-create-rinfo-list (xml-entry &optional class extra-kws)
4744 (loop for x in pref-list do
4764 (setq kwds (idlwave-rinfo-group-keywords kwds link))
4769 (idlwave-shorten-syntax
4775 (defun idlwave-rinfo-group-keywords (kwds master-link)
4781 link (idlwave-split-link-target (nth 1 kwd))
4796 (defun idlwave-convert-xml-clean-statement-aliases (aliases)
4800 (loop for x in aliases do
4801 (setq entry (assoc x idlwave-system-routines))
4806 (defun idlwave-convert-xml-clean-routine-aliases (aliases)
4810 (loop for x in aliases do
4819 (loop for x in all-parts do
4823 (loop for x in aliases do
4824 (when (setq alias (assoc (cdr x) idlwave-system-routines))
4828 (push alias idlwave-system-routines)))
4829 (loop for x in remove-list do
4830 (delq x idlwave-system-routines))))
4832 (defun idlwave-convert-xml-clean-sysvar-aliases (aliases)
4836 (loop for x in aliases do
4837 (when (setq alias (assoc (cdr x) idlwave-system-variables-alist))
4841 (push alias idlwave-system-variables-alist)))
4842 (loop for x in remove-list do
4843 (delq x idlwave-system-variables-alist))))
4846 (defun idlwave-xml-create-sysvar-alist (xml-entry)
4865 (idlwave-split-link-target (cdr (assq 'link props)))))
4872 (defvar idlwave-xml-routine-info-file nil)
4874 (defun idlwave-save-routine-info ()
4875 (if idlwave-xml-routine-info-file
4876 (with-temp-file idlwave-xml-system-rinfo-converted-file
4879 ;; IDLWAVE Routine Information File (IDLWAVE version " idlwave-mode-version ")
4881 ;; " idlwave-xml-routine-info-file "
4884 (insert (format "\n(setq idlwave-xml-routine-info-file \n \"%s\")"
4885 idlwave-xml-routine-info-file))
4886 (insert "\n(setq idlwave-system-routines\n '")
4887 (prin1 idlwave-system-routines (current-buffer))
4889 (insert "\n(setq idlwave-system-variables-alist\n '")
4890 (prin1 idlwave-system-variables-alist (current-buffer))
4892 (insert "\n(setq idlwave-system-class-info\n '")
4893 (prin1 idlwave-system-class-info (current-buffer))
4895 (insert "\n(setq idlwave-executive-commands-alist\n '")
4896 (prin1 idlwave-executive-commands-alist (current-buffer))
4898 (insert "\n(setq idlwave-help-special-topic-words\n '")
4899 (prin1 idlwave-help-special-topic-words (current-buffer))
4902 (defun idlwave-convert-xml-system-routine-info ()
4907 (expand-file-name "help/online_help" (idlwave-sys-dir))))
4931 (setq idlwave-xml-routine-info-file nil)
4933 (setq idlwave-system-routines nil
4934 idlwave-system-variables-alist nil
4935 idlwave-system-class-info nil
4936 idlwave-executive-commands-alist nil
4937 idlwave-help-special-topic-words nil)
4954 (setq routines (idlwave-xml-create-rinfo-list elem))
4956 (setq idlwave-system-routines
4957 (nconc idlwave-system-routines routines))
4959 (push routines idlwave-executive-commands-alist))))
4962 (setq class-result (idlwave-xml-create-class-method-lists elem))
4963 (push (car class-result) idlwave-system-class-info)
4964 (setq idlwave-system-routines
4965 (nconc idlwave-system-routines (cdr class-result))))
4970 idlwave-help-special-topic-words)
4981 (push (idlwave-xml-create-sysvar-alist elem)
4982 idlwave-system-variables-alist)))
4984 (idlwave-convert-xml-clean-routine-aliases routine-aliases)
4985 (idlwave-convert-xml-clean-statement-aliases statement-aliases)
4986 (idlwave-convert-xml-clean-sysvar-aliases sysvar-aliases)
4988 (setq idlwave-xml-routine-info-file catalog-file)
4989 (idlwave-save-routine-info)
5000 (defun idlwave-load-rinfo-next-step ()
5002 (arr idlwave-load-rinfo-steps-done))
5005 (message "Loading system routine info in idle time...")
5006 (idlwave-load-system-routine-info)
5008 (message "Loading system routine info in idle time...done")
5013 (message "Normalizing idlwave-system-routines in idle time...")
5014 (idlwave-reset-sintern t)
5015 (put 'idlwave-reset-sintern 'done-by-idle t)
5016 (setq idlwave-system-routines
5017 (idlwave-sintern-rinfo-list idlwave-system-routines 'sys))
5018 (message "Normalizing idlwave-system-routines in idle time...done")
5023 (when (and (stringp idlwave-user-catalog-file)
5024 (file-regular-p idlwave-user-catalog-file))
5025 (message "Loading user catalog in idle time...")
5027 (load-file idlwave-user-catalog-file)
5031 (boundp 'idlwave-library-routines)
5032 idlwave-library-routines)
5034 (setq idlwave-library-routines nil)
5037 idlwave-user-catalog-file))
5038 (message "Loading user catalog in idle time...done")))
5043 (when idlwave-user-catalog-routines
5044 (message "Normalizing user catalog routines in idle time...")
5045 (setq idlwave-user-catalog-routines
5046 (idlwave-sintern-rinfo-list
5047 idlwave-user-catalog-routines 'sys))
5049 "Normalizing user catalog routines in idle time...done"))
5054 (idlwave-scan-library-catalogs
5055 "Loading and normalizing library catalogs in idle time...")
5059 (message "Finishing initialization in idle time...")
5060 (idlwave-routines)
5061 (message "Finishing initialization in idle time...done")
5066 (idlwave-load-rinfo-next-step)
5067 (setq idlwave-load-rinfo-idle-timer
5069 idlwave-init-rinfo-when-idle-after
5070 nil 'idlwave-load-rinfo-next-step))))))
5072 (defun idlwave-load-all-rinfo (&optional force)
5077 (when (or force (not (aref idlwave-load-rinfo-steps-done 0)))
5079 (idlwave-load-system-routine-info))
5080 (when (or force (not (aref idlwave-load-rinfo-steps-done 1)))
5081 (message "Normalizing idlwave-system-routines...")
5082 (setq idlwave-system-routines
5083 (idlwave-sintern-rinfo-list idlwave-system-routines 'sys))
5084 (message "Normalizing idlwave-system-routines...done"))
5085 (when idlwave-system-routines
5086 (setq idlwave-routines (copy-sequence idlwave-system-routines))
5087 (setq idlwave-last-system-routine-info-cons-cell
5088 (nthcdr (1- (length idlwave-routines)) idlwave-routines)))
5091 (when (and (stringp idlwave-user-catalog-file)
5092 (file-regular-p idlwave-user-catalog-file))
5094 (when (or force (not (aref idlwave-load-rinfo-steps-done 2)))
5095 (load-file idlwave-user-catalog-file))
5098 (boundp 'idlwave-library-routines)
5099 idlwave-library-routines)
5100 (setq idlwave-library-routines nil)
5102 idlwave-user-catalog-file))
5103 (setq idlwave-true-path-alist nil)
5104 (when (or force (not (aref idlwave-load-rinfo-steps-done 3)))
5106 (setq idlwave-user-catalog-routines
5107 (idlwave-sintern-rinfo-list
5108 idlwave-user-catalog-routines 'sys))
5112 (when (or force (not (aref idlwave-load-rinfo-steps-done 4)))
5113 (idlwave-scan-library-catalogs
5115 (run-hooks 'idlwave-after-load-rinfo-hook))
5118 (defun idlwave-update-buffer-routine-info ()
5121 ((eq idlwave-scan-all-buffers-for-routine-info t)
5124 (setq res (idlwave-get-routine-info-from-buffers
5126 ((null idlwave-scan-all-buffers-for-routine-info)
5131 (if (eq major-mode 'idlwave-mode)
5134 (setq res (idlwave-get-routine-info-from-buffers
5137 (setq idlwave-buffer-routines
5138 (idlwave-sintern-rinfo-list res 'set))))
5140 (defun idlwave-concatenate-rinfo-lists (&optional quiet run-hook)
5143 ;; later ones. We assume that if things in the buffers are newer
5144 ;; then in the shell of the system, they are meant to be different.
5145 (setcdr idlwave-last-system-routine-info-cons-cell
5146 (append idlwave-buffer-routines
5147 idlwave-compiled-routines
5148 idlwave-library-catalog-routines
5149 idlwave-user-catalog-routines))
5150 (setq idlwave-class-alist nil)
5156 (length idlwave-buffer-routines)
5157 (length idlwave-compiled-routines)
5158 (length idlwave-library-catalog-routines)
5159 (length idlwave-user-catalog-routines)
5160 (length idlwave-system-routines)))
5162 (run-hooks 'idlwave-update-rinfo-hook)))
5164 (defun idlwave-class-alist ()
5166 (or idlwave-class-alist
5168 (loop for x in idlwave-routines do
5170 (not (assq class idlwave-class-alist)))
5171 (push (list class) idlwave-class-alist)))
5172 idlwave-class-alist)))
5175 (defun idlwave-save-buffer-update ()
5176 (idlwave-update-current-buffer-info 'save-buffer))
5177 (defun idlwave-kill-buffer-update ()
5178 (idlwave-update-current-buffer-info 'kill-buffer))
5179 (defun idlwave-new-buffer-update ()
5180 (idlwave-update-current-buffer-info 'find-file))
5182 (defun idlwave-update-current-buffer-info (why)
5183 "Update idlwave-routines for current buffer. Can run from after-save-hook."
5184 (when (and (eq major-mode 'idlwave-mode)
5185 (or (eq t idlwave-auto-routine-info-updates)
5186 (memq why idlwave-auto-routine-info-updates))
5187 idlwave-scan-all-buffers-for-routine-info
5188 idlwave-routines)
5191 (idlwave-replace-buffer-routine-info
5196 (idlwave-sintern-rinfo-list
5197 (idlwave-get-routine-info-from-buffers
5199 (idlwave-concatenate-rinfo-lists 'quiet)
5203 (defun idlwave-replace-buffer-routine-info (file new)
5204 "Cut the part from FILE out of `idlwave-buffer-routines' and add NEW."
5205 (let ((list idlwave-buffer-routines)
5211 (if (eq (idlwave-routine-source-file (nth 3 (car list))) file)
5219 (setq idlwave-buffer-routines
5220 (append new (delq nil idlwave-buffer-routines)))))
5224 (defun idlwave-get-routine-info-from-buffers (buffers)
5225 "Call `idlwave-get-buffer-routine-info' on idlwave-mode buffers in BUFFERS."
5230 (if (and (eq major-mode 'idlwave-mode)
5234 (idlwave-get-buffer-routine-info)
5240 (defun idlwave-get-buffer-routine-info ()
5253 (idlwave-end-of-statement)
5255 (setq entry (idlwave-parse-definition string))
5259 (defvar idlwave-scanning-lib-dir)
5260 (defun idlwave-parse-definition (string)
5294 ;; will not be contained in the calling sequence.
5298 (cond ((not (boundp 'idlwave-scanning-lib))
5307 idlwave-scanning-lib-dir "UserLib")))
5324 (defun idlwave-sys-dir ()
5327 ((and idlwave-system-directory
5328 (not (string= idlwave-system-directory "")))
5329 idlwave-system-directory)
5334 (defun idlwave-create-user-catalog-file (&optional arg)
5338 the result as a file `idlwave-user-catalog-file'. When this file
5344 (if (and (stringp idlwave-user-catalog-file)
5345 (file-regular-p idlwave-user-catalog-file))
5347 (load-file idlwave-user-catalog-file)
5350 (unless (and (stringp idlwave-user-catalog-file)
5351 (> (length idlwave-user-catalog-file) 0)
5353 (file-name-directory idlwave-user-catalog-file))
5355 idlwave-user-catalog-file))))
5356 (error "`idlwave-user-catalog-file' does not point to a file in an accessible directory"))
5360 ((and arg idlwave-path-alist
5361 (consp (car idlwave-path-alist)))
5362 (idlwave-scan-user-lib-files idlwave-path-alist))
5365 (idlwave-library-path
5366 (idlwave-display-user-catalog-widget
5367 (if idlwave-true-path-alist
5371 idlwave-true-path-alist)))
5375 (idlwave-expand-path idlwave-library-path))
5376 (mapcar 'list (idlwave-expand-path idlwave-library-path)))))
5382 (idlwave-shell-send-command idlwave-shell-path-query
5383 '(idlwave-user-catalog-command-hook nil)
5388 (defun idlwave-user-catalog-command-hook (&optional arg)
5389 ;; Command hook used by `idlwave-create-user-catalog-file'.
5392 (idlwave-scan-user-lib-files idlwave-path-alist)
5394 (idlwave-shell-get-path-info 'no-write) ; set to something path-alist
5395 (idlwave-scan-library-catalogs "Locating library catalogs..." 'no-load)
5396 (idlwave-display-user-catalog-widget idlwave-path-alist)))
5398 (defconst idlwave-user-catalog-widget-help-string
5401 would like to extract routine information, to be stored in the file:
5406 `idlwave-user-catalog-file', and call this command again.
5417 (defvar idlwave-widget)
5419 (defun idlwave-display-user-catalog-widget (dirs-list)
5430 (make-local-variable 'idlwave-widget)
5431 (widget-insert (format idlwave-user-catalog-widget-help-string
5432 idlwave-user-catalog-file))
5435 :notify 'idlwave-widget-scan-user-lib-files
5439 :notify 'idlwave-delete-user-catalog-file
5445 (let ((path-list (widget-get idlwave-widget :path-dirs)))
5448 (idlwave-path-alist-add-flag x 'user)))
5450 (idlwave-display-user-catalog-widget path-list)))
5456 (let ((path-list (widget-get idlwave-widget :path-dirs)))
5458 (idlwave-path-alist-remove-flag x 'user))
5460 (idlwave-display-user-catalog-widget path-list)))
5471 (setq idlwave-widget
5485 (widget-put idlwave-widget :path-dirs dirs-list)
5492 (defun idlwave-delete-user-catalog-file (&rest ignore)
5494 (format "Delete file %s " idlwave-user-catalog-file))
5496 (delete-file idlwave-user-catalog-file)
5497 (message "%s has been deleted" idlwave-user-catalog-file))))
5499 (defun idlwave-widget-scan-user-lib-files (&rest ignore)
5500 ;; Call `idlwave-scan-user-lib-files' with data taken from the widget.
5501 (let* ((widget idlwave-widget)
5512 (idlwave-path-alist-add-flag dir-entry 'user)
5513 (idlwave-path-alist-remove-flag dir-entry 'user)))
5514 (idlwave-scan-user-lib-files path-alist)))
5517 (defun idlwave-scan-user-lib-files (path-alist)
5518 ;; Scan the PRO files in PATH-ALIST and store the info in the user catalog
5519 (let* ((idlwave-scanning-lib t)
5520 (idlwave-scanning-lib-dir "")
5521 (idlwave-completion-case nil)
5523 (setq idlwave-user-catalog-routines nil
5524 idlwave-path-alist path-alist ; for library-path instead
5525 idlwave-true-path-alist nil)
5526 (if idlwave-auto-write-paths (idlwave-write-paths))
5528 (set-buffer (get-buffer-create "*idlwave-scan.pro*"))
5529 (idlwave-mode)
5534 (setq idlwave-scanning-lib-dir dir)
5544 (setq idlwave-user-catalog-routines
5545 (append (idlwave-get-routine-info-from-buffers
5547 idlwave-user-catalog-routines)))))))))
5549 (kill-buffer "*idlwave-scan.pro*")
5553 (find-file idlwave-user-catalog-file))
5562 (insert "\n(setq idlwave-user-catalog-routines\n '(")
5568 idlwave-user-catalog-routines))
5570 (file-name-nondirectory idlwave-user-catalog-file)))
5576 (message "Info for %d routines saved in %s"
5577 (length idlwave-user-catalog-routines)
5578 idlwave-user-catalog-file)
5580 (idlwave-update-routine-info t))
5582 (defun idlwave-read-paths ()
5583 (if (and (stringp idlwave-path-file)
5584 (file-regular-p idlwave-path-file))
5586 (load idlwave-path-file t t t)
5589 (defun idlwave-write-paths ()
5591 (when (and idlwave-path-alist idlwave-system-directory)
5594 (find-file idlwave-path-file))
5602 (insert (format "\n(setq idlwave-system-directory \"%s\")\n"
5603 idlwave-system-directory))
5606 (insert "\n(setq idlwave-path-alist\n '(")
5612 idlwave-path-alist))
5618 (defun idlwave-expand-path (path &optional default-dir)
5631 (setq path1 (append (idlwave-recursive-directory-list dir) path1))
5637 (defun idlwave-recursive-directory-list (dir)
5655 (defun idlwave-scan-library-catalogs (&optional message-base no-load)
5658 All directories on `idlwave-path-alist' (or `idlwave-library-path'
5661 NO-LOAD is non-nil. The variable `idlwave-use-library-catalogs' can
5663 (when idlwave-use-library-catalogs
5665 (if idlwave-library-path
5666 (idlwave-expand-path idlwave-library-path)
5667 (mapcar 'car idlwave-path-alist)))
5676 (setq idlwave-library-catalog-routines nil)
5683 (not (string= idlwave-library-catalog-libname
5686 idlwave-library-catalog-libname))
5687 (setq old-libname idlwave-library-catalog-libname))
5688 (when idlwave-library-catalog-routines
5691 (idlwave-sintern-rinfo-list
5692 idlwave-library-catalog-routines 'sys dir)
5696 (when (and idlwave-path-alist
5697 (setq dir-entry (assoc dir idlwave-path-alist)))
5698 (idlwave-path-alist-add-flag dir-entry 'lib)))))
5699 (unless no-load (setq idlwave-library-catalog-routines all-routines))
5706 (defconst idlwave-routine-info.pro
5824 (defvar idlwave-idlwave_routine_info-compiled nil
5827 (defvar idlwave-shell-temp-pro-file)
5828 (defvar idlwave-shell-temp-rinfo-save-file)
5830 (defun idlwave-shell-compile-helper-routines (&optional wait)
5831 (unless (and idlwave-idlwave_routine_info-compiled
5832 (file-readable-p (idlwave-shell-temp-file 'rinfo)))
5834 (set-buffer (idlwave-find-file-noselect
5835 (idlwave-shell-temp-file 'pro)))
5837 (insert idlwave-routine-info.pro)
5839 (idlwave-shell-send-command
5840 (concat ".run \"" idlwave-shell-temp-pro-file "\"")
5842 (idlwave-shell-send-command
5844 (idlwave-shell-temp-file 'rinfo))
5846 (setq idlwave-idlwave_routine_info-compiled t))
5850 (idlwave-shell-send-command
5852 idlwave-shell-temp-rinfo-save-file
5853 idlwave-shell-temp-rinfo-save-file)
5857 (defun idlwave-shell-update-routine-info (&optional quiet run-hooks wait file)
5864 ;; FILE is set, only update routine info for routines in that file.
5866 (idlwave-shell-compile-helper-routines wait)
5868 (idlwave-shell-send-command
5871 (idlwave-shell-routine-info-filter)
5872 (idlwave-concatenate-rinfo-lists ,quiet ,run-hooks))
5879 (defvar idlwave-completion-help-info nil)
5880 (defvar idlwave-completion-help-links nil)
5881 (defvar idlwave-current-obj_new-class nil)
5882 (defvar idlwave-complete-special nil)
5884 (defun idlwave-complete (&optional arg module class)
5890 - after a `(' or `,' in the argument list of a function or procedure,
5894 When several completions are possible, a list will be displayed in the
5897 \\[idlwave-complete].
5900 name, the action depends upon `idlwave-query-class', which see. You
5904 See also the variables `idlwave-keyword-completion-adds-equal' and
5905 `idlwave-function-completion-adds-paren'.
5907 The optional ARG can be used to specify the completion type in order
5923 function names in places where the default would be a keyword.
5932 (idlwave-routines)
5937 (idlwave-make-force-complete-where-list arg module class)
5938 (idlwave-where)))
5940 (idlwave-force-class-query (equal arg '(4)))
5952 (eq (car-safe last-command) 'idlwave-display-completion-list)
5955 (idlwave-scroll-completions))
5957 ;; Complete a filename in quotes
5958 ((and (idlwave-in-quote)
5960 (idlwave-complete-filename))
5963 ((and idlwave-complete-special
5964 (idlwave-call-special idlwave-complete-special)))
5971 (setq idlwave-completion-help-info '(class))
5972 (idlwave-complete-class))
5977 (class-selector (idlwave-determine-class cw-list 'pro))
5978 (super-classes (unless (idlwave-explicit-class-listed cw-list)
5979 (idlwave-all-class-inherits class-selector)))
5982 (setq idlwave-completion-help-info
5984 (idlwave-complete-in-buffer
5986 (idlwave-routines) 'idlwave-selector
5995 'idlwave-attach-method-classes 'idlwave-add-file-link-selector)))
6000 (class-selector (idlwave-determine-class cw-list 'fun))
6001 (super-classes (unless (idlwave-explicit-class-listed cw-list)
6002 (idlwave-all-class-inherits class-selector)))
6005 (setq idlwave-completion-help-info
6007 (idlwave-complete-in-buffer
6009 (idlwave-routines) 'idlwave-selector
6018 'idlwave-attach-method-classes 'idlwave-add-file-link-selector)))
6022 (idlwave-complete 3))
6030 (class (idlwave-determine-class where 'pro))
6032 (super-classes (idlwave-all-class-inherits class-selector))
6034 (entry (idlwave-best-rinfo-assq
6035 name 'pro class (idlwave-routines)))
6037 (list (idlwave-entry-keywords entry 'do-link)))
6040 (idlwave-make-full-name class name)))
6041 (setq list (idlwave-fix-keywords name 'pro class list
6044 (idlwave-make-full-name class name)))
6045 (setq idlwave-completion-help-info
6047 (idlwave-complete-in-buffer
6050 (idlwave-make-full-name class name)
6055 'idlwave-attach-keyword-classes)))
6063 (class (idlwave-determine-class where 'fun))
6065 (super-classes (idlwave-all-class-inherits class-selector))
6067 (entry (idlwave-best-rinfo-assq
6068 name 'fun class (idlwave-routines)))
6070 (list (idlwave-entry-keywords entry 'do-link))
6074 (idlwave-make-full-name class name)))
6075 (setq list (idlwave-fix-keywords name 'fun class list
6080 (concat idlwave-current-obj_new-class
6082 (idlwave-make-full-name class name)))
6085 (setq idlwave-completion-help-info
6087 (idlwave-complete-in-buffer
6094 'idlwave-attach-keyword-classes)))
6096 (t (error "This should not happen (idlwave-complete)")))))
6098 (defvar idlwave-complete-special nil
6102 should use `idlwave-complete-in-buffer' to do some completion and
6107 (defun idlwave-call-special (functions &rest args)
6116 (defun idlwave-make-force-complete-where-list (what &optional module class)
6119 ;; WHAT is the prefix arg of `idlwave-complete', see there for details.
6121 ;; The class name will also be found in MODULE if that is like "class::mod".
6127 (module (idlwave-sintern-routine-or-method module class))
6128 (class (idlwave-sintern-class class))
6154 (idlwave-completing-read
6155 "Procedure: " (idlwave-routines) 'idlwave-selector))))
6156 (setq pro (idlwave-sintern-routine pro))
6168 (idlwave-completing-read
6169 "Function: " (idlwave-routines) 'idlwave-selector))))
6170 (setq func (idlwave-sintern-routine func))
6178 (let* ((class (idlwave-determine-class class-list 'pro))
6180 (super-classes (idlwave-all-class-inherits class-selector))
6183 (idlwave-completing-read
6184 (format "Procedure in %s class: " class-selector)
6185 (idlwave-routines) 'idlwave-selector))))
6186 (setq pro (idlwave-sintern-method pro))
6194 (let* ((class (idlwave-determine-class class-list 'fun))
6196 (super-classes (idlwave-all-class-inherits class-selector))
6199 (idlwave-completing-read
6200 (format "Function in %s class: " class-selector)
6201 (idlwave-routines) 'idlwave-selector))))
6202 (setq func (idlwave-sintern-method func))
6211 (defun idlwave-completing-read (&rest args)
6220 (defvar idlwave-shell-default-directory)
6221 (defun idlwave-complete-filename ()
6227 (if (and (boundp 'idlwave-shell-default-directory)
6228 (stringp idlwave-shell-default-directory)
6229 (file-directory-p idlwave-shell-default-directory))
6230 idlwave-shell-default-directory
6234 (defun idlwave-make-full-name (class name)
6238 (defun idlwave-rinfo-assoc (name type class list)
6239 "Like `idlwave-rinfo-assq', but sintern strings first."
6240 (idlwave-rinfo-assq
6241 (idlwave-sintern-routine-or-method name class)
6242 type (idlwave-sintern-class class) list))
6244 (defun idlwave-rinfo-assq (name type class list)
6255 (defun idlwave-rinfo-assq-any-class (name type class list)
6257 (let* ((classes (cons class (idlwave-all-class-inherits class)))
6260 (if (setq rtn (idlwave-rinfo-assq name type (pop classes) list))
6264 (defun idlwave-best-rinfo-assq (name type class list &optional with-file
6266 "Like `idlwave-rinfo-assq', but get all twins and sort, then return first.
6270 (let ((twins (idlwave-routine-twins
6271 (idlwave-rinfo-assq-any-class name type class list)
6275 (setq twins (sort twins 'idlwave-routine-entry-compare-twins))
6278 (setq syslibp (idlwave-any-syslib (cdr twins)))
6289 (defun idlwave-best-rinfo-assoc (name type class list &optional with-file
6291 "Like `idlwave-best-rinfo-assq', but sintern strings first."
6292 (idlwave-best-rinfo-assq
6293 (idlwave-sintern-routine-or-method name class)
6294 type (idlwave-sintern-class class) list with-file keep-system))
6296 (defun idlwave-any-syslib (entries)
6303 (setq file (idlwave-routine-source-file (nth 3 (car entries))))
6304 (if (and file (idlwave-syslib-p file))
6309 (defun idlwave-all-assq (key list)
6310 "Return a list of all associations of Key in LIST."
6317 (defun idlwave-all-method-classes (method &optional type)
6321 (mapcar 'car (idlwave-class-alist))
6328 (idlwave-all-assq method (idlwave-routines)))
6329 (idlwave-uniquify rtn))))
6331 (defun idlwave-all-method-keyword-classes (method keyword &optional type)
6343 (assoc keyword (idlwave-entry-keywords x))
6345 (idlwave-all-assq method (idlwave-routines)))
6346 (idlwave-uniquify rtn))))
6348 (defun idlwave-members-only (list club)
6349 "Return list of all elements in LIST which are also in CLUB."
6357 (defun idlwave-nonmembers-only (list club)
6358 "Return list of all elements in LIST which are not in CLUB."
6367 (defun idlwave-explicit-class-listed (info)
6369 INFO is as returned by idlwave-what-function or -procedure."
6375 (defvar idlwave-determine-class-special nil
6379 (defun idlwave-determine-class (info type)
6381 ;; INFO is the `cw-list' structure as returned by idlwave-where.
6382 ;; The second element in this structure is the class. When nil, we
6393 idlwave-query-class))
6395 idlwave-query-class))
6406 (force-query idlwave-force-class-query)
6412 (if (and arrow (get-text-property apos 'idlwave-class)
6413 idlwave-store-inquired-class
6415 (setq class (get-text-property apos 'idlwave-class)
6416 class (idlwave-sintern-class class)))
6418 (setq class (or (nth 2 (idlwave-current-routine)) class)))
6422 idlwave-determine-class-special
6425 (idlwave-call-special idlwave-determine-class-special apos))
6427 (setq class (idlwave-sintern-class special-class)
6428 store idlwave-store-inquired-class)))
6434 (mapcar 'list (idlwave-all-method-classes (car info) type)))
6436 (idlwave-sintern-class
6443 (setq store idlwave-store-inquired-class)
6444 (idlwave-completing-read
6449 class-alist nil nil nil 'idlwave-class-history))))))
6458 `(idlwave-class ,class face ,idlwave-class-arrow-face
6471 (defun idlwave-selector (a)
6477 (defun idlwave-add-file-link-selector (a)
6479 (let ((sel (idlwave-selector a)) file)
6480 (if (and sel (setq file (idlwave-entry-has-help a)))
6481 (push (cons (car a) file) idlwave-completion-help-links))
6485 (defun idlwave-where ()
6504 (idlwave-routines)
6505 (let* (;(bos (save-excursion (idlwave-beginning-of-statement) (point)))
6506 (bos (save-excursion (idlwave-start-of-substatement 'pre) (point)))
6507 (func-entry (idlwave-what-function bos))
6513 (pro-entry (idlwave-what-procedure bos))
6518 (last-char (idlwave-last-valid-char))
6554 ; ;; FIXME: I am sure there can be more in this list
6564 (idlwave-sintern-class (match-string 4))
6572 (defun idlwave-this-word (&optional class)
6580 (defun idlwave-what-function (&optional bound)
6593 (idlwave-with-special-syntax
6617 (idlwave-sintern-routine-or-method func class)
6618 (idlwave-sintern-class class)
6623 (defun idlwave-what-procedure (&optional bound)
6632 ;;(idlwave-beginning-of-statement)
6633 (idlwave-start-of-substatement 'pre)
6639 (if (and (idlwave-skip-object)
6651 (list (idlwave-sintern-routine-or-method pro class)
6652 (idlwave-sintern-class class)
6656 (defun idlwave-skip-object ()
6664 ((looking-at idlwave-identifier)
6673 (if (not (looking-at idlwave-identifier))
6687 (defun idlwave-last-valid-char ()
6689 and also not part of the current identifier. Since we do this in
6713 (defvar idlwave-complete-after-success-form nil
6715 (defvar idlwave-complete-after-success-form-force nil
6716 "A form to evaluate after completion selection in *Completions* buffer.")
6717 (defconst idlwave-completion-mark (make-marker)
6720 (defun idlwave-complete-in-buffer (type stype list selector prompt isa
6725 PROMPT in echo area. TYPE is one of the intern types, e.g. 'function,
6736 ;; What is already in the buffer?
6741 idlwave-complete-after-success-form
6742 (list 'idlwave-after-successful-completion
6743 (list 'quote type) slash beg)
6744 idlwave-complete-after-success-form-force
6745 (list 'idlwave-after-successful-completion
6746 (list 'quote type) slash (list 'quote 'force))))
6751 spart (idlwave-sintern stype part)
6754 idlwave-completion-help-links nil)
6765 idlwave-complete-empty-string-as-lower-case)
6766 (not idlwave-completion-force-default-case))
6771 (idlwave-after-successful-completion type slash beg))
6775 (idlwave-uniquify
6781 (idlwave-after-successful-completion type slash beg)
6788 (unless idlwave-completion-help-links ; already set somewhere?
6793 idlwave-completion-help-links))))
6809 idlwave-complete-empty-string-as-lower-case)
6810 (not idlwave-completion-force-default-case))
6817 (idlwave-display-completion-list list prompt beg complete))
6820 (defun idlwave-complete-class ()
6823 ;; Call `idlwave-routines' to make sure the class list will be available
6824 (idlwave-routines)
6836 ;; Do the completion, using list gathered from `idlwave-routines'
6837 (idlwave-complete-in-buffer
6838 'class 'class (idlwave-class-alist) nil
6842 (let* ((entry (idlwave-class-info x))
6845 idlwave-completion-help-links))
6849 (defun idlwave-attach-classes (list type show-classes)
6853 ;; SHOW-CLASSES is the value of `idlwave-completion-show-classes'.
6878 (idlwave-class-or-superclass-with-tag class-selector x)))
6882 (idlwave-all-method-keyword-classes
6884 (idlwave-all-method-classes x type-selector)))
6896 ;; We do want info in the buffer
6914 (defun idlwave-attach-method-classes (list)
6915 ;; Call idlwave-attach-classes with method parameters
6916 (idlwave-attach-classes list 'method idlwave-completion-show-classes))
6917 (defun idlwave-attach-keyword-classes (list)
6918 ;; Call idlwave-attach-classes with keyword parameters
6919 (idlwave-attach-classes list 'kwd idlwave-completion-show-classes))
6920 (defun idlwave-attach-class-tag-classes (list)
6921 ;; Call idlwave-attach-classes with class structure tags
6922 (idlwave-attach-classes list 'class-tag idlwave-completion-show-classes))
6931 (defun idlwave-pset (item)
6934 (defun idlwave-popup-select (ev list title &optional sort)
6935 "Select an item in LIST with a popup menu.
6938 (let ((maxpopup idlwave-max-popup-menu-items)
6948 (mapcar (lambda (x) (vector x (list 'idlwave-pset
6951 (setq menu (idlwave-split-menu-xemacs menu maxpopup))
6961 (setq menu (idlwave-split-menu-emacs menu maxpopup))
6965 (defun idlwave-split-menu-xemacs (menu N)
6990 (defun idlwave-split-menu-emacs (menu N)
7018 (defvar idlwave-completion-setup-hook nil)
7020 (defun idlwave-scroll-completions (&optional message)
7033 (eval idlwave-complete-after-success-form))
7038 (defun idlwave-display-completion-list (list &optional message beg complete)
7039 "Display the completions in LIST in the completions buffer and echo MESSAGE."
7041 (idlwave-local-value 'idlwave-completion-p "*Completions*"))
7042 (move-marker idlwave-completion-mark beg)
7043 (setq idlwave-before-completion-wconf (current-window-configuration)))
7046 (idlwave-display-completion-list-xemacs
7048 (idlwave-display-completion-list-emacs list))
7050 ;; Store a special value in `this-command'. When `idlwave-complete'
7051 ;; finds this in `last-command', it will scroll the *Completions* buffer.
7052 (setq this-command (list 'idlwave-display-completion-list message complete))
7055 (idlwave-set-local 'idlwave-completion-p t "*Completions*")
7058 (if (and idlwave-completion-fontify-classes
7060 (idlwave-completion-fontify-classes))
7063 (run-hooks 'idlwave-completion-setup-hook)
7068 (defun idlwave-choose (function &rest args)
7072 (if (and (eq major-mode 'idlwave-shell-mode)
7080 (eval idlwave-complete-after-success-form-force))
7082 (defun idlwave-keyboard-quit ()
7085 (if (eq (car-safe last-command) 'idlwave-display-completion-list)
7086 (idlwave-restore-wconf-after-completion))
7089 (defun idlwave-restore-wconf-after-completion ()
7091 (and idlwave-completion-restore-window-configuration
7092 idlwave-before-completion-wconf
7093 (set-window-configuration idlwave-before-completion-wconf)))
7095 (defun idlwave-one-key-select (sym prompt delay)
7096 "Make the user select an element from the alist in the variable SYM.
7103 First, the strings are checked for preselected keys, like in \"[P]rint\".
7104 If these don't exist, a letter in the string is automatically selected."
7113 (setq keys-alist (idlwave-make-one-key-alist alist))
7135 (defun idlwave-make-one-key-alist (alist)
7183 (defun idlwave-set-local (var value &optional buffer)
7184 "Set the buffer-local value of VAR in BUFFER to VALUE."
7189 (defun idlwave-local-value (var &optional buffer)
7190 "Return the value of VAR in BUFFER, but only if VAR is local to BUFFER."
7200 (defvar idlwave-completion-map nil
7201 "Keymap for completion-list-mode with idlwave-complete.")
7203 (defun idlwave-display-completion-list-xemacs (list &rest cl-args)
7206 ':activate-callback 'idlwave-default-choose-completion
7211 (or idlwave-completion-map
7212 (setq idlwave-completion-map
7213 (idlwave-make-modified-completion-map-xemacs
7216 (defun idlwave-default-choose-completion (&rest args)
7218 (apply 'idlwave-choose 'default-choose-completion args))
7220 (defun idlwave-make-modified-completion-map-xemacs (old-map)
7221 "Replace `choose-completion' and `mouse-choose-completion' in OLD-MAP."
7223 (define-key new-map [button3up] 'idlwave-mouse-completion-help)
7229 ;; In Emacs we also replace keybindings in the completion
7230 ;; map in order to install our wrappers.
7232 (defun idlwave-display-completion-list-emacs (list)
7239 (or idlwave-completion-map
7240 (setq idlwave-completion-map
7241 (idlwave-make-modified-completion-map-emacs
7244 (defun idlwave-make-modified-completion-map-emacs (old-map)
7245 "Replace `choose-completion' and `mouse-choose-completion' in OLD-MAP."
7248 'choose-completion 'idlwave-choose-completion new-map)
7250 'mouse-choose-completion 'idlwave-mouse-choose-completion new-map)
7251 (define-key new-map [mouse-3] 'idlwave-mouse-completion-help)
7254 (defun idlwave-choose-completion (&rest args)
7255 "Choose the completion that point is in or next to."
7257 (apply 'idlwave-choose 'choose-completion args))
7259 (defun idlwave-mouse-choose-completion (&rest args)
7260 "Click on an alternative in the `*Completions*' buffer to choose it."
7262 (apply 'idlwave-choose 'mouse-choose-completion args))
7272 ;; plugin. It is in self.el, but currently still very bad.
7273 ;; This could be in a separate file in the distribution, or
7274 ;; in an appendix for the manual.
7276 (defvar idlwave-struct-skip
7278 "Regexp for skipping continued blank or comment-only lines in
7281 (defvar idlwave-struct-tag-regexp
7283 idlwave-struct-skip ; 4 groups
7288 (defun idlwave-struct-tags ()
7289 "Return a list of all tags in the structure defined at point.
7292 (let* ((borders (idlwave-struct-borders))
7299 (while (re-search-forward idlwave-struct-tag-regexp end t)
7307 (defun idlwave-find-struct-tag (tag)
7308 "Find a given TAG in the structure defined at point."
7309 (let* ((borders (idlwave-struct-borders))
7316 (defun idlwave-struct-inherits ()
7317 "Return a list of all `inherits' names in the struct at point.
7320 (let* ((borders (idlwave-struct-borders))
7330 idlwave-struct-skip ; 4 groups
7332 idlwave-struct-skip ; 4 more
7342 (defun idlwave-in-structure ()
7346 (if (not (or (idlwave-in-comment) (idlwave-in-quote)))
7347 (if (idlwave-find-structure-definition nil nil 'back)
7348 (let ((borders (idlwave-struct-borders)))
7352 (defun idlwave-struct-borders ()
7362 (defun idlwave-find-structure-definition (&optional var name bound)
7375 (concat "\\<" (regexp-quote (downcase var)) "\\>" ws)
7391 (defvar idlwave-class-info nil)
7392 (defvar idlwave-class-reset nil) ; to reset buffer-local classes
7394 (add-hook 'idlwave-update-rinfo-hook
7395 (lambda () (setq idlwave-class-reset t)))
7396 (add-hook 'idlwave-after-load-rinfo-hook
7397 (lambda () (setq idlwave-class-info nil)))
7399 (defun idlwave-class-info (class)
7401 (if idlwave-class-info
7402 (if idlwave-class-reset
7404 idlwave-class-reset nil
7405 idlwave-class-info ; Remove any visited in a buffer
7409 (idlwave-class-file-or-buffer
7410 (or (cdr (assq 'found-in x)) (car x)))))
7414 idlwave-class-info))))
7415 ;; Info is nil, put in the system stuff to start.
7416 (setq idlwave-class-info idlwave-system-class-info)
7417 (setq list idlwave-class-info)
7419 (idlwave-sintern-class-info entry)))
7420 (setq class (idlwave-sintern-class class))
7421 (or (assq class idlwave-class-info)
7422 (progn (idlwave-scan-class-info class)
7423 (assq class idlwave-class-info)))))
7425 (defun idlwave-sintern-class-info (entry)
7426 "Sintern the class names in a class-info entry."
7429 (setcar entry (idlwave-sintern-class (car entry) 'set))
7431 (setcdr inherits (mapcar (lambda (x) (idlwave-sintern-class x 'set))
7434 (defun idlwave-find-class-definition (class &optional all-hook alt-class)
7436 If ALL-HOOK is set, find all named structure definitions in a given
7446 (setq end-lim (save-excursion (idlwave-end-of-subprogram) (point)))
7448 (idlwave-find-structure-definition nil t end-lim))
7450 (idlwave-find-structure-definition nil (or alt-class class))))))
7453 (defun idlwave-class-file-or-buffer (class)
7456 (file (idlwave-routine-source-file
7457 (nth 3 (idlwave-rinfo-assoc pro 'pro nil
7458 (idlwave-routines))))))
7459 (cons file (if file (idlwave-get-buffer-visiting file)))))
7462 (defun idlwave-scan-class-info (class)
7463 "Scan all class and named structure info in the class__define pro"
7464 (let* ((idlwave-auto-routine-info-updates nil)
7465 (filebuf (idlwave-class-file-or-buffer class))
7468 (class (idlwave-sintern-class class)))
7477 ;; Read the file in temporarily
7480 (unless (eq major-mode 'idlwave-mode)
7481 (idlwave-mode))
7485 (idlwave-find-class-definition class
7488 (let* ((this-class (idlwave-sintern-class name))
7491 (cons 'tags (idlwave-struct-tags))
7492 (cons 'inherits (idlwave-struct-inherits)))))
7494 (setq entry (nconc entry (list (cons 'found-in class)))))
7495 (idlwave-sintern-class-info entry)
7496 (push entry idlwave-class-info)))))))))
7498 (defun idlwave-class-found-in (class)
7500 (cdr (assq 'found-in (idlwave-class-info class))))
7501 (defun idlwave-class-tags (class)
7502 "Return the native tags in CLASS."
7503 (cdr (assq 'tags (idlwave-class-info class))))
7504 (defun idlwave-class-inherits (class)
7506 (cdr (assq 'inherits (idlwave-class-info class))))
7509 (defun idlwave-all-class-tags (class)
7510 "Return a list of native and inherited tags in CLASS."
7512 (apply 'append (mapcar 'idlwave-class-tags
7513 (cons class (idlwave-all-class-inherits class))))
7515 (idlwave-class-tag-reset)
7519 (defun idlwave-all-class-inherits (class)
7521 The list is cached in `idlwave-class-info' for faster access."
7523 ((not idlwave-support-inheritance) nil)
7527 (let ((info (idlwave-class-info class))
7533 (idlwave-class-inherits class)))
7540 (idlwave-class-inherits (car cl)))
7550 (defun idlwave-entry-keywords (entry &optional record-link)
7569 (concat idlwave-html-link-sep
7577 (defun idlwave-entry-find-keyword (entry keyword)
7578 "Find keyword KEYWORD in entry ENTRY, and return (with link) if set"
7588 idlwave-html-link-sep
7599 (defvar idlwave-current-tags-class nil)
7600 (defvar idlwave-current-class-tags nil)
7601 (defvar idlwave-current-native-class-tags nil)
7602 (defvar idlwave-sint-class-tags nil)
7603 (idlwave-new-sintern-type 'class-tag)
7604 (add-to-list 'idlwave-complete-special 'idlwave-complete-class-structure-tag)
7605 (add-hook 'idlwave-update-rinfo-hook 'idlwave-class-tag-reset)
7607 (defun idlwave-complete-class-structure-tag ()
7608 "Complete a structure tag on a `self' argument in an object method."
7617 (let* ((class-selector (nth 2 (idlwave-current-routine)))
7618 (super-classes (idlwave-all-class-inherits class-selector)))
7619 ;; Check if we are in a class routine
7621 (error "Not in a method procedure or function"))
7623 (if (not (equal class-selector idlwave-current-tags-class))
7624 (idlwave-prepare-class-tag-completion class-selector))
7625 (setq idlwave-completion-help-info
7626 (list 'idlwave-complete-class-structure-tag-help
7627 (idlwave-sintern-routine
7630 (let ((idlwave-cpl-bold idlwave-current-native-class-tags))
7631 (idlwave-complete-in-buffer
7633 idlwave-current-class-tags nil
7636 'idlwave-attach-class-tag-classes))
7640 (defun idlwave-class-tag-reset ()
7641 (setq idlwave-current-tags-class nil))
7643 (defun idlwave-prepare-class-tag-completion (class)
7645 (setq idlwave-sint-class-tags nil)
7646 (setq idlwave-current-tags-class class)
7647 (setq idlwave-current-class-tags
7649 (list (idlwave-sintern-class-tag x 'set)))
7650 (idlwave-all-class-tags class)))
7651 (setq idlwave-current-native-class-tags
7652 (mapcar 'downcase (idlwave-class-tags class))))
7659 (defvar idlwave-sint-sysvars nil)
7660 (defvar idlwave-sint-sysvartags nil)
7661 (idlwave-new-sintern-type 'sysvar)
7662 (idlwave-new-sintern-type 'sysvartag)
7663 (add-to-list 'idlwave-complete-special 'idlwave-complete-sysvar-or-tag)
7664 (add-hook 'idlwave-update-rinfo-hook 'idlwave-sysvars-reset)
7665 (add-hook 'idlwave-after-load-rinfo-hook 'idlwave-sintern-sysvar-alist)
7668 (defun idlwave-complete-sysvar-or-tag ()
7677 (setq idlwave-completion-help-info '(idlwave-complete-sysvar-help))
7678 (idlwave-complete-in-buffer 'sysvar 'sysvar
7679 idlwave-system-variables-alist nil
7690 (let* ((var (idlwave-sintern-sysvar (match-string 1)))
7691 (entry (assq var idlwave-system-variables-alist))
7695 (setq idlwave-completion-help-info
7696 (list 'idlwave-complete-sysvar-tag-help var))
7697 (idlwave-complete-in-buffer 'sysvartag 'sysvartag
7706 (defun idlwave-complete-sysvar-help (mode word)
7707 (let ((word (or (nth 1 idlwave-completion-help-info) word))
7708 (entry (assoc word idlwave-system-variables-alist)))
7716 (defun idlwave-complete-sysvar-tag-help (mode word)
7717 (let* ((var (nth 1 idlwave-completion-help-info))
7718 (entry (assoc var idlwave-system-variables-alist))
7729 (idlwave-substitute-link-target main target)
7733 (defun idlwave-split-link-target (link)
7735 (if (string-match idlwave-html-link-sep link)
7739 (defun idlwave-substitute-link-target (link target)
7746 (concat main-base idlwave-html-link-sep (number-to-string target))
7749 ;; Fake help in the source buffer for class structure tags.
7753 (defvar idlwave-help-do-class-struct-tag nil)
7754 (defun idlwave-complete-class-structure-tag-help (mode word)
7759 (let (class-with found-in)
7761 (idlwave-class-or-superclass-with-tag
7762 idlwave-current-tags-class
7764 (if (assq (idlwave-sintern-class class-with)
7765 idlwave-system-class-info)
7767 (if (setq found-in (idlwave-class-found-in class-with))
7768 (setq name (cons (concat found-in "__define") class-with))
7771 idlwave-help-do-class-struct-tag t))
7774 (defun idlwave-class-or-superclass-with-tag (class tag)
7777 (let ((sclasses (cons class (idlwave-all-class-inherits class)))
7782 (let ((tags (idlwave-class-tags cl)))
7789 (defun idlwave-sysvars-reset ()
7790 (if (and (fboundp 'idlwave-shell-is-running)
7791 (idlwave-shell-is-running)
7792 idlwave-idlwave_routine_info-compiled)
7793 (idlwave-shell-send-command "idlwave_get_sysvars"
7794 'idlwave-process-sysvars 'hide)))
7796 (defun idlwave-process-sysvars ()
7797 (idlwave-shell-filter-sysvars)
7798 (setq idlwave-sint-sysvars nil
7799 idlwave-sint-sysvartags nil)
7800 (idlwave-sintern-sysvar-alist))
7802 (defun idlwave-sintern-sysvar-alist ()
7803 (let ((list idlwave-system-variables-alist) entry tags)
7805 (setcar entry (idlwave-sintern-sysvar (car entry) 'set))
7810 (cons (idlwave-sintern-sysvartag (car x) 'set)
7814 (defvar idlwave-shell-command-output)
7815 (defun idlwave-shell-filter-sysvars ()
7817 (let ((text idlwave-shell-command-output)
7819 (old idlwave-system-variables-alist)
7821 (setq idlwave-system-variables-alist nil)
7827 (idlwave-split-string (match-string 3 text))))
7829 (setq old-entry (assq (idlwave-sintern-sysvar var) old))
7831 (setq idlwave-system-variables-alist
7838 (idlwave-sintern-sysvartag x)
7841 idlwave-system-variables-alist)))
7843 (setq idlwave-system-variables-alist
7844 (or idlwave-system-variables-alist old))))
7846 (defun idlwave-completion-fontify-classes ()
7858 (defun idlwave-uniquify (list)
7867 (defun idlwave-after-successful-completion (type slash &optional verify)
7875 ((equal idlwave-function-completion-adds-paren nil) nil)
7876 ((or (equal idlwave-function-completion-adds-paren t)
7877 (equal idlwave-function-completion-adds-paren 1))
7879 ((equal idlwave-function-completion-adds-paren 2)
7884 (if (and idlwave-keyword-completion-adds-equal
7894 (idlwave-local-value 'idlwave-completion-p
7896 (eq (marker-buffer idlwave-completion-mark)
7898 (equal (marker-position idlwave-completion-mark)
7900 (idlwave-restore-wconf-after-completion))
7901 (move-marker idlwave-completion-mark nil)
7902 (setq idlwave-before-completion-wconf nil))
7904 (defun idlwave-mouse-context-help (ev &optional arg)
7905 "Call `idlwave-context-help' on the clicked location."
7908 (idlwave-context-help arg))
7910 (defvar idlwave-last-context-help-pos nil)
7911 (defun idlwave-context-help (&optional arg)
7914 point is on a routine name or in the argument list of a routine, help
7917 visits the source file, finding help in the header (if
7918 `idlwave-help-source-try-header' is non-nil) or the routine definition
7921 (idlwave-do-context-help arg))
7923 (defun idlwave-mouse-completion-help (ev)
7929 (idlwave-do-mouse-completion-help ev))
7931 (defun idlwave-routine-info (&optional arg external)
7933 point is on the name a function or procedure, or in the argument list
7937 When point is on an object operator `->', display the class stored in
7938 this arrow, if any (see `idlwave-store-inquired-class'). With a
7942 (idlwave-routines)
7947 (if (get-text-property (point) 'idlwave-class)
7955 '(idlwave-class nil face nil))
7959 (get-text-property (point) 'idlwave-class)))
7964 (let* ((idlwave-query-class nil)
7965 (idlwave-force-class-query (equal arg '(4)))
7966 (module (idlwave-what-module)))
7968 (apply 'idlwave-display-calling-sequence
7969 (idlwave-fix-module-if-obj_new module))
7972 (defun idlwave-resolve (&optional arg)
7974 Like `idlwave-routine-info', this looks for a routine call at point.
7975 After confirmation in the minibuffer, it will use the shell to issue
7981 (let* ((idlwave-query-class nil)
7982 (idlwave-force-class-query (equal arg '(4)))
7983 (module (idlwave-what-module))
7984 (name (idlwave-make-full-name (nth 2 module) (car module)))
8001 (idlwave-shell-send-command
8003 'idlwave-update-routine-info
8006 (idlwave-shell-send-command
8008 (list 'idlwave-shell-send-command
8011 '(idlwave-update-routine-info)
8014 (defun idlwave-find-module-this-file ()
8016 (idlwave-find-module '(4)))
8018 (defun idlwave-find-module (&optional arg)
8021 function offers as default the module name `idlwave-routine-info'
8025 (let* ((idlwave-query-class nil)
8026 (idlwave-force-class-query (equal arg '(16)))
8028 (module (idlwave-fix-module-if-obj_new (idlwave-what-module)))
8030 (concat (idlwave-make-full-name
8035 (idlwave-uniquify
8042 (concat (idlwave-make-full-name
8046 (idlwave-save-buffer-update)
8047 (idlwave-routines))))))
8048 (name (idlwave-completing-read
8052 (format "Module in this file: "))
8064 (setq name (idlwave-sintern-routine-or-method name class)
8065 class (idlwave-sintern-class class)
8069 (idlwave-do-find-module name type class nil this-buffer)))
8071 (defun idlwave-do-find-module (name type class
8073 (let ((name1 (idlwave-make-full-name class name))
8078 (setq entry (idlwave-best-rinfo-assq name type class (idlwave-routines)
8082 (idlwave-make-full-name (nth 2 entry) name)
8085 (setq file (idlwave-routine-source-file source)))
8088 (idlwave-expand-lib-file-name
8104 (idlwave-find-file-noselect file 'find))
8114 (regexp-quote (downcase name2))
8122 (defun idlwave-what-module ()
8124 Used by `idlwave-routine-info' and `idlwave-find-module'."
8125 (idlwave-routines)
8128 (idlwave-beginning-of-statement)
8133 (idlwave-sintern-routine-or-method (match-string-no-properties 4)
8136 (idlwave-sintern-class (match-string 3)))
8139 (let* ((where (idlwave-where))
8143 (this-word (idlwave-this-word "a-zA-Z0-9$_"))
8150 (setq this-word (idlwave-sintern-routine-or-method
8153 (idlwave-determine-class
8160 (setq this-word (idlwave-sintern-routine-or-method
8163 (idlwave-determine-class
8169 (setq this-word (idlwave-sintern-routine this-word))
8172 (list func 'fun (idlwave-determine-class (nth 1 where) 'fun)))
8174 (list pro 'pro (idlwave-determine-class (nth 0 where) 'pro)))
8177 (defun idlwave-what-module-find-class ()
8178 "Call idlwave-what-module and find the inherited class if necessary."
8179 (let* ((module (idlwave-what-module))
8186 (apply 'idlwave-find-inherited-class module))
8189 (defun idlwave-find-inherited-class (name type class)
8191 (let ((entry (idlwave-best-rinfo-assoc name type class (idlwave-routines))))
8196 (defun idlwave-fix-module-if-obj_new (module)
8198 If yes, and if the cursor is in the keyword region, change to the
8207 (idlwave-beginning-of-statement)
8213 (setq module (list (idlwave-sintern-method "Init")
8215 (idlwave-sintern-class class)))))
8218 (defun idlwave-fix-keywords (name type class keywords
8223 demand _EXTRA in the keyword list."
8229 (or (eq major-mode 'idlwave-mode)
8230 (eq major-mode 'idlwave-shell-mode)))
8231 (let* ((bos (save-excursion (idlwave-beginning-of-statement) (point)))
8237 (setq class (idlwave-sintern-class (match-string 1 string)))
8238 (setq idlwave-current-obj_new-class class)
8241 (idlwave-entry-keywords
8242 (idlwave-rinfo-assq
8243 (idlwave-sintern-method "INIT")
8246 (idlwave-routines)) 'do-link))))))
8256 (idlwave-entry-keywords entry 'do-link)))))
8257 (idlwave-all-assq name (idlwave-routines)))
8258 (setq keywords (idlwave-uniquify keywords)))
8261 ;; the user indicated that method in `idlwave-keyword-class-inheritance'
8264 idlwave-keyword-class-inheritance
8268 (assq (idlwave-sintern-keyword "_extra") keywords)
8269 (assq (idlwave-sintern-keyword "_ref_extra") keywords))
8271 (let ((regexps idlwave-keyword-class-inheritance) re)
8276 (loop for entry in (idlwave-routines) do
8282 (idlwave-entry-keywords entry 'do-link))))
8283 (setq keywords (idlwave-uniquify keywords)))
8288 (defun idlwave-expand-keyword (keyword module)
8302 (kwd (idlwave-sintern-keyword keyword))
8303 (entry (idlwave-best-rinfo-assoc name type class (idlwave-routines)))
8304 (kwd-alist (idlwave-entry-keywords entry))
8305 (extra (or (assq (idlwave-sintern-keyword "_EXTRA") kwd-alist)
8306 (assq (idlwave-sintern-keyword "_REF_EXTRA") kwd-alist)))
8326 (defvar idlwave-rinfo-mouse-map (make-sparse-keymap))
8327 (defvar idlwave-rinfo-map (make-sparse-keymap))
8328 (define-key idlwave-rinfo-mouse-map
8330 'idlwave-mouse-active-rinfo)
8331 (define-key idlwave-rinfo-mouse-map
8333 'idlwave-mouse-active-rinfo-shift)
8334 (define-key idlwave-rinfo-mouse-map
8336 'idlwave-mouse-active-rinfo-right)
8337 (define-key idlwave-rinfo-mouse-map " " 'idlwave-active-rinfo-space)
8338 (define-key idlwave-rinfo-map "q" 'idlwave-quit-help)
8339 (define-key idlwave-rinfo-mouse-map "q" 'idlwave-quit-help)
8340 (defvar idlwave-popup-source nil)
8341 (defvar idlwave-rinfo-marker (make-marker))
8343 (defun idlwave-quit-help ()
8348 (fboundp 'idlwave-help-quit))
8350 (idlwave-help-quit))
8354 (defun idlwave-display-calling-sequence (name type class
8356 ;; Display the calling sequence of module NAME, type TYPE in class CLASS.
8358 (entry (or (idlwave-best-rinfo-assq name type class
8359 (idlwave-routines))
8360 (idlwave-rinfo-assq name type class
8361 idlwave-unresolved-routines)))
8364 (superclasses (idlwave-all-class-inherits initial-class))
8365 (twins (idlwave-routine-twins entry))
8366 (dtwins (idlwave-study-twins twins))
8370 (keywords (idlwave-entry-keywords entry 'do-link))
8377 "Button2: Jump to source and back | Button3: Source in Help window.")
8379 "Button2: Display info about same method in superclass")
8383 (face 'idlwave-help-link)
8387 (setq keywords (idlwave-fix-keywords name type class keywords))
8391 (if initial-class (concat "in class " initial-class) "")))
8398 (move-marker idlwave-rinfo-marker (point))
8400 (use-local-map idlwave-rinfo-map)
8403 (set (make-local-variable 'idlwave-popup-source) nil)
8404 (set (make-local-variable 'idlwave-current-obj_new-class)
8405 idlwave-current-obj_new-class)
8408 km-prop idlwave-rinfo-mouse-map
8419 ;; If Method exists in a different class link it
8420 (if (idlwave-rinfo-assq name type c (idlwave-routines))
8424 km-prop idlwave-rinfo-mouse-map
8452 km-prop idlwave-rinfo-mouse-map
8466 km-prop idlwave-rinfo-mouse-map
8473 (idlwave-insert-source-location
8481 (when (and all (> cnt idlwave-rinfo-max-source-lines))
8485 idlwave-rinfo-max-source-lines))
8491 idlwave-resize-routine-help-window)
8502 (defun idlwave-insert-source-location (prefix entry &optional file-props)
8513 (ndupl (or (and buffer-flag (idlwave-count-memq 'buffer types))
8514 (and user-flag (idlwave-count-memq 'user types))
8515 (and lib-flag (idlwave-count-memq 'lib types))
8537 ((idlwave-syslib-p file)
8548 ((setq special (idlwave-special-lib-test file))
8552 ((idlwave-lib-p file) (insert "Library "))
8576 (defun idlwave-special-lib-test (file)
8579 (let ((alist idlwave-special-lib-alist)
8590 (defun idlwave-mouse-active-rinfo-right (ev)
8592 (idlwave-mouse-active-rinfo ev 'right))
8594 (defun idlwave-mouse-active-rinfo-shift (ev)
8596 (idlwave-mouse-active-rinfo ev nil 'shift))
8598 (defun idlwave-active-rinfo-space ()
8600 (idlwave-mouse-active-rinfo nil 'right))
8602 (defun idlwave-mouse-active-rinfo (ev &optional right shift)
8603 "Does the mouse actions in the routine info buffer.
8618 word (idlwave-this-word)
8623 (idlwave-display-calling-sequence
8624 (idlwave-sintern-method name)
8625 type (idlwave-sintern-class word)
8628 (idlwave-online-help link name type class))
8629 ((eq id 'source) ; Source in help or buffer
8631 (let ((idlwave-extra-help-function 'idlwave-help-with-source)
8632 (idlwave-help-source-try-header nil)
8633 ;; Fake idlwave-routines so help will find the right entry
8634 (idlwave-routines
8636 (idlwave-help-get-special-help name type class nil))
8638 (setq idlwave-popup-source (not idlwave-popup-source))
8639 (if idlwave-popup-source
8641 (idlwave-do-find-module name type class source)
8643 (setq idlwave-popup-source nil)
8649 (goto-char (marker-position idlwave-rinfo-marker)))))
8652 (idlwave-online-help link name type class keyword)
8653 (idlwave-rinfo-insert-keyword keyword buf shift))))))
8655 (defun idlwave-rinfo-insert-keyword (keyword buffer &optional shift)
8656 "Insert KEYWORD in BUFFER. Make sure buffer is displayed in a window."
8658 (if idlwave-complete-empty-string-as-lower-case
8674 idlwave-keyword-completion-adds-equal)
8677 (defun idlwave-list-buffer-load-path-shadows (&optional arg)
8678 "List the load path shadows of all routines defined in current buffer."
8680 (idlwave-routines)
8681 (if (eq major-mode 'idlwave-mode)
8682 (idlwave-list-load-path-shadows
8683 nil (idlwave-update-current-buffer-info 'save-buffer)
8684 "in current buffer")
8685 (error "Current buffer is not in idlwave-mode")))
8687 (defun idlwave-list-shell-load-path-shadows (&optional arg)
8695 ((or (not (fboundp 'idlwave-shell-is-running))
8696 (not (idlwave-shell-is-running)))
8698 ((null idlwave-compiled-routines)
8701 (idlwave-list-load-path-shadows nil idlwave-compiled-routines
8702 "in the shell"))))
8704 (defun idlwave-list-all-load-path-shadows (&optional arg)
8707 (idlwave-list-load-path-shadows nil nil "globally"))
8709 (defun idlwave-list-load-path-shadows (arg &optional special-routines loc)
8713 When SPECIAL-ROUTINES in non-nil, only look for shadows of these routines.
8716 the load path in order to find a definition. The output of this
8718 (idlwave-routines) ; Make sure everything is loaded.
8719 (unless (or idlwave-user-catalog-routines idlwave-library-catalog-routines)
8723 (let* ((routines (append idlwave-system-routines
8724 idlwave-compiled-routines
8725 idlwave-library-catalog-routines
8726 idlwave-user-catalog-routines
8727 idlwave-buffer-routines
8738 (idlwave-sort-prefer-buffer-info nil)
8749 (string< (downcase (idlwave-make-full-name
8751 (downcase (idlwave-make-full-name
8759 (apply 'idlwave-do-find-module
8764 (apply 'idlwave-do-find-module
8776 (setq twins (idlwave-routine-twins routine (or lroutines routines)))
8779 (setq dtwins (idlwave-study-twins twins)))
8783 (> (idlwave-count-memq 'lib (nth 2 (car dtwins))) 1)
8784 (> (idlwave-count-memq 'user (nth 2 (car dtwins))) 1)
8785 (> (idlwave-count-memq 'buffer (nth 2 (car dtwins))) 1))
8788 (idlwave-make-full-name (nth 2 routine)
8797 (idlwave-insert-source-location "\n - " twin props1))))
8808 (defun idlwave-print-source (routine)
8811 (sfile (idlwave-routine-source-file source)))
8812 (if (idlwave-syslib-p sfile) (setq stype 'syslib))
8821 (defun idlwave-routine-twins (entry &optional list)
8822 "Return all twin entries of ENTRY in LIST.
8823 LIST defaults to `idlwave-routines'.
8829 (candidates (idlwave-all-assq name (or list (idlwave-routines))))
8836 (if (setq candidate (idlwave-rinfo-assq name type class
8837 idlwave-unresolved-routines))
8841 (defun idlwave-study-twins (entries)
8842 "Return dangerous twins of first entry in ENTRIES.
8843 Dangerous twins are routines with same name, but in different files on
8844 the load path. If a file is in the system library and has an entry in
8845 the `idlwave-system-routines' list, we omit the latter as
8851 (class (nth 2 entry)) ; idlwave-routine-twin-compare
8859 file (idlwave-routine-source-file source))
8866 ;; Check for an entry in the system library
8869 (idlwave-syslib-p file))
8881 ;; File is in system *library* - remove any 'system entry
8886 (when (and (idlwave-syslib-scanned-p)
8889 (sort alist 'idlwave-routine-twin-compare)))
8893 (defvar idlwave-sort-prefer-buffer-info t
8894 "Internal variable used to influence `idlwave-routine-twin-compare'.")
8896 (defmacro idlwave-xor (a b)
8900 (defun idlwave-routine-entry-compare (a b)
8907 ((not (equal (idlwave-downcase-safe class)
8908 (idlwave-downcase-safe (nth 2 b))))
8922 (idlwave-routine-entry-compare-twins a b)))))
8924 (defun idlwave-routine-entry-compare-twins (a b)
8926 twins. This basically calls `idlwave-routine-twin-compare' with the
8933 (afile (idlwave-routine-source-file asrc))
8934 (bfile (idlwave-routine-source-file bsrc)))
8935 (idlwave-routine-twin-compare
8944 (defun idlwave-routine-twin-compare (a b)
8968 (tpath-alist (idlwave-true-path-alist))
8981 (regexp-quote (downcase class))
8982 (regexp-quote (downcase name)))
8983 (format "\\`%s\\.pro" (regexp-quote (downcase name)))))
8994 ((idlwave-xor asysp bsysp) asysp) ; System entries first
8995 ((idlwave-xor aunresp bunresp) bunresp) ; Unresolved last
8996 ((and idlwave-sort-prefer-buffer-info
8997 (idlwave-xor abufp bbufp)) abufp) ; Buffers before non-buffers
8998 ((idlwave-xor acompp bcompp) acompp) ; Compiled entries
8999 ((idlwave-xor apathp bpathp) apathp) ; Library before non-library
9000 ((idlwave-xor anamep bnamep) anamep) ; Correct file names first
9002 (idlwave-xor adefp bdefp)) bdefp) ; __define after __method
9006 (defun idlwave-routine-source-file (source)
9011 (defun idlwave-downcase-safe (string)
9017 (defun idlwave-count-eq (elt list)
9018 "How often is ELT in LIST?"
9021 (defun idlwave-count-memq (elt alist)
9022 "How often is ELT a key in ALIST?"
9025 (defun idlwave-syslib-p (file)
9026 "Non-nil if FILE is in the system library."
9029 (expand-file-name "lib" (idlwave-sys-dir)))))
9031 (string-match (concat "^" (regexp-quote true-syslib)) true-file)))
9033 (defun idlwave-lib-p (file)
9034 "Non-nil if file is in the library"
9036 (assoc true-dir (idlwave-true-path-alist))))
9038 (defun idlwave-path-alist-add-flag (list-entry flag)
9044 (defun idlwave-path-alist-remove-flag (list-entry flag)
9049 (defun idlwave-true-path-alist ()
9050 "Return `idlwave-path-alist' alist with true-names.
9051 Info is cached, but relies on the functions setting `idlwave-path-alist'
9052 to reset the variable `idlwave-true-path-alist' to nil."
9053 (or idlwave-true-path-alist
9054 (setq idlwave-true-path-alist
9061 idlwave-path-alist))))
9063 (defun idlwave-syslib-scanned-p ()
9067 (expand-file-name "lib" (idlwave-sys-dir))))))
9068 (cdr (assoc true-syslib (idlwave-true-path-alist)))))
9078 ;; (pop-up a list of IDL units in the current file).
9081 (defun idlwave-prev-index-position ()
9086 ((idlwave-find-key "\\<\\(pro\\|function\\)\\>" -1 'nomark))
9087 ;; ((idlwave-find-key idlwave-begin-unit-reg 1 'nomark)
9090 (defun idlwave-unit-name ()
9093 `idlwave-prev-index-position'."
9103 (defalias 'idlwave-function-menu
9114 ;; Here we hack func-menu.el in order to support this new mode.
9115 ;; The latest versions of func-menu.el already have this stuff in, so
9120 (or (assq 'idlwave-mode fume-function-name-regexp-alist)
9123 (cons '(idlwave-mode . fume-function-name-regexp-idl)
9125 (or (assq 'idlwave-mode fume-find-function-name-method-alist)
9128 (cons '(idlwave-mode . fume-find-next-idl-function-name)
9131 (defun idlwave-edit-in-idlde ()
9132 "Edit the current file in IDL Development environment."
9135 idlwave-shell-explicit-file-name "-c" "-e"
9138 (defvar idlwave-help-use-assistant)
9139 (defun idlwave-launch-idlhelp ()
9142 (if idlwave-help-use-assistant
9143 (idlwave-help-assistant-raise)
9144 (start-process "idlhelp" nil idlwave-help-application)))
9147 (defvar idlwave-mode-menu-def
9149 ["PRO/FUNC menu" idlwave-function-menu t]
9151 ["Subprogram Start" idlwave-beginning-of-subprogram t]
9152 ["Subprogram End" idlwave-end-of-subprogram t]
9153 ["Block Start" idlwave-beginning-of-block t]
9154 ["Block End" idlwave-end-of-block t]
9155 ["Up Block" idlwave-backward-up-block t]
9156 ["Down Block" idlwave-down-block t]
9157 ["Skip Block Backward" idlwave-backward-block t]
9158 ["Skip Block Forward" idlwave-forward-block t])
9160 ["Subprogram" idlwave-mark-subprogram t]
9161 ["Block" idlwave-mark-block t]
9162 ["Header" idlwave-mark-doclib t])
9164 ["Indent Entire Statement" idlwave-indent-statement
9166 ["Indent Subprogram" idlwave-indent-subprogram t]
9167 ["(Un)Comment Region" idlwave-toggle-comment-region t]
9168 ["Continue/Split line" idlwave-split-line t]
9170 ["Toggle Auto Fill" idlwave-auto-fill-mode :style toggle
9171 :selected (symbol-value idlwave-fill-function)])
9173 ["Procedure" idlwave-procedure t]
9174 ["Function" idlwave-function t]
9175 ["Doc Header" idlwave-doc-header t]
9176 ["Log" idlwave-doc-modification t]
9178 ["Case" idlwave-case t]
9179 ["For" idlwave-for t]
9180 ["Repeat" idlwave-repeat t]
9181 ["While" idlwave-while t]
9183 ["Close Block" idlwave-close-block t])
9185 ["Complete" idlwave-complete t]
9187 ["1 Procedure Name" (idlwave-complete 'procedure) t]
9188 ["2 Procedure Keyword" (idlwave-complete 'procedure-keyword) t]
9190 ["3 Function Name" (idlwave-complete 'function) t]
9191 ["4 Function Keyword" (idlwave-complete 'function-keyword) t]
9193 ["5 Procedure Method Name" (idlwave-complete 'procedure-method) t]
9194 ["6 Procedure Method Keyword" (idlwave-complete 'procedure-method-keyword) t]
9196 ["7 Function Method Name" (idlwave-complete 'function-method) t]
9197 ["8 Function Method Keyword" (idlwave-complete 'function-method-keyword) t]
9199 ["9 Class Name" idlwave-complete-class t]))
9201 ["Show Routine Info" idlwave-routine-info t]
9202 ["Online Context Help" idlwave-context-help t]
9204 ["Find Routine Source" idlwave-find-module t]
9205 ["Resolve Routine" idlwave-resolve (featurep 'idlw-shell)]
9207 ["Update Routine Info" idlwave-update-routine-info t]
9208 ["Rescan XML Help Catalog" idlwave-convert-xml-system-routine-info t]
9211 ["Select Catalog Directories" (idlwave-create-user-catalog-file nil) t]
9212 ["Scan Directories" (idlwave-update-routine-info '(16))
9213 (and idlwave-path-alist (not idlwave-catalog-process))]
9214 ["Scan Directories &" (idlwave-update-routine-info '(64))
9215 (and idlwave-path-alist (not idlwave-catalog-process))]
9218 ["Check Current Buffer" idlwave-list-buffer-load-path-shadows t]
9219 ["Check Compiled Routines" idlwave-list-shell-load-path-shadows t]
9220 ["Check Everything" idlwave-list-all-load-path-shadows t])
9222 ["Kill auto-created buffers" idlwave-kill-autoloaded-buffers t]
9224 ["Insert TAB character" idlwave-hard-tab t])
9227 ["Start IDL shell" idlwave-shell t]
9228 ["Edit file in IDLDE" idlwave-edit-in-idlde t]
9229 ["Launch IDL Help" idlwave-launch-idlhelp t])
9232 ["Browse IDLWAVE Group" idlwave-customize t]
9234 ["Build Full Customize Menu" idlwave-create-customize-menu
9238 ["Abbreviation List" idlwave-list-abbrevs t]
9240 ["Commentary in idlwave.el" idlwave-show-commentary t]
9241 ["Commentary in idlw-shell.el" idlwave-shell-show-commentary t]
9243 ["Info" idlwave-info t]
9245 ["Help with Topic" idlwave-help-assistant-help-with-topic
9246 idlwave-help-use-assistant]
9247 ["Launch IDL Help" idlwave-launch-idlhelp t])))
9249 (defvar idlwave-mode-debug-menu-def
9251 ["Start IDL shell" idlwave-shell t]
9252 ["Save and .RUN buffer" idlwave-shell-save-and-run
9253 (and (boundp 'idlwave-shell-automatic-start)
9254 idlwave-shell-automatic-start)]))
9258 (easy-menu-define idlwave-mode-menu idlwave-mode-map
9260 idlwave-mode-menu-def)
9261 (easy-menu-define idlwave-mode-debug-menu idlwave-mode-map
9263 idlwave-mode-debug-menu-def)))
9265 (defun idlwave-customize ()
9266 "Call the customize function with idlwave as argument."
9272 (customize-browse 'idlwave))
9274 (defun idlwave-create-customize-menu ()
9285 `(["Browse IDLWAVE group" idlwave-customize t]
9287 ,(customize-menu-create 'idlwave)
9296 (defun idlwave-show-commentary ()
9297 "Use the finder to view the file documentation from `idlwave.el'."
9300 (finder-commentary "idlwave.el"))
9302 (defun idlwave-shell-show-commentary ()
9308 (defun idlwave-info ()
9309 "Read documentation for IDLWAVE in the info system."
9312 (Info-goto-node "(idlwave)"))
9314 (defun idlwave-list-abbrevs (arg)
9315 "Show the code abbreviations define in IDLWAVE mode.
9328 (let ((table (symbol-value 'idlwave-mode-abbrev-table))
9357 (princ "Abbreviations and Actions in IDLWAVE-Mode\n")
9361 (princ "Code Abbreviations and Templates in IDLWAVE-Mode\n")
9382 (or idlwave-routines (idlwave-start-load-rinfo-timer))
9384 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.[Pp][Rr][Oo]\\'" . idlwave-mode))
9387 (run-hooks 'idlwave-load-hook)
9389 (provide 'idlwave)
9392 ;;; idlwave.el ends here