summaryrefslogtreecommitdiff
path: root/lisp/longlines.el
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2005-11-25 11:06:30 +0000
committerDavid Kastrup <dak@gnu.org>2005-11-25 11:06:30 +0000
commite5ad37ee8d4044d0feeecd97aca2b254b835c1d1 (patch)
treeb604529c90b4fb24004905244b669cacc1ff276e /lisp/longlines.el
parentd973cf9cdbe9d032383c4da89e582089ab3932e0 (diff)
downloademacs-e5ad37ee8d4044d0feeecd97aca2b254b835c1d1.tar.gz
(longlines-wrap-line): Reorder wrapping to "insert
new character, then delete" in order to preserve markers.
Diffstat (limited to 'lisp/longlines.el')
-rw-r--r--lisp/longlines.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/longlines.el b/lisp/longlines.el
index 93f3daa4ee8..37dadcd43d1 100644
--- a/lisp/longlines.el
+++ b/lisp/longlines.el
@@ -246,17 +246,21 @@ not need to be wrapped, move point to the next line and return t."
nil)
(if (longlines-merge-lines-p)
(progn (end-of-line)
- (delete-char 1)
;; After certain commands (e.g. kill-line), there may be two
;; successive soft newlines in the buffer. In this case, we
;; replace these two newlines by a single space. Unfortunately,
;; this breaks the conservation of (spaces + newlines), so we
;; have to fiddle with longlines-wrap-point.
- (if (or (bolp) (eolp))
- (if (> longlines-wrap-point (point))
- (setq longlines-wrap-point
- (1- longlines-wrap-point)))
- (insert-char ? 1))
+ (if (or (prog1 (bolp) (forward-char 1)) (eolp))
+ (progn
+ (delete-char -1)
+ (if (> longlines-wrap-point (point))
+ (setq longlines-wrap-point
+ (1- longlines-wrap-point))))
+ (insert-before-markers-and-inherit ?\ )
+ (backward-char 1)
+ (delete-char -1)
+ (forward-char 1))
nil)
(forward-line 1)
t)))