From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Re: orgalist-mode: wrong indentation in message mode after recent change in emacs Date: Tue, 23 Apr 2019 08:15:09 -0400 Message-ID: References: <87k1gdptsn.fsf@len.workgroup> <87ef6l9x13.fsf@tcd.ie> <87a7ghw2tc.fsf@nicolasgoaziou.fr> <87wojldmcx.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="26553"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org To: "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 23 14:26:21 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 1hIuVA-0006mR-3n for ged-emacs-devel@m.gmane.org; Tue, 23 Apr 2019 14:26:20 +0200 Original-Received: from localhost ([127.0.0.1]:53055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIuV8-0002F4-Uv for ged-emacs-devel@m.gmane.org; Tue, 23 Apr 2019 08:26:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIuTg-000288-13 for emacs-devel@gnu.org; Tue, 23 Apr 2019 08:24:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIuKP-00059B-Hd for emacs-devel@gnu.org; Tue, 23 Apr 2019 08:15:18 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:36262) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIuKO-00057r-6n; Tue, 23 Apr 2019 08:15:12 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id x3NCF9pY016311; Tue, 23 Apr 2019 08:15:10 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 5DC6066184; Tue, 23 Apr 2019 08:15:09 -0400 (EDT) In-Reply-To: <87wojldmcx.fsf@tcd.ie> (Basil L. Contovounesios's message of "Tue, 23 Apr 2019 11:53:02 +0100") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6531=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6531> : inlines <7058> : streams <1819492> : uri <2836085> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 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:235813 gmane.emacs.orgmode:124244 Archived-At: >>> The first is whether orgalist-mode couldn't use a custom >>> indent-line-function instead of advising what may or may not be set to >>> indent-relative by the user. >> I don't know how that would work in practice. > Me neither. >> But a minor mode taking control over `indent-line-function' sounds >> wrong. > Well, orgalist already "takes control" over indent-line-function and > indent-according-to-mode via advice, and the latter advice seems to > assume that indent-line-function is set to the default indent-relative > or indent-relative-first-indent-point. I haven't bothered to look at the advice to have an opinion here, so I'll let you guys figure out this part. >>> The second is why advice--buffer-local does what it does. Stefan, why >>> does it behave differently depending on local-variable-p? Why can't it >>> simply call make-local-variable before returning the symbol-value? Normally a hook runs both its local part and its global part, where the global part is represented in the local list by the special element `t`. When you do `make-local-variable` you're basically *copying* the global part to the local part, with the usual implications: when the global part is later modified those modifications won't be properly reflected in the local copy. That's why we had `make-local-hook` which is now automatically performed by `add-hook` depending on the `local` arg. The exact same thing goes for `add-function` when applied to a variable. In the current case, I think calling `make-local-variable` is likely harmless because *we* know the global value should likely never change, but that's not something that `add-function` knows to be true in general. So instead, `add-function` sets the local value to a function that looks up the global value and runs it, which is the moral equivalent of the `t` element on normal hooks. >>> The third is why indent-according-to-mode hard-codes the check for >>> indent-relative and indent-relative-first-indent-point. History. Comparing functions is always a bad idea. But I couldn't and still can't see how to avoid it here without introducing worse problems. >>> Wouldn't it be nice if this check instead looked up some variable >>> akin to electric-indent-functions-without-reindent, that can be more >>> easily customised? Yes, tho it probably wouldn't help much here: not only we'd still be comparing functions, but we'd also need for orgalist to go through the trouble of manually adding the closure dynamically created by `add-function` to this list. Stefan