unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Pascal Bourguignon <spam@thalassa.informatimago.com>
Subject: Re: help with lisp function
Date: 17 Feb 2004 16:21:39 +0100	[thread overview]
Message-ID: <87d68dd94s.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: c0tags$68g$1@home.itg.ti.com

"Javier Oviedo" <email_joviedo@yahoo.com> 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	other threads:[~2004-02-17 15:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-17 15:03 help with lisp function Javier Oviedo
2004-02-17 15:21 ` Pascal Bourguignon [this message]
2004-02-17 16:03   ` Peter Lee
2004-02-17 16:18   ` Javier Oviedo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d68dd94s.fsf@thalassa.informatimago.com \
    --to=spam@thalassa.informatimago.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).