Function: idlwave-surround

idlwave-surround is a byte-compiled function defined in idlwave.el.gz.

Signature

(idlwave-surround &optional BEFORE AFTER LENGTH IS-ACTION)

Documentation

Surround the LENGTH characters before point with blanks.

LENGTH defaults to 1. Optional arguments BEFORE and AFTER affect the behavior before and after the characters (see also description of idlwave-make-space):

nil do nothing
0 force no spaces
integer > 0 force exactly n spaces
integer < 0 at least |n| spaces

The function does nothing if any of the following conditions is true:
- idlwave-surround-by-blank is nil
- the character before point is inside a string or comment

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/idlwave.el.gz
(defun idlwave-surround (&optional before after length _is-action)
  "Surround the LENGTH characters before point with blanks.
LENGTH defaults to 1.
Optional arguments BEFORE and AFTER affect the behavior before and
after the characters (see also description of `idlwave-make-space'):

nil            do nothing
0              force no spaces
integer > 0    force exactly n spaces
integer < 0    at least |n| spaces

The function does nothing if any of the following conditions is true:
- `idlwave-surround-by-blank' is nil
- the character before point is inside a string or comment"
  (when (and idlwave-surround-by-blank (not (idlwave-quoted)))
    (let ((length (or length 1))) ; establish a default for LENGTH
      (backward-char length)
      (save-restriction
	(let ((here (point)))
	  (skip-chars-backward " \t")
	  (if (bolp)
	      ;; avoid clobbering indent
	      (progn
		(move-to-column (idlwave-calculate-indent))
		(if (<= (point) here)
		    (narrow-to-region (point) here))
		(goto-char here)))
	  (idlwave-make-space before))
	(skip-chars-forward " \t"))
      (forward-char length)
      (idlwave-make-space after)
      ;; Check to see if the line should auto wrap
      (if (and (equal (char-after (1- (point))) ?\ )
	       (> (current-column) fill-column))
	  (funcall auto-fill-function)))))