From: Alex Branham <alex.branham@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: Support showing stars as pretty bullets
Date: Wed, 04 Apr 2018 17:14:47 -0500 [thread overview]
Message-ID: <87370ak4a0.fsf@gmail.com> (raw)
In-Reply-To: <87vad8vxld.fsf@nicolasgoaziou.fr>
On Tue 03 Apr 2018 at 15:33, Nicolas Goaziou <mail@nicolasgoaziou.fr> 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
next prev parent reply other threads:[~2018-04-04 22:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-01 20:59 Support showing stars as pretty bullets Alex Branham
2018-04-02 18:47 ` Nicolas Goaziou
2018-04-03 0:41 ` Alex Branham
2018-04-03 1:11 ` William Denton
2018-04-03 6:39 ` Nicolas Goaziou
2018-04-03 14:30 ` Alex Branham
2018-04-03 20:33 ` Nicolas Goaziou
2018-04-04 22:14 ` Alex Branham [this message]
2018-04-05 12:50 ` Nicolas Goaziou
2018-04-10 16:00 ` Alex Branham
2018-04-14 10:20 ` Nicolas Goaziou
2018-04-14 13:10 ` Rasmus
2018-04-06 20:22 ` Rasmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87370ak4a0.fsf@gmail.com \
--to=alex.branham@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).