all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Uwe Brauer <oub@mat.ucm.es>, emacs-devel@gnu.org
Subject: Re: sub and superscripts: without «_» and «^»
Date: Thu, 03 Sep 2015 09:02:50 +0200	[thread overview]
Message-ID: <87613sc7dx.fsf@gnu.org> (raw)
In-Reply-To: <jwv4mjcd17z.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 02 Sep 2015 16:20:27 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I asked this on auctex-dev but it might be question concerning core
>> functionality of GNU emacs:
>
> The necessary core functionality has been present for a long time:
> just add the proper `invisible' property to the chars you don't want
> to see.

I guess what Uwe wants is that `prettify-symbols-mode' in a (La)TeX
buffer (with stock latex-mode or AUCTeX; doesn't really matter) could
have the option to make the ^ and _ invisible, too.

I already told him that this is not what p-s-m is meant for.  But it's
easy enough to write a custom font-lock rule for that:

--8<---------------cut here---------------start------------->8---
(defun th/invisible-super-sub-scripts ()
  (interactive)
  (cl-pushnew 'invisible font-lock-extra-managed-props)
  (font-lock-add-keywords
   nil
   '(("[^\\\\]\\([_^]\\)" (1 '(face nil invisible t) t))))
  (font-lock-flush))
--8<---------------cut here---------------end--------------->8---

Uwe, if you want you could do something like that:

--8<---------------cut here---------------start------------->8---
(add-hook 'prettify-symbols-mode-hook
	  (lambda ()
	    (when (eq major-mode 'latex-mode)
	      (th/invisible-super-sub-scripts))))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo



  reply	other threads:[~2015-09-03  7:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 16:38 sub and superscripts: without «_» and «^» Uwe Brauer
2015-09-02 18:58 ` Eli Zaretskii
2015-09-02 20:20 ` Stefan Monnier
2015-09-03  7:02   ` Tassilo Horn [this message]
2015-09-03  9:41     ` Uwe Brauer

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87613sc7dx.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=oub@mat.ucm.es \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.