Function: idlwave-calculate-paren-indent

idlwave-calculate-paren-indent is a byte-compiled function defined in idlwave.el.gz.

Signature

(idlwave-calculate-paren-indent BEG-REG END-REG CLOSE-EXP)

Documentation

Calculate the continuation indent inside a paren group.

Returns a cons-cell with (open . indent), where open is the location of the open paren.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/idlwave.el.gz
;;
;; Parentheses indent
;;

(defun idlwave-calculate-paren-indent (beg-reg end-reg close-exp)
  "Calculate the continuation indent inside a paren group.
Returns a cons-cell with (open . indent), where open is the
location of the open paren."
  (let ((open (nth 1 (parse-partial-sexp beg-reg end-reg))))
    ;; Found an innermost open paren.
    (when open
      (goto-char open)
      ;; Line up with next word unless this is a closing paren.
      (cons open
	    (cond
	     ;; Plain Kernighan-style nested indent
	     (idlwave-indent-parens-nested
	      (+ idlwave-continuation-indent (idlwave-current-indent)))

	     ;; This is a closed paren - line up under open paren.
	     (close-exp
	      (current-column))

	     ;; Empty (or just comment) follows -- revert to basic indent
	     ((progn
		;; Skip paren
		(forward-char 1)
		(looking-at "[ \t$]*\\(;.*\\)?$"))
	      nil)

	     ;; Line up with first word after any blank space
	     ((progn
		(skip-chars-forward " \t")
		(current-column))))))))