branch: externals/ellama
commit b22fbc71e2948c7171dca3d392c90e9cc7211db0
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>

    Refactor org filling for README and NEWS
    
    Introduce a reusable `refill-org` macro that uses `org-element` to fill
    paragraphs to 80 columns, replacing the previous `fill-region` approach. 
Update
    `refill-news` and `refill-readme` targets to use this macro, simplifying the
    Makefile and ensuring consistent formatting across org files.
---
 Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 2d02709da1..91df3e07ab 100644
--- a/Makefile
+++ b/Makefile
@@ -55,8 +55,10 @@ manual:
 format-elisp:
        emacs -batch --eval "(let ((files (append (file-expand-wildcards 
\"ellama*.el\") (file-expand-wildcards \"tests/*.el\")))) (package-initialize) 
(require 'transient) (dolist (file files) (with-current-buffer 
(find-file-noselect file) (emacs-lisp-mode) (indent-region (point-min) 
(point-max)) (untabify (point-min) (point-max)) (delete-trailing-whitespace) 
(save-buffer))))"
 
+refill-org := "(with-current-buffer (find-file-noselect \"FILE\") 
(package-initialize) (require (quote org)) (require (quote org-element)) (setq 
fill-column 80) (save-excursion (org-with-wide-buffer (cl-loop for el in 
(reverse (org-element-map (org-element-parse-buffer) (quote (paragraph 
quote-block item)) (quote identity))) do (goto-char (org-element-property 
:contents-begin el)) (org-fill-paragraph)))) (save-buffer))"
+
 refill-news:
-       emacs -batch --eval "(with-current-buffer (find-file-noselect 
\"./NEWS.org\") (setq fill-column 80) (fill-region (point-min) (point-max)) 
(save-buffer))"
+       emacs -batch --eval $(subst FILE,./NEWS.org,$(refill-org))
 
 refill-readme:
-       emacs -batch --eval "(with-current-buffer (find-file-noselect 
\"./README.org\") (setq fill-column 80) (fill-region (point-min) (point-max)) 
(save-buffer))"
+       emacs -batch --eval $(subst FILE,./README.org,$(refill-org))

Reply via email to