From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Patch to vertically center line content when using line-spacing variable Date: Sat, 07 Sep 2019 12:50:04 +0300 Message-ID: <83ftl85tbn.fsf@gnu.org> References: Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="149110"; mail-complaints-to="usenet@blaine.gmane.org" Cc: stefan@marxist.se, emacs-devel@gnu.org To: Jesse Medeiros Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 07 11:50:16 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 1i6XMF-000ccQ-BO for ged-emacs-devel@m.gmane.org; Sat, 07 Sep 2019 11:50:15 +0200 Original-Received: from localhost ([::1]:33974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6XMD-0003sa-Fd for ged-emacs-devel@m.gmane.org; Sat, 07 Sep 2019 05:50:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42169) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6XM5-0003sT-N8 for emacs-devel@gnu.org; Sat, 07 Sep 2019 05:50:06 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i6XM5-0007kh-IG; Sat, 07 Sep 2019 05:50:05 -0400 Original-Received: from [176.228.60.248] (port=1338 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1i6XM3-0003Kn-4b; Sat, 07 Sep 2019 05:50:03 -0400 In-reply-to: (message from Jesse Medeiros on Sat, 31 Aug 2019 21:01:44 -0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:239918 Archived-At: > From: Jesse Medeiros > Date: Sat, 31 Aug 2019 21:01:44 -0300 > Cc: emacs-devel@gnu.org > > > The preferred format for patches is to have a commit message in the > > form of a ChangeLog entry, and to send it as an attached file produced > > with e.g. "git format-patch -1". > > Oh, sorry I missed that. I'm sending the patch in the attachment. > Thanks for the tips. Thanks, I have a few minor comments: > @@ -956,6 +961,7 @@ reset_buffer (register struct buffer *b) > (b, BVAR (&buffer_defaults, enable_multibyte_characters)); > bset_cursor_type (b, BVAR (&buffer_defaults, cursor_type)); > bset_extra_line_spacing (b, BVAR (&buffer_defaults, extra_line_spacing)); > + bset_line_spacing_vertical_center (b, BVAR (&buffer_defaults, line_spacing_vertical_center)); Please break this long line into two. > + DEFVAR_PER_BUFFER ("line-spacing-vertical-center", > + &BVAR (current_buffer, line_spacing_vertical_center), Qnil, > + doc: /* Non-nil will center the line content vertically ^^^^ "means" instead of "will" follows our style closer. > +when using `line-spacing' variable. */); > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -29294,7 +29294,13 @@ gui_produce_glyphs (struct it *it) > > if (extra_line_spacing > 0) > { > - it->descent += extra_line_spacing; > + if (! BVAR (XBUFFER (it->w->contents), line_spacing_vertical_center)) { > + it->descent += extra_line_spacing; > + } else { > + int spacing = extra_line_spacing / 2; > + it->ascent += spacing; > + it->descent += spacing; > + } Please use our style of putting braces around blocks: if (something) { do_this; do_that; } else { do_something_else; } Finally, this change warrants an entry in NEWS, please provide one. I think we should also mention this variable in the ELisp manual, where we describe the line-spacing feature.