emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Alex Branham <alex.branham@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: Support showing stars as pretty bullets
Date: Tue, 03 Apr 2018 22:33:50 +0200	[thread overview]
Message-ID: <87vad8vxld.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87k1tofjlo.fsf@gmail.com> (Alex Branham's message of "Tue, 03 Apr 2018 09:30:27 -0500")


> 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	other threads:[~2018-04-04 19:03 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 [this message]
2018-04-04 22:14           ` Alex Branham
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=87vad8vxld.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=alex.branham@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).