help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with lisp function


From: Pascal Bourguignon
Subject: Re: help with lisp function
Date: 17 Feb 2004 16:21:39 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

"Javier Oviedo" <address@hidden> writes:

> Hi all. I'm trying to write a function that copies lines from one buffer to
> another buffer and keeps the original text properties. It works...sort of.
> The problem is that after 70 lines, the copy stops carrying the text
> properties over....the copy itself is done correctly and I end up with two
> identical buffers. The problem is only with the text-properties being lost
> after line 70. So, for the first 70 lines are displayed with the original
> text-properties, but everything after that is displayed as plain text. Doing
> a describe-text-properties verifies this.
> 
> Any help/thoughts/comments? Thanks in advance!
> 
> Here is the function:
> 
> (defun jo-test ()
>   (interactive)
>   (setq buf-name "*JOTest*")
>   (setq curbuf (buffer-name))
>   (setq test-buf (get-buffer-create buf-name))
>   (display-buffer test-buf)
>   (save-excursion
>     (goto-char (point-min))
>     (with-current-buffer test-buf
>       (setq buffer-read-only nil)
>       (with-current-buffer curbuf
>         (while (not (eobp))
>           (setq curMatch "")
>           (setq curMatch (buffer-substring (line-beginning-position)
> (line-end-position)))
>           (forward-line 1)
>           (with-current-buffer test-buf
>             (insert (concat curMatch "\n"))  ))))))

Notice how it looks nicer _______________________^

I  assume   the  text  properties   you're  asking  for   include  the
fontification   of   the  source   buffer?    Fontification  is   done
lazily. Only  shown lines and a  few more are fontified.   The rest is
done only if and when it's shown.

-- 
__Pascal_Bourguignon__                     http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]