From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Branham Subject: Re: Support showing stars as pretty bullets Date: Wed, 04 Apr 2018 17:14:47 -0500 Message-ID: <87370ak4a0.fsf@gmail.com> References: <874lkutzg8.fsf@gmail.com> <878ta51m3w.fsf@nicolasgoaziou.fr> <87sh8di0je.fsf@gmail.com> <87woxoztd5.fsf@nicolasgoaziou.fr> <87k1tofjlo.fsf@gmail.com> <87vad8vxld.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3qgA-0006cc-Fx for emacs-orgmode@gnu.org; Wed, 04 Apr 2018 18:14:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3qg7-0007xh-51 for emacs-orgmode@gnu.org; Wed, 04 Apr 2018 18:14:54 -0400 Received: from mail-ot0-x22f.google.com ([2607:f8b0:4003:c0f::22f]:39203) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f3qg6-0007wz-VR for emacs-orgmode@gnu.org; Wed, 04 Apr 2018 18:14:51 -0400 Received: by mail-ot0-x22f.google.com with SMTP id a14-v6so6939382otf.6 for ; Wed, 04 Apr 2018 15:14:50 -0700 (PDT) In-reply-to: <87vad8vxld.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: Org Mode List On Tue 03 Apr 2018 at 15:33, Nicolas Goaziou 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 '(("*" . ?=E2=80=A2)) >> + "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=3D 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