From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 29d1c72: Introduce new value t for compilation-context-lines to eliminate scrolling Date: Sat, 31 Aug 2019 10:53:16 +0000 Message-ID: <20190831105316.GA4822@ACM> References: <20190825102322.19558.22771@vcs0.savannah.gnu.org> <20190825102323.5080620CD5@vcs0.savannah.gnu.org> <20190825190637.GE4724@ACM> <838srhghoc.fsf@gnu.org> <20190826162651.GA4137@ACM> <83ef17gaar.fsf@gnu.org> <20190827200520.GC20676@ACM> <8336hjbzn5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="254269"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 31 12:53:32 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i410e-00142E-GM for ged-emacs-devel@m.gmane.org; Sat, 31 Aug 2019 12:53:32 +0200 Original-Received: from localhost ([::1]:43954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i410c-0002H7-Oe for ged-emacs-devel@m.gmane.org; Sat, 31 Aug 2019 06:53:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38239) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i410U-0002H1-3y for emacs-devel@gnu.org; Sat, 31 Aug 2019 06:53:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i410S-0008MM-KU for emacs-devel@gnu.org; Sat, 31 Aug 2019 06:53:21 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:23639 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1i410S-0008Kv-DL for emacs-devel@gnu.org; Sat, 31 Aug 2019 06:53:20 -0400 Original-Received: (qmail 39731 invoked by uid 3782); 31 Aug 2019 10:00:26 -0000 Original-Received: from acm.muc.de (p2E5D5E4B.dip0.t-ipconnect.de [46.93.94.75]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 31 Aug 2019 12:00:25 +0200 Original-Received: (qmail 5451 invoked by uid 1000); 31 Aug 2019 10:53:16 -0000 Content-Disposition: inline In-Reply-To: <8336hjbzn5.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239722 Archived-At: Hello, Eli. On Thu, Aug 29, 2019 at 21:22:06 +0300, Eli Zaretskii wrote: > > Date: Tue, 27 Aug 2019 20:05:20 +0000 > > Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org > > From: Alan Mackenzie > > > > Should I have been aware of this? > > > What is "this" in this context? The display margins or how to use > > > them with overlays? > > I think, more the first of these. > > > > Somehow, in the elisp manual, it seems buried under several levels > > > > of chapters, sections, and sub-sections. > The subsection describing the display margins is part of the section > which documents the 'display' properties in general, so I think it's > in a correct and logical place. > Where would you expect it to be mentioned, not to be "buried"? Maybe on the page "Emacs Display", rather than the current menu point: * Display Property Enabling special display features. , something like: * Display Property Images, margins, text size, etc. might be more helpful. > > I found implementing these margins (see patch in separate post) to be > > particularly difficult. There is no complete example of how to do this > > on the "Display Margins" elisp manual page. > Feel free to provide an example. The simplest way, one that doesn't > use an overlay string, is just setting a display property on buffer > text, something that hardly needs an example. This would involve that text not getting displayed. I'm not sure doing that would ever be useful - if such a display text property were put on the first character of a line, and that line were empty, it would (presumably) make that line disappear from the display. I will get an example together, but at the moment Real Life is somewhat stressful. Maybe I could base it on the margin I'm putting into fringeless windows in compilation-mode. > > There, the word "property" is used, rather than "text property or > > overlay property", leaving me uncertain of whether I could have > > implemented this "=>" in the margin solely with overlays. > This is a subsection of a section about 'display' property, which is > only available for text in buffers and Lisp strings, not for overlays. > One should read the manual in the context of the parent sections. I was floundering around in confusion for several hours, trying to get some concrete handle on how to code the margins. If the sentence in "Display Margins" had read: The way to display something in the margins is to specify it in a margin display specification in the `display' TEXT property of some text. ^^^^ , this would have helped me. > > I was uncertain, right up till near when I had the thing ready, > > whether the variables implementing this need to be buffer local or > > not. > Which variables? compilation-margin-string ;; the "=>" which appears in the margin compilation--dummy-string ;; the before-string which has a `display' text ;; property for the margin. compilation-arrow-overlay ;; The overlay causing the "=>" to be displayed ;; at the appropriate line in the window. Of these, only the last needs to be buffer local, since there might be several compilation-mode windows live at the same time. Really it ought to be a "window local variable", but we don't have these. That's probably a good thing. > And why did you think they need to be buffer-local? Text properties > already localize their values enough, so there should be no need for > anything buffer-local. That's in general, not only for the display > properties. Yes. I think I've got that, now. > > Also, the setup seems wierd. Why isn't there a direct `margin' overlay > > property, much the same way there's a `before-string' overlay property? > Because no one wrote the code to do that. That's a good answer. Thanks! > This is a display property, so you can put it on buffer text or on a > Lisp string, in particular on a Lisp string that is before- or > after-string of an overlay. > > Instead, what we have is a required "dummy" `before-string', which is > > supplanted by a `display' text property on it. It just seems a strange > > way of implementing it. This certainly doesn't promote easy > > understanding. IMHO, of course. > Display properties (really, any "replacing" properties) are tricky in > implementation, you should look up the code some day. Then you will > maybe understand why no one ever wanted to add one more such > facility. Yes. I spent quite a bit of time a couple of weeks ago getting my head around the code in xdisp.c for before-strings and after-strings. Maybe adding margins into the mix wouldn't really be a good idea. ;-) > The way of using the display properties to display in the margins was > originally implemented only for buffer text; placing it on overlay > strings had bugs until Emacs 24 or 25, I think. Ah. > In any case, the ELisp manual describes this possibility, precisely > because it is not easy to come up on one's own. So I think we are OK > here, documentation-wise. As above, I think a complete example in the "Display Margins" page would be helpful. I'll get around to formulating this some time (soon?). -- Alan Mackenzie (Nuremberg, Germany).