From dbb6181a5d8b5aa14a46bb207ebaf6c7911c8ced Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 15 Jun 2022 10:26:10 -0500 Subject: aodifu --- lisp/+org.el | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'lisp/+org.el') diff --git a/lisp/+org.el b/lisp/+org.el index 0d6e300..6b956ae 100644 --- a/lisp/+org.el +++ b/lisp/+org.el @@ -729,5 +729,42 @@ When called with a prefix ARG, will still unconditionally call ((org-at-table-p) #'org-table-wrap-region) (t #'org-return))))) + +;;; el-patch + +(el-patch-defun org-format-outline-path (path &optional width prefix separator) + "Format the outline path PATH for display. +WIDTH is the maximum number of characters that is available. +PREFIX is a prefix to be included in the returned string, +such as the file name. +SEPARATOR is inserted between the different parts of the path, +the default is \"/\"." + (setq width (or width 79)) + (setq path (delq nil path)) + (unless (> width 0) + (user-error "Argument `width' must be positive")) + (setq separator (or separator "/")) + (let* ((org-odd-levels-only nil) + (fpath (concat + prefix (and prefix path separator) + (mapconcat + (lambda (s) (replace-regexp-in-string "[ \t]+\\'" "" s)) + (cl-loop for head in path + for n from 0 + collect (el-patch-swap + (org-add-props + head nil 'face + (nth (% n org-n-level-faces) org-level-faces)) + head)) + separator)))) + (when (> (length fpath) width) + (if (< width 7) + ;; It's unlikely that `width' will be this small, but don't + ;; waste characters by adding ".." if it is. + (setq fpath (substring fpath 0 width)) + (setf (substring fpath (- width 2)) ".."))) + fpath)) + + (provide '+org) ;;; +org.el ends here -- cgit 1.4.1-21-gabe81