Function: woman0-so

woman0-so is a byte-compiled function defined in woman.el.gz.

Signature

(woman0-so)

Documentation

.so filename -- Switch source file. .so requests may be nested.

Source Code

;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman0-so ()
  ".so filename -- Switch source file.  `.so' requests may be nested."
  ;; Leaves point at start of new text.
  ;; (skip-chars-forward " \t")
  (let* ((beg (point))
	 (end (progn (woman-forward-arg 'unquote) (point)))
	 (name (buffer-substring beg end))
	 (filename name))
    ;; If the specified file does not exist in this ...
    (or (file-exists-p filename)
	;; or the parent directory ...
        (file-exists-p
         (setq filename (concat "../" name)))
	;; then use the WoMan search mechanism to find the filename ...
	(setq filename
	      (woman-file-name
	       (file-name-base name)))
	;; Cannot find the file, so ...
	(kill-buffer (current-buffer))
	(error "File `%s' not found" name))
    (beginning-of-line)
    (woman-delete-line 1)
    (let* ((from (point))
           (length (woman-insert-file-contents filename 0))
           (to (copy-marker (+ from length) t)))
      (woman-pre-process-region from to)
      (set-marker to nil)
      (goto-char from))))