emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 18/38] Move `org-buffer-list' to org-macs.el---


From: Ihor Radchenko
Subject: [PATCH v2 18/38] Move `org-buffer-list' to org-macs.el---
Date: Wed, 20 Apr 2022 21:26:10 +0800

---
 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]