From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Re: line/wrap-prefix patch Date: Wed, 02 Jul 2008 00:19:17 +0200 Message-ID: <87abh1i6xm.fsf@escher.local.home> References: <61zlp3k2xx.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1214950807 31832 80.91.229.12 (1 Jul 2008 22:20:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Jul 2008 22:20:07 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 02 00:20:53 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KDoDS-00008n-O8 for ged-emacs-devel@m.gmane.org; Wed, 02 Jul 2008 00:20:51 +0200 Original-Received: from localhost ([127.0.0.1]:56886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KDoCc-0003IN-6A for ged-emacs-devel@m.gmane.org; Tue, 01 Jul 2008 18:19:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KDoCF-00039j-58 for emacs-devel@gnu.org; Tue, 01 Jul 2008 18:19:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KDoCD-000397-QI for emacs-devel@gnu.org; Tue, 01 Jul 2008 18:19:34 -0400 Original-Received: from [199.232.76.173] (port=33088 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KDoCD-00038y-Im for emacs-devel@gnu.org; Tue, 01 Jul 2008 18:19:33 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:52841 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KDoCD-0004kv-2M for emacs-devel@gnu.org; Tue, 01 Jul 2008 18:19:33 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KDoC5-00013g-R6 for emacs-devel@gnu.org; Tue, 01 Jul 2008 22:19:26 +0000 Original-Received: from i5387e83e.versanet.de ([83.135.232.62]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Jul 2008 22:19:25 +0000 Original-Received: from stephen.berman by i5387e83e.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Jul 2008 22:19:25 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 133 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: i5387e83e.versanet.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:100281 Archived-At: On Sun, 29 Jun 2008 23:38:02 -0400 Miles Bader wrote: > Here's a patch that implements the "wrap-prefix" feature discussed > earlier. It allows a prefix to be added to the beginning of each line > wrapped by redisplay. [...] > Any comments? I really like it. I haven't tested it extensively yet, but it appears to work for the most part as well as -- and in all likelihood in some cases better than -- the modified version of longlines.el I wrote to get this feature (posted at ). One nice advantage of your implementation is that it does not, in conjunction with auto-composition-mode, break isearch (see ). However, your implementation does suffer from the same display problem at (window-start) that mine does (see ). Here is a recipe in terms of your implementation to show the problem: 1. emacs -Q 2. In an empty buffer type "test " enough time to make the line of text longer than fill-column. 3. Type (setq word-wrap t wrap-prefix '(space :width 5)) and put the cursor on the first `t' after the indentation. Now the buffer displays the following, where `|' marks the left fringe, and `^' the cursor: |test test test test test test test test test test test test test test | test test ^ 4. Type M-: (scroll-up 1); now the buffer displays the following, where again `|' marks the left fringe, and `^' the cursor: |test test ^ That is, the displayed indentation is lost at window-start. When I reported this as a bug involving a display property with a newline (which is what I use in my modification of longlines.el), RMS responded thus: > It seems to me that it is impossible to avoid this behavior, > because the window-start value says to start the redisplay > with the t that starts `test'. > So it's more of a misfeature than a bug. It still seems like a bug to me and I hope that you or someone else can fix it. In fact, the problem is slightly worse (or at least different) in your implementation than in mine. Make the "test" line longer, so that after wrapping it displays two indented lines, thus: |test test test test test test test test test test test test test test test | test test test test test test test test test test test test test test | test test and append enough copies of that line to be able to scroll through several screens, then scroll until you see this at the top of the window: |test test test test test test test test test test test test test test test | test test test test test test test test test test test test test test The first line is in fact indented but this is not displayed due to the "misfeature". Now move the cursor up one line at a time until it gets to the top and point is recentered. Now you'll see this: ... |test test test test test test test test test test test test test test test | test test test test test test test test test test test test test test | test test |test test test test test test test test test test test test test test test |test test test test test test test test test test test test test test test | test test |test test test test test test test test test test test test test test test | test test test test test test test test test test test test test test | test test ... That is, the display bug is still visible, but now in the middle of the window instead of at window-start. Scrolling (but not line movement) restores the proper display. (In my implementation the display problem seem confined to window-start, though it also has additional problems that yours does not.) I have two more comments. One involves the continuation glyphs in the fringes. Probably it will usually be desirable to suppress them, but I know of one case where it would be nice to suppress them only partially: namely, if you have a long line that contains a string that cannot be wrapped because it is longer than (window-width), such as a URL. In this case it would be nice to suppress the continuation glyphs on wrappable long lines but display them on such unwrappable ones. My final comment concerns adaptive filling. In my modification of longlines.el long lines are appropriately wrapped at different levels of indentation, resulting in displays like this: * test test test test test test test test test test test test test test test test test test test test test test test test * test test test test test test test test test test test test test test test test test test test test test test test test test test * test test test test test test test test test test test test test test test test test test test test test test test test test test * test test test test test test test test test test test test test test test test test test test test test test test test test test * test test test test test test test test test test test test test test test test test test test test test test test I get this by setting my equivalent of wrap-prefix to (fill-context-prefix (line-beginning-position) (line-end-position)) each time a new line is wrapped. With your patch, doing (setq wrap-prefix (fill-context-prefix (line-beginning-position) (line-end-position))) results in a display like this: * test test test test test test test test test test test test test test test test test test test test test test test test * test test test test test test test test test test test test test test test test test test test test test test test test test test * test test test test test test test test test test test test test test test test test test test test test test test test test test * test test test test test test test test test test test test test test test test test test test test test test test test test test * test test test test test test test test test test test test test test test test test test test test test test test It would be nice to get the appropriate indentation. Steve Berman