comparison lisp/tl/richtext.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 0293115a14e9
children 54cc21c15cbb
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 ;;;
1 ;;; richtext.el -- read and save files in text/richtext format 2 ;;; richtext.el -- read and save files in text/richtext format
2 3 ;;;
3 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. 4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
4 5 ;;; Copyright (C) 1995 MORIOKA Tomohiko
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp> 6 ;;;
6 ;; Created: 1995/7/15 7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Version: $Id: richtext.el,v 1.3 1997/02/02 05:06:17 steve Exp $ 8 ;;; Created: 1995/7/15
8 ;; Keywords: wp, faces, MIME, multimedia 9 ;;; Version:
9 10 ;;; $Id: richtext.el,v 1.1.1.1 1996/12/18 22:43:38 steve Exp $
10 ;; This file is not part of GNU Emacs yet. 11 ;;; Keywords: wp, faces, MIME, multimedia
11 12 ;;;
12 ;; This program is free software; you can redistribute it and/or 13 ;;; This file is part of GNU Emacs.
13 ;; modify it under the terms of the GNU General Public License as 14 ;;;
14 ;; published by the Free Software Foundation; either version 2, or (at 15 ;;; GNU Emacs is free software; you can redistribute it and/or modify
15 ;; your option) any later version. 16 ;;; it under the terms of the GNU General Public License as published by
16 17 ;;; the Free Software Foundation; either version 2, or (at your option)
17 ;; This program is distributed in the hope that it will be useful, but 18 ;;; any later version.
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of 19 ;;;
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 ;;; GNU Emacs is distributed in the hope that it will be useful,
20 ;; General Public License for more details. 21 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; You should have received a copy of the GNU General Public License 23 ;;; GNU General Public License for more details.
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the 24 ;;;
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 25 ;;; You should have received a copy of the GNU General Public License
25 ;; Boston, MA 02111-1307, USA. 26 ;;; along with GNU Emacs; see the file COPYING. If not, write to
26 27 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 ;;; Code:
28 28
29 (require 'enriched) 29 (require 'enriched)
30 30
31 31
32 ;;; @ variables 32 ;;; @ variables
141 (save-excursion 141 (save-excursion
142 (save-restriction 142 (save-restriction
143 (narrow-to-region from to) 143 (narrow-to-region from to)
144 (goto-char from) 144 (goto-char from)
145 (let ((file-width (enriched-get-file-width)) 145 (let ((file-width (enriched-get-file-width))
146 (use-hard-newlines t)) 146 (use-hard-newlines t) pc nc)
147 (enriched-remove-header) 147 (enriched-remove-header)
148 148
149 (goto-char from) 149 (goto-char from)
150 (while (re-search-forward "\n\n+" nil t) 150 (while (re-search-forward "\n\n+" nil t)
151 (replace-match "\n") 151 (replace-match "\n")
162 ;; Translate annotations 162 ;; Translate annotations
163 (format-deannotate-region from (point-max) richtext-translations 163 (format-deannotate-region from (point-max) richtext-translations
164 'richtext-next-annotation) 164 'richtext-next-annotation)
165 165
166 ;; Fill paragraphs 166 ;; Fill paragraphs
167 (if (and file-width ; possible reasons not to fill: 167 (if (or (and file-width ; possible reasons not to fill:
168 (= file-width (enriched-text-width))) ; correct wd. 168 (= file-width (enriched-text-width))) ; correct wd.
169 (null enriched-fill-after-visiting) ; never fill
170 (and (eq 'ask enriched-fill-after-visiting) ; asked & declined
171 (not (y-or-n-p "Re-fill for current display width? "))))
169 ;; Minimally, we have to insert indentation and justification. 172 ;; Minimally, we have to insert indentation and justification.
170 (enriched-insert-indentation) 173 (enriched-insert-indentation)
171 (if enriched-verbose (message "Filling paragraphs...")) 174 (if enriched-verbose (message "Filling paragraphs..."))
172 (fill-region (point-min) (point-max)))) 175 (fill-region (point-min) (point-max))))
173 (if enriched-verbose (message nil)) 176 (if enriched-verbose (message nil))
176 179
177 ;;; @ end 180 ;;; @ end
178 ;;; 181 ;;;
179 182
180 (provide 'richtext) 183 (provide 'richtext)
181
182 ;;; richtext.el ends here