Function: kfile:write

kfile:write is an interactive and byte-compiled function defined in kfile.el.

Signature

(kfile:write FILE)

Documentation

Write current outline to FILE.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kfile.el
;;; Next function is adapted from `file-write' of GNU Emacs.
(defun kfile:write (file)
  "Write current outline to FILE."
  (interactive "FWrite outline file: ")
  (when (or (null file) (string-equal file ""))
    (error "(kfile:write): Invalid file name, \"%s\"" file))
  ;; If arg is just a directory, use same file name, but in that directory.
  (when (and (file-directory-p file) (hypb:buffer-file-name))
    (setq file (concat (file-name-as-directory file)
		       (file-name-nondirectory (hypb:buffer-file-name)))))
  (set-visited-file-name file)
  ;; Set-visited-file-name clears local-write-file-hooks that we use to save
  ;; koutlines properly, so reinitialize local variables.
  (kotl-mode)
  (set-buffer-modified-p t)
  ;; This next line must come before the save-buffer so write-file-functions
  ;; can make use of it.
  (kview:set-buffer kotl-kview (current-buffer))
  (save-buffer))