annotate lisp/longlines.el @ 68285:2a5c4effbefd

(Translation of Characters): Search cmds use translation-table-for-input. Automatically made local.
author Richard M. Stallman <rms@gnu.org>
date Fri, 20 Jan 2006 01:30:49 +0000
parents e1a1deda5d65
children 3bd95f4f2941
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; longlines.el --- automatically wrap long lines
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
67673
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
3 ;; Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Authors: Kai Grossjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Alex Schroeder <alex@gnu.org>
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Chong Yidong <cyd@stupidchicken.com>
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; Maintainer: Chong Yidong <cyd@stupidchicken.com>
66465
9a896c723ab2 * longlines.el (longlines-mode): Bind after-change-functions to
Chong Yidong <cyd@stupidchicken.com>
parents: 66453
diff changeset
9 ;; Keywords: convenience, wp
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; any later version.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; GNU General Public License for more details.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63557
diff changeset
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63557
diff changeset
26 ;; Boston, MA 02110-1301, USA.
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;; Commentary:
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; Some text editors save text files with long lines, and they
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; automatically break these lines at whitespace, without actually
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; inserting any newline characters. When doing `M-q' in Emacs, you
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; are inserting newline characters. Longlines mode provides a file
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; format which wraps the long lines when reading a file and unwraps
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; the lines when saving the file. It can also wrap and unwrap
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; automatically as editing takes place.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; Special thanks to Rod Smith for many useful bug reports.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;;; Code:
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 (defgroup longlines nil
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 "Automatic wrapping of long lines when loading files."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 :group 'fill)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 (defcustom longlines-auto-wrap t
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 "*Non-nil means long lines are automatically wrapped after each command.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 Otherwise, you can perform filling using `fill-paragraph' or
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 `auto-fill-mode'. In any case, the soft newlines will be removed
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 when the file is saved to disk."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 :group 'longlines
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 :type 'boolean)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 (defcustom longlines-wrap-follows-window-size nil
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 "*Non-nil means wrapping and filling happen at the edge of the window.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 Otherwise, `fill-column' is used, regardless of the window size. This
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 does not work well when the buffer is displayed in multiple windows
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 with differing widths."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 :group 'longlines
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 :type 'boolean)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (defcustom longlines-show-hard-newlines nil
63557
6a1d35d4ea03 (longlines-mode, longlines-show-hard-newlines): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 63198
diff changeset
63 "*Non-nil means each hard newline is marked on the screen.
6a1d35d4ea03 (longlines-mode, longlines-show-hard-newlines): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 63198
diff changeset
64 \(The variable `longlines-show-effect' controls what they look like.)
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 You can also enable the display temporarily, using the command
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 `longlines-show-hard-newlines'"
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 :group 'longlines
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 :type 'boolean)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 (defcustom longlines-show-effect (propertize "|\n" 'face 'escape-glyph)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 "*A string to display when showing hard newlines.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 This is used when `longlines-show-hard-newlines' is on."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 :group 'longlines
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 :type 'string)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;; Internal variables
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (defvar longlines-wrap-beg nil)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (defvar longlines-wrap-end nil)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 (defvar longlines-wrap-point nil)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (defvar longlines-showing nil)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 (make-variable-buffer-local 'longlines-wrap-beg)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 (make-variable-buffer-local 'longlines-wrap-end)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (make-variable-buffer-local 'longlines-wrap-point)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (make-variable-buffer-local 'longlines-showing)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ;; Mode
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;;;###autoload
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (define-minor-mode longlines-mode
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 "Toggle Long Lines mode.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 In Long Lines mode, long lines are wrapped if they extend beyond
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 `fill-column'. The soft newlines used for line wrapping will not
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 show up when the text is yanked or saved to disk.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96
63557
6a1d35d4ea03 (longlines-mode, longlines-show-hard-newlines): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 63198
diff changeset
97 If the variable `longlines-auto-wrap' is non-nil, lines are automatically
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 wrapped whenever the buffer is changed. You can always call
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 `fill-paragraph' to fill individual paragraphs.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100
63557
6a1d35d4ea03 (longlines-mode, longlines-show-hard-newlines): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 63198
diff changeset
101 If the variable `longlines-show-hard-newlines' is non-nil, hard newlines
6a1d35d4ea03 (longlines-mode, longlines-show-hard-newlines): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 63198
diff changeset
102 are indicated with a symbol."
61289
78b96a3ee117 (longlines-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents: 61125
diff changeset
103 :group 'longlines :lighter " ll"
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (if longlines-mode
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 ;; Turn on longlines mode
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (progn
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (use-hard-newlines 1 'never)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (set (make-local-variable 'require-final-newline) nil)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (add-to-list 'buffer-file-format 'longlines)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (add-hook 'change-major-mode-hook 'longlines-mode-off nil t)
67021
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
111 (add-hook 'before-revert-hook 'longlines-before-revert-hook nil t)
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (make-local-variable 'buffer-substring-filters)
66088
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
113 (set (make-local-variable 'isearch-search-fun-function)
67701
Chong Yidong <cyd@stupidchicken.com>
parents: 67673
diff changeset
114 'longlines-search-function)
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (add-to-list 'buffer-substring-filters 'longlines-encode-string)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (when longlines-wrap-follows-window-size
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (set (make-local-variable 'fill-column)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (- (window-width) window-min-width))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (add-hook 'window-configuration-change-hook
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 'longlines-window-change-function nil t))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 (let ((buffer-undo-list t)
65312
915d671fef52 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
122 (inhibit-read-only t)
66465
9a896c723ab2 * longlines.el (longlines-mode): Bind after-change-functions to
Chong Yidong <cyd@stupidchicken.com>
parents: 66453
diff changeset
123 (after-change-functions nil)
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (mod (buffer-modified-p)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 ;; Turning off undo is OK since (spaces + newlines) is
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 ;; conserved, except for a corner case in
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 ;; longlines-wrap-lines that we'll never encounter from here
66453
ce840b1d13ad * longlines.el (longlines-mode): Remove narrowing before
Chong Yidong <cyd@stupidchicken.com>
parents: 66132
diff changeset
128 (save-restriction
ce840b1d13ad * longlines.el (longlines-mode): Remove narrowing before
Chong Yidong <cyd@stupidchicken.com>
parents: 66132
diff changeset
129 (widen)
67673
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
130 (longlines-decode-buffer)
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
131 (longlines-wrap-region (point-min) (point-max)))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (set-buffer-modified-p mod))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (when (and longlines-show-hard-newlines
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 (not longlines-showing))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (longlines-show-hard-newlines))
66995
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
136
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
137 ;; Hacks to make longlines play nice with various modes.
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
138 (cond ((eq major-mode 'mail-mode)
67213
818361523ce8 * longlines.el (longlines-mode): Add mail-setup-hook.
Chong Yidong <cyd@stupidchicken.com>
parents: 67120
diff changeset
139 (add-hook 'mail-setup-hook 'longlines-decode-buffer nil t)
66995
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
140 (or mail-citation-hook
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
141 (add-hook 'mail-citation-hook 'mail-indent-citation nil t))
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
142 (add-hook 'mail-citation-hook 'longlines-decode-region nil t))
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
143 ((eq major-mode 'message-mode)
67031
9dbc51935e01 (longlines-mode): Add a message-setup-hook.
Chong Yidong <cyd@stupidchicken.com>
parents: 67024
diff changeset
144 (add-hook 'message-setup-hook 'longlines-decode-buffer nil t)
66995
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
145 (make-local-variable 'message-indent-citation-function)
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
146 (if (not (listp message-indent-citation-function))
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
147 (setq message-indent-citation-function
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
148 (list message-indent-citation-function)))
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
149 (add-to-list 'message-indent-citation-function
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
150 'longlines-decode-region t)))
66996
cf7bf8dadf78 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 66995
diff changeset
151
cf7bf8dadf78 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 66995
diff changeset
152 (when longlines-auto-wrap
cf7bf8dadf78 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 66995
diff changeset
153 (auto-fill-mode 0)
cf7bf8dadf78 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 66995
diff changeset
154 (add-hook 'after-change-functions
cf7bf8dadf78 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 66995
diff changeset
155 'longlines-after-change-function nil t)
cf7bf8dadf78 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 66995
diff changeset
156 (add-hook 'post-command-hook
cf7bf8dadf78 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 66995
diff changeset
157 'longlines-post-command-function nil t)))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 ;; Turn off longlines mode
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (setq buffer-file-format (delete 'longlines buffer-file-format))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (if longlines-showing
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (longlines-unshow-hard-newlines))
65312
915d671fef52 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
162 (let ((buffer-undo-list t)
66465
9a896c723ab2 * longlines.el (longlines-mode): Bind after-change-functions to
Chong Yidong <cyd@stupidchicken.com>
parents: 66453
diff changeset
163 (after-change-functions nil)
65312
915d671fef52 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
164 (inhibit-read-only t))
66453
ce840b1d13ad * longlines.el (longlines-mode): Remove narrowing before
Chong Yidong <cyd@stupidchicken.com>
parents: 66132
diff changeset
165 (save-restriction
ce840b1d13ad * longlines.el (longlines-mode): Remove narrowing before
Chong Yidong <cyd@stupidchicken.com>
parents: 66132
diff changeset
166 (widen)
ce840b1d13ad * longlines.el (longlines-mode): Remove narrowing before
Chong Yidong <cyd@stupidchicken.com>
parents: 66132
diff changeset
167 (longlines-encode-region (point-min) (point-max))))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (remove-hook 'change-major-mode-hook 'longlines-mode-off t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (remove-hook 'after-change-functions 'longlines-after-change-function t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 (remove-hook 'post-command-hook 'longlines-post-command-function t)
67021
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
171 (remove-hook 'before-revert-hook 'longlines-before-revert-hook t)
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 (remove-hook 'window-configuration-change-hook
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 'longlines-window-change-function t)
65312
915d671fef52 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
174 (when longlines-wrap-follows-window-size
915d671fef52 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
175 (kill-local-variable 'fill-column))
66088
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
176 (kill-local-variable 'isearch-search-fun-function)
65312
915d671fef52 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
177 (kill-local-variable 'require-final-newline)
915d671fef52 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
178 (kill-local-variable 'buffer-substring-filters)
915d671fef52 *** empty log message ***
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
179 (kill-local-variable 'use-hard-newlines)))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 (defun longlines-mode-off ()
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 "Turn off longlines mode.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 This function exists to be called by `change-major-mode-hook' when the
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 major mode changes."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (longlines-mode 0))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 ;; Showing the effect of hard newlines in the buffer
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (defun longlines-show-hard-newlines (&optional arg)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 "Make hard newlines visible by adding a face.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 With optional argument ARG, make the hard newlines invisible again."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 (interactive "P")
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 (let ((buffer-undo-list t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (mod (buffer-modified-p)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 (if arg
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (longlines-unshow-hard-newlines)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (setq longlines-showing t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (longlines-show-region (point-min) (point-max)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (set-buffer-modified-p mod)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 (defun longlines-show-region (beg end)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 "Make hard newlines between BEG and END visible."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 (let* ((pmin (min beg end))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 (pmax (max beg end))
64216
6c19076eecb0 (longlines-show-region, longlines-unshow-hard-newlines):
Richard M. Stallman <rms@gnu.org>
parents: 64091
diff changeset
205 (pos (text-property-not-all pmin pmax 'hard nil)))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 (while pos
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 (put-text-property pos (1+ pos) 'display
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 (copy-sequence longlines-show-effect))
64216
6c19076eecb0 (longlines-show-region, longlines-unshow-hard-newlines):
Richard M. Stallman <rms@gnu.org>
parents: 64091
diff changeset
209 (setq pos (text-property-not-all (1+ pos) pmax 'hard nil)))))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 (defun longlines-unshow-hard-newlines ()
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 "Make hard newlines invisible again."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 (interactive)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 (setq longlines-showing nil)
64216
6c19076eecb0 (longlines-show-region, longlines-unshow-hard-newlines):
Richard M. Stallman <rms@gnu.org>
parents: 64091
diff changeset
215 (let ((pos (text-property-not-all (point-min) (point-max) 'hard nil)))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 (while pos
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 (remove-text-properties pos (1+ pos) '(display))
64216
6c19076eecb0 (longlines-show-region, longlines-unshow-hard-newlines):
Richard M. Stallman <rms@gnu.org>
parents: 64091
diff changeset
218 (setq pos (text-property-not-all (1+ pos) (point-max) 'hard nil)))))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 ;; Wrapping the paragraphs.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 (defun longlines-wrap-region (beg end)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 "Wrap each successive line, starting with the line before BEG.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 Stop when we reach lines after END that don't need wrapping, or the
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 end of the buffer."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 (setq longlines-wrap-point (point))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 (goto-char beg)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 (forward-line -1)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 ;; Two successful longlines-wrap-line's in a row mean successive
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 ;; lines don't need wrapping.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 (while (null (and (longlines-wrap-line)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 (or (eobp)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 (and (>= (point) end)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 (longlines-wrap-line))))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 (goto-char longlines-wrap-point))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 (defun longlines-wrap-line ()
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 "If the current line needs to be wrapped, wrap it and return nil.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 If wrapping is performed, point remains on the line. If the line does
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 not need to be wrapped, move point to the next line and return t."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 (if (longlines-set-breakpoint)
67033
1a383aa3be8a longlines.el (longlines-wrap-line): Preserve marker positions.
Chong Yidong <cyd@stupidchicken.com>
parents: 67031
diff changeset
242 (progn (insert-before-markers ?\n)
1a383aa3be8a longlines.el (longlines-wrap-line): Preserve marker positions.
Chong Yidong <cyd@stupidchicken.com>
parents: 67031
diff changeset
243 (backward-char 1)
1a383aa3be8a longlines.el (longlines-wrap-line): Preserve marker positions.
Chong Yidong <cyd@stupidchicken.com>
parents: 67031
diff changeset
244 (delete-char -1)
1a383aa3be8a longlines.el (longlines-wrap-line): Preserve marker positions.
Chong Yidong <cyd@stupidchicken.com>
parents: 67031
diff changeset
245 (forward-char 1)
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 nil)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 (if (longlines-merge-lines-p)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 (progn (end-of-line)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 ;; After certain commands (e.g. kill-line), there may be two
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 ;; successive soft newlines in the buffer. In this case, we
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 ;; replace these two newlines by a single space. Unfortunately,
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 ;; this breaks the conservation of (spaces + newlines), so we
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 ;; have to fiddle with longlines-wrap-point.
67120
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
254 (if (or (prog1 (bolp) (forward-char 1)) (eolp))
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
255 (progn
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
256 (delete-char -1)
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
257 (if (> longlines-wrap-point (point))
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
258 (setq longlines-wrap-point
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
259 (1- longlines-wrap-point))))
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
260 (insert-before-markers-and-inherit ?\ )
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
261 (backward-char 1)
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
262 (delete-char -1)
d3b833785ae6 (longlines-wrap-line): Reorder wrapping to "insert
David Kastrup <dak@gnu.org>
parents: 67033
diff changeset
263 (forward-char 1))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 nil)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 (forward-line 1)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 t)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 (defun longlines-set-breakpoint ()
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 "Place point where we should break the current line, and return t.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 If the line should not be broken, return nil; point remains on the
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 line."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (move-to-column fill-column)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 (if (and (re-search-forward "[^ ]" (line-end-position) 1)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 (> (current-column) fill-column))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 ;; This line is too long. Can we break it?
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 (or (longlines-find-break-backward)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 (progn (move-to-column fill-column)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 (longlines-find-break-forward)))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 (defun longlines-find-break-backward ()
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 "Move point backward to the first available breakpoint and return t.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 If no breakpoint is found, return nil."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (and (search-backward " " (line-beginning-position) 1)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (save-excursion
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (skip-chars-backward " " (line-beginning-position))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 (null (bolp)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (progn (forward-char 1)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 (if (and fill-nobreak-predicate
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (run-hook-with-args-until-success
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 'fill-nobreak-predicate))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 (progn (skip-chars-backward " " (line-beginning-position))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (longlines-find-break-backward))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 t))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (defun longlines-find-break-forward ()
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 "Move point forward to the first available breakpoint and return t.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 If no break point is found, return nil."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 (and (search-forward " " (line-end-position) 1)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 (progn (skip-chars-forward " " (line-end-position))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 (null (eolp)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 (if (and fill-nobreak-predicate
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (run-hook-with-args-until-success
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 'fill-nobreak-predicate))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (longlines-find-break-forward)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 t)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (defun longlines-merge-lines-p ()
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 "Return t if part of the next line can fit onto the current line.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 Otherwise, return nil. Text cannot be moved across hard newlines."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (save-excursion
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 (end-of-line)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (and (null (eobp))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 (null (get-text-property (point) 'hard))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (let ((space (- fill-column (current-column))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (forward-line 1)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (if (eq (char-after) ? )
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 t ; We can always merge some spaces
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 (<= (if (search-forward " " (line-end-position) 1)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 (current-column)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 (1+ (current-column)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 space))))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322
66995
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
323 (defun longlines-decode-region (&optional beg end)
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
324 "Turn all newlines between BEG and END into hard newlines.
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
325 If BEG and END are nil, the point and mark are used."
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
326 (if (null beg) (setq beg (point)))
e10f2e7919f0 Add hacks for citation in mail-mode and message-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 66465
diff changeset
327 (if (null end) (setq end (mark t)))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 (save-excursion
67673
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
329 (let ((reg-max (max beg end)))
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
330 (goto-char (min beg end))
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
331 (while (search-forward "\n" reg-max t)
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
332 (set-hard-newline-properties
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
333 (match-beginning 0) (match-end 0))))))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334
67031
9dbc51935e01 (longlines-mode): Add a message-setup-hook.
Chong Yidong <cyd@stupidchicken.com>
parents: 67024
diff changeset
335 (defun longlines-decode-buffer ()
9dbc51935e01 (longlines-mode): Add a message-setup-hook.
Chong Yidong <cyd@stupidchicken.com>
parents: 67024
diff changeset
336 "Turn all newlines in the buffer into hard newlines."
9dbc51935e01 (longlines-mode): Add a message-setup-hook.
Chong Yidong <cyd@stupidchicken.com>
parents: 67024
diff changeset
337 (longlines-decode-region (point-min) (point-max)))
9dbc51935e01 (longlines-mode): Add a message-setup-hook.
Chong Yidong <cyd@stupidchicken.com>
parents: 67024
diff changeset
338
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 (defun longlines-encode-region (beg end &optional buffer)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 "Replace each soft newline between BEG and END with exactly one space.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 Hard newlines are left intact. The optional argument BUFFER exists for
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 compatibility with `format-alist', and is ignored."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 (save-excursion
67673
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
344 (let ((reg-max (max beg end))
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
345 (mod (buffer-modified-p)))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 (goto-char (min beg end))
67673
947510e65020 * longlines.el (longlines-mode): Wrap while widened.
Chong Yidong <cyd@stupidchicken.com>
parents: 67213
diff changeset
347 (while (search-forward "\n" reg-max t)
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (unless (get-text-property (match-beginning 0) 'hard)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 (replace-match " ")))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 (set-buffer-modified-p mod)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 end)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 (defun longlines-encode-string (string)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 "Return a copy of STRING with each soft newline replaced by a space.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 Hard newlines are left intact."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 (let* ((str (copy-sequence string))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (pos (string-match "\n" str)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 (while pos
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 (if (null (get-text-property pos 'hard str))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 (aset str pos ? ))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (setq pos (string-match "\n" str (1+ pos))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 str))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 ;; Auto wrap
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 (defun longlines-auto-wrap (&optional arg)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 "Turn on automatic line wrapping, and wrap the entire buffer.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 With optional argument ARG, turn off line wrapping."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 (interactive "P")
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 (remove-hook 'after-change-functions 'longlines-after-change-function t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 (remove-hook 'post-command-hook 'longlines-post-command-function t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 (if arg
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 (progn (setq longlines-auto-wrap nil)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 (message "Auto wrap disabled."))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 (setq longlines-auto-wrap t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 (add-hook 'after-change-functions
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 'longlines-after-change-function nil t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 (add-hook 'post-command-hook
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 'longlines-post-command-function nil t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (let ((mod (buffer-modified-p)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 (longlines-wrap-region (point-min) (point-max))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (set-buffer-modified-p mod))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 (message "Auto wrap enabled.")))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 (defun longlines-after-change-function (beg end len)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 "Update `longlines-wrap-beg' and `longlines-wrap-end'.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 This is called by `after-change-functions' to keep track of the region
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 that has changed."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 (unless undo-in-progress
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 (setq longlines-wrap-beg
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 (if longlines-wrap-beg (min longlines-wrap-beg beg) beg))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 (setq longlines-wrap-end
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (if longlines-wrap-end (max longlines-wrap-end end) end))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 (defun longlines-post-command-function ()
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 "Perform line wrapping on the parts of the buffer that have changed.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 This is called by `post-command-hook' after each command."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 (when longlines-wrap-beg
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 (cond ((or (eq this-command 'yank)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 (eq this-command 'yank-pop))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 (longlines-decode-region (point) (mark t))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 (if longlines-showing
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (longlines-show-region (point) (mark t))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 ((and (eq this-command 'newline) longlines-showing)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 (save-excursion
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (if (search-backward "\n" nil t)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 (longlines-show-region
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 (match-beginning 0) (match-end 0))))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 (unless (or (eq this-command 'fill-paragraph)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (eq this-command 'fill-region))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (longlines-wrap-region longlines-wrap-beg longlines-wrap-end))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 (setq longlines-wrap-beg nil)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 (setq longlines-wrap-end nil)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 (defun longlines-window-change-function ()
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 "Re-wrap the buffer if the window width has changed.
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 This is called by `window-size-change-functions'."
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 (when (/= fill-column (- (window-width) window-min-width))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (setq fill-column (- (window-width) window-min-width))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 (let ((mod (buffer-modified-p)))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 (longlines-wrap-region (point-min) (point-max))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (set-buffer-modified-p mod))))
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423
66088
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
424 ;; Isearch
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
425
67701
Chong Yidong <cyd@stupidchicken.com>
parents: 67673
diff changeset
426 (defun longlines-search-function ()
66088
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
427 (cond
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
428 (isearch-word
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
429 (if isearch-forward 'word-search-forward 'word-search-backward))
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
430 (isearch-regexp
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
431 (if isearch-forward 're-search-forward 're-search-backward))
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
432 (t
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
433 (if isearch-forward
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
434 'longlines-search-forward
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
435 'longlines-search-backward))))
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
436
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
437 (defun longlines-search-forward (string &optional bound noerror count)
66132
3fe20f1edf7b * longlines.el (longlines-search-forward)
Chong Yidong <cyd@stupidchicken.com>
parents: 66088
diff changeset
438 (let ((search-spaces-regexp "[ \n]+"))
66088
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
439 (re-search-forward (regexp-quote string) bound noerror count)))
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
440
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
441 (defun longlines-search-backward (string &optional bound noerror count)
66132
3fe20f1edf7b * longlines.el (longlines-search-forward)
Chong Yidong <cyd@stupidchicken.com>
parents: 66088
diff changeset
442 (let ((search-spaces-regexp "[ \n]+"))
66088
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
443 (re-search-backward (regexp-quote string) bound noerror count)))
b63142efae15 * longlines.el (longlinges-search-function)
Chong Yidong <cyd@stupidchicken.com>
parents: 65312
diff changeset
444
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 ;; Loading and saving
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446
67021
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
447 (defun longlines-before-revert-hook ()
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
448 (add-hook 'after-revert-hook 'longlines-after-revert-hook nil t)
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
449 (longlines-mode 0))
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
450
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
451 (defun longlines-after-revert-hook ()
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
452 (remove-hook 'after-revert-hook 'longlines-after-revert-hook t)
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
453 (longlines-mode 1))
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
454
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 (add-to-list
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 'format-alist
67024
Chong Yidong <cyd@stupidchicken.com>
parents: 67021
diff changeset
457 (list 'longlines "Automatically wrap long lines." nil nil
67021
e220d76071f7 * longlines.el (longlines-before-revert-hook)
Chong Yidong <cyd@stupidchicken.com>
parents: 66996
diff changeset
458 'longlines-encode-region t nil))
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 (provide 'longlines)
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461
61125
93886f61ae3e Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 61110
diff changeset
462 ;; arch-tag: 3489d225-5506-47b9-8659-d8807b77c624
61110
a1569f3fbb77 Initial version.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 ;;; longlines.el ends here