Function: woman-negative-vertical-space

woman-negative-vertical-space is a byte-compiled function defined in woman.el.gz.

Signature

(woman-negative-vertical-space FROM)

Documentation

.sp N with N < 0 => overlap following with preceding lines at FROM.

Source Code

;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman-negative-vertical-space (from)
  ".sp N with N < 0 => overlap following with preceding lines at FROM."
  ;; Run by woman-decode-region if necessary -- not usually required.
  (WoMan-warn "Negative vertical spacing support is experimental!")
  (goto-char from)
  (while
      ;; Find next control line:
      (re-search-forward "^\\.sp " nil t)
    (let ((N (woman-get-numeric-arg))
	  overlap overwritten)
      (woman-delete-whole-line)
      (setq from (point)
	    overlap (buffer-substring from
				      (progn (forward-line (- N)) (point))))
      (delete-region from (point))
      (forward-line N)
      (let ((imax (length overlap))
	    (i 0) c)
	(while (< i imax)
	  (setq c (aref overlap i))
	  (cond ((eq c ?\n)		; skip
		 (forward-line))
		((eolp)			; extend line
		 ;; Insert character INCLUDING TEXT PROPERTIES:
		 ;; (insert (substring overlap i (1+ i)))
		 (let ((eol (string-search "\n" overlap i)))
		   (insert (substring overlap i eol))
		   (setq i (or eol imax)))
		 )
		((eq c ?\s)		; skip
		 (forward-char))
		((eq c ?\t)		; skip
		 (if (eq (following-char) ?\t)
		     (forward-char)	; both tabs, just skip
		   (dotimes (_ woman-tab-width)
                     (if (eolp)
                         (insert ?\s)	; extend line
                       (forward-char)) ; skip
		     )))
		(t
		 (if (or (eq (following-char) ?\s) ; overwrite OK
			 overwritten) ; warning only once per ".sp -"
		     ()
		   (setq overwritten t)
		   (WoMan-warn
		    "Character(s) overwritten by negative vertical spacing in line %d"
		    (count-lines 1 (point))))
		 (delete-char 1) (insert (substring overlap i (1+ i)))))
	  (setq i (1+ i)))))))