emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Support showing stars as pretty bullets


From: Nicolas Goaziou
Subject: Re: [O] Support showing stars as pretty bullets
Date: Tue, 03 Apr 2018 22:33:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

> Fair enough. How about the attached patch instead? It only sets up the
> two local variables in org.el and puts the rest in org-entities.el since
> that file is also concerned with replacing characters with "prettier"
> versions of themselves.

I don't think it belongs to "org-entities.el" either. While it is true
there is some prettification done there, this is not the sole point of
the library. IOW, it is more than eye-candy; it affects, e.g., export.

I really think it should go into a new "org-art.el" file.

More comments follow.

> +;; prettify-mode
> +(defvar-local org-prettify-alist '(("*" . ?•))
> +  "An alist of symbols to prettify, see `prettify-symbols-alist'.
> +Whether the symbol actually gets prettified is controlled by
> +`org-pretty-compose-p', which see.")

Should this be a defcustom?

Also, note that the name space must match library, so if it goes into
"org-art.el", it ought to be named, e.g., `org-art-prettify-alist'.

> +(defun org-pretty-compose-p (start end match)
> +  "Return t if the symbol should be prettified.

"Non-nil if symbol between START and END should be prettified.
MATCH is ..."

> +START and END are the start and end points, MATCH is the string
> +match.  See also `prettify-symbols-compose-predicate'."
> +  (if (string= match "*")
> +      ;; prettify asterisks in headings
> +      (org-at-heading-p)

Doesn't this mean that any bold object in headline is going to be
prettified?

Maybe something like this (untested):

  (and (org-match-line org-outline-regexp-bol)
       (< end (match-end 0)))

> +    ;; else rely on the default function

Nitpick:

  ";; Else rely on the default function."
  
> +  ;; Setup prettify mode

Ditto:

  ";; Setup prettify mode."

> +  (setq-local prettify-symbols-alist org-prettify-alist)
> +  (setq-local prettify-symbols-compose-predicate
> #'org-pretty-compose-p)

This should also go into "org-art.el", which is an optional library. We
don't want to activate anything related to it every time Org is loaded.

Can it be tested somehow?



reply via email to

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