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

Lines Matching +defs:indent +defs:line +defs:function

41 ;; continuation line indenting, from wave.el.
129 ;; using a temporary function in `post-command-hook' - not pretty,
141 ;; line: endif & endif. Using "&" outside of block begin/end lines
162 (unless (fboundp 'line-beginning-position)
163 (defalias 'line-beginning-position 'point-at-bol))
164 (unless (fboundp 'line-end-position)
165 (defalias 'line-end-position 'point-at-eol))
205 (defcustom idlwave-main-block-indent 2
212 (defcustom idlwave-block-indent 3
220 A value equal to negative `idlwave-block-indent' will make END lines
221 line up with the block BEGIN lines."
225 (defcustom idlwave-continuation-indent 3
232 (defcustom idlwave-max-extra-continuation-indent 40
233 "*Maximum additional indentation for special continuation indent.
234 Several special indentations are tried to help line up continuation
241 cases. See also `idlwave-indent-to-open-paren', which can override
246 (defcustom idlwave-indent-to-open-paren t
247 "*Non-nil means, indent continuation lines to innermost open
249 `idlwave-max-extra-continuation-indent'. Matching parens and the
259 the value of `max-extra-continuation-indent', which, if zero, would
270 (defcustom idlwave-indent-parens-nested nil
271 "*Non-nil means, indent continuation lines with parens by nesting
277 (defcustom idlwave-hanging-indent t
279 hanging indent given by `idlwave-hang-indent-regexp' match in the first line
284 (defcustom idlwave-hang-indent-regexp "- "
285 "*Regular expression matching the position of the hanging indent
286 in the first line of a comment paragraph. The size of the indent
291 (defcustom idlwave-use-last-hang-indent nil
292 "*If non-nil then use last match on line for `idlwave-indent-regexp'."
296 (defcustom idlwave-fill-comment-line-only t
303 When the line end falls within a string, string concatenation with the
307 This variable is ignored when `idlwave-fill-comment-line-only' is
312 (defcustom idlwave-split-line-string t
313 "*If non-nil then `idlwave-split-line' will split strings with `+'.
314 When the splitting point of a line falls inside a string, split the string
323 at the beginning of a line is never changed."
327 (defcustom idlwave-begin-line-comment nil
328 "*A comment anchored at the beginning of line.
330 indentation changed. If nil the default is \"^;\", i.e., any line
332 the line should begin with \"^\"."
334 :type '(choice (const :tag "Any line beginning with `;'" nil)
338 "*A comment that starts with this regular expression on a line by
500 '(choice :tag "by applying the function"
526 The value can also be any Emacs Lisp function which transforms the
727 (defcustom idlwave-function-completion-adds-paren t
728 "*Non-nil means, completion automatically adds `(' after completed function.
747 (defgroup idlwave-abbrev-and-indent-action nil
754 The actions that can be performed are listed in `idlwave-indent-action-table'."
755 :group 'idlwave-abbrev-and-indent-action
767 :group 'idlwave-abbrev-and-indent-action
774 See help for `idlwave-indent-action-table' for symbols using `idlwave-surround'.
782 :group 'idlwave-abbrev-and-indent-action
791 :group 'idlwave-abbrev-and-indent-action
799 :group 'idlwave-abbrev-and-indent-action
804 :group 'idlwave-abbrev-and-indent-action
808 "*Non-nil means re-indent line after END was typed."
809 :group 'idlwave-abbrev-and-indent-action
820 :group 'idlwave-abbrev-and-indent-action
830 :group 'idlwave-abbrev-and-indent-action
837 :group 'idlwave-abbrev-and-indent-action
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
849 ;; general, the expand table is only used when a line is explicitly
851 ;; is used, the action table is used when a line is indirectly
852 ;; indented via line splitting, auto-filling or a new line creation.
860 ;; (idlwave-action-and-binding "\\<\\(pro\\|function\\)\\>[ \t]*\\<"
870 (defvar idlwave-indent-action-table nil
872 and function as a cdr. This table is used by `idlwave-indent-line'.
880 (defvar idlwave-indent-expand-table nil
882 and function as a cdr. The table is used by the
883 `idlwave-indent-and-action' function. See documentation for
968 When nil, the header is positioned between the PRO/FUNCTION line of
975 "*The hook function used to update the timestamp of a function."
977 :type 'function)
1006 execution search path. If you want to specify command line switches
1007 for the idl program, use `idlwave-shell-command-line-options'.
1014 (defcustom idlwave-shell-command-line-options nil
1015 "*A list of command line options for calling the IDL program.
1160 ;; Function declarations. Fontify keyword plus function name.
1162 '("\\<\\(function\\|pro\\)\\>[ \t]+\\(\\sw+\\(::\\sw+\\)?\\)"
1164 (2 font-lock-function-name-face nil t)))
1206 (2 font-lock-function-name-face)))
1270 beginning-of-line))
1275 (defconst idlwave-comment-line-start-skip "^[ \t]*;"
1276 "Regexp to match the start of a full-line comment.
1277 That is the _beginning_ of a line containing a comment delimiter `;' preceded
1281 "\\<\\(pro\\|function\\|begin\\|case\\|switch\\)\\>"
1285 (defconst idlwave-begin-unit-reg "^\\s-*\\(pro\\|function\\)\\>\\|\\`"
1289 (defconst idlwave-end-unit-reg "^\\s-*\\(pro\\|function\\)\\>\\|\\'"
1290 "Regular expression to find the line that indicates the end of unit.
1291 This line is the end of buffer or the start of another unit. The case does
1294 (defconst idlwave-continue-line-reg "\\<\\$"
1295 "Regular expression to match a continued line.")
1304 ("function" . "end")
1344 ;; followed by a statement on the same line.
1351 '(pdef . ("pro\\>\\|function\\>" nil))
1381 (defvar idlwave-fill-function 'auto-fill-function
1382 "IDL mode auto fill function.")
1384 (defvar idlwave-comment-indent-function 'comment-indent-function
1385 "IDL mode comment indent function.")
1390 (defvar idlwave-comment-indent-char ?\
1395 "Character which is inserted as a last character on previous line by
1396 \\[idlwave-split-line] to begin a continuation line. Normally $.")
1401 "Creates a function for abbrev hooks to call `idlwave-check-abbrev' with args."
1412 "Creates a function for abbrev hooks that ensures abbrevs are not quoted.
1477 "KEY and CMD are made into a key binding and an indent action.
1478 KEY is a string - same as for the `define-key' function. CMD is a
1479 function of no arguments or a list to be evaluated. CMD is bound to
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'.
1503 (let* ((table (if select 'idlwave-indent-action-table
1504 'idlwave-indent-expand-table))
1543 (define-key idlwave-mode-map "\M-\r" 'idlwave-split-line)
1544 (define-key idlwave-mode-map "\M-\C-q" 'idlwave-indent-subprogram)
1548 ;; (define-key idlwave-mode-map "\t" 'idlwave-indent-line)
1549 (define-key idlwave-mode-map [(shift iso-lefttab)] 'idlwave-indent-statement)
1577 ;; (define-key idlwave-mode-map "\C-c\C-f" 'idlwave-function)
1593 "Set breakpoint in current line." t)
1613 ;; See description of the function `idlwave-action-and-binding'.
1666 (idlwave-define-abbrev "fu" "" (idlwave-code-abbrev idlwave-function))
1753 (idlwave-define-abbrev "function" "function" (idlwave-keyword-abbrev 0 t) t)
1774 (defvar imenu-create-index-function)
1775 (defvar extract-index-name-function)
1776 (defvar prev-index-position-function)
1777 (defvar imenu-extract-index-name-function)
1778 (defvar imenu-prev-index-position-function)
1792 TAB is used for explicit indentation of the current line.
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
1808 comment. The indentation of the second line of the paragraph
1811 comments. When the variable `idlwave-fill-comment-line-only' is
1817 again followed by \\[indent-region] (`indent-region').
1822 accepted keyword parameters of a procedure or function with
1869 beginning of the current program unit (pro, function or main).
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)
1924 (set (make-local-variable 'indent-tabs-mode) nil)
1937 (set (make-local-variable idlwave-fill-function) 'idlwave-auto-fill)
1939 (set (make-local-variable 'comment-multi-line) nil)
1947 (set (make-local-variable 'add-log-current-defun-function)
1955 ;; Following line is for Emacs - XEmacs uses the corresponding property
1958 (set (make-local-variable 'font-lock-mark-block-function)
1960 (set (make-local-variable 'font-lock-fontify-region-function)
1964 (set (make-local-variable 'imenu-create-index-function)
1965 'imenu-default-create-index-function)
1966 (set (make-local-variable 'imenu-extract-index-name-function)
1968 (set (make-local-variable 'imenu-prev-index-position-function)
2028 (forward-line -1)
2029 (when (setq pos (idlwave-is-continuation-line))
2048 It is evaluated in the lisp function `idlwave-command-hook' which is
2101 "Move to start of comment delimiter on current line.
2102 Moves to end of line if there is no comment delimiter.
2105 (let ((eos (progn (end-of-line) (point)))
2109 (beginning-of-line)
2159 ;; Re-indent end line
2160 ;;(insert-char ?\ 1) ;; So indent, etc. work well
2164 (eol-pos (save-excursion (end-of-line) (point)))
2166 (if idlwave-reindent-end (idlwave-indent-line))
2211 ((looking-at "pro\\|case\\|switch\\|function\\>")
2232 ;; Start new line if we are not in a new line
2237 (newline-and-indent)))
2273 The function does nothing if any of the following conditions is true:
2283 ;; avoid clobbering indent
2285 (move-to-column (idlwave-calculate-indent))
2293 ;; Check to see if the line should auto wrap
2296 (funcall auto-fill-function)))))
2318 (idlwave-indent-to (+ start-col n))
2321 (idlwave-indent-to end-col (- n))
2327 "Inserts a newline and indents the current and previous line."
2339 ;; The current line is being split, the cursor should be at the
2340 ;; beginning of the new line skipping the leading indentation.
2342 ;; The reason we insert the new line before indenting is that the
2343 ;; indenting could be confused by keywords (e.g. END) on the line
2345 ;; `indent-for-tab-command' followed by `newline-and-indent'.
2347 (beginning-of-line 0)
2348 (idlwave-indent-line)
2349 (forward-line)
2350 (idlwave-indent-line))
2358 "Compute indent for the beginning of the IDL comment delimiter."
2360 (if idlwave-begin-line-comment
2361 (looking-at idlwave-begin-line-comment)
2366 ;; On line by itself, indent as code
2367 (let ((tem (idlwave-calculate-indent)))
2375 (defun idlwave-split-line ()
2376 "Continue line by breaking line at point and indent the lines.
2377 For a code line insert continuation marker. If the line is a line comment
2378 then the new line will contain a comment with the same indentation.
2379 Splits strings with the IDL operator `+' if `idlwave-split-line-string' is
2386 ;; For code line add continuation.
2390 (if idlwave-split-line-string
2395 (newline-and-indent)
2405 (newline-and-indent)))
2406 (indent-new-comment-line))
2407 ;; Indent previous line
2409 (forward-line -1)
2410 (idlwave-indent-line)
2412 ;; Reindent new line
2413 (idlwave-indent-line)))
2524 (setq beg (progn (beginning-of-line) (point)))
2527 (forward-line 1)
2542 (if (looking-at "[ \t]*\\<\\(pro\\|function\\)\\>\\s-+\\(\\([a-zA-Z0-9$_]+\\)::\\)?\\([a-zA-Z0-9$_]+\\)")
2544 'pro 'function))
2553 Point is placed at the beginning of the line whether or not this is an
2561 (if (save-excursion (forward-line -1) (idlwave-is-continuation-line))
2563 (beginning-of-line)))))
2567 Returns t if the current line before moving is the beginning of
2571 (if (not (= (forward-line -1) 0))
2572 ;; first line in file
2574 ;; skip blank lines, label lines, include lines and line comments
2580 (looking-at idlwave-comment-line-start-skip)
2584 (= (forward-line -1) 0)))
2588 (forward-line -1)
2589 (idlwave-is-continuation-line))
2590 (= (forward-line -1) 0)))
2595 If not in a statement just moves to end of line. Returns position."
2597 (while (and (idlwave-is-continuation-line)
2598 (= (forward-line 1) 0))
2599 (while (and (idlwave-is-comment-or-empty-line)
2600 (= (forward-line 1) 0))))
2601 (end-of-line)
2606 If not in a statement just moves to end of line. Returns position."
2608 (while (and (idlwave-is-continuation-line)
2609 (= (forward-line 1) 0)))
2610 (end-of-line)
2620 ;; skip blank lines, label lines, include lines and line comments
2621 (while (and (= (forward-line 1) 0)
2626 (looking-at idlwave-comment-line-start-skip)
2633 "Skip past multiple commands on a line (with `&')."
2647 ;; So we find the first colon in the line and make sure
2653 ;; As many in this mode, this function is heuristic and not an exact
2671 statement is on a new line or is a subpart of the current statement.
2698 ;; If a continuation line starts here, move to next line
2700 (beginning-of-line 2))
2714 (forward-line 1))
2776 (cond ((or (memq what '(function-keyword procedure-keyword))
2786 (defun idlwave-indent-and-action (&optional arg)
2787 "Call `idlwave-indent-line' and do expand actions.
2788 With prefix ARG non-nil, indent the entire sub-statement."
2803 (idlwave-indent-statement)
2804 (idlwave-indent-line t)))
2806 (defun idlwave-indent-line (&optional expand)
2807 "Indents current IDL line as code or as a comment.
2808 The actions in `idlwave-indent-action-table' are performed.
2810 `idlwave-indent-expand-table' are performed."
2819 (beginning-of-line)
2820 (if (looking-at idlwave-comment-line-start-skip)
2821 ;; Indentation for a line comment
2824 (idlwave-indent-left-margin (idlwave-comment-hook)))
2831 (mapcar 'idlwave-do-action idlwave-indent-expand-table))
2834 (mapcar 'idlwave-do-action idlwave-indent-action-table))
2836 ;; No longer expand abbrevs on the line. The user can do this
2839 ;; Indent for code line
2841 (beginning-of-line)
2843 ;; a label line
2849 ;; indent the line
2850 (idlwave-indent-left-margin (idlwave-calculate-indent)))
2852 (end-of-line)
2854 ;; Emacs 21 is too smart with fill-column on comment indent
2855 (let ((fill-column (if (fboundp 'comment-indent-new-line)
2858 (indent-for-comment)))))
2864 "Perform an action repeatedly on a line. ACTION is a list (REG
2865 . FUNC). REG is a regular expression. FUNC is either a function name
2873 (beginning-of-line)
2879 (defun idlwave-indent-to (col &optional min)
2886 (defun idlwave-indent-left-margin (col)
2887 "Indent the current line to column COL.
2891 (beginning-of-line)
2893 (idlwave-indent-to col)))
2895 (defun idlwave-indent-subprogram ()
2904 (indent-region beg (point) nil))
2907 (defun idlwave-indent-statement ()
2914 (indent-region beg (point) nil))))
2916 (defun idlwave-calculate-indent ()
2917 "Return appropriate indentation for current line as IDL code."
2919 (beginning-of-line)
2922 ;; function
2925 ;; Check for continuation line
2927 (and (= (forward-line -1) 0)
2928 (idlwave-is-continuation-line)))
2929 (idlwave-calculate-cont-indent))
2930 ;; calculate indent based on previous and current statements
2932 (the-indent
2933 ;; calculate indent based on previous statement
2943 (+ (idlwave-current-statement-indent)
2944 idlwave-main-block-indent))
2947 (+ (idlwave-min-current-statement-indent)
2948 idlwave-block-indent))
2955 (idlwave-min-current-statement-indent)))
2957 ;; idlwave-block-indent))
2959 ;; Default to current indent
2960 ((idlwave-current-statement-indent))))))
2965 (+ the-indent idlwave-end-offset))
2966 (the-indent)))))))
2969 ;; Parentheses indent
2972 (defun idlwave-calculate-paren-indent (beg-reg end-reg close-exp)
2973 "Calculate the continuation indent inside a paren group.
2974 Returns a cons-cell with (open . indent), where open is the
2983 ;; Plain Kernighan-style nested indent
2984 (idlwave-indent-parens-nested
2985 (+ idlwave-continuation-indent (idlwave-current-indent)))
2987 ;; This is a closed paren - line up under open paren.
2991 ;; Empty (or just comment) follows -- revert to basic indent
3003 (defun idlwave-calculate-cont-indent ()
3004 "Calculates the IDL continuation indent column from the previous
3007 of the previous line. Various special types of continuations,
3012 (end-reg (progn (beginning-of-line) (point)))
3016 (if (eq (line-beginning-position) end-reg)
3019 (basic-indent (+ (idlwave-min-current-statement-indent end-reg)
3020 idlwave-continuation-indent))
3021 fancy-nonparen-indent fancy-paren-indent)
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
3053 (if (/= (forward-line -1) 0)
3060 (+ idlwave-continuation-indent (idlwave-current-indent)))
3062 ;; Parenthetical indent, either traditional or Kernighan style
3063 ((setq fancy-paren-indent
3069 indent-cons)
3071 (while (setq indent-cons (idlwave-calculate-paren-indent
3075 idlwave-indent-to-open-paren
3076 idlwave-indent-parens-nested
3077 (null (cdr indent-cons))
3078 (< (- (cdr indent-cons) basic-indent)
3079 idlwave-max-extra-continuation-indent))
3080 (throw 'loop (cdr indent-cons)))
3081 (setq end-reg (car indent-cons))))))
3082 fancy-paren-indent)
3086 (> idlwave-max-extra-continuation-indent 0)
3087 (setq fancy-nonparen-indent
3094 (idlwave-look-at "^[ \t]*\\(pro\\|function\\)") ;skip over
3097 ;; Comment only, or blank line with "$"? Basic indent.
3106 (if (null (idlwave-what-function beg-reg))
3115 (< (- fancy-nonparen-indent basic-indent)
3116 idlwave-max-extra-continuation-indent))
3117 (if fancy-paren-indent ;calculated but disallowed paren indent
3118 (+ fancy-nonparen-indent idlwave-continuation-indent)
3119 fancy-nonparen-indent))
3121 ;; Basic indent, by default
3122 (t basic-indent)))))
3178 (end-of-line)
3182 (if (>= dir 0) (end-of-line)) ;Make sure we are in current block
3192 (defun idlwave-min-current-statement-indent (&optional end-reg)
3193 "The minimum indent in the current statement."
3195 (if (not (idlwave-is-continuation-line))
3196 (idlwave-current-indent)
3197 (let ((min (idlwave-current-indent)) comm-or-empty)
3198 (while (and (= (forward-line 1) 0)
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."
3210 (if last-line
3213 (idlwave-current-indent))
3215 (defun idlwave-current-indent ()
3216 "Return the column of the indentation of the current line.
3217 Skips any whitespace. Returns 0 if the end-of-line follows the whitespace."
3219 (beginning-of-line)
3221 ;; if we are at the end of blank line return 0
3225 (defun idlwave-is-continuation-line ()
3226 "Tests if current line is continuation line.
3235 (eq (forward-line -1) 0))
3238 (defun idlwave-is-comment-line ()
3239 "Tests if the current line is a comment line."
3241 (beginning-of-line 1)
3244 (defun idlwave-is-comment-or-empty-line ()
3245 "Tests if the current line is a comment line."
3247 (beginning-of-line 1)
3251 "Searches current line from current point for REGEXP.
3258 This function produces unexpected results if REGEXP contains quotes or
3264 (if cont (idlwave-end-of-statement) (end-of-line))
3279 line comments. The indentation is given by the hanging indent of the
3280 first line, otherwise by the minimum indentation of the lines after
3281 the first line. The indentation of the first line does not change.
3282 Does not effect code lines. Does not fill comments on the same line
3283 with code. The hanging indent is given by the end of the first match
3284 matching `idlwave-hang-indent-regexp' on the paragraph's first line . If the
3285 optional argument NOHANG is non-nil then the hanging indent is
3288 ;; check if this is a line comment
3290 (beginning-of-line)
3294 ((indent 999)
3295 pre here diff fill-prefix-reg bcl first-indent
3299 ;; contiguous line comments. Thus, we may be changing tabs in
3314 (beginning-of-line)
3318 (save-excursion (end-of-line) (point))
3320 ;; Get the comment leader on the line and its length
3329 (beginning-of-line) (point))
3338 (forward-line -1))
3339 ;; Move to first line of paragraph
3341 (forward-line 1))
3347 (forward-line 1))
3348 (beginning-of-line)
3351 (forward-line -1))
3352 (end-of-line)
3354 ;; fill-region needs END to be at the beginning of line after
3355 ;; the paragraph or it will add a line).
3358 ;; Set END to the beginning of line after the paragraph
3365 ;; point will be at the beginning of a line in which case
3367 ;; the first paragraph line and thus will not affect the
3370 ;; First check to see if indentation is based on hanging indent.
3371 (if (and (not nohang) idlwave-hanging-indent
3375 (idlwave-calc-hanging-indent))))
3377 ;; each line's indent is at least as great as the hanging
3378 ;; indent. This is needed for fill-paragraph to work with
3381 (setq indent hang)
3382 (beginning-of-line)
3385 (save-excursion (end-of-line) (point))
3387 (if (> (setq diff (- indent (current-column))) 0)
3394 (forward-line -1))
3398 ;; after first line.
3400 ;; beginning of line and END is at the end of line
3402 ;; be the case for a single line paragraph).
3404 (beginning-of-line)
3405 (setq indent
3406 (min indent
3410 (save-excursion (end-of-line) (point))
3413 (forward-line -1))
3416 (make-string (- indent pre)
3418 ;; first-line indent
3419 (setq first-indent
3424 (save-excursion (end-of-line) (point))
3427 indent))
3433 ;; to keep whitespace untouched on the first line within the
3434 ;; indent length and to preserve any indent on the first line
3435 ;; (first indent).
3438 (buffer-substring start (+ start first-indent -1)))
3439 (subst-char-in-region start (+ start first-indent -1) ?\ ?~ nil)
3445 (delete-region start (+ start first-indent -1))
3449 ;; body fill-region will put it at the beginning of the line.
3453 (defun idlwave-calc-hanging-indent ()
3454 "Calculate the position of the hanging indent for the comment
3455 paragraph. The hanging indent position is given by the first match
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
3458 the line.
3460 (if idlwave-use-last-hang-indent
3462 (end-of-line)
3464 idlwave-hang-indent-regexp
3465 (save-excursion (beginning-of-line) (point))
3467 (+ (current-column) (length idlwave-hang-indent-regexp))))
3469 (beginning-of-line)
3471 idlwave-hang-indent-regexp
3472 (save-excursion (end-of-line) (point))
3478 Only fills non-comment lines if `idlwave-fill-comment-line-only' is
3479 non-nil. Places a continuation character at the end of the line if
3484 (if (or (not idlwave-fill-comment-line-only)
3486 ;; Check for comment line
3487 (beginning-of-line)
3488 (looking-at idlwave-comment-line-start-skip)))
3490 (idlwave-indent-line)
3491 ;; Prevent actions do-auto-fill which calls indent-line-function.
3502 (end-of-line 0)
3503 ;; Indent the split line
3504 (idlwave-indent-line))
3506 (beginning-of-line)
3507 (looking-at idlwave-comment-line-start-skip))
3508 ;; A continued line comment
3509 ;; We treat continued line comments as part of a comment
3510 ;; paragraph. So we check for a hanging indent.
3511 (if idlwave-hanging-indent
3513 (indent
3515 (forward-line -1)
3516 (idlwave-calc-hanging-indent))))
3517 (if indent
3521 (beginning-of-line)
3524 (save-excursion (end-of-line) (point)) t)
3526 (idlwave-indent-to indent)
3531 (end-of-line 0)
3533 ;; Splitting a non-full-line comment.
3534 ;; Insert the comment delimiter from split line
3537 (beginning-of-line)
3539 ;; Insert blank to keep off beginning of line
3542 (forward-line -1)
3547 (idlwave-indent-line))
3548 ;; Split code line - add continuation character
3550 (end-of-line 0)
3556 ;; the line was split. That space was removed.
3563 (beginning-of-line)
3569 ;; Although do-auto-fill (via indent-new-comment-line) calls
3570 ;; idlwave-indent-line for the new line, re-indent again
3572 (idlwave-indent-line))
3579 automatically breaks the line at a previous space."
3581 (prog1 (set idlwave-fill-function
3583 (not (symbol-value idlwave-fill-function))
3587 ;; update mode-line
3602 ;; make sure we catch the current line if it begins the unit
3605 (end-of-line)
3607 (beginning-of-line)
3608 ;; skip function or procedure line
3609 (if (idlwave-look-at "\\<\\(pro\\|function\\)\\>")
3612 (if (> (forward-line 1) 0) (insert "\n")))))
3622 "Default timestamp insertion function"
3628 ;; Remove extra spaces from line
3630 ;; Insert a blank line comment to separate from the date entry -
3631 ;; will keep the entry from flowing onto date line if re-filled.
3655 (end-of-line)
3657 (end-of-line -1)
3693 Ignores comment delimiters on the current line.
3702 ;; search for the string start from the beginning of line.
3704 (eol (progn (end-of-line) (point)))
3705 (bq (progn (beginning-of-line) (point)))
3757 ;; Replace these with a general template function, something like
3764 Opens a line if point is not followed by a newline modulo intervening
3772 The lines containing S1 and S2 are reindented using `indent-region'
3785 (let ((beg (save-excursion (beginning-of-line) (point)))
3788 (open-line 1))
3794 (indent-region beg end nil))
3851 (defun idlwave-function ()
3854 (idlwave-rw-case "function")
3977 ;; Remove this function from the hook.
4089 "Comment the lines in the region if the first non-blank line is
4100 (beginning-of-line)
4123 ;; For the completion and routine info function, we want to normalize
4300 "Define a variable and a function to sintern the new type TAG.
4301 This defines the function `idlwave-sintern-TAG' and the variable
4308 (fset func ; set the function
4346 "Holds the combinded procedure/function/method routine-info.")
4546 ;; 2. When this function is called non-interactively, it
4709 ;; procedure and function (e.g. call_method).
4714 (syntax-vec (make-vector 3 nil)) ; procedure, function, exec command
5249 "^[ \t]*\\(pro\\|function\\)[ \t]" nil t)
5267 ;; Remove the continuation line stuff
5274 "\\<\\(pro\\|function\\)\\>\\s-+\\(\\([a-zA-Z0-9$_]+\\)::\\)?\\([a-zA-Z0-9$_]+\\)" string)
5309 (if (string= type "function") "Result = " "")
5314 (if (string= type "function") "(" ", ")
5316 (if (string= type "function") ")" ""))))
5410 not be scanned. You can scan your own libraries off-line using the
5806 s = strtrim(strjoin(s,' ',/single),2) ; make one line
5885 "Complete a function, procedure or keyword name at point.
5886 This function is smart and figures out what can be completed
5889 - In the middle of a statement it completes function names.
5890 - after a `(' or `,' in the argument list of a function or procedure,
5891 it completes a keyword of the relevant function or procedure.
5899 The function also knows about object methods. When it needs a class
5905 `idlwave-function-completion-adds-paren'.
5914 3 <=> 'function
5915 4 <=> 'function-keyword
5918 7 <=> 'function-method
5919 8 <=> 'function-method-keyword
5923 function names in places where the default would be a keyword.
5997 ((eq what 'function)
5998 ;; Complete a function name
6003 (isa (concat "function" (if class-selector "-method" "")))
6008 'function (if class-selector 'method 'routine)
6020 ((and (memq what '(procedure-keyword function-keyword)) ; Special Case
6057 ((eq what 'function-keyword)
6058 ;; Complete a function keyword
6066 (isa (format "function%s-keyword" (if class "-method" "")))
6073 (error "Nothing known about function %s"
6083 (unless list (error "No keywords available for function %s"
6089 (format "Select keyword for function %s%s" msg-name
6100 These functions are called for each completion. Each function must
6103 return t. If such a function returns t, *no further* attempts to
6104 complete other contexts will be done. If the function returns nil,
6123 ("function") ("function-keyword")
6125 ("function-method") ("function-method-keyword")
6160 ((eq what 'function)
6161 (list nil-list nil-list 'function nil-list nil))
6163 ((eq what 'function-keyword)
6171 (list nil-list nil-list 'function-keyword
6190 ((eq what 'function-method)
6191 (list nil-list nil-list 'function class-list nil))
6193 ((eq what 'function-method-keyword)
6203 (list nil-list nil-list 'function-keyword
6369 INFO is as returned by idlwave-what-function or -procedure."
6507 (func-entry (idlwave-what-function bos))
6524 ((string-match "\\`[ \t]*\\(pro\\|function\\)[ \t]+[a-zA-Z0-9_]*\\'"
6534 ((string-match "\\`[ \t]*\\(pro\\|function\\)\\>"
6547 (setq cw 'function-keyword cw-mod func cw-point func-point
6553 ; ;; after these chars, a function makes no sense
6557 ;; Everywhere else we try a function.
6559 (setq cw 'function)
6580 (defun idlwave-what-function (&optional bound)
6581 ;; Find out if point is within the argument list of a function.
6582 ;; The return value is ("function-name" class arrow-start (point) level).
6692 This function is not general, can only be used for completion stuff."
6706 (beginning-of-line 0)
6708 ;; continuation line
6721 &optional prepare-display-function
6724 SELECTOR is the PREDICATE argument for the completion function. Show
6725 PROMPT in echo area. TYPE is one of the intern types, e.g. 'function,
6799 ; (completion-fixup-function ; Emacs
6805 (if prepare-display-function
6806 (setq list (funcall prepare-display-function list)))
6825 ;; Check for the special case of completing empty string after pro/function
6829 (re-search-backward "\\<\\(pro\\|function\\)[ \t]+\\="
6833 "^[ \t]*\\(pro\\|function\\)[ \t]+\\([a-zA-Z0-9_]+::\\)" nil t))))
6953 (funcall (event-function resp) (event-object resp)))
7068 (defun idlwave-choose (function &rest args)
7071 (apply function args))
7097 The keys of the alist are expected to be strings. The function returns the
7621 (error "Not in a method procedure or function"))
7868 "Add `=' or `(' after successful completion of keyword and function.
7873 ((eq type 'function)
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)
7933 point is on the name a function or procedure, or in the argument list
7934 of a function or procedure, this command displays a help buffer with
7985 (type (if (eq (nth 1 module) 'pro) "pro" "function"))
7989 (if (string-match "\\(pro\\|function\\)[ \t]+\\(\\(.*\\)::\\)?\\(.*\\)"
7996 (if (string= (downcase type) "function")
8021 function offers as default the module name `idlwave-routine-info'
8110 (cond ((eq type 'fun) "function")
8112 (t "\\(pro\\|function\\)"))
8129 (looking-at "[ \t]*\\(pro\\|function\\)[ \t]+\\(\\([a-zA-Z0-9_$]+\\)::\\)?\\([a-zA-Z0-9$_]+\\)\\([, \t\n]\\|$\\)")))
8130 ;; This is a function or procedure definition statement
8156 ((and (eq cw 'function)
8166 ((and (memq cw '(function-keyword procedure-keyword))
8168 (eq next-char ?\()) ; A function!
8226 ;; If this is the OBJ_NEW function, try to figure out the class and use
8297 If it cannot be a keyword, the function return nil.
8319 ;; We do know the function, which does not have the keyword.
8322 ;; We do not know the function, so this just might be a correct
8393 (error "No function or procedure call at point"))
8504 Start line with PREFIX. If a file name is inserted, add FILE-PROPS to
8631 (let ((idlwave-extra-help-function 'idlwave-help-with-source)
9082 "Search for the previous procedure or function.
9086 ((idlwave-find-key "\\<\\(pro\\|function\\)\\>" -1 'nomark))
9103 (defalias 'idlwave-function-menu
9107 'function-menu)
9120 (or (assq 'idlwave-mode fume-function-name-regexp-alist)
9121 (not (boundp 'fume-function-name-regexp-idl)) ; avoid problems
9122 (setq fume-function-name-regexp-alist
9123 (cons '(idlwave-mode . fume-function-name-regexp-idl)
9124 fume-function-name-regexp-alist)))
9125 (or (assq 'idlwave-mode fume-find-function-name-method-alist)
9126 (not (fboundp 'fume-find-next-idl-function-name)) ; avoid problems
9127 (setq fume-find-function-name-method-alist
9128 (cons '(idlwave-mode . fume-find-next-idl-function-name)
9129 fume-find-function-name-method-alist))))))
9149 ["PRO/FUNC menu" idlwave-function-menu t]
9164 ["Indent Entire Statement" idlwave-indent-statement
9165 :active t :keys "C-u \\[indent-for-tab-command]" ]
9166 ["Indent Subprogram" idlwave-indent-subprogram t]
9168 ["Continue/Split line" idlwave-split-line t]
9171 :selected (symbol-value idlwave-fill-function)])
9174 ["Function" idlwave-function t]
9190 ["3 Function Name" (idlwave-complete 'function) t]
9191 ["4 Function Keyword" (idlwave-complete 'function-keyword) t]
9196 ["7 Function Method Name" (idlwave-complete 'function-method) t]
9197 ["8 Function Method Keyword" (idlwave-complete 'function-method-keyword) t]
9266 "Call the customize function with idlwave as argument."
9319 The function does *not* list abbrevs which replace a word with itself
9325 This function was written since `list-abbrevs' looks terrible for IDLWAVE mode."
9337 func (symbol-function sym))
9372 ;; Make sure each abbreviation uses only one display line