From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#67008: 30.0.50; Multiple major mode parents Date: Sat, 11 Nov 2023 11:20:45 -0500 Message-ID: References: <445405AC-C0DA-4914-984E-B42671AB536D@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35083"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 67008@debbugs.gnu.org, Ikumi Keita , Yuan Fu , Dmitry Gutov To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 11 17:21:51 2023 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 1r1qk1-00090H-Bb for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Nov 2023 17:21:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r1qjf-0007Qp-6d; Sat, 11 Nov 2023 11:21:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r1qjc-0007QV-Ar for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2023 11:21:24 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r1qjZ-0003ey-Iv for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2023 11:21:24 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r1qkD-0002ud-VI for bug-gnu-emacs@gnu.org; Sat, 11 Nov 2023 11:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Nov 2023 16:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67008 X-GNU-PR-Package: emacs Original-Received: via spool by 67008-submit@debbugs.gnu.org id=B67008.169971969611127 (code B ref 67008); Sat, 11 Nov 2023 16:22:01 +0000 Original-Received: (at 67008) by debbugs.gnu.org; 11 Nov 2023 16:21:36 +0000 Original-Received: from localhost ([127.0.0.1]:54363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r1qjo-0002tP-6U for submit@debbugs.gnu.org; Sat, 11 Nov 2023 11:21:36 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25633) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r1qjl-0002tA-QT for 67008@debbugs.gnu.org; Sat, 11 Nov 2023 11:21:34 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A6F511000AD; Sat, 11 Nov 2023 11:20:47 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1699719647; bh=rTy+y56c7ykJAPSRMo2T1fhJ5HxpjSRMdzqDK1oQjF4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=JbsAjZbjdhFbWQIRH/DURJATohkLLEwhxv6+jgVK/CsHzr3RXmKEhSPyHKhHmiyeP bxSeEAz0JdOICORmU6QSnf4auQK42PeI1gjVF2m3p0oS0T6EpIQHHba8JxJSqJrLwO 5LCRgNIBEucTtSHtDUn7vE7YHhLX9KorHtVzdb7uCXM1BS/zSn9xwYSe6uOMaZtfkD P+5mAJftJL5VHrw9FQa7eYOlLrZD0FUMCbuhgoSGJHL3xISRFaPbSOPb8MaTeSunlm mYAaF2gcYxgBJs7mTfPU0Dn/xsxuAzrSiXWb3MZH+uwfsyqF+HI4FhnIEgb4yBNMW3 NaWcDxt/KPsCQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EB791100061; Sat, 11 Nov 2023 11:20:46 -0500 (EST) Original-Received: from pastel (unknown [45.72.227.120]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B8C61120201; Sat, 11 Nov 2023 11:20:46 -0500 (EST) In-Reply-To: <445405AC-C0DA-4914-984E-B42671AB536D@gmail.com> ("Mattias =?UTF-8?Q?Engdeg=C3=A5rd?="'s message of "Sat, 11 Nov 2023 11:14:47 +0100") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274165 Archived-At: >> * lisp/subr.el (merge-ordered-lists): New function. > That's nice to have, indeed. > The implementation is a bit imperative (and quadratic?) but I assume it was > tuned for performance (on small inputs). I basically took the code from EIEIO, just massaged a bit to offer a simpler API. I'm sure there are ways to make it more efficient for larger inputs, but I haven't put much thought into optimizing/tuning it. >> + "Merge LISTS in a consistent order. >> +LISTS is a list of lists of elements. >> +Merge them into a single list containing the same elements (removing >> +duplicates) and obeying their relative positions in each list. > I think the doc string should mention C3, Fair enough. > and that we use `eq` as equivalence predicate here. Oops, indeed, thanks. >> +If a consistent order does not exist, call ERROR-FUNCTION with >> +the remaining lists. >> +It should return the candidate to use to continue the merge >> +By default we choose the first element of the first list." > > It's not obvious from the text what the arguments to such an error-function > would look like and what the return value should be. None of the existing > three callers seem to use this argument, for that matter. Oh, that's a bug in my patch: the EIEIO code should use (to signal the same error it currently signals). > Given that `eieio--c3-merge-lists` raises an error if there is no total > order, shouldn't the new code do so? Yup. > And we definitely should have tests (I completely understand that you didn't > bothered writing any for something that may or may not actually be used). I don't understand, there are many `if` tests in the code already. > (Really wish we could hive off the whole CEDET tree to ELPA one day.) Including EIEIO? `defclass` is quite popular among contributors coming from the Common Lisp world, so we have several packages in Emacs itself which use it: % grep -l '^(defclass' lisp/**/*.el | grep -v 'cedet\|eieio' lisp/auth-source.el lisp/emacs-lisp/chart.el lisp/emacs-lisp/vtable.el lisp/gnus/gnus-icalendar.el lisp/gnus/gnus-search.el lisp/international/emoji.el lisp/jsonrpc.el lisp/progmodes/eglot.el lisp/registry.el lisp/transient.el % The use in `emoji.el` seems to be due to the use in `transient.el`. Stefan