Changeset 4166 for trunk/lisp/progmodes/idlwave.el
- Timestamp:
- 09/18/06 20:48:14 (2 years ago)
- Files:
-
- trunk/lisp/progmodes/idlwave.el (modified) (291 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/progmodes/idlwave.el
r4079 r4166 76 76 ;; SOURCE). 77 77 ;; 78 ;; 78 ;; 79 79 ;; ACKNOWLEDGMENTS 80 80 ;; =============== … … 126 126 ;; point backward, e.g., "\cl" expanded with a space becomes 127 127 ;; "LONG( )" with point before the close paren. This is solved by 128 ;; using a temporary function in `post-command-hook' - not pretty, 128 ;; using a temporary function in `post-command-hook' - not pretty, 129 129 ;; but it works. 130 130 ;; … … 179 179 ;; We have the old or no custom-library, hack around it! 180 180 (defmacro defgroup (&rest args) nil) 181 (defmacro defcustom (var value doc &rest args) 181 (defmacro defcustom (var value doc &rest args) 182 182 `(defvar ,var ,value ,doc)))) 183 183 … … 185 185 "Major mode for editing IDL .pro files." 186 186 :tag "IDLWAVE" 187 :link '(url-link :tag "Home Page" 187 :link '(url-link :tag "Home Page" 188 188 "http://idlwave.org") 189 189 :link '(emacs-commentary-link :tag "Commentary in idlw-shell.el" … … 299 299 (defcustom idlwave-auto-fill-split-string t 300 300 "*If non-nil then auto fill will split strings with the IDL `+' operator. 301 When the line end falls within a string, string concatenation with the 302 '+' operator will be used to distribute a long string over lines. 301 When the line end falls within a string, string concatenation with the 302 '+' operator will be used to distribute a long string over lines. 303 303 If nil and a string is split then a terminal beep and warning are issued. 304 304 … … 419 419 (const :tag "After a buffer was killed" kill-buffer) 420 420 (const :tag "After a buffer was compiled successfully, update shell info" compile-buffer)))) 421 421 422 422 (defcustom idlwave-rinfo-max-source-lines 5 423 423 "*Maximum number of source files displayed in the Routine Info window. … … 454 454 455 455 ;; Configuration files 456 (defcustom idlwave-config-directory 456 (defcustom idlwave-config-directory 457 457 (convert-standard-filename "~/.idlwave") 458 458 "*Directory for configuration files and user-library catalog." … … 470 470 "Alist of regular expressions matching special library directories. 471 471 When listing routine source locations, IDLWAVE gives a short hint where 472 the file defining the routine is located. By default it lists `SystemLib' 472 the file defining the routine is located. By default it lists `SystemLib' 473 473 for routines in the system library `!DIR/lib' and `Library' for anything 474 474 else. This variable can define additional types. The car of each entry … … 481 481 482 482 (defcustom idlwave-auto-write-paths t 483 "Write out path (!PATH) and system directory (!DIR) info automatically. 483 "Write out path (!PATH) and system directory (!DIR) info automatically. 484 484 Path info is needed to locate library catalog files. If non-nil, 485 485 whenever the path-list changes as a result of shell-query, etc., it is … … 512 512 words inserted into the buffer by completion. The preferred case can 513 513 be specified separately for routine names, keywords, classes and 514 methods. 514 methods. 515 515 This alist should therefore have entries for `routine' (normal 516 516 functions and procedures, i.e. non-methods), `keyword', `class', and … … 599 599 :group 'idlwave-routine-info 600 600 :type '(repeat (regexp :tag "Match method:"))) 601 601 602 602 603 603 (defcustom idlwave-completion-show-classes 1 … … 664 664 completion, respectively. 665 665 666 The alist may have additional entries specifying exceptions from the 666 The alist may have additional entries specifying exceptions from the 667 667 keyword completion rule for specific methods, like INIT or 668 668 GETPROPERTY. In order to turn on class specification for the INIT … … 688 688 689 689 When you specify a class, this information can be stored as a text 690 property on the `->' arrow in the source code, so that during the same 690 property on the `->' arrow in the source code, so that during the same 691 691 editing session, IDLWAVE will not have to ask again. When this 692 692 variable is non-nil, IDLWAVE will store and reuse the class information. … … 1066 1066 :type 'boolean) 1067 1067 1068 (defcustom idlwave-default-font-lock-items 1068 (defcustom idlwave-default-font-lock-items 1069 1069 '(pros-and-functions batch-files idlwave-idl-keywords label goto 1070 1070 common-blocks class-arrows) … … 1128 1128 1129 1129 ;; The following are the reserved words in IDL. Maybe we should 1130 ;; highlight some more stuff as well? 1130 ;; highlight some more stuff as well? 1131 1131 ;; Procedure declarations. Fontify keyword plus procedure name. 1132 1132 (defvar idlwave-idl-keywords 1133 ;; To update this regexp, update the list of keywords and 1133 ;; To update this regexp, update the list of keywords and 1134 1134 ;; evaluate the form. 1135 ;; (insert 1135 ;; (insert 1136 1136 ;; (prin1-to-string 1137 ;; (concat 1137 ;; (concat 1138 1138 ;; "\\<\\(" 1139 ;; (regexp-opt 1139 ;; (regexp-opt 1140 1140 ;; '("||" "&&" "and" "or" "xor" "not" 1141 ;; "eq" "ge" "gt" "le" "lt" "ne" 1141 ;; "eq" "ge" "gt" "le" "lt" "ne" 1142 1142 ;; "for" "do" "endfor" 1143 ;; "if" "then" "endif" "else" "endelse" 1143 ;; "if" "then" "endif" "else" "endelse" 1144 1144 ;; "case" "of" "endcase" 1145 1145 ;; "switch" "break" "continue" "endswitch" 1146 1146 ;; "begin" "end" 1147 1147 ;; "repeat" "until" "endrep" 1148 ;; "while" "endwhile" 1148 ;; "while" "endwhile" 1149 1149 ;; "goto" "return" 1150 1150 ;; "inherits" "mod" … … 1169 1169 ("[ \t]*\\(\\sw+\\)[ ,]*" 1170 1170 ;; Start with point after block name and comma 1171 (goto-char (match-end 0)) ; needed for XEmacs, could be nil 1171 (goto-char (match-end 0)) ; needed for XEmacs, could be nil 1172 1172 nil 1173 1173 (1 font-lock-variable-name-face) ; variable names … … 1224 1224 (all-operators 1225 1225 '("[-*^#+<>/]" (0 font-lock-keyword-face))) 1226 1226 1227 1227 ;; Arrows with text property `idlwave-class' 1228 1228 (class-arrows … … 1261 1261 (defvar idlwave-font-lock-defaults 1262 1262 '((idlwave-font-lock-keywords 1263 idlwave-font-lock-keywords-1 1263 idlwave-font-lock-keywords-1 1264 1264 idlwave-font-lock-keywords-2 1265 1265 idlwave-font-lock-keywords-3) 1266 nil t 1267 ((?$ . "w") (?_ . "w") (?. . "w") (?| . "w") (?& . "w")) 1266 nil t 1267 ((?$ . "w") (?_ . "w") (?. . "w") (?| . "w") (?& . "w")) 1268 1268 beginning-of-line)) 1269 1269 1270 (put 'idlwave-mode 'font-lock-defaults 1270 (put 'idlwave-mode 'font-lock-defaults 1271 1271 idlwave-font-lock-defaults) ; XEmacs 1272 1272 … … 1276 1276 only by whitespace.") 1277 1277 1278 (defconst idlwave-begin-block-reg 1278 (defconst idlwave-begin-block-reg 1279 1279 "\\<\\(pro\\|function\\|begin\\|case\\|switch\\)\\>" 1280 1280 "Regular expression to find the beginning of a block. The case does … … 1353 1353 '(case . ("case\\>" nil)) 1354 1354 '(switch . ("switch\\>" nil)) 1355 (cons 'call (list (concat "\\(" idlwave-variable "\\) *= *" 1355 (cons 'call (list (concat "\\(" idlwave-variable "\\) *= *" 1356 1356 "\\(" idlwave-method-call "\\s *\\)?" 1357 1357 idlwave-identifier 1358 1358 "\\s *(") nil)) 1359 (cons 'call (list (concat 1359 (cons 'call (list (concat 1360 1360 "\\(" idlwave-method-call "\\s *\\)?" 1361 idlwave-identifier 1361 idlwave-identifier 1362 1362 "\\( *\\($\\|\\$\\)\\|\\s *,\\)") nil)) 1363 (cons 'assign (list (concat 1363 (cons 'assign (list (concat 1364 1364 "\\(" idlwave-variable "\\) *=") nil))) 1365 1365 1366 1366 "Associated list of statement matching regular expressions. 1367 1367 Each regular expression matches the start of an IDL statement. The … … 1386 1386 ;; of length one rather than a single character. 1387 1387 ;; The code in this file accepts either format for compatibility. 1388 (defvar idlwave-comment-indent-char ?\ 1388 (defvar idlwave-comment-indent-char ?\ 1389 1389 "Character to be inserted for IDL comment indentation. 1390 1390 Normally a space.") … … 1558 1558 ;; Bind the debug commands also with the special modifiers. 1559 1559 (let ((shift (memq 'shift idlwave-shell-debug-modifiers)) 1560 (mods-noshift (delq 'shift 1560 (mods-noshift (delq 'shift 1561 1561 (copy-sequence idlwave-shell-debug-modifiers)))) 1562 (define-key idlwave-mode-map 1562 (define-key idlwave-mode-map 1563 1563 (vector (append mods-noshift (list (if shift ?C ?c)))) 1564 1564 'idlwave-shell-save-and-run) 1565 (define-key idlwave-mode-map 1565 (define-key idlwave-mode-map 1566 1566 (vector (append mods-noshift (list (if shift ?B ?b)))) 1567 1567 'idlwave-shell-break-here) 1568 (define-key idlwave-mode-map 1568 (define-key idlwave-mode-map 1569 1569 (vector (append mods-noshift (list (if shift ?E ?e)))) 1570 1570 'idlwave-shell-run-region))) … … 1603 1603 (define-key idlwave-mode-map "\C-c\C-i" 'idlwave-update-routine-info) 1604 1604 (define-key idlwave-mode-map "\C-c=" 'idlwave-resolve) 1605 (define-key idlwave-mode-map 1605 (define-key idlwave-mode-map 1606 1606 (if (featurep 'xemacs) [(shift button3)] [(shift mouse-3)]) 1607 1607 'idlwave-mouse-context-help) … … 1618 1618 (idlwave-action-and-binding "=" '(idlwave-expand-equal -1 -1)) 1619 1619 1620 ;; Actions for > and < are complicated by >=, <=, and ->... 1620 ;; Actions for > and < are complicated by >=, <=, and ->... 1621 1621 (idlwave-action-and-binding "<" '(idlwave-custom-ltgtr-surround nil)) 1622 1622 (idlwave-action-and-binding ">" '(idlwave-custom-ltgtr-surround 'gtr)) … … 1651 1651 1652 1652 (condition-case nil 1653 (modify-syntax-entry (string-to-char idlwave-abbrev-start-char) 1653 (modify-syntax-entry (string-to-char idlwave-abbrev-start-char) 1654 1654 "w" idlwave-mode-syntax-table) 1655 1655 (error nil)) … … 1775 1775 (defvar imenu-prev-index-position-function) 1776 1776 ;; defined later - so just make the compiler hush 1777 (defvar idlwave-mode-menu) 1777 (defvar idlwave-mode-menu) 1778 1778 (defvar idlwave-mode-debug-menu) 1779 1779 … … 1859 1859 \\elif IF-ELSE statement template 1860 1860 \\b BEGIN 1861 1861 1862 1862 For a full list, use \\[idlwave-list-abbrevs]. Some templates also 1863 1863 have direct keybindings - see the list of keybindings below. … … 1901 1901 (interactive) 1902 1902 (kill-all-local-variables) 1903 1903 1904 1904 (if idlwave-startup-message 1905 1905 (message "Emacs IDLWAVE mode version %s." idlwave-mode-version)) 1906 1906 (setq idlwave-startup-message nil) 1907 1907 1908 1908 (setq local-abbrev-table idlwave-mode-abbrev-table) 1909 1909 (set-syntax-table idlwave-mode-syntax-table) 1910 1910 1911 1911 (set (make-local-variable 'indent-line-function) 'idlwave-indent-and-action) 1912 1912 1913 1913 (make-local-variable idlwave-comment-indent-function) 1914 1914 (set idlwave-comment-indent-function 'idlwave-comment-hook) 1915 1915 1916 1916 (set (make-local-variable 'comment-start-skip) ";+[ \t]*") 1917 1917 (set (make-local-variable 'comment-start) ";") … … 1921 1921 (set (make-local-variable 'indent-tabs-mode) nil) 1922 1922 (set (make-local-variable 'completion-ignore-case) t) 1923 1923 1924 1924 (use-local-map idlwave-mode-map) 1925 1925 … … 1931 1931 (setq major-mode 'idlwave-mode) 1932 1932 (setq abbrev-mode t) 1933 1933 1934 1934 (set (make-local-variable idlwave-fill-function) 'idlwave-auto-fill) 1935 1935 (setq comment-end "") 1936 1936 (set (make-local-variable 'comment-multi-line) nil) 1937 (set (make-local-variable 'paragraph-separate) 1937 (set (make-local-variable 'paragraph-separate) 1938 1938 "[ \t\f]*$\\|[ \t]*;+[ \t]*$\\|;+[+=-_*]+$") 1939 1939 (set (make-local-variable 'paragraph-start) "[ \t\f]\\|[ \t]*;+[ \t]") … … 1944 1944 (if (boundp 'tag-table-alist) 1945 1945 (add-to-list 'tag-table-alist '("\\.pro$" . "IDLTAGS"))) 1946 1946 1947 1947 ;; Font-lock additions - originally Phil Williams, then Ulrik Dickow 1948 1948 ;; Following line is for Emacs - XEmacs uses the corresponding property … … 1969 1969 ";" 1970 1970 'idlwave-forward-block nil)) 1971 1971 1972 1972 1973 1973 ;; Make a local post-command-hook and add our hook to it … … 2001 2001 (if (not (file-directory-p idlwave-config-directory)) 2002 2002 (make-directory idlwave-config-directory)) 2003 (setq 2004 idlwave-user-catalog-file (expand-file-name 2005 idlwave-user-catalog-file 2003 (setq 2004 idlwave-user-catalog-file (expand-file-name 2005 idlwave-user-catalog-file 2006 2006 idlwave-config-directory) 2007 idlwave-xml-system-rinfo-converted-file 2008 (expand-file-name 2007 idlwave-xml-system-rinfo-converted-file 2008 (expand-file-name 2009 2009 idlwave-xml-system-rinfo-converted-file 2010 2010 idlwave-config-directory) 2011 idlwave-path-file (expand-file-name 2012 idlwave-path-file 2011 idlwave-path-file (expand-file-name 2012 idlwave-path-file 2013 2013 idlwave-config-directory)) 2014 2014 (idlwave-read-paths) ; we may need these early … … 2029 2029 ;; 2030 2030 ;; Code Formatting ---------------------------------------------------- 2031 ;; 2031 ;; 2032 2032 2033 2033 (defun idlwave-hard-tab () … … 2172 2172 (setq end-pos pos)) 2173 2173 (goto-char end-pos) 2174 (setq end (buffer-substring 2174 (setq end (buffer-substring 2175 2175 (progn 2176 2176 (skip-chars-backward "a-zA-Z") … … 2194 2194 (t 2195 2195 (beep) 2196 (message "Warning: Shouldn't this be \"%s\" instead of \"%s\"?" 2196 (message "Warning: Shouldn't this be \"%s\" instead of \"%s\"?" 2197 2197 end1 end) 2198 2198 (sit-for 1)))))))) … … 2206 2206 (assoc (downcase (match-string 0)) idlwave-block-matches)) 2207 2207 ((looking-at "begin\\>") 2208 (let ((limit (save-excursion 2209 (idlwave-beginning-of-statement) 2208 (let ((limit (save-excursion 2209 (idlwave-beginning-of-statement) 2210 2210 (point)))) 2211 2211 (cond … … 2491 2491 (idlwave-block-jump-out -1 'nomark) 2492 2492 (point)))) 2493 (if (setq status (idlwave-find-key 2493 (if (setq status (idlwave-find-key 2494 2494 idlwave-end-block-reg -1 'nomark eos)) 2495 2495 (idlwave-beginning-of-statement) … … 2499 2499 (idlwave-block-jump-out 1 'nomark) 2500 2500 (point)))) 2501 (if (setq status (idlwave-find-key 2501 (if (setq status (idlwave-find-key 2502 2502 idlwave-begin-block-reg 1 'nomark eos)) 2503 2503 (idlwave-end-of-statement) … … 2513 2513 (goto-char (point-max)) 2514 2514 (if (re-search-backward idlwave-doclib-start nil t) 2515 (progn 2515 (progn 2516 2516 (setq beg (progn (beginning-of-line) (point))) 2517 2517 (if (re-search-forward idlwave-doclib-end nil t) … … 2546 2546 (if (re-search-backward idlwave-shell-prompt-pattern nil t) 2547 2547 (goto-char (match-end 0)))) 2548 (t 2548 (t 2549 2549 (if (save-excursion (forward-line -1) (idlwave-is-continuation-line)) 2550 2550 (idlwave-previous-statement) … … 2623 2623 (when (re-search-forward ".*&" lim t) 2624 2624 (goto-char (match-end 0)) 2625 (if (idlwave-quoted) 2625 (if (idlwave-quoted) 2626 2626 (goto-char save-point) 2627 2627 (if (eq (char-after (- (point) 2)) ?&) (goto-char save-point)))) … … 2640 2640 ;; - not followed by another ":" in explicit class, ala a->b::c 2641 2641 ;; As many in this mode, this function is heuristic and not an exact 2642 ;; parser. 2642 ;; parser. 2643 2643 (let* ((start (point)) 2644 2644 (eos (save-excursion (idlwave-end-of-statement) (point))) … … 2717 2717 like assignment statements. When nil, spaces are removed for keyword 2718 2718 assignment. Any other value keeps the current space around the `='. 2719 Limits in for loops are treated as keyword assignment. 2719 Limits in for loops are treated as keyword assignment. 2720 2720 2721 2721 Starting with IDL 6.0, a number of op= assignments are available. … … 2734 2734 See `idlwave-surround'." 2735 2735 (if idlwave-surround-by-blank 2736 (let 2736 (let 2737 2737 ((non-an-ops "\\(##\\|\\*\\|\\+\\|-\\|/\\|<\\|>\\|\\^\\)\\=") 2738 (an-ops 2738 (an-ops 2739 2739 "\\s-\\(AND\\|EQ\\|GE\\|GT\\|LE\\|LT\\|MOD\\|NE\\|OR\\|XOR\\)\\=") 2740 2740 (len 1)) 2741 2742 (save-excursion 2741 2742 (save-excursion 2743 2743 (let ((case-fold-search t)) 2744 2744 (backward-char) 2745 (if (or 2745 (if (or 2746 2746 (re-search-backward non-an-ops nil t) 2747 2747 ;; Why doesn't ##? work for both? 2748 (re-search-backward "\\(#\\)\\=" nil t)) 2748 (re-search-backward "\\(#\\)\\=" nil t)) 2749 2749 (setq len (1+ (length (match-string 1)))) 2750 2750 (when (re-search-backward an-ops nil t) 2751 2751 ;(setq begin nil) ; won't modify begin 2752 2752 (setq len (1+ (length (match-string 1)))))))) 2753 2754 (if (eq t idlwave-pad-keyword) 2753 2754 (if (eq t idlwave-pad-keyword) 2755 2755 ;; Everything gets padded equally 2756 2756 (idlwave-surround before after len) … … 2763 2763 (nth 2 (idlwave-where))))) 2764 2764 (cond ((or (memq what '(function-keyword procedure-keyword)) 2765 (memq (caar st) '(for pdef))) 2766 (cond 2765 (memq (caar st) '(for pdef))) 2766 (cond 2767 2767 ((null idlwave-pad-keyword) 2768 2768 (idlwave-surround 0 0) … … 2770 2770 (t))) ; leave any spaces alone 2771 2771 (t (idlwave-surround before after len)))))))) 2772 2772 2773 2773 2774 2774 (defun idlwave-indent-and-action (&optional arg) … … 2777 2777 (interactive "p") 2778 2778 (save-excursion 2779 (if (and idlwave-expand-generic-end 2780 (re-search-backward "\\<\\(end\\)\\s-*\\=" 2779 (if (and idlwave-expand-generic-end 2780 (re-search-backward "\\<\\(end\\)\\s-*\\=" 2781 2781 (max 0 (- (point) 10)) t) 2782 2782 (looking-at "\\(end\\)\\([ \n\t]\\|\\'\\)")) … … 2788 2788 (setq arg current-prefix-arg) 2789 2789 (setq current-prefix-arg nil)) 2790 (if arg 2790 (if arg 2791 2791 (idlwave-indent-statement) 2792 2792 (idlwave-indent-line t))) … … 2923 2923 (cond 2924 2924 ;; Beginning of file 2925 ((prog1 2925 ((prog1 2926 2926 (idlwave-previous-statement) 2927 2927 (setq beg-prev-pos (point))) … … 2933 2933 ;; Begin block 2934 2934 ((idlwave-look-at idlwave-begin-block-reg t) 2935 (+ (idlwave-min-current-statement-indent) 2935 (+ (idlwave-min-current-statement-indent) 2936 2936 idlwave-block-indent)) 2937 2937 ;; End Block … … 2944 2944 ;; idlwave-end-offset 2945 2945 ;; idlwave-block-indent)) 2946 2946 2947 2947 ;; Default to current indent 2948 2948 ((idlwave-current-statement-indent)))))) … … 2960 2960 (defun idlwave-calculate-paren-indent (beg-reg end-reg close-exp) 2961 2961 "Calculate the continuation indent inside a paren group. 2962 Returns a cons-cell with (open . indent), where open is the 2962 Returns a cons-cell with (open . indent), where open is the 2963 2963 location of the open paren" 2964 2964 (let ((open (nth 1 (parse-partial-sexp beg-reg end-reg)))) … … 3001 3001 (beg-last-statement (save-excursion (idlwave-previous-statement) 3002 3002 (point))) 3003 (beg-reg (progn (idlwave-start-of-substatement 'pre) 3003 (beg-reg (progn (idlwave-start-of-substatement 'pre) 3004 3004 (if (eq (line-beginning-position) end-reg) 3005 3005 (goto-char beg-last-statement) … … 3008 3008 idlwave-continuation-indent)) 3009 3009 fancy-nonparen-indent fancy-paren-indent) 3010 (cond 3010 (cond 3011 3011 ;; Align then with its matching if, etc. 3012 3012 ((let ((matchers '(("\\<if\\>" . "[ \t]*then") 3013 3013 ("\\<\\(if\\|end\\(if\\)?\\)\\>" . "[ \t]*else") 3014 3014 ("\\<\\(for\\|while\\)\\>" . "[ \t]*do") 3015 ("\\<\\(repeat\\|end\\(rep\\)?\\)\\>" . 3015 ("\\<\\(repeat\\|end\\(rep\\)?\\)\\>" . 3016 3016 "[ \t]*until") 3017 3017 ("\\<case\\>" . "[ \t]*of"))) 3018 3018 match cont-re) 3019 3019 (goto-char end-reg) 3020 (and 3020 (and 3021 3021 (setq cont-re 3022 3022 (catch 'exit … … 3027 3027 (idlwave-find-key cont-re -1 'nomark beg-last-statement))) 3028 3028 (if (looking-at "end") ;; that one's special 3029 (- (idlwave-current-indent) 3029 (- (idlwave-current-indent) 3030 3030 (+ idlwave-block-indent idlwave-end-offset)) 3031 3031 (idlwave-current-indent))) … … 3053 3053 (close-exp (progn 3054 3054 (goto-char end-reg) 3055 (skip-chars-forward " \t") 3055 (skip-chars-forward " \t") 3056 3056 (looking-at "\\s)"))) 3057 3057 indent-cons) … … 3087 3087 nil 3088 3088 (current-column))) 3089 3089 3090 3090 ;; Continued assignment (with =): 3091 3091 ((catch 'assign ; 3092 3092 (while (looking-at "[^=\n\r]*\\(=\\)[ \t]*") 3093 3093 (goto-char (match-end 0)) 3094 (if (null (idlwave-what-function beg-reg)) 3094 (if (null (idlwave-what-function beg-reg)) 3095 3095 (throw 'assign t)))) 3096 3096 (unless (or … … 3154 3154 (case-fold-search t) 3155 3155 (limit (if (>= dir 0) (point-max) (point-min))) 3156 (block-limit (if (>= dir 0) 3156 (block-limit (if (>= dir 0) 3157 3157 idlwave-begin-block-reg 3158 3158 idlwave-end-block-reg)) … … 3165 3165 idlwave-begin-unit-reg dir t limit) 3166 3166 (end-of-line) 3167 (idlwave-find-key 3167 (idlwave-find-key 3168 3168 idlwave-end-unit-reg dir t limit))) 3169 3169 limit))) … … 3190 3190 (unless comm-or-empty (setq min (min min (idlwave-current-indent))))) 3191 3191 (if (or comm-or-empty (and end-reg (>= (point) end-reg))) 3192 min 3192 min 3193 3193 (min min (idlwave-current-indent)))))) 3194 3194 … … 3217 3217 (let (p) 3218 3218 (save-excursion 3219 (or 3219 (or 3220 3220 (idlwave-look-at "\\<\\$") 3221 3221 (catch 'loop 3222 (while (and (looking-at "^[ \t]*\\(;.*\\)?$") 3222 (while (and (looking-at "^[ \t]*\\(;.*\\)?$") 3223 3223 (eq (forward-line -1) 0)) 3224 3224 (if (setq p (idlwave-look-at "\\<\\$")) (throw 'loop p)))))))) … … 3318 3318 (point)))) 3319 3319 "[^;]")) 3320 3320 3321 3321 ;; Mark the beginning and end of the paragraph 3322 3322 (goto-char bcl) … … 3382 3382 (forward-line -1)) 3383 3383 ) 3384 3384 3385 3385 ;; No hang. Instead find minimum indentation of paragraph 3386 3386 ;; after first line. … … 3414 3414 (current-column)) 3415 3415 indent)) 3416 3416 3417 3417 ;; try to keep point at its original place 3418 3418 (goto-char here) … … 3463 3463 3464 3464 (defun idlwave-auto-fill () 3465 "Called to break lines in auto fill mode. 3465 "Called to break lines in auto fill mode. 3466 3466 Only fills non-comment lines if `idlwave-fill-comment-line-only' is 3467 3467 non-nil. Places a continuation character at the end of the line if … … 3614 3614 (insert ", " (user-full-name)) 3615 3615 (if (boundp 'user-mail-address) 3616 (insert " <" user-mail-address ">") 3616 (insert " <" user-mail-address ">") 3617 3617 (insert " <" (user-login-name) "@" (system-name) ">")) 3618 3618 ;; Remove extra spaces from line … … 3640 3640 (progn 3641 3641 (goto-char beg) 3642 (if (re-search-forward 3642 (if (re-search-forward 3643 3643 (concat idlwave-doc-modifications-keyword ":") 3644 3644 end t) … … 3738 3738 (save-excursion 3739 3739 (forward-char) 3740 (re-search-backward (concat "\\(" idlwave-idl-keywords 3740 (re-search-backward (concat "\\(" idlwave-idl-keywords 3741 3741 "\\|[[(*+-/=,^><]\\)\\s-*\\*") limit t))))) 3742 3742 … … 3784 3784 (if (stringp prompt) 3785 3785 (message prompt))))) 3786 3786 3787 3787 (defun idlwave-rw-case (string) 3788 3788 "Make STRING have the case required by `idlwave-reserved-word-upcase'." … … 3802 3802 "Build skeleton IDL case statement." 3803 3803 (interactive) 3804 (idlwave-template 3804 (idlwave-template 3805 3805 (idlwave-rw-case "case") 3806 3806 (idlwave-rw-case " of\n\nendcase") … … 3810 3810 "Build skeleton IDL switch statement." 3811 3811 (interactive) 3812 (idlwave-template 3812 (idlwave-template 3813 3813 (idlwave-rw-case "switch") 3814 3814 (idlwave-rw-case " of\n\nendswitch") … … 3818 3818 "Build skeleton for loop statment." 3819 3819 (interactive) 3820 (idlwave-template 3820 (idlwave-template 3821 3821 (idlwave-rw-case "for") 3822 3822 (idlwave-rw-case " do begin\n\nendfor") … … 3833 3833 (defun idlwave-procedure () 3834 3834 (interactive) 3835 (idlwave-template 3835 (idlwave-template 3836 3836 (idlwave-rw-case "pro") 3837 3837 (idlwave-rw-case "\n\nreturn\nend") … … 3840 3840 (defun idlwave-function () 3841 3841 (interactive) 3842 (idlwave-template 3842 (idlwave-template 3843 3843 (idlwave-rw-case "function") 3844 3844 (idlwave-rw-case "\n\nreturn\nend") … … 3854 3854 (defun idlwave-while () 3855 3855 (interactive) 3856 (idlwave-template 3856 (idlwave-template 3857 3857 (idlwave-rw-case "while") 3858 3858 (idlwave-rw-case " do begin\n\nendwhile") … … 3933 3933 "How many outlawed buffers have tag TAG?" 3934 3934 (length (delq nil 3935 (mapcar 3936 (lambda (x) (eq (cdr x) tag)) 3935 (mapcar 3936 (lambda (x) (eq (cdr x) tag)) 3937 3937 idlwave-outlawed-buffers)))) 3938 3938 … … 3948 3948 (kill-buffer (car entry)) 3949 3949 (incf cnt) 3950 (setq idlwave-outlawed-buffers 3950 (setq idlwave-outlawed-buffers 3951 3951 (delq entry idlwave-outlawed-buffers))) 3952 (setq idlwave-outlawed-buffers 3952 (setq idlwave-outlawed-buffers 3953 3953 (delq entry idlwave-outlawed-buffers)))) 3954 3954 (message "%d buffer%s killed" cnt (if (= cnt 1) "" "s")))) … … 3962 3962 ;; Revoke license 3963 3963 (if entry 3964 (setq idlwave-outlawed-buffers 3964 (setq idlwave-outlawed-buffers 3965 3965 (delq entry idlwave-outlawed-buffers))) 3966 3966 ;; Remove this function from the hook. … … 3981 3981 ;; Find FILE on the scanned lib path and return a buffer visiting it 3982 3982 ;; This is for, e.g., finding source with no user catalog 3983 (cond 3983 (cond 3984 3984 ((null file) nil) 3985 3985 ((file-name-absolute-p file) file) … … 3996 3996 (let (directory directories cmd append status numdirs dir getsubdirs 3997 3997 buffer save_buffer files numfiles item errbuf) 3998 3998 3999 3999 ;; 4000 4000 ;; Read list of directories … … 4048 4048 (setq errbuf (get-buffer-create "*idltags-error*")) 4049 4049 (setq status (+ status 4050 (if (eq 0 (call-process 4050 (if (eq 0 (call-process 4051 4051 "sh" nil errbuf nil "-c" 4052 4052 (concat cmd append item))) … … 4062 4062 (setq item (nth numfiles files)) 4063 4063 ))) 4064 4064 4065 4065 (setq numdirs (1+ numdirs)) 4066 4066 (setq dir (nth numdirs directories))) … … 4068 4068 (setq numdirs (1+ numdirs)) 4069 4069 (setq dir (nth numdirs directories))))) 4070 4070 4071 4071 (setq errbuf (get-buffer-create "*idltags-error*")) 4072 4072 (if (= status 0) … … 4144 4144 (if (or (not (fboundp 'gethash)) 4145 4145 (not (fboundp 'puthash))) 4146 (progn 4146 (progn 4147 4147 (require 'cl) 4148 4148 (or (fboundp 'puthash) … … 4163 4163 (loop for entry in entries 4164 4164 for var = (car entry) for size = (nth 1 entry) 4165 do (setcdr (symbol-value var) 4165 do (setcdr (symbol-value var) 4166 4166 (make-hash-table ':size size ':test 'equal))) 4167 4167 (setq idlwave-sint-dirs nil … … 4173 4173 (loop for entry in entries 4174 4174 for var = (car entry) for size = (nth 1 entry) 4175 do (setcar (symbol-value var) 4175 do (setcar (symbol-value var) 4176 4176 (make-hash-table ':size size ':test 'equal)))))) 4177 4177 … … 4260 4260 (setq name (idlwave-sintern-method name set))) 4261 4261 (setq name (idlwave-sintern-routine name set))) 4262 4262 4263 4263 ;; The source 4264 4264 (let ((source-type (car source)) 4265 4265 (source-file (nth 1 source)) 4266 (source-dir (if default-dir 4266 (source-dir (if default-dir 4267 4267 (file-name-as-directory default-dir) 4268 4268 (nth 2 source))) … … 4273 4273 (setq source-lib (idlwave-sintern-libname source-lib set))) 4274 4274 (setq source (list source-type source-file source-dir source-lib))) 4275 4275 4276 4276 ;; The keywords 4277 4277 (setq kwds (mapcar (lambda (x) … … 4408 4408 (not (file-regular-p idlwave-user-catalog-file))) 4409 4409 (error "No catalog has been produced yet")) 4410 (let* ((emacs ( expand-file-name (invocation-name) (invocation-directory)))4410 (let* ((emacs (concat invocation-directory invocation-name)) 4411 4411 (args (list "-batch" 4412 4412 "-l" (expand-file-name "~/.emacs") 4413 4413 "-l" "idlwave" 4414 4414 "-f" "idlwave-rescan-catalog-directories")) 4415 (process (apply 'start-process "idlcat" 4415 (process (apply 'start-process "idlcat" 4416 4416 nil emacs args))) 4417 4417 (setq idlwave-catalog-process process) 4418 (set-process-sentinel 4418 (set-process-sentinel 4419 4419 process 4420 4420 (lambda (pro why) … … 4433 4433 ;; (system) | (lib pro_file dir "LIBNAME") | (user pro_file dir "USERLIB") | 4434 4434 ;; (buffer pro_file dir) | (compiled pro_file dir) 4435 ;; "calling_string" ("HELPFILE" (("KWD1" . link1) ...)) 4435 ;; "calling_string" ("HELPFILE" (("KWD1" . link1) ...)) 4436 4436 ;; ("HELPFILE2" (("KWD2" . link) ...)) ...) 4437 4437 ;; … … 4492 4492 ;; preparing work, load and renormalize everything anyway. 4493 4493 (override-idle (or arg idlwave-buffer-case-takes-precedence))) 4494 4494 4495 4495 (setq idlwave-buffer-routines nil 4496 4496 idlwave-compiled-routines nil … … 4503 4503 ((null idlwave-system-routines) t) 4504 4504 (t 'bufsh)))) 4505 4505 4506 4506 (if idlwave-buffer-case-takes-precedence 4507 4507 ;; We can safely scan the buffer stuff first … … 4518 4518 (ask-shell (and shell-is-running 4519 4519 idlwave-query-shell-for-routine-info))) 4520 4520 4521 4521 ;; Load the library catalogs again, first re-scanning the path 4522 (when arg 4522 (when arg 4523 4523 (if shell-is-running 4524 4524 (idlwave-shell-send-command idlwave-shell-path-query … … 4540 4540 ;; the shell might do it again. 4541 4541 (idlwave-concatenate-rinfo-lists nil 'run-hooks)) 4542 4542 4543 4543 (when ask-shell 4544 4544 ;; Ask the shell about the routines it knows of. … … 4577 4577 ;; disk. As a last fallback, load the (likely outdated) idlw-rinfo 4578 4578 ;; file distributed with older IDLWAVE versions (<6.0) 4579 (unless (and (load idlwave-xml-system-rinfo-converted-file 4579 (unless (and (load idlwave-xml-system-rinfo-converted-file 4580 4580 'noerror 'nomessage) 4581 4581 (idlwave-xml-system-routine-info-up-to-date)) … … 4583 4583 (condition-case nil 4584 4584 (idlwave-convert-xml-system-routine-info) 4585 (error 4586 (unless (load idlwave-xml-system-rinfo-converted-file 4585 (error 4586 (unless (load idlwave-xml-system-rinfo-converted-file 4587 4587 'noerror 'nomessage) 4588 4588 (if idlwave-system-routines 4589 (message 4589 (message 4590 4590 "Failed to load converted routine info, using old conversion.") 4591 (message 4591 (message 4592 4592 "Failed to convert XML routine info, falling back on idlw-rinfo.") 4593 4593 (if (not (load "idlw-rinfo" 'noerror 'nomessage))
