From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MODFM2UPYGL98QAAbAwnHQ (envelope-from ) for ; Wed, 20 Apr 2022 15:49:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id sDDJMmUPYGJSGwAAG6o9tA (envelope-from ) for ; Wed, 20 Apr 2022 15:49:25 +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 5C8F730178 for ; Wed, 20 Apr 2022 15:49:25 +0200 (CEST) Received: from localhost ([::1]:37736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhAhw-0006tH-Bx for larch@yhetil.org; Wed, 20 Apr 2022 09:49:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhAKj-0004JW-0R for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 09:25:27 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:33514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhAKd-0003yy-Sz for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 09:25:21 -0400 Received: by mail-pg1-x532.google.com with SMTP id k14so1650614pga.0 for ; Wed, 20 Apr 2022 06:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:in-reply-to:references:message-id:date:mime-version; bh=UFeRpiAnHg5S56Kt5Fff9k8vL3qMFHMINRQxQpGWX+o=; b=ArYzXqyb+W7RLNj+YfUpcG/ohCiORrliJOTBBR8vf26aTZPc4rRscyFhuSKDXiXR0u m0ELrkilkqJemyImewmHTYVuqAxy+QKEU6VlASHMAGYNxa6t7Z6eb+fsVOPHndK8/lVh x15d2eLiPmIhnYGXJSevfKdyYdOpgJIVvnjmSFvjoCqu3etBASG4osIxtcAQ1+b6JjMu 0rleyu4Wk4nBiAtDnRrKk4e1TpwYKmCxtIICpqRh5RWnDE5Tt6ldMpDsCAtle7UuLxYC fT94VDGJwN8/xzQCax2r6VUj82Hc99gZwTSq37TXoEB+ybdZjE2AvvG9/IVlmq0lMEpG sWMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references :message-id:date:mime-version; bh=UFeRpiAnHg5S56Kt5Fff9k8vL3qMFHMINRQxQpGWX+o=; b=u82HQQ/C8vGsvj7pM9ef4AnldKS2vJgcQCbs+Wnj1VtlCKV/knyKtQ9oa5L8SKGiE+ nIRO797npJwJaez+6UXicUWw8YrmVUmLCdZEKXDXhh4SH0uQLEaVXbjtgqHH7VW4p8Tq plRy0QNzr68a6VNSRrgKd6LdkxTKARf+k9jP0QIZzHHpS4rvNm9x9sztv20zh1HrhsQi DUzmf3GzKDLDJcxoTeowJyv+aVI+ZNO4MyxMKKHN6agJD5qDk4Hs8xgqAuiaWmjsrbbW t5ddQXzOOIcsOcvs6kI3yUp8O5qU0iTBik0T/dUZjuIpVFJMsXVnQEkGYkKn3fd2ux3B wZWw== X-Gm-Message-State: AOAM532sVUc4XsiDARGlZjy5UPLf0zaqjL37xhLudxVuJTn6BHhsLPnN IXB6jRunR3V2J6vDdFW1sWBpqw9++r/sBg== X-Google-Smtp-Source: ABdhPJzXdDgqFJ0d7jeZnQpBdsYOXAHC3CtTYduXnKioFljbEXoFYjfoiithF1JIwDV8dzYTaJChSw== X-Received: by 2002:a65:5c81:0:b0:3aa:494c:6668 with SMTP id a1-20020a655c81000000b003aa494c6668mr5891305pgt.603.1650461117875; Wed, 20 Apr 2022 06:25:17 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id d8-20020a636808000000b00398e9c7049bsm19897915pgc.31.2022.04.20.06.25.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 06:25:17 -0700 (PDT) From: Ihor Radchenko To: emacs-orgmode@gnu.org Subject: [PATCH v2 18/38] Move `org-buffer-list' to org-macs.el--- In-Reply-To: References: Message-Id: Date: Wed, 20 Apr 2022 21:26:10 +0800 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=yantar92@gmail.com; helo=mail-pg1-x532.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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-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=1650462565; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=lGXiDbqfYjVUVCn7H8ZIsC3UHwwp9Za9MpoyBLbx2CI=; b=KDxYZda3O4bNV7qwuKsBXTiGQvHcU5/Cqjzmv16MF0vHehG0ah5KvJZorEzyOylZd11zVf OhYxvIRsdE1LKAr8Z7IQQ6HG6myRx+/twvBZYWfsp1NZVkVovc6BVsJRMj0EU9NtlsPiZM 14kky+DqudHtS7rE8DWrduOruGzvVsz4hkz5xzMfqKgUJ50cYUfYHuufb1QiG+7pYnYVRP 9EnJ43jKS8kG0NSdlgOa6qKVsPl3p1r9gf1CoPlABVKfizZyqRN5NGQ9yrfvfCE/S8XnIb LeVFQPAoqNVOaoOtHLoLEJOAO96wUSX+AMX84XhaJwoL0JXlQzKuXFuOAYIjew== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650462565; a=rsa-sha256; cv=none; b=CJNCRd/4liHMfR8LuO2A3mRY5XMpK5mDkXiaRsgKx5JY3DFkqxkAP0H7sb3dIwt+7RQ1gs PaHflVdhDu3sQVqGWTd6f0bl+khNKQi/HOWLkebwXxr+qWHJbMVOWOs7X3BblQ5XFB0+o6 FCkhysVUomlrUQrrZGOwpXaBc7s5GkVHLLJD3qVPoNPMVcxZU2SISc6GvbMBDoqjvF9jqq GL2EzJYvFaCBM3J4PI10ynjyeHkB6diEQ5ZB0G8MS+6zPe4YsCHYcUtwjDec8lu0bn78HQ 4B5XAzFw+oiqMb4CVylJ80vNQpJND20+bHoXEw8KpN+46f0dpvJYM+wXTWo/Yw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=ArYzXqyb; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (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: 6.66 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=ArYzXqyb; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (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: 5C8F730178 X-Spam-Score: 6.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: zCtz2YhsANVQ --- lisp/org-macs.el | 38 ++++++++++++++++++++++++++++++++++++++ lisp/org.el | 38 -------------------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 42a91781b..188168cdc 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -223,6 +223,44 @@ (defun org-fit-window-to-buffer (&optional window max-height min-height (shrink-window-if-larger-than-buffer window))) (or window (selected-window))) +(defun org-buffer-list (&optional predicate exclude-tmp) + "Return a list of Org buffers. +PREDICATE can be `export', `files' or `agenda'. + +export restrict the list to Export buffers. +files restrict the list to buffers visiting Org files. +agenda restrict the list to buffers visiting agenda files. + +If EXCLUDE-TMP is non-nil, ignore temporary buffers." + (let* ((bfn nil) + (agenda-files (and (eq predicate 'agenda) + (mapcar 'file-truename (org-agenda-files t)))) + (filter + (cond + ((eq predicate 'files) + (lambda (b) (with-current-buffer b (derived-mode-p 'org-mode)))) + ((eq predicate 'export) + (lambda (b) (string-match "\\*Org .*Export" (buffer-name b)))) + ((eq predicate 'agenda) + (lambda (b) + (with-current-buffer b + (and (derived-mode-p 'org-mode) + (setq bfn (buffer-file-name b)) + (member (file-truename bfn) agenda-files))))) + (t (lambda (b) (with-current-buffer b + (or (derived-mode-p 'org-mode) + (string-match "\\*Org .*Export" + (buffer-name b))))))))) + (delq nil + (mapcar + (lambda(b) + (if (and (funcall filter b) + (or (not exclude-tmp) + (not (string-match "tmp" (buffer-name b))))) + b + nil)) + (buffer-list))))) + ;;; File diff --git a/lisp/org.el b/lisp/org.el index 2608865da..402ce3520 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -14748,44 +14748,6 @@ (defun org-switchb (&optional arg) (mapcar #'list (mapcar #'buffer-name blist)) nil t)))) -(defun org-buffer-list (&optional predicate exclude-tmp) - "Return a list of Org buffers. -PREDICATE can be `export', `files' or `agenda'. - -export restrict the list to Export buffers. -files restrict the list to buffers visiting Org files. -agenda restrict the list to buffers visiting agenda files. - -If EXCLUDE-TMP is non-nil, ignore temporary buffers." - (let* ((bfn nil) - (agenda-files (and (eq predicate 'agenda) - (mapcar 'file-truename (org-agenda-files t)))) - (filter - (cond - ((eq predicate 'files) - (lambda (b) (with-current-buffer b (derived-mode-p 'org-mode)))) - ((eq predicate 'export) - (lambda (b) (string-match "\\*Org .*Export" (buffer-name b)))) - ((eq predicate 'agenda) - (lambda (b) - (with-current-buffer b - (and (derived-mode-p 'org-mode) - (setq bfn (buffer-file-name b)) - (member (file-truename bfn) agenda-files))))) - (t (lambda (b) (with-current-buffer b - (or (derived-mode-p 'org-mode) - (string-match "\\*Org .*Export" - (buffer-name b))))))))) - (delq nil - (mapcar - (lambda(b) - (if (and (funcall filter b) - (or (not exclude-tmp) - (not (string-match "tmp" (buffer-name b))))) - b - nil)) - (buffer-list))))) - (defun org-agenda-files (&optional unrestricted archives) "Get the list of agenda files. Optional UNRESTRICTED means return the full list even if a restriction -- 2.35.1 -- Ihor Radchenko, PhD, Center for Advancing Materials Performance from the Nanoscale (CAMP-nano) State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong University, Xi'an, China Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg