From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: help with lisp function Date: 17 Feb 2004 16:21:39 +0100 Organization: [posted via Easynet Spain] Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87d68dd94s.fsf@thalassa.informatimago.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077032084 3485 80.91.224.253 (17 Feb 2004 15:34:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 17 Feb 2004 15:34:44 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 17 16:34:35 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1At7F4-0003XY-00 for ; Tue, 17 Feb 2004 16:34:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1At7Dr-0004Ga-QK for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Feb 2004 10:33:19 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!colt.net!easynet-quince!easynet.net!easynet-post2!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Lines: 46 Original-NNTP-Posting-Host: 62.93.174.79 Original-X-Trace: DXC=PMXG5XmoV]MEDIA\dbhAbFiZdW>mQFP3FbBd4DjF1d]A Original-Xref: shelby.stanford.edu gnu.emacs.help:120992 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:16941 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16941 "Javier Oviedo" 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/