From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Newsgroups: gmane.emacs.bugs Subject: bug#26909: 25.1; A face for margins Date: Mon, 11 May 2020 17:01:23 -0400 Message-ID: References: <83lgq096iz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------728EDCB6E572DF804AC06739" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="102092"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Cc: 26909@debbugs.gnu.org To: Eli Zaretskii , Yuri Khan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 11 23:02:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYFYy-000QS7-I5 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 May 2020 23:02:12 +0200 Original-Received: from localhost ([::1]:58148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYFYx-0007qo-7a for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 May 2020 17:02:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYFYo-0007qN-Vc for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 17:02:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYFYo-0001AS-Ko for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 17:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jYFYo-0003DY-Hz for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 17:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 May 2020 21:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26909 X-GNU-PR-Package: emacs Original-Received: via spool by 26909-submit@debbugs.gnu.org id=B26909.158923089312327 (code B ref 26909); Mon, 11 May 2020 21:02:02 +0000 Original-Received: (at 26909) by debbugs.gnu.org; 11 May 2020 21:01:33 +0000 Original-Received: from localhost ([127.0.0.1]:53464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYFYK-0003Ck-VA for submit@debbugs.gnu.org; Mon, 11 May 2020 17:01:33 -0400 Original-Received: from mail-qt1-f177.google.com ([209.85.160.177]:40229) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYFYJ-0003CV-JR for 26909@debbugs.gnu.org; Mon, 11 May 2020 17:01:32 -0400 Original-Received: by mail-qt1-f177.google.com with SMTP id c24so2860786qtw.7 for <26909@debbugs.gnu.org>; Mon, 11 May 2020 14:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=C/3CBi9DqnfzgYko5/FFUbf/2uovoYGDMbnSfKdgDKE=; b=F9AvwWwaijZuXd6Ze1xYDRezhmGaFMxeOHaWi1iEFeMkI+h6adja6WRGt+Y4vb9Jqv UGrkRZvLYBZ2aenjoDsf+LLRQCA4ibMlK2oK3LAd2zApPRWz8iMN3VD9f/jrpgiPqbqr ykY0K0mdhU9g6qMhDKi+TkxpE1X3qnCO37JC5QsHeDkc1ebrNzr/7fOm2gRf4sLhM/ER PzTQ8RlgbQMZ3Bzj1Rkc4FK7AcVOkaXx9qkjMPaXFVHaYI45y40bdI0e6QVZ9Hur3IB0 6CF5TqMaxuSObu3qsIpGBYiADN83Q7KyMbWLGxa0jPCZwkSsZJOXkPJcFXjDHDNYcbng v54A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=C/3CBi9DqnfzgYko5/FFUbf/2uovoYGDMbnSfKdgDKE=; b=it8Onqc1nzMW2CYbAdNsluv/l0bI2YTNwAgEMzA6L28XseWwfsZy4wQQ7s0AMZx1Sm FBipfjFgDqlm5Dt4x/TAprUF86PttUBCRQXkqgK+H+tt7WmwUFujisRic2OBAZLzW+P0 Ox97Dr9YCq1XHlx90yj6Hh3kX7rC7gwDZ28U3wEEGW/0mDmOrYyU0YOnqFP0cJhegPF8 ZwDJKU+HDzBt4gbtUM5QeYXP2fFAqLhjsfKse+xYHwbRm69dLONrixczgFty4/KtUJGI aPx6aAymX8hGVn01OyKnJQCrXvKm/Y9j0Zfn3lOoJwwjF+IGlrTIJdY8x7ld/bLkSie/ JxAw== X-Gm-Message-State: AGi0PubMmQA8imFjmkobyocBTm8JvkMeSXcB8o8f3/+vHTdKct1la9l4 RH22CIY7coEE4vXGCzj3iZTEvk50OvI= X-Google-Smtp-Source: APiQypIGdauCBH3OGZzLRRrH+KxPorYt3MOIYhsYE87pbjgsdtVOh5+al5EYy4HJIZfl0mkz89UyDA== X-Received: by 2002:ac8:534b:: with SMTP id d11mr10890807qto.287.1589230885732; Mon, 11 May 2020 14:01:25 -0700 (PDT) Original-Received: from ?IPv6:2601:184:4180:66e7:4d17:b25e:8d9:2188? ([2601:184:4180:66e7:4d17:b25e:8d9:2188]) by smtp.googlemail.com with ESMTPSA id q17sm9324552qkq.111.2020.05.11.14.01.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2020 14:01:24 -0700 (PDT) In-Reply-To: <83lgq096iz.fsf@gnu.org> Content-Language: en-GB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180082 Archived-At: This is a multi-part message in MIME format. --------------728EDCB6E572DF804AC06739 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Eli and Yuri, On 13/05/2017 10.27, Eli Zaretskii wrote:>> From: Yuri Khan >> Date: Sat, 13 May 2017 21:07:03 +0700 >> >> The last two actions demonstrate that customizing the faces of >> whatever is displayed in the margin is not sufficient. A mechanism is >> needed that will allow customization of the margin where nothing is >> displayed. A new face would serve nicely. > > A face can only affect places where something is displayed using that > face. Display margins only display text if the buffer specifies text > properties or overlays which display in the margins. But what you > would like to do calls for having a face that would affect screen > space where _nothing_ is displayed, and such screen space in Emacs is > always displayed using the frame's background color, not by using some > face. > > IOW, I don't think introducing a new face would help here. Some > additional mechanism would be necessary. A margin face would be great to have. How reasonable would it be to fill the margins with a stretched space? Would it be too costly? Currently we almost do that in extend_face_to_end_of_line, but short-circuits earlier in that function mean that this part is only applicable when there is e.g. a region. if (WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0 && it->glyph_row->used[LEFT_MARGIN_AREA] == 0) { it->glyph_row->glyphs[LEFT_MARGIN_AREA][0] = space_glyph; it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].face_id = default_face->id; it->glyph_row->used[LEFT_MARGIN_AREA] = 1; } if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 && it->glyph_row->used[RIGHT_MARGIN_AREA] == 0) { it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0] = space_glyph; it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].face_id = default_face->id; it->glyph_row->used[RIGHT_MARGIN_AREA] = 1; } The (silly) attached patch confirms that removing the short-circuits makes it possible to set a face in the margins, but besides the performance aspect it only applies to lines that have contents. Is this a reasonable way to go? If not, what might be better way? Clément. --------------728EDCB6E572DF804AC06739 Content-Type: text/x-patch; charset=UTF-8; name="0001-Add-a-margin-face-remove-short-circuits-in-extend_fa.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Add-a-margin-face-remove-short-circuits-in-extend_fa.pa"; filename*1="tch" >From a8a13cec225b00117557e5c84999a877843099da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pit-Claudel?= Date: Mon, 11 May 2020 16:52:51 -0400 Subject: [PATCH] Add a margin face, remove short-circuits in extend_face_to_end_of_line --- src/dispextern.h | 1 + src/xdisp.c | 10 ++++++---- src/xfaces.c | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 0b1f3d14ae..2650d49e02 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1814,6 +1814,7 @@ #define FACE_UNIBYTE_P(FACE) ((FACE)->charset < 0) MODE_LINE_INACTIVE_FACE_ID, TOOL_BAR_FACE_ID, FRINGE_FACE_ID, + MARGIN_FACE_ID, HEADER_LINE_FACE_ID, SCROLL_BAR_FACE_ID, BORDER_FACE_ID, diff --git a/src/xdisp.c b/src/xdisp.c index 140d134572..5a7bf58828 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -21759,7 +21759,8 @@ extend_face_to_end_of_line (struct it *it) /* If the window has display margins, we will need to extend their face even if the text area is filled. */ && !(WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0 - || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0)) + || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0) + && false) return; const int extend_face_id = (it->face_id == DEFAULT_FACE_ID @@ -21785,7 +21786,8 @@ extend_face_to_end_of_line (struct it *it) && !face->stipple #endif && !it->glyph_row->reversed_p - && !Vdisplay_fill_column_indicator) + && !Vdisplay_fill_column_indicator + && false) return; /* Set the glyph row flag indicating that the face of the last glyph @@ -21834,7 +21836,7 @@ extend_face_to_end_of_line (struct it *it) { it->glyph_row->glyphs[LEFT_MARGIN_AREA][0] = space_glyph; it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].face_id = - default_face->id; + lookup_named_face (it->w, f, Qmargin, false); it->glyph_row->used[LEFT_MARGIN_AREA] = 1; } if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 @@ -21842,7 +21844,7 @@ extend_face_to_end_of_line (struct it *it) { it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0] = space_glyph; it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].face_id = - default_face->id; + lookup_named_face (it->w, f, Qmargin, false); it->glyph_row->used[RIGHT_MARGIN_AREA] = 1; } diff --git a/src/xfaces.c b/src/xfaces.c index bab142ade0..f604c43928 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4768,6 +4768,7 @@ lookup_basic_face (struct window *w, struct frame *f, int face_id) case TAB_BAR_FACE_ID: name = Qtab_bar; break; case TOOL_BAR_FACE_ID: name = Qtool_bar; break; case FRINGE_FACE_ID: name = Qfringe; break; + case MARGIN_FACE_ID: name = Qmargin; break; case SCROLL_BAR_FACE_ID: name = Qscroll_bar; break; case BORDER_FACE_ID: name = Qborder; break; case CURSOR_FACE_ID: name = Qcursor; break; @@ -5463,6 +5464,7 @@ realize_basic_faces (struct frame *f) realize_named_face (f, Qmode_line_inactive, MODE_LINE_INACTIVE_FACE_ID); realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID); realize_named_face (f, Qfringe, FRINGE_FACE_ID); + realize_named_face (f, Qmargin, MARGIN_FACE_ID); realize_named_face (f, Qheader_line, HEADER_LINE_FACE_ID); realize_named_face (f, Qscroll_bar, SCROLL_BAR_FACE_ID); realize_named_face (f, Qborder, BORDER_FACE_ID); @@ -6808,6 +6810,7 @@ syms_of_xfaces (void) DEFSYM (Qtool_bar, "tool-bar"); DEFSYM (Qtab_bar, "tab-bar"); DEFSYM (Qfringe, "fringe"); + DEFSYM (Qmargin, "margin"); DEFSYM (Qtab_line, "tab-line"); DEFSYM (Qheader_line, "header-line"); DEFSYM (Qscroll_bar, "scroll-bar"); -- 2.17.1 --------------728EDCB6E572DF804AC06739--