From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CP1PN4K3amJsIQAAbAwnHQ (envelope-from ) for ; Thu, 28 Apr 2022 17:49:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id YN1EN4K3amIVQwAAauVa8A (envelope-from ) for ; Thu, 28 Apr 2022 17:49:22 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9BA45117A9 for ; Thu, 28 Apr 2022 17:49:22 +0200 (CEST) Received: from localhost ([::1]:57836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nk6OP-00074Z-EU for larch@yhetil.org; Thu, 28 Apr 2022 11:49:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nk6FX-00065a-Jx for emacs-orgmode@gnu.org; Thu, 28 Apr 2022 11:40:11 -0400 Received: from ciao.gmane.io ([116.202.254.214]:52242) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nk6FW-000837-3b for emacs-orgmode@gnu.org; Thu, 28 Apr 2022 11:40:11 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nk6FU-0007yK-8h for emacs-orgmode@gnu.org; Thu, 28 Apr 2022 17:40:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Eric Abrahamsen Subject: Re: Bug in orgalist mode's advice on indent-according-to-mode Date: Thu, 28 Apr 2022 08:39:57 -0700 Message-ID: <878rrpfc8i.fsf@ericabrahamsen.net> References: <87czh1g4cn.fsf@ericabrahamsen.net> <87sfpxohb5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cancel-Lock: sha1:qrDhk0UBU7CD0+AgucctqdX/0k0= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651160962; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LFhBJomwLoruQi995GQDQ5BDC6Du1ekChxe2IbkfWBU=; b=n9bTkCormW7feXuMMjg7APdjjmCJPRoJtp7kwV+xQGYyznJ9298D5bFUV7Dz9KOM6F2AwW hyTB6QAcJjzUYaOZunCHoz7wMPJ2YfF5KRKqNgwbmUQTcjrvy7IPRjFAPMQYzG2rJJ4v41 7H1JGGtj6mdd6R2YCFWY/lsM+BPiFb51Cu6VvibgQf4gAo2MrxUek9VAc9YRQBxElvZlFI io8WMpBkmPT1UDSr2Cdp2Eea390eV5H4eQMCRmqHVXUzTgI9j1L4TWx4pT1u5NkV9PLBMb ab3xjpujHu4V/4LqqhYxeoaltNMlPaWsbFo47nBF/53IEs2rY5vKWeOCvQT59w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651160962; a=rsa-sha256; cv=none; b=L0hFhd59e0qKdvWhzrniSZF+8omXAwO8f5TMhPfJ2vi/1NYCByt8AaR1nDaO3scab0LKEw SRmlngi/wrFQYX+2Lb9OaXklzwlL2isbyvpmJcGSKMv14I5iNZixuAV7tMD0gW67Ay0YdL V+OXEeV/YF1C5bREv7WZQXvrImV0KWS0YbNbHiFezB0SLD6RBnsqlrgFXhcsZWl+B6xqbT iFfev8cIwJHt0aqU2yIvrYRg+hfGHkyH6yOOpDfq/VgHnTz/IjcDm+MZrbnlbU0Rv1e/VC zRWCbAiZLtLPwRmZ9W4PYBYlbBx0OAHTUb8xvzG6rNZOO6B4KXjHHqA4h3W8bw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=ericabrahamsen.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 1.90 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=ericabrahamsen.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9BA45117A9 X-Spam-Score: 1.90 X-Migadu-Scanner: scn0.migadu.com X-TUID: MbPl9nZpNwyG Tim Cross writes: > Eric Abrahamsen writes: > >> In Emacs commit f596f0db82c0b1ff3fe8e8f1d8b07d2fe7504ab6, from Nov 2021, >> the function `indent-according-to-mode' was given an optional >> inhibit-widen argument. That argument being passed causes orgalist's >> advice to fail, as the lambda doesn't accept any additional arguments. >> One way to fix it would be like that: >> >> (unless (advice-member-p 'orgalist-fix-bug:31361 'indent-according-to-mode) >> (advice-add 'indent-according-to-mode >> :around (lambda (old &optional inhibit-widen) >> "Workaround bug#31361." >> (or (orgalist--indent-line) >> (let ((indent-line-function >> (advice--cd*r indent-line-function))) >> (funcall old inhibit-widen)))) >> '((name . orgalist-fix-bug:31361))))) >> >> Or I suppose a more future-proof approach might be to use a &rest and >> then `apply' instead of `funcall'. >> > > A better solution would probably be to fix this without using > add-advice. While advice can be a useful escape hatch, it really is best > avoided, especially given that it doesn't always play nice with lexical > binding. I note this one is also calling an undocumented internal > function. In principle I quite agree! But orgalist is basically built on top of add-function/advice-add, so I didn't think that was an option. And also assumed that, given what Orgalist is trying to do, there isn't a cleaner solution right now.