From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Render a buffer or string to a simpler string? Date: Sun, 26 May 2013 05:50:45 +0300 Message-ID: <83a9niqwsa.fsf@gnu.org> References: <87bo7yq2az.fsf@yandex.ru> <83d2serd46.fsf@gnu.org> <87vc66d96b.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1369536670 2267 80.91.229.3 (26 May 2013 02:51:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 May 2013 02:51:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 26 04:51:10 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UgR37-0004OW-WB for geh-help-gnu-emacs@m.gmane.org; Sun, 26 May 2013 04:51:10 +0200 Original-Received: from localhost ([::1]:60047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgR37-0001Fo-6q for geh-help-gnu-emacs@m.gmane.org; Sat, 25 May 2013 22:51:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgR2p-0001Eq-Jw for help-gnu-emacs@gnu.org; Sat, 25 May 2013 22:50:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UgR2g-0007Wj-F6 for help-gnu-emacs@gnu.org; Sat, 25 May 2013 22:50:51 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:53128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgR2g-0007Wd-77 for help-gnu-emacs@gnu.org; Sat, 25 May 2013 22:50:42 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MND00J00X47YR00@a-mtaout23.012.net.il> for help-gnu-emacs@gnu.org; Sun, 26 May 2013 05:50:40 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MND00JVCX8GP660@a-mtaout23.012.net.il> for help-gnu-emacs@gnu.org; Sun, 26 May 2013 05:50:40 +0300 (IDT) In-reply-to: <87vc66d96b.fsf@yandex.ru> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.175 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91061 Archived-At: > From: Dmitry Gutov > Cc: help-gnu-emacs@gnu.org > Date: Sun, 26 May 2013 01:46:52 +0400 > > Eli Zaretskii writes: > > >> From: Dmitry Gutov > >> Date: Sat, 25 May 2013 23:36:52 +0400 > >> > >> Is there an easy way to convert a string with `line-prefix' and, > >> optionally, `prefix' and `display' properties to a string without those > >> properties corresponding to how the former string is going to be > >> displayed? > > > > Why do you need that? What do you need to accomplish that needs such > > a strange feature? > > Write an automated test (with ERT) that would be easy to read and modify > later. We lack such a feature currently. Display rendering is a C-level operation, whose result is not a string, but an array of structures called "glyphs" which are passed to the terminal back end for drawing on the screen. So you need primitives (which don't exist) to produce Lisp strings out of those glyphs. > To put it differently, the goal is to make the buffer look a certain way, > so I'd like to be able to check that it does look that way. That's hard to do automatically, unless you use external software that grabs screen portions. Rendering is just one of the aspects, there's also alignment, decorations, remnants from previous redisplay cycles, etc. > (For my current purpose, it would be fine if that render-to-string > function disregarded eyecandy text-properties, like `face', but in the > general case, being able to compare them, too, would be handy.) Removing properties from strings is a feature we do have.