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: Alex Branham
Subject: Re: [O] Support showing stars as pretty bullets
Date: Wed, 04 Apr 2018 17:14:47 -0500
User-agent: mu4e 1.0; emacs 26.0.91

On Tue 03 Apr 2018 at 15:33, Nicolas Goaziou <address@hidden> wrote:

>> 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.

The issue I see with putting it into org-art.el is that users won't be
able to just call M-x prettify-symbols-mode in an org buffer. They'll
have to do something like

(require 'org-art)
(add-hook 'org-mode-hook #'org-art-prettify)

or something like that. It seems like more work for users than setting
two variables in org-mode. There's also no way for users who prefer M-x
customize to easily activate it (unless we add a defcustom to org.el...)
Or am I missing something?

Let me know, everything else below is relatively minor.

Thanks again!

> 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?

prettify-symbols-alist isn't, so I don't think this should be either.

> 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'.

Will do

>> +(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 ..."

Sure thing

>> +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)))

Thanks, this fixes the bug I mentioned in my first email. Seems to work
well on my end, too!

>> +    ;; else rely on the default function
>
> Nitpick:
>
>   ";; Else rely on the default function."
>
>> +  ;; Setup prettify mode
>
> Ditto:
>
>   ";; Setup prettify mode."

Sure, I'll fix those

>> +  (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?

I'll look into it



reply via email to

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