* bug#1425: Longlines mode not preserving text properties
@ 2008-11-24 23:22 Peter Seibel
2012-11-30 6:58 ` Chong Yidong
0 siblings, 1 reply; 2+ messages in thread
From: Peter Seibel @ 2008-11-24 23:22 UTC (permalink / raw)
To: bug-gnu-emacs
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.
Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list.
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
I have some code that applies text properties via the
write-region-annotate-functions and after-insert-file-functions
mechanism in a major mode that also uses longlines-mode. When my text
properties span a soft newline longlines mode doesn't preserve them
when it converts spaces to newlines and back.
The following patch seems to fix my problem but perhaps someone who
groks longlines mode could come up with a more elegant solution.
--- longlines.el.orig 2008-11-24 14:50:17.000000000 -0800
+++ longlines.el 2008-11-24 14:58:22.000000000 -0800
@@ -240,7 +240,7 @@
If wrapping is performed, point remains on the line. If the line does
not need to be wrapped, move point to the next line and return t."
(if (longlines-set-breakpoint)
- (progn (insert-before-markers ?\n)
+ (progn (insert-before-markers-and-inherit ?\n)
(backward-char 1)
(delete-char -1)
(forward-char 1)
@@ -347,7 +347,13 @@
(goto-char (min beg end))
(while (search-forward "\n" reg-max t)
(unless (get-text-property (match-beginning 0) 'hard)
- (replace-match " ")))
+ (let* ((pos (match-beginning 0))
+ (props (text-properties-at pos nil)))
+ (replace-match " ")
+ (let* ((hard-start (member 'hard props))
+ (after-hard (cddr hard-start))
+ (newprops (nconc (ldiff props hard-start) after-hard)))
+ (set-text-properties pos (1+ pos) newprops) nil))))
(set-buffer-modified-p mod)
end)))
If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
`bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Applications/Emacs.app/Contents/Resources/etc/DEBUG for instructions.
In GNU Emacs 22.0.99.1 (powerpc-apple-darwin8.9.0, Carbon Version 1.6.0)
of 2007-05-06 on beagle
Windowing system distributor `Apple Inc.', version 10.4.11
configured using `configure '--without-x' '--prefix=/usr/local''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
locale-coding-system: iso-8859-1
default-enable-multibyte-characters: t
Major mode: Coders at Work Editing
Minor modes in effect:
longlines-mode: t
encoded-kbd-mode: t
erc-track-mode: t
erc-track-minor-mode: t
erc-services-mode: t
erc-ring-mode: t
erc-pcomplete-mode: t
erc-netsplit-mode: t
erc-button-mode: t
erc-fill-mode: t
erc-autojoin-mode: t
smart-quote-mode: t
erc-irccontrols-mode: t
erc-noncommands-mode: t
shell-dirtrack-mode: t
tooltip-mode: t
mouse-wheel-mode: t
use-hard-newlines: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
n s SPC m e c h a n i s m . C-a M-q <down> <down> C-e
SPC I t SPC a l s o <M-backspace> <M-backspace> <backspace>
<backspace> SPC i n SPC a SPC m a j o r SPC m o d e
SPC t h a t SPC a l s o SPC u s e s SPC l o n g l i
n e s SPC m o d e . SPC T h e SPC M-b M-b <backspace>
- C-e t e x t SPC p r o p e r t i e s SPC M-b M-b M-b
C-k W h e n SPC m y SPC m e <backspace> <backspace>
t e x t SPC p r o p e r t i e s SPC s p a n SPC a SPC
s o f t SPC n e w l i n e SPC M-q C-a C-e SPC l o n
g <M-backspace> t h e SPC <M-backspace> l o n g l i
n e s SPC m o d e SPC M-b M-b C-e M-b C-e d o e s n
' t SPC p r e s e r v e SPC t h e m SPC w h e n SPC
i t SPC c o n v e r t s SPC s p a c e s SPC t o SPC
n e w l i n e s SPC a n d SPC b a c k . M-q C-a C-e
SPC <backspace> C-v C-v M-v M-v C-v M-< <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <up> <up> <down> C-SPC <up> <up> <up> <up> <up>
M-w C-x k <return> M-x r e p o r t <tab> <return>
Recent messages:
Making completion list...
Loading emacsbug...done
Quit
170 (#o252, #xaa)
1097 (#o2111, #x449)
Quit
Making completion list...
Mark set
Auto-saving...done
Mark set [2 times]
--
Peter Seibel
http://www.codersatwork.com/
http://www.gigamonkeys.com/blog/
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#1425: Longlines mode not preserving text properties
2008-11-24 23:22 bug#1425: Longlines mode not preserving text properties Peter Seibel
@ 2012-11-30 6:58 ` Chong Yidong
0 siblings, 0 replies; 2+ messages in thread
From: Chong Yidong @ 2012-11-30 6:58 UTC (permalink / raw)
To: Peter Seibel; +Cc: 1425-done
"Peter Seibel" <peter@gigamonkeys.com> writes:
> I have some code that applies text properties via the
> write-region-annotate-functions and after-insert-file-functions
> mechanism in a major mode that also uses longlines-mode. When my text
> properties span a soft newline longlines mode doesn't preserve them
> when it converts spaces to newlines and back.
>
> The following patch seems to fix my problem but perhaps someone who
> groks longlines mode could come up with a more elegant solution.
Longlines mode has been quasi-obsoleted by Visual Line mode since this
bug was files (and soon to be formally obsoleted), but I've committed a
tweaked version of this patch that doesn't use ldiff. Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-30 6:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 23:22 bug#1425: Longlines mode not preserving text properties Peter Seibel
2012-11-30 6:58 ` Chong Yidong
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.