Mercurial > hg > xemacs-beta
comparison lisp/hyperbole/kotl/kfile.el @ 36:c53a95d3c46d r19-15b101
Import from CVS: tag r19-15b101
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:53:38 +0200 |
parents | 376386a54a3c |
children | 131b0175ea99 |
comparison
equal
deleted
inserted
replaced
35:279432d5c479 | 36:c53a95d3c46d |
---|---|
6 ;; KEYWORDS: outlines, wp | 6 ;; KEYWORDS: outlines, wp |
7 ;; | 7 ;; |
8 ;; AUTHOR: Bob Weiner & Kellie Clark | 8 ;; AUTHOR: Bob Weiner & Kellie Clark |
9 ;; | 9 ;; |
10 ;; ORIG-DATE: 10/31/93 | 10 ;; ORIG-DATE: 10/31/93 |
11 ;; LAST-MOD: 1-Nov-95 at 00:46:41 by Bob Weiner | 11 ;; LAST-MOD: 6-Mar-97 at 01:17:51 by Bob Weiner |
12 | |
12 ;;; ************************************************************************ | 13 ;;; ************************************************************************ |
13 ;;; Other required Elisp libraries | 14 ;;; Other required Elisp libraries |
14 ;;; ************************************************************************ | 15 ;;; ************************************************************************ |
15 | 16 |
16 (mapcar 'require '(kproperty kotl-mode)) | 17 (mapcar 'require '(kproperty kotl-mode)) |
150 (defun kfile:read (buffer existing-file-p) | 151 (defun kfile:read (buffer existing-file-p) |
151 "Create a new kotl view by reading BUFFER or create an empty view when EXISTING-FILE-P is nil. | 152 "Create a new kotl view by reading BUFFER or create an empty view when EXISTING-FILE-P is nil. |
152 Return the new view." | 153 Return the new view." |
153 (let (ver-string) | 154 (let (ver-string) |
154 (cond ((not (bufferp buffer)) | 155 (cond ((not (bufferp buffer)) |
155 (error "(kfile:read): Argument must be a buffer, '%s'." buffer)) | 156 (error "(kfile:read): Argument must be a buffer, `%s'." buffer)) |
156 ((not existing-file-p) | 157 ((not existing-file-p) |
157 (kfile:create buffer)) | 158 (kfile:create buffer)) |
158 ((progn | 159 ((progn |
159 (set-buffer buffer) | 160 (set-buffer buffer) |
160 (not (setq ver-string (kfile:is-p)))) | 161 (not (setq ver-string (kfile:is-p)))) |
161 (error "(kfile:read): '%s' is not a koutline file." buffer)) | 162 (error "(kfile:read): `%s' is not a koutline file." buffer)) |
162 ((equal ver-string "Kotl-4.0") | 163 ((equal ver-string "Kotl-4.0") |
163 (kfile:read-v4-or-v3 buffer nil)) | 164 (kfile:read-v4-or-v3 buffer nil)) |
164 ((equal ver-string "Kotl-3.0") | 165 ((equal ver-string "Kotl-3.0") |
165 (kfile:read-v4-or-v3 buffer t)) | 166 (kfile:read-v4-or-v3 buffer t)) |
166 ((equal ver-string "Kotl-2.0") | 167 ((equal ver-string "Kotl-2.0") |
167 (kfile:read-v2 buffer)) | 168 (kfile:read-v2 buffer)) |
168 ((equal ver-string "Kotl-1.0") | 169 ((equal ver-string "Kotl-1.0") |
169 (error "(kfile:read): V1 koutlines are no longer supported")) | 170 (error "(kfile:read): V1 koutlines are no longer supported")) |
170 (t (error "(kfile:read): '%s' has unknown kotl version, %s." | 171 (t (error "(kfile:read): `%s' has unknown kotl version, %s." |
171 buffer ver-string))))) | 172 buffer ver-string))))) |
172 | 173 |
173 (defun kfile:read-v2 (buffer) | 174 (defun kfile:read-v2 (buffer) |
174 "Create a kotl view by reading kotl version-2 BUFFER. Return the new view." | 175 "Create a kotl view by reading kotl version-2 BUFFER. Return the new view." |
175 (let ((standard-input buffer) | 176 (let ((standard-input buffer) |
321 ;; Return point to its original position as given by the opoint marker. | 322 ;; Return point to its original position as given by the opoint marker. |
322 (goto-char opoint) | 323 (goto-char opoint) |
323 (set-marker opoint nil) | 324 (set-marker opoint nil) |
324 nil))) | 325 nil))) |
325 | 326 |
326 ;;; Next function is adapted from 'file-write' of GNU Emacs 19, copyright FSF, | 327 ;;; Next function is adapted from `file-write' of GNU Emacs 19, copyright FSF, |
327 ;;; under the GPL. | 328 ;;; under the GPL. |
328 (defun kfile:write (file) | 329 (defun kfile:write (file) |
329 "Write current outline to FILE." | 330 "Write current outline to FILE." |
330 (interactive "FWrite outline file: ") | 331 (interactive "FWrite outline file: ") |
331 (if (or (null file) (string-equal file "")) | 332 (if (or (null file) (string-equal file "")) |
527 ;;; ************************************************************************ | 528 ;;; ************************************************************************ |
528 ;;; Private variables | 529 ;;; Private variables |
529 ;;; ************************************************************************ | 530 ;;; ************************************************************************ |
530 | 531 |
531 (defvar kfile:escape-newlines t | 532 (defvar kfile:escape-newlines t |
532 "Value of print-escape-newlines used by 'kfile:print-to-string' function.") | 533 "Value of print-escape-newlines used by `kfile:print-to-string' function.") |
533 | 534 |
534 (provide 'kfile) | 535 (provide 'kfile) |