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: [RFC] Using a display_info union instead of a typedef Display_Info Date: Wed, 17 Apr 2019 19:55:35 +0300 Message-ID: <834l6wfu60.fsf@gnu.org> References: <87mukvw4la.fsf@gmail.com> <87imvjw3uu.fsf@gmail.com> <813c7912-e0fd-57aa-37c4-a1e1974e1434@cs.ucla.edu> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="195658"; mail-complaints-to="usenet@blaine.gmane.org" Cc: agrambot@gmail.com, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 17 18:56:17 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGnr6-000ok8-E9 for ged-emacs-devel@m.gmane.org; Wed, 17 Apr 2019 18:56:16 +0200 Original-Received: from localhost ([127.0.0.1]:56662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGnr5-0002ho-G0 for ged-emacs-devel@m.gmane.org; Wed, 17 Apr 2019 12:56:15 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGnqW-0002gM-Mu for emacs-devel@gnu.org; Wed, 17 Apr 2019 12:55:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGnqW-0003Bv-4R; Wed, 17 Apr 2019 12:55:40 -0400 Original-Received: from [176.228.60.248] (port=2335 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hGnqU-0003tC-KV; Wed, 17 Apr 2019 12:55:39 -0400 In-reply-to: <813c7912-e0fd-57aa-37c4-a1e1974e1434@cs.ucla.edu> (message from Paul Eggert on Tue, 16 Apr 2019 11:54:57 -0700) 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.21 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:235592 Archived-At: > From: Paul Eggert > Date: Tue, 16 Apr 2019 11:54:57 -0700 > Cc: emacs-devel@gnu.org > > Thanks, this looks like a step in the right direction. I have a few > minor quibbles: function names like U_DISPLAY_INFO_X shouldn't be > lowercase, and more important DISPLAY_INFO/display_info should be a > function and not a macro, and it should return a pointer to new generic > type, 'struct generic_display_info' say, that contains only the leading > elements common to all the structures - and all the structures should be > changed to have a first member of that generic type. See the first > members of 'struct Lisp_Vector' and 'struct Lisp_Char_Table' for an > example of this. I actually don't see why we need a function. FRAME_DISPLAY_INFO can continue being a macro, because all it does is return a pointer to a struct which is a member of 'struct frame'. The struct to which FRAME_DISPLAY_INFO will have to change to support several window-systems in the same session, but the change can be very simple, like what we do with 'struct font' which is then extended by the various font backends, see for example w32font.h. Then when some code needs to access window-system specific parts of display_info, it will cast the pointer returned by FRAME_DISPLAY_INFO to the correct struct, and use the result. > I have my doubts about installing this in master now, as it doesn't have > direct benefit now. Ironically, one of the patches I have in mind (which > should improve overall Emacs performance significantly) involves > reverting a patch installed some years ago that was intended to be a > refactoring to do later work that was never done. So I appreciate Eli's > concern about merging this into master right away. > > However, the patch seems to be a good candidate for installing into a > scratch branch that later patches can improve on, and once that branch > has direct benefits we could merge that into master. IMO, if we don't want to install such changes on master soon, there's no reason to ask Alex to work on these changes. After all, all the ideas, the discussions, and even the patches Alex proposed are all in the archives, so if someone will want to work on this in the future, they can pick up where we leave off. FWIW, if the changes are cleaned up, and for example don't introduce dispatch functions with platform-specific #ifdef's, but instead go the way I described above, I'm okay with considering something like that for master. I didn't like the original implementation, but I don't reject the idea itself.