From dbc6934ae699f118472dfa6919972019be4a4eac Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 24 Jan 2022 13:24:50 -0600 Subject: Add variable +org-before-save-prettify-buffer --- lisp/+org.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/+org.el b/lisp/+org.el index 57a4a16..5062a08 100644 --- a/lisp/+org.el +++ b/lisp/+org.el @@ -314,12 +314,18 @@ instead of the true count." ;;; Hooks & Advice +(defvar +org-before-save-prettify-buffer t + "Prettify org buffers before saving.") + +(put '+org-before-save-prettify-buffer 'safe-local-variable #'booleanp) + (defun +org-before-save@prettify-buffer () - (save-mark-and-excursion - (mark-whole-buffer) - ;;(org-fill-paragraph nil t) - (+org-fix-blank-lines t) - (org-align-tags t))) + (when +org-before-save-prettify-buffer + (save-mark-and-excursion + (mark-whole-buffer) + ;;(org-fill-paragraph nil t) + (+org-fix-blank-lines t) + (org-align-tags t)))) (defun +org-delete-backward-char (N) "Keep tables aligned while deleting N characters backward. -- cgit 1.4.1-21-gabe81