[Top][All Lists]

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

org-format-outline-path fonts sizes in the minibuffer

Subject: org-format-outline-path fonts sizes in the minibuffer
Date: Mon, 31 Aug 2020 10:16:08 -0400

*I’m not sure If this is actually a bug so I haven’t included any backtrace/debug information.*

Forgive me I am not sure the exact terminology. I have, within the last two weeks, began to transition to emacs from vim, specifically for org mode. In addition I am not a developer by trade and my knowledge of elisp is limited. 

What exactly did you do?
Move cursor to any header in a .org file.

What did you expect to happen?
An outline to appear within the “echo area,” which does not resize the minibuffer.  

What happened instead?
I have set various headers to various faces and sizes, when I move my cursor over a header the outline appears to use all of the fonts information when displaying it in the minibuffer/echo area. 

What should happen?
Of course this is subjective, but I believe that only the color should be passed on in the outline if anything. Or some variables exposed that can be set to change this behavior. 

(setq org-outline-echo OPTION)

t - Defualt Behavior 
color-only - Passes the color of the headers to the outline in the echo area
plain-text - just passes the text letting the fonts already set elsewhere display

Or some kind of hook that lets us choose what fonts to use for which heading in the echo. 

You can see a picture of what is occurring here. https://preview.redd.it/2cgllvc9aak51.png?width=1638&format=png&auto=webp&s=f7636f477b08aba5c0b34b3e49611de3fba82188

A fellow Redditor u/BulkyLoad87 proposed this solution, which appears to work, but I’m not sure what else this might effect. 
(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)
                  (lambda (s) (replace-regexp-in-string "[ \t]+\\'" "" s))
                  (cl-loop for head in path
                           for n from 0
                           for face = (nth (% n org-n-level-faces) org-level-faces)
                           collect (org-add-props
                                       head nil 'face
                                       `(:foreground ,(face-foreground face nil t) :weight bold)))
    (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)) "..")))

Very Respectfully,

reply via email to

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