From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: New ELPA package ada-lite Date: Wed, 17 Aug 2022 07:49:45 -0400 Message-ID: References: <86y1vpfl1k.fsf@stephe-leake.org> <86sflvfbb5.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25711"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel To: Stephen Leake Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 17 13:58:00 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oOHgN-0006OB-TE for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Aug 2022 13:58:00 +0200 Original-Received: from localhost ([::1]:49590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOHgM-0002NF-Ln for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Aug 2022 07:57:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOHYY-0004nZ-1n for emacs-devel@gnu.org; Wed, 17 Aug 2022 07:49:57 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:58463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOHYV-0001pE-30 for emacs-devel@gnu.org; Wed, 17 Aug 2022 07:49:53 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id EF562440F0C; Wed, 17 Aug 2022 07:49:48 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1D758440BAB; Wed, 17 Aug 2022 07:49:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1660736987; bh=5azuvWG7v7k1aLucfHBPepHCWTeoAMVqo+dL8E/CeY8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=kod+V3ykv0cMbhw4lCTFDojPuhaOA38StqnhrlSIVzORiHXHgmFLFN6Bnci3odGyS PHKyuLGknx2cHa8G+TsJen8Ovvfsnwj4hRoOz4yR6wIEfJr5WdVvyhPEMw/91xLn7b oAbflRXEx8xdnsK9Idyq+0HsBczy1keHLbNe4hSmEvWmuaBwkfLwvTAoQtD1YEcrBk HNRq0Xiccup3xAgDremupc968IvEFD9ghoLR8uqr8rXkSxBKBCzg7vcpRXhwIUjlv2 3/C15SqekOQvNvkVlQzuFgUAmas8kRIZ+Yg/pSfCPaJrzEfL6e1Yxu33zKfgdF0Vza 4IU12UtCVkxAw== Original-Received: from pastel (unknown [45.72.195.111]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CA0EA1202C1; Wed, 17 Aug 2022 07:49:46 -0400 (EDT) In-Reply-To: <86sflvfbb5.fsf@stephe-leake.org> (Stephen Leake's message of "Wed, 17 Aug 2022 02:50:54 -0700") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:293545 Archived-At: >> Sounds good, as long as the other ada-mode will be modified to (require >> and) derive from (or extend) ada-lite. >> >> Currently, if both ada-mode and ada-lite packages are installed and >> activated, their autoloads will fight for the top spot of >> `auto-mode-alist`. > > Hmm. I was assuming only one would be activated. In my current testing, > I have ada-mode disabled in package-load-list, so I have not run into > this problem. > > I don't see how deriving ada-mode from ada-lite-mode helps here; there > are still conflicting entries in auto-mode-alist. It doesn't for the `auto-mode-alist` issue. Maybe the full ada-mode should be turned into a minor mode for `ada-lite-mode` (like eglot-mode)? > Are there other modes in ELPA (or MELPA?) that support the same file > extensions? There's a bunch of similar cases: - Built-in tex-mode va AUCTeX - cperl-mode vs perl-mode - js-mode vs js2-mode vs js3-mode vs jsx-mode vs ... - python.el vs python-mode.el This is generally considered as a problem, so the better choice is to try and avoid it. The worst in the list above is python.el and python-mode.el because AFAIK they can't be loaded at the same time (because of name conflicts). In the JavaScript world we try to avoid it by consolidating these into a base js-mode plus a bunch of minor modes (e.g. `js2-minor-mode` and `js-jsx-syntax`). I think the second-best choice is to have a single auto-mode-alist entry and rely on function redefinition to make `-mode` point to the desired alternative (e.g. (defalias 'perl-mode 'cperl-mode)). >> `inhibit-point-motion-hooks` is t (and obsolete) since Emacs-25. > Ah. I guess the byte-compiler doesn't report an obsolete warning here, > because it's in a let? Nah, it's much simpler: DEFVAR_LISP ("inhibit-point-motion-hooks", Vinhibit_point_motion_hooks, doc: /* If non-nil, don't run `point-left' and `point-entered' text properties. This also inhibits the use of the `intangible' text property. This variable is obsolete since Emacs-25.1. Use `cursor-intangible-mode' or `cursor-sensor-mode' instead. */); /* FIXME: We should make-obsolete-variable, but that signals too many warnings in code which does (let ((inhibit-point-motion-hooks t)) ...) Ideally, make-obsolete-variable should let us specify that only the nil value is obsolete, but that requires too many changes in bytecomp.el, so for now we'll keep it "obsolete via the docstring". */ Vinhibit_point_motion_hooks = Qt; > Can that be improved? Maybe it's time we mark it really as obsolete, indeed. >> - The second char in "\"'" is unused (it's only used for open/close >> parentheses-like thingies). > I guess "strings" are defined to always have the same start and end > delimiters. Indeed. For those strings that don't obey this rule we have the "string fence" syntax. >>> (set (make-local-variable 'syntax-propertize-function) #'ada-lite-syntax-propertize) >>> (syntax-ppss-flush-cache (point-min));; reparse with new function >> Why/when have you found this explicit flush to be necessary? > When changing modes in a buffer, or just resetting the mode after > editing ada-lite-syntax-propertize. Really? > You seem to be implying that syntax-ppss-flush-cache is already done by > the "set major mode" code? Yes, that should be the case (because the cache's info is kept in local vars which get zapped by the `kill-all-local-variables`). >>> (defun ada-lite-find-project (_dir) >>> "If ada-lite-mode, return ada-lite project. >>> For `project-find-functions'" >>> (and (eq major-mode 'ada-lite-mode) >> >> I recommend (derived-mode-p 'ada-lite-mode) instead? > > That would be wrong for ada-mode if it derives from ada-lite-mode; > ada-mode assumes a different kind of project. Hmm... Stefan