From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: PATCH: ewoc.el to permit node representation abutment Date: Mon, 08 May 2006 11:04:15 -0400 Message-ID: References: <8764kkty67.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1147100706 19400 80.91.229.2 (8 May 2006 15:05:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 May 2006 15:05:06 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 08 17:04:55 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fd7Hs-0001CN-Cx for ged-emacs-devel@m.gmane.org; Mon, 08 May 2006 17:04:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fd7Hr-0000V4-U3 for ged-emacs-devel@m.gmane.org; Mon, 08 May 2006 11:04:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fd7Hf-0000Up-OR for emacs-devel@gnu.org; Mon, 08 May 2006 11:04:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fd7Hd-0000Ub-85 for emacs-devel@gnu.org; Mon, 08 May 2006 11:04:26 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fd7Hd-0000UY-2m for emacs-devel@gnu.org; Mon, 08 May 2006 11:04:25 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fd7IT-0001j8-0s; Mon, 08 May 2006 11:05:17 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id B39A62CF46F; Mon, 8 May 2006 11:04:22 -0400 (EDT) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 8E06A445C; Mon, 8 May 2006 11:04:15 -0400 (EDT) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 65FB7716B9; Mon, 8 May 2006 11:04:15 -0400 (EDT) Original-To: Thien-Thi Nguyen In-Reply-To: (Thien-Thi Nguyen's message of "08 May 2006 04:48:05 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:54097 Archived-At: > i've revised the patch (please see below) to handle empty representations. > this was tested by modifying `cvs-fileinfo-pp' to output empty string for a > certain hardcoded filename in my local repo, making the empty string > conditional on a variable and toggling the variable followed by either > `ewoc-refresh' or `ewoc-invalidate' calls. (this description omits several > steps for preparing the testing framework, but you get the idea.) > * emacs-lisp/ewoc.el (ewoc--create-node): Don't insert > trailing newline. Also, create marker with insertion type t. > (ewoc--refresh-node): Delete all text from current node's > start marker to the next one's. Also, make the marker > "stay put" before calling the pretty-printer, and return it. > (ewoc--init-stay-put-list, ewoc--reset-marker-types): New funcs. > (ewoc-create): Use marker insertion type t. > (ewoc-map): Collect "stay put" markers; reset them when done. > (ewoc-invalidate): Rewrite. > (ewoc-refresh): Don't insert newline. > Collect "stay put" markers; reset them when done. > (ewoc-set-hf): Reset header and footer markers when done. > * pcvs-info.el (cvs-fileinfo-pp): Insert trailing newline. > note that ewoc.el is 1.19 from cvs. Hmm... now it looks too complex to be installed before Emacs-22. Can't it be done more simply. Basically just do something like: [ quality-control: this is guaranteed 100% untested ] (defun ewoc--refresh-node (pp node) "Redisplay the element represented by NODE using the pretty-printer PP. Set NODE's start marker's insertion type to nil and return it." (save-excursion (let* ((inhibit-read-only t) (m (ewoc--node-start-marker node)) (n (ewoc--node-right node))) ;; First, remove the string from the buffer: (delete-region m (ewoc--node-start-marker n)) ;; Calculate and insert the string. (goto-char m) ;; Temporarily change insertion type of the end marker so it is indeed ;; moved to the end. (set-marker-insertion-type (ewoc--node-start-marker n) t) (funcall pp (ewoc--node-data node)) (set-marker-insertion-type (ewoc--node-start-marker n) nil) ;; Since our markers have insertion type nil (i.e. not "insert-before"), ;; all markers that were at position `m' are still at position `m', ;; including the ones for subsequent empty nodes, which we thus have ;; to reseat. (setq m (ewoc--node-start-marker n)) (while (and (setq n (ewoc--node-right n)) (< (ewoc--node-start-marker n) m)) (set-marker (ewoc--node-start-marker n) m)))))) -- Stefan