Function: fortune-append

fortune-append is a byte-compiled function defined in fortune.el.gz.

Signature

(fortune-append STRING &optional INTERACTIVE FILE)

Documentation

Append STRING to the fortune FILE.

If INTERACTIVE is non-nil, don't compile the fortune file afterwards.

Source Code

;; Defined in /usr/src/emacs/lisp/play/fortune.el.gz
;;; **************
;;; Inserting a new fortune
(defun fortune-append (string &optional interactive file)
  "Append STRING to the fortune FILE.

If INTERACTIVE is non-nil, don't compile the fortune file afterwards."
  (setq file (expand-file-name
	      (substitute-in-file-name (or file fortune-file))))
  (if (file-directory-p file)
      (error "Cannot append fortune to directory %s" file))
  (if interactive ; switch to file and return buffer
      (find-file-other-frame file)
    (find-file-noselect file))
  (let ((fortune-buffer (get-file-buffer file)))

    (set-buffer fortune-buffer)
    (goto-char (point-max))
    (setq fill-column fortune-fill-column)
    (setq auto-fill-inhibit-regexp "^%")
    (turn-on-auto-fill)
    (insert string fortune-end-sep)
    (unless interactive
      (save-buffer)
      (if fortune-always-compile
	  (fortune-compile file)))))