From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WBw3HXEaZmNRrwAAbAwnHQ (envelope-from ) for ; Sat, 05 Nov 2022 09:10:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id YOcOHXEaZmMTAAEAauVa8A (envelope-from ) for ; Sat, 05 Nov 2022 09:10:25 +0100 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 1886B1EC88 for ; Sat, 5 Nov 2022 09:10:24 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orEF2-0006S3-N0; Sat, 05 Nov 2022 04:09:24 -0400 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 1orEF0-0006Rp-Hi for emacs-orgmode@gnu.org; Sat, 05 Nov 2022 04:09:22 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orEEx-0007Ax-O4 for emacs-orgmode@gnu.org; Sat, 05 Nov 2022 04:09:21 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 5826C240026 for ; Sat, 5 Nov 2022 09:08:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667635739; bh=iNbwJC3qO+ssf0KP6/QiC0pV8t/5yhClYun2vZCzZ0I=; h=From:To:Cc:Subject:Date:From; b=G03MOJl/Bym3cZy1kOg22bQvIh/CfTykNYFqeiWlEeEgkmmDiDd47vh7ZZ/7Pp/cK G/HmvUFGknLeanqFfl2lJ8ZHoAlkfBA24gKEKls5CPd69L2xhzZhpalccWVI9xxYwM ufnUuj4H8jCfYJdjytKBQpPR5A2izQwPjuKaqvMg5HlVxeZYOQ70WyNiu6TwVXhNPb UeuP8eQNqQXy1xJe0pNfMZPFzVt+zq+NaYrCJl6nXtytTqn6vjcgfxUmsvXgTf3vSj 7S/pwcj/FAn2ltNXdI2CX/2juegxei/nbdvWQZzHlOjxD+UlaqFqy+rQPP+ENCPMHV x9wnwltXn7UrQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N499z0fFKz9rxM; Sat, 5 Nov 2022 09:08:54 +0100 (CET) From: Ihor Radchenko To: Adam Porter Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] * lisp/org.el: (org-get-indirect-buffer) Allow indirect base buffers In-Reply-To: <66cdbc7d-9720-d124-a9f1-2467ae07a4ef@alphapapa.net> References: <66cdbc7d-9720-d124-a9f1-2467ae07a4ef@alphapapa.net> Date: Sat, 05 Nov 2022 08:09:34 +0000 Message-ID: <87a655lt4x.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1667635825; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=1Hds4donqnPNS9ZSlXet4Eb0Sa2gp9avu1a/xbisaDg=; b=ZklYKTuc+k27Gajn++H2L0VG1gjXHMIwQL+byVOkCmFB14RxH+phAOWKZ5e/OezNzFatmk In1mayFQXj8vulv6e4/VO0H+5WHBjhZLMhK6wKdwqSbSqxtdIe+zpzwpnZVKuJ5m6BjCpW 5wVfMyq+VyBcsREuMCoJ8XE0pXujsYUYNyQIS7Ix7TtBtrbnuntb/01IqBNOQ42cjMbZ3B zmvR3HWuy3lqghjgFFLIDkp2qeS7A1SQXJQ1vxdL4cT0IZNb9N3Y6l+ou9YKWr73KYgKxA MlfcxUBvm5KUZivFwZAZycdsKuWj9t1naNrKg4MhV4HFe+gCUUxK42oqyRs3UQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667635825; a=rsa-sha256; cv=none; b=q7x9EYBrx2popi52VIbGt+5Umig3XHwCXQ+vb7GZ87irtObvl38p3DC7/c6bYn8m22jPsA iSqtXj7YQMWDU9Fgao1itrYnDXdbEULSWZCzEzjAX9X0qate1G5O982x8zDXAjaAvsJeSd WIZR7qVf2W+AsUeaVR1VRBdq+KvBJHf5Rkp2DoSsYNzRZQRycDKnCPusjpxgprf1DLSOTx wuclLjMlX0lG4cr3EQ6SEaumdEEBU/ZVnwzoA6CzMLFfEBidf1RslcXUDbDXZUqdmaNZV8 SWc7c7DJk4Dg+azMMhMwBrpauDjXt3UIuE6z6DWvRSP2KXsxz9ZzwO+csEzmEQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="G03MOJl/"; dmarc=pass (policy=none) header.from=posteo.net; 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: -2.00 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="G03MOJl/"; dmarc=pass (policy=none) header.from=posteo.net; 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: 1886B1EC88 X-Spam-Score: -2.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: ta32VV1PSL/2 Adam Porter writes: > The attached patch improves the function org-get-indirect-buffer, fixing > a bug, clarifying the code, and adding a docstring. Thanks! I have some comments. > +(cl-defun org-get-indirect-buffer (&optional (buffer (current-buffer)) heading) > + "Return an indirect buffer based on BUFFER. > +If HEADING, prepend it to the name of the new buffer." Maybe append to the name? > + (let* ((base-buffer (or (buffer-base-buffer buffer) buffer)) > + (suffix-prefix (if heading > + (concat heading "-") > + "")) Why not pre-define the whole prefix instead? (prefix (format "%s-%s" (buffer-name base-buffer) (if heading (concat heading "-") ""))) then, can just say (format "%s%s" prefix n) in the loop. > + (buffer-name (cl-loop for n from 1 to 100 why to 100? It may fail (even though unlikely) and also unnecessary. Can just say for n from 1. > + ;; FIXME: Explain why this `condition-case' is necessary. Why > + ;; could an error be signaled with the CLONE argument non-nil, > + ;; and why would trying again without CLONE solve the problem? > + (error (make-indirect-buffer base-buffer buffer-name))))) I did not find why in the git logs. It looks like some ancient code. You can remove it in a followup patch. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at