annotate lisp/hyperbole/kotl/kimport.el @ 114:8619ce7e4c50 r20-1b9

Import from CVS: tag r20-1b9
author cvs
date Mon, 13 Aug 2007 09:21:54 +0200
parents 131b0175ea99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: kimport.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Convert and insert other outline file formats into koutlines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs V19 Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: data, outlines, wp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner & Kellie Clark
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; ORIG-DATE: 15-Nov-93 at 11:57:05
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 70
diff changeset
11 ;; LAST-MOD: 6-Mar-97 at 01:18:33 by Bob Weiner
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 70
diff changeset
12
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; kfile.el requires kotl-mode.el which requires kimport.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (require 'wrolo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; kimport:mode-alist and kimport:suffix-alist are defined in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; "../hyperbole.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (defun kimport:file (import-from output-to &optional children-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 "Import a buffer or file IMPORT-FROM into the koutline in buffer or file OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 Any suffix in IMPORT-FROM's buffer name is used to determine the type of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 importation. All others are imported as text, one paragraph per cell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 See the documentation for the variable, `kimport:suffix-alist' for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 information on specific importation formats."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (interactive "FImport from buffer/file: \nFInsert into koutline buffer/file: \nP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (let ((import-buf-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (cond ((or (bufferp import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (get-buffer import-from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (buffer-name (get-buffer import-from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ((get-file-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (buffer-name (get-file-buffer import-from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ((stringp import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (file-name-nondirectory import-from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (t (error "(kimport:buffer): `%s' is an invalid `import-from' argument"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (set-buffer import-buf-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (if (setq function (cdr (assq major-mode kimport:mode-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (let ((import-suffix (if (string-match "\\..+\\'" import-buf-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (match-string 0 import-buf-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (suffix-alist kimport:suffix-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 suffix-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (while (and import-suffix suffix-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (setq suffix-regexp (car (car suffix-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 function (cdr (car suffix-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 suffix-alist (cdr suffix-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (if (string-match suffix-regexp import-suffix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (setq function nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (if function nil (setq function (cdr (assq t kimport:mode-alist))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (funcall function import-from output-to children-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;; Augment right-side numbered files, blank line between cells
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (defun kimport:aug-post-outline (import-from output-to &optional children-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 "Insert Augment outline statements from IMPORT-FROM into koutline OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 Displays and leaves point in OUTPUT-TO. See documentation for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 `kimport:initialize' for valid values of IMPORT-FROM and OUTPUT-TO and for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 an explanation of where imported cells are placed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 If OUTPUT-TO is a new koutline, the first statement inserted will be the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 first cell. Otherwise, it will be the successor of the current cell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 Each statement to be imported is delimited by an Augment relative id at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 end of the statement. \"1\" = level 1, \"1a\" = level 2 in outline and so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 on."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (interactive "FImport from Augment post-numbered buffer/file: \nFBuffer/file to insert cells into: \nP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (let ((output-level 1) (klabel "1")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 initially-empty-output no-renumber orig-point count total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;; Don't change the order of import-from and output-to inits here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (setq import-from (kimport:copy-and-set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 output-to (kimport:initialize output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 orig-point (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 initially-empty-output (zerop (- (point-max) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 no-renumber (or initially-empty-output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (not (if children-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (kcell-view:child-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (kcell-view:sibling-p)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (if (eq import-from output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (error "(kimport:aug-post-outline): Import and output buffers may not be the same."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (show-all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;; Total number of Augement statements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (setq total (read (count-matches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 " +\\([0-9][0-9a-z]*\\)\n\\(\n\\|\\'\\)")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (if initially-empty-output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ;; Insert first cell as sibling of current cell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (set-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (if children-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;; Insert as children.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (progn (setq klabel (klabel:child (kcell-view:label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 output-level (klabel:level klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;; Move to end of this cell since cell insertion will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;; occur at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (goto-char (kcell-view:end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;; Insert as successors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (setq klabel (klabel:increment (kcell-view:label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 output-level (klabel:level klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ;; Move to start of line of next tree since cell insertion will occur
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;; at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (goto-char (kotl-mode:tree-end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (setq count (kimport:aug-post-statements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 import-from output-to klabel output-level 1 0 total)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (pop-to-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (kfile:narrow-to-kcells)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (if no-renumber nil (klabel-type:update-labels klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (goto-char orig-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (if (kotl-mode:buffer-empty-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (kotl-mode:to-valid-position))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (message "Imported %d of %d Augment statements." count total)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;;;
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 70
diff changeset
137 ;;; Emacs outliner style files, leading `*' cell delimiters
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (defun kimport:star-outline (import-from output-to &optional children-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 "Insert star outline nodes from IMPORT-FROM into koutline OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 Displays and leaves point in OUTPUT-TO. See documentation for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 `kimport:initialize' for valid values of IMPORT-FROM and OUTPUT-TO and for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 an explanation of where imported cells are placed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 \"* \" = level 1, \"** \" = level 2 in outline and so on."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (interactive "FImport from star delimited cells buffer/file: \nFBuffer/file to insert cells into: \nP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (let ((output-level 1) (klabel "1")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 initially-empty-output no-renumber orig-point count total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;; Don't change the order of import-from and output-to inits here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (setq import-from (kimport:copy-and-set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 output-to (kimport:initialize output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 orig-point (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 initially-empty-output (zerop (- (point-max) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 no-renumber (or initially-empty-output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (not (if children-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (kcell-view:child-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (kcell-view:sibling-p)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (if (eq import-from output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (error "(kimport:star-outline): Import and output buffers may not be the same."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (show-all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ;; If initial text in buffer is not an star outline node, add a star to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;; make it one, so it is not deleted from the import.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (if (not (looking-at "[ \t]*\\*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (insert "* "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;; Total number of top-level cells.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (setq total (read (count-matches "^[ \t]*\\*[ \t\n]")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (if initially-empty-output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;; Insert first cell as sibling of current cell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (set-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (if children-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;; Insert as children.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (progn (setq klabel (klabel:child (kcell-view:label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 output-level (klabel:level klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;; Move to end of this cell since cell insertion will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;; occur at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (goto-char (kcell-view:end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;; Insert as successors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (setq klabel (klabel:increment (kcell-view:label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 output-level (klabel:level klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;; Move to start of line of next tree since cell insertion will occur
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;; at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (goto-char (kotl-mode:tree-end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (setq count (kimport:star-entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 import-from output-to klabel output-level 1 0 total)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (pop-to-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (kfile:narrow-to-kcells)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (if no-renumber nil (klabel-type:update-labels klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (goto-char orig-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (if (kotl-mode:buffer-empty-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (kotl-mode:to-valid-position))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (message "Imported %d of %d star outline trees." count total)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ;;; Generic text file import or koutline insertion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (defun kimport:text (import-from output-to &optional children-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 "Insert text paragraphs from IMPORT-FROM into koutline OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 Displays and leaves point in OUTPUT-TO. See documentation for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 `kimport:initialize' for valid values of IMPORT-FROM and OUTPUT-TO and for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 an explanation of where imported cells are placed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 Text paragraphs are imported as a sequence of same level cells. Koutlines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 are imported with their structure intact.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 70
diff changeset
217 The variable, `paragraph-start,' is used to determine paragraphs."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (interactive "FImport from text/koutline buffer/file: \nFInsert cells into koutline buffer/file: \nP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (let ((klabel "1") (output-level 1) (count 0) initially-empty-output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 no-renumber orig-point total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;; Don't change the order of import-from and output-to inits here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (setq import-from (kimport:copy-and-set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 output-to (kimport:initialize output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 orig-point (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 initially-empty-output (zerop (- (point-max) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 no-renumber (or initially-empty-output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (not (if children-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (kcell-view:child-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (kcell-view:sibling-p)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (if (eq import-from output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (error "(kimport:text): Import and output buffers may not be the same."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (let ((kotl-import (eq major-mode 'kotl-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 visible-cells)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (if initially-empty-output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;; Insert first cell as sibling of current cell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (set-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (if children-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ;; Insert as children.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (progn (setq klabel (klabel:child (kcell-view:label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 output-level (klabel:level klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;; Move to end of this cell since cell insertion will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;; occur at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (goto-char (kcell-view:end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;; Insert as successors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (setq klabel (klabel:increment (kcell-view:label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 output-level (klabel:level klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;; Move to start of line of next tree since cell insertion will occur
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ;; at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (goto-char (kotl-mode:tree-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (set-buffer import-from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (if kotl-import
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;; Importing from a koutline, so handle specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (progn (kotl-mode:beginning-of-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ;; Total number of cells.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (setq total (read (count-matches "[\n\r][\n\r]"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 visible-cells (read (count-matches "\n\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 count (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;; Incredible non-local exit to ensure that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;; recursion ends at the right time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (catch 'end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (kimport:kcells import-from output-to klabel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 output-level 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 count total)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (show-all)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ;; Total number of paragraphs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (setq total (read (count-matches paragraph-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 count (kimport:text-paragraphs import-from output-to klabel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 output-level count total))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (pop-to-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (kfile:narrow-to-kcells)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (if no-renumber nil (klabel-type:update-labels klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (goto-char orig-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (if (kotl-mode:buffer-empty-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (kotl-mode:to-valid-position))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (if kotl-import
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (message "Imported %d of %d visible cells from a %d cell outline."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 count visible-cells total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (message "Imported %d of %d paragraphs." count total)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 ;;; Private functions - Don't call these functions from outside of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ;;; module or you may misuse them and cause data corruption.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (defun kimport:aug-label-lessp (label1 label2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 "Return non-nil iff Augment-style LABEL1 is less than LABEL2."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (let ((lev1 (klabel:level-alpha label1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (lev2 (klabel:level-alpha label2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (cond ((< lev1 lev2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ((= lev1 lev2) (string-lessp label1 label2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (t nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (defun kimport:aug-post-statements (import-from output-to klabel output-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 import-level count total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 "Insert post-numbered Augment statements (contents only) from IMPORT-FROM into existing OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 KLABEL is the label to use for the first imported statement.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 OUTPUT-LEVEL is the level at which to insert the first statement.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 IMPORT-LEVEL is the depth of the current statement in the import file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 \(initially 1).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 COUNT of inserted cells starts at 0. TOTAL is the total number of statements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 in IMPORT-FROM, used to show a running tally of the imported statements."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (let ((cell-end-regexp " +\\([0-9][0-9a-z]*\\)\n\\(\n+\\|\\'\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 contents start subtree-p end end-contents statement-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 child-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ;; While find cells at import-level or deeper ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (while (and (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (re-search-forward cell-end-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (<= import-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (setq statement-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (klabel:level-alpha
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (match-beginning 1) (match-end 1))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (setq end-contents (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 end (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (setq contents (kimport:unindent-region (point) end-contents))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (goto-char end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (setq subtree-p (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (if (re-search-forward cell-end-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (< statement-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (klabel:level-alpha
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (match-beginning 1) (match-end 1)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (set-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 ;; Add the cell starting at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (kview:add-cell klabel output-level contents nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (if subtree-p (setq child-label (klabel:child klabel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (message "%d of %d statements converted..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (setq count (1+ count)) total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (setq klabel (klabel:increment klabel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 ;; Current buffer returns to `import-from' here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;; Handle each sub-level through recursion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (if subtree-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ;; Subtree exists so insert its cells.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (setq count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (kimport:aug-post-statements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 import-from output-to child-label (1+ output-level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (1+ import-level) count total))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (goto-char start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (defun kimport:copy-and-set-buffer (source)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 "Copy and untabify SOURCE, set copy buffer as current buffer for this command and return the copy buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 SOURCE may be a buffer name, a buffer or a file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 If SOURCE buffer name begins with a space, it is not copied under the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 assumption that it already has been. If SOURCE is a koutline, it is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 copied since there is no need to copy it to import it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 ;; This buffer name format is used so that we can easily
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 ;; extract any file name suffix from the buffer name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (setq source (set-buffer (or (get-buffer source)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (find-file-noselect source))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (let ((mode (or (if (boundp 'kotl-previous-mode) kotl-previous-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 major-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 copy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (if (or (eq mode 'kotl-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (= ?\ (aref (buffer-name source) 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 source
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (setq copy (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (concat " " (if (string-match ".+[|<]" (buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (substring (buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 0 (1- (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (buffer-name)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (set-buffer copy)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (setq buffer-read-only nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 major-mode mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (insert-buffer source)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (untabify (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ;; Ensure buffer ends with a newline so that we don't miss the last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 ;; element during the import.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (if (/= (preceding-char) ?\n) (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 copy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (defun kimport:initialize (output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 "Setup to import elements into koutline OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 Return OUTPUT-TO buffer and set current buffer for the current command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 to OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 OUTPUT-TO may be a buffer, buffer-name or file name. If OUTPUT-TO exists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 already, it must be a koutline or an error will be signaled. For an existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 OUTPUT-TO, the text cells are inserted after the cell at point or after the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 first cell for a newly loaded koutline. If OUTPUT-TO is nil, the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 buffer is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 If OUTPUT-TO is an existing koutline, the first cell imported will be added
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 as the successor of the current cell. If an existing file is read in as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 OUTPUT-TO within this function, point is left at the end of this buffer so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 that imported cells will be appended to the buffer. For a new file, this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 means the first cell imported will become the first outline cell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 If a non-nil third argument, CHILDREN-P, is given to the caller of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 function and OUTPUT-TO contains at least one cell, then the imported cells
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 will be added as children of the cell where this function leaves point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 \(either the current cell or for a newly read in outline, the last cell)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (let* ((output-existing-buffer-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (if output-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (or (get-buffer output-to) (get-file-buffer output-to))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (output-exists-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (if output-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (or output-existing-buffer-p (file-exists-p output-to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 ;; current buffer will be used for output and it exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (setq output-to (if output-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (or (get-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (find-file-noselect output-to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (set-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (if output-exists-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (if (eq major-mode 'kotl-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (if (kotl-mode:buffer-empty-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 ;; Make imported cells be appended if the output buffer was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 ;; just read in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (if output-existing-buffer-p nil (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (kotl-mode:to-valid-position))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 "(kimport:initialize): Second arg, %s, must be a koutline file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (buffer-name output-to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (if (eq major-mode 'kotl-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (setq kview nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (kotl-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (delete-region (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (defun kimport:kcells (import-from output-to klabel output-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 import-level count total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 "Insert visible koutline cells (contents and attributes) from IMPORT-FROM into existing OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 KLABEL is the label to use for the first imported cell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 OUTPUT-LEVEL is the level at which to insert the first cell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 IMPORT-LEVEL is the depth of the current cell in the import file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 \(initially 1).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 COUNT of inserted cells starts at 0. TOTAL is the total number of cells
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 in IMPORT-FROM, used to show a running tally of the imported cells."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (goto-char (kcell-view:start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (let ((again t) contents subtree-p child-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 ;; While find cells at import-level or deeper ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (while (<= import-level (kcell-view:level))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (setq subtree-p (kcell-view:child-p nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 contents (kcell-view:contents))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (goto-char (kcell-view:end-contents))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (set-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 ;; Add the cell starting at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (kview:add-cell klabel output-level contents nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (if subtree-p (setq child-label (klabel:child klabel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (message "%d of %d cells inserted..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (setq count (1+ count)) total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (setq klabel (klabel:increment klabel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 ;; Current buffer returns to `import-from' here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 ;; Handle each sub-level through recursion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (if (and (setq again (kcell-view:next t)) subtree-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 ;; Subtree exists so insert its cells.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (setq count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (kimport:kcells
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 import-from output-to child-label (1+ output-level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (1+ import-level) count total)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (if again nil (throw 'end count))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (defun kimport:star-entries (import-from output-to klabel output-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 import-level count total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 "Insert visible star outline entries from IMPORT-FROM into existing OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 KLABEL is the label to use for the first imported entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 OUTPUT-LEVEL is the level at which to insert the first entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 IMPORT-LEVEL is the depth of the current entry in the import file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 \(initially 1).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 COUNT of inserted entries starts at 0. TOTAL is the total number of entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 in IMPORT-FROM, used to show a running tally of the imported entries."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (let ((start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (rolo-entry-regexp "^[ \t]*\\(\\*+\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 subtree-p end contents node-level child-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 ;; While find cells at import-level or deeper ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (while (and (re-search-forward rolo-entry-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (<= import-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (setq node-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (length
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (match-beginning 1) (match-end 1))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (skip-chars-forward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (setq start (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 end (rolo-to-entry-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 subtree-p (if (looking-at rolo-entry-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (< node-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (length (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (match-beginning 1) (match-end 1))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (skip-chars-backward "\n\r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (setq contents (kimport:unindent-region start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (set-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 ;; Add the cell starting at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (kview:add-cell klabel output-level contents nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (if subtree-p (setq child-label (klabel:child klabel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (message "%d of %d trees converted..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (if (= node-level 1) (setq count (1+ count)) count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (setq klabel (klabel:increment klabel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 ;; Current buffer returns to `import-from' here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (goto-char end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ;; Handle each sub-level through recursion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (if subtree-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ;; Subtree exists so insert its cells.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (setq count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (kimport:star-entries import-from output-to child-label
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (1+ output-level) (1+ import-level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 count total))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (goto-char start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (defun kimport:text-paragraphs (import-from output-to klabel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 output-level count total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 "Insert text paragraphs from IMPORT-FROM into existing OUTPUT-TO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 First cell is inserted with KLABEL at OUTPUT-LEVEL, as the sibling of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 previous cell, with the COUNT of inserted paragraphs starting at 0. TOTAL is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 the total number of paragraphs in IMPORT-FROM, used to show a running tally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 of the imported paragraphs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 70
diff changeset
544 The variable, `paragraph-start' is used to determine paragraphs."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (let* ((count 0) start end contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ;; Next line is needed when importing into an existing kview.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 ;; Move past blank lines at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (skip-chars-forward " \t\n\r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (while (and (setq start (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 end (re-search-forward paragraph-start nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (/= start end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (setq contents (kimport:unindent-region start end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (set-buffer output-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 ;; Add the cell starting at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (kview:add-cell klabel output-level contents nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (setq count (1+ count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (message "%d of %d paragraphs converted..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 count total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (setq klabel (klabel:increment klabel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (set-buffer import-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (goto-char end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 ;; Move past blank lines separating paragraphs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (skip-chars-forward " \t\n\r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (beginning-of-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (message "%d of %d paragraphs converted" count total)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (defun kimport:unindent-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 "Calculate indent based upon the second line within the region START to END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 Remove the indent and return the remaining region as a string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (let (indent-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 ;; Remove leading indent from lines in paragraph. Base paragraph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 ;; indent on the 2nd paragraph line since the first line might be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;; further indented or outdented.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (setq indent-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (if (re-search-forward "[\n\r][ \t]+" end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (concat "^" (make-string (current-column) ?\ ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (if indent-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (hypb:replace-match-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 indent-regexp (buffer-substring start end) "" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (buffer-substring start end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (provide 'kimport)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589