all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Changing into greek glyphs in texinfo-mode
@ 2021-01-31 13:18 pietru
  2021-01-31 21:03 ` pietru
  2021-01-31 22:08 ` Stefan Monnier
  0 siblings, 2 replies; 14+ messages in thread
From: pietru @ 2021-01-31 13:18 UTC (permalink / raw
  To: Help Gnu Emacs

I want to change \alpha and \beta in texinfo files to show the 
appropriate glyph.  How can I do it?

(defvar glyph-list
  '(;; Greek
    ("\\alpha" . ?α)
    ("\\beta" . ?β))
  "A list of glyph marks.")






^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-01-31 13:18 Changing into greek glyphs in texinfo-mode pietru
@ 2021-01-31 21:03 ` pietru
  2021-01-31 22:08 ` Stefan Monnier
  1 sibling, 0 replies; 14+ messages in thread
From: pietru @ 2021-01-31 21:03 UTC (permalink / raw
  To: pietru; +Cc: Help Gnu Emacs

I want to make the glyph substitution when next character is any of 
" ", "-", "+", "\", ",", ":", ";", ".", "_", "^".

This targets every \something construct on its own or followed by
another one:

"\\\\\\<[a-z]+\\>\\([\s+\,:;._^-]\\\\\\<[a-z]+\\>\\)?"

This matches \alpha and \alpha followed by another construct like
\alpha-\thing:

"\\\\\\<alpha+\\>\\([\s+\,:;._^-]\\\\\\<[a-z]+\\>\\)?"

But I need help on to do the actual substitution.

> Sent: Monday, February 01, 2021 at 1:18 AM
> From: pietru@caramail.com
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Changing into greek glyphs in texinfo-mode
>
> I want to change \alpha and \beta in texinfo files to show the 
> appropriate glyph.  How can I do it?
> 
> (defvar glyph-list
>   '(;; Greek
>     ("\\alpha" . ?α)
>     ("\\beta" . ?β))
>   "A list of glyph marks.")
> 
> 
> 
> 
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-01-31 13:18 Changing into greek glyphs in texinfo-mode pietru
  2021-01-31 21:03 ` pietru
@ 2021-01-31 22:08 ` Stefan Monnier
  2021-01-31 22:17   ` pietru
  1 sibling, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2021-01-31 22:08 UTC (permalink / raw
  To: help-gnu-emacs

> I want to change \alpha and \beta in texinfo files to show the 
> appropriate glyph.  How can I do it?
>
> (defvar glyph-list
>   '(;; Greek
>     ("\\alpha" . ?α)
>     ("\\beta" . ?β))
>   "A list of glyph marks.")

Not sure how you want it to be "change"d, but maybe you're looking for
`prettify-symbols-mode` and its `prettify-symbols-alist`?


        Stefan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-01-31 22:08 ` Stefan Monnier
@ 2021-01-31 22:17   ` pietru
  2021-02-01 13:35     ` pietru
  0 siblings, 1 reply; 14+ messages in thread
From: pietru @ 2021-01-31 22:17 UTC (permalink / raw
  To: Stefan Monnier; +Cc: help-gnu-emacs

> Sent: Monday, February 01, 2021 at 10:08 AM
> From: "Stefan Monnier" <monnier@iro.umontreal.ca>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Changing into greek glyphs in texinfo-mode
>
> > I want to change \alpha and \beta in texinfo files to show the 
> > appropriate glyph.  How can I do it?
> >
> > (defvar glyph-list
> >   '(;; Greek
> >     ("\\alpha" . ?α)
> >     ("\\beta" . ?β))
> >   "A list of glyph marks.")
> 
> Not sure how you want it to be "change"d, but maybe you're looking for
> `prettify-symbols-mode` and its `prettify-symbols-alist`?
 
It is an obscure piece of code.  I am trying to make a minor mode for texinfo,
and have an clearer implementation.

 
>         Stefan
> 
> 
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-01-31 22:17   ` pietru
@ 2021-02-01 13:35     ` pietru
  2021-02-01 13:51       ` Gregory Heytings
  2021-02-01 14:01       ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 14+ messages in thread
From: pietru @ 2021-02-01 13:35 UTC (permalink / raw
  To: pietru; +Cc: help-gnu-emacs, Stefan Monnier


Does anybody have a strategy how to do this thing?  I do not think
I should do a replacement, only for display, which I can turn on
or off. 

> Sent: Monday, February 01, 2021 at 10:17 AM
> From: pietru@caramail.com
> To: "Stefan Monnier" <monnier@iro.umontreal.ca>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Changing into greek glyphs in texinfo-mode
>
> > Sent: Monday, February 01, 2021 at 10:08 AM
> > From: "Stefan Monnier" <monnier@iro.umontreal.ca>
> > To: help-gnu-emacs@gnu.org
> > Subject: Re: Changing into greek glyphs in texinfo-mode
> >
> > > I want to change \alpha and \beta in texinfo files to show the 
> > > appropriate glyph.  How can I do it?
> > >
> > > (defvar glyph-list
> > >   '(;; Greek
> > >     ("\\alpha" . ?α)
> > >     ("\\beta" . ?β))
> > >   "A list of glyph marks.")
> > 
> > Not sure how you want it to be "change"d, but maybe you're looking for
> > `prettify-symbols-mode` and its `prettify-symbols-alist`?
>  
> It is an obscure piece of code.  I am trying to make a minor mode for texinfo,
> and have an clearer implementation.
> 
>  
> >         Stefan
> > 
> > 
> >
> 
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-02-01 13:35     ` pietru
@ 2021-02-01 13:51       ` Gregory Heytings
  2021-02-01 14:02         ` pietru
  2021-02-01 14:01       ` moasenwood--- via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 14+ messages in thread
From: Gregory Heytings @ 2021-02-01 13:51 UTC (permalink / raw
  To: help-gnu-emacs


>
> Does anybody have a strategy how to do this thing?  I do not think I 
> should do a replacement, only for display, which I can turn on or off.
>

Follow Stefan's advice:

(add-hook 'texinfo-mode-hook
           (lambda ()
             (push '("\\alpha" . ?α) prettify-symbols-alist)
             (push '("\\beta" . ?β) prettify-symbols-alist)))

This only affects the way "\alpha" and "\beta" are displayed, and you can 
turn it on or off with M-x prettify-symbols-mode .  If you want to turn it 
on by default, do:

(add-hook 'texinfo-mode-hook
           (lambda ()
             (push '("\\alpha" . ?α) prettify-symbols-alist)
             (push '("\\beta" . ?β) prettify-symbols-alist)
             (prettify-symbols-mode)))


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-02-01 13:35     ` pietru
  2021-02-01 13:51       ` Gregory Heytings
@ 2021-02-01 14:01       ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-01 14:59         ` pietru
  1 sibling, 1 reply; 14+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-01 14:01 UTC (permalink / raw
  To: help-gnu-emacs

pietru wrote:

> Does anybody have a strategy how to do this thing? I do not
> think I should do a replacement, only for display, which
> I can turn on or off.

Yes, check out for example dafny-mode which you find in MELPAs
boogie-friends version 20210127.1405 -

Then type fore example

  ensures x ==> "formal verification stinks"

and it will change ==> into something I cannot even make out
here in the Linux VT.

Very annoying IMO.

Check out the compose-* stuff - is that what it is?

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-02-01 13:51       ` Gregory Heytings
@ 2021-02-01 14:02         ` pietru
  0 siblings, 0 replies; 14+ messages in thread
From: pietru @ 2021-02-01 14:02 UTC (permalink / raw
  To: Gregory Heytings; +Cc: help-gnu-emacs


> Sent: Tuesday, February 02, 2021 at 1:51 AM
> From: "Gregory Heytings" <gregory@heytings.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Changing into greek glyphs in texinfo-mode
>
> 
> >
> > Does anybody have a strategy how to do this thing?  I do not think I 
> > should do a replacement, only for display, which I can turn on or off.
> >
> 
> Follow Stefan's advice:
> 
> (add-hook 'texinfo-mode-hook
>            (lambda ()
>              (push '("\\alpha" . ?α) prettify-symbols-alist)
>              (push '("\\beta" . ?β) prettify-symbols-alist)))
> 
> This only affects the way "\alpha" and "\beta" are displayed, and you can 
> turn it on or off with M-x prettify-symbols-mode .  If you want to turn it 
> on by default, do:

Correct.  I want to write a replacement code as I find the one in
tex-mode.el too cryptic.  For starts I want to try using just
\alpha and \beta. 

 
> (add-hook 'texinfo-mode-hook
>            (lambda ()
>              (push '("\\alpha" . ?α) prettify-symbols-alist)
>              (push '("\\beta" . ?β) prettify-symbols-alist)
>              (prettify-symbols-mode)))
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-02-01 14:01       ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-02-01 14:59         ` pietru
  2021-02-01 17:30           ` pietru
  0 siblings, 1 reply; 14+ messages in thread
From: pietru @ 2021-02-01 14:59 UTC (permalink / raw
  To: moasenwood; +Cc: help-gnu-emacs

> Sent: Tuesday, February 02, 2021 at 2:01 AM
> From: "moasenwood--- via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Changing into greek glyphs in texinfo-mode
>
> pietru wrote:
> 
> > Does anybody have a strategy how to do this thing? I do not
> > think I should do a replacement, only for display, which
> > I can turn on or off.
> 
> Yes, check out for example dafny-mode which you find in MELPAs
> boogie-friends version 20210127.1405 -

Thank you.
 
> Then type fore example
> 
>   ensures x ==> "formal verification stinks"

Have looked at line 203 for the keyword "forall".  I changed it for
\alpha.  Now I need some more function for this to take effect. 

 (list "\\\\\\<alpha+\\>\\([\s+\,:;._^-]\\\\\\<[a-z]+\\>\\)?"
      '(1 (compose-region (match-beginning 1) (match-end 1) ?α))
      '(1 font-lock-keyword-face append))

> and it will change ==> into something I cannot even make out
> here in the Linux VT.
> 
> Very annoying IMO.
> 
> Check out the compose-* stuff - is that what it is?
> 
> -- 
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
> 
> 
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-02-01 14:59         ` pietru
@ 2021-02-01 17:30           ` pietru
  2021-02-02  4:10             ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 14+ messages in thread
From: pietru @ 2021-02-01 17:30 UTC (permalink / raw
  To: pietru; +Cc: help-gnu-emacs, moasenwood


I am having a problem with dafny-font-lock-keywords, as I cannot
see where the functionality for replacing the "forall" keyword
is being called and set up.



> Sent: Tuesday, February 02, 2021 at 2:59 AM
> From: pietru@caramail.com
> To: moasenwood@zoho.eu
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Changing into greek glyphs in texinfo-mode
>
> > Sent: Tuesday, February 02, 2021 at 2:01 AM
> > From: "moasenwood--- via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> > To: help-gnu-emacs@gnu.org
> > Subject: Re: Changing into greek glyphs in texinfo-mode
> >
> > pietru wrote:
> > 
> > > Does anybody have a strategy how to do this thing? I do not
> > > think I should do a replacement, only for display, which
> > > I can turn on or off.
> > 
> > Yes, check out for example dafny-mode which you find in MELPAs
> > boogie-friends version 20210127.1405 -
> 
> Thank you.
>  
> > Then type fore example
> > 
> >   ensures x ==> "formal verification stinks"
> 
> Have looked at line 203 for the keyword "forall".  I changed it for
> \alpha.  Now I need some more function for this to take effect. 
> 
>  (list "\\\\\\<alpha+\\>\\([\s+\,:;._^-]\\\\\\<[a-z]+\\>\\)?"
>       '(1 (compose-region (match-beginning 1) (match-end 1) ?α))
>       '(1 font-lock-keyword-face append))
> 
> > and it will change ==> into something I cannot even make out
> > here in the Linux VT.
> > 
> > Very annoying IMO.
> > 
> > Check out the compose-* stuff - is that what it is?
> > 
> > -- 
> > underground experts united
> > http://user.it.uu.se/~embe8573
> > https://dataswamp.org/~incal
> > 
> > 
> >
> 
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-02-01 17:30           ` pietru
@ 2021-02-02  4:10             ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-02  5:04               ` pietru
  0 siblings, 1 reply; 14+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-02  4:10 UTC (permalink / raw
  To: help-gnu-emacs

pietru wrote:

> I am having a problem with dafny-font-lock-keywords, as
> I cannot see where the functionality for replacing the
> "forall" keyword is being called and set up.

If it is/uses font-lock then this is handled outside of the
mode, the mode just sets it up, that way not every mode has to
have the horsepower to also execute it.

Keep on using the source, Luke! Line 198 looks suspicious, as
do 509...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-02-02  4:10             ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-02-02  5:04               ` pietru
  2021-02-02 12:56                 ` pietru
  0 siblings, 1 reply; 14+ messages in thread
From: pietru @ 2021-02-02  5:04 UTC (permalink / raw
  To: moasenwood; +Cc: help-gnu-emacs

It is calling  prog-mode.el, which is part of emacs.  I am trying to
make a minor mode with all functionality in my minor mode though.

What function would I need to copy over?



> Sent: Tuesday, February 02, 2021 at 4:10 PM
> From: "moasenwood--- via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Changing into greek glyphs in texinfo-mode
>
> pietru wrote:
>
> > I am having a problem with dafny-font-lock-keywords, as
> > I cannot see where the functionality for replacing the
> > "forall" keyword is being called and set up.
>
> If it is/uses font-lock then this is handled outside of the
> mode, the mode just sets it up, that way not every mode has to
> have the horsepower to also execute it.
>
> Keep on using the source, Luke! Line 198 looks suspicious, as
> do 509...
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-02-02  5:04               ` pietru
@ 2021-02-02 12:56                 ` pietru
  2021-02-02 13:26                   ` pietru
  0 siblings, 1 reply; 14+ messages in thread
From: pietru @ 2021-02-02 12:56 UTC (permalink / raw
  To: pietru; +Cc: help-gnu-emacs

I can see that dafny-mode ts relying on "prog-mode.el".  Same
prettify functionality is also being provided by "tex-mode.el".
But I don't see how tex-mode.el uses prog-mode.el


> Sent: Tuesday, February 02, 2021 at 5:04 PM
> From: pietru@caramail.com
> To: moasenwood@zoho.eu
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Changing into greek glyphs in texinfo-mode
>
> It is calling  prog-mode.el, which is part of emacs.  I am trying to
> make a minor mode with all functionality in my minor mode though.
>
> What function would I need to copy over?
>
>
>
> > Sent: Tuesday, February 02, 2021 at 4:10 PM
> > From: "moasenwood--- via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> > To: help-gnu-emacs@gnu.org
> > Subject: Re: Changing into greek glyphs in texinfo-mode
> >
> > pietru wrote:
> >
> > > I am having a problem with dafny-font-lock-keywords, as
> > > I cannot see where the functionality for replacing the
> > > "forall" keyword is being called and set up.
> >
> > If it is/uses font-lock then this is handled outside of the
> > mode, the mode just sets it up, that way not every mode has to
> > have the horsepower to also execute it.
> >
> > Keep on using the source, Luke! Line 198 looks suspicious, as
> > do 509...
> >
> > --
> > underground experts united
> > http://user.it.uu.se/~embe8573
> > https://dataswamp.org/~incal
> >
> >
> >
>
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Changing into greek glyphs in texinfo-mode
  2021-02-02 12:56                 ` pietru
@ 2021-02-02 13:26                   ` pietru
  0 siblings, 0 replies; 14+ messages in thread
From: pietru @ 2021-02-02 13:26 UTC (permalink / raw
  To: pietru; +Cc: help-gnu-emacs

The problem with prog-mode.el is that it is used as major mode, whereas I
am doing a minor made for texinfo-mode.

> Sent: Wednesday, February 03, 2021 at 12:56 AM
> From: pietru@caramail.com
> To: pietru@caramail.com
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Changing into greek glyphs in texinfo-mode
>
> I can see that dafny-mode ts relying on "prog-mode.el".  Same
> prettify functionality is also being provided by "tex-mode.el".
> But I don't see how tex-mode.el uses prog-mode.el
>
>
> > Sent: Tuesday, February 02, 2021 at 5:04 PM
> > From: pietru@caramail.com
> > To: moasenwood@zoho.eu
> > Cc: help-gnu-emacs@gnu.org
> > Subject: Re: Changing into greek glyphs in texinfo-mode
> >
> > It is calling  prog-mode.el, which is part of emacs.  I am trying to
> > make a minor mode with all functionality in my minor mode though.
> >
> > What function would I need to copy over?
> >
> >
> >
> > > Sent: Tuesday, February 02, 2021 at 4:10 PM
> > > From: "moasenwood--- via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> > > To: help-gnu-emacs@gnu.org
> > > Subject: Re: Changing into greek glyphs in texinfo-mode
> > >
> > > pietru wrote:
> > >
> > > > I am having a problem with dafny-font-lock-keywords, as
> > > > I cannot see where the functionality for replacing the
> > > > "forall" keyword is being called and set up.
> > >
> > > If it is/uses font-lock then this is handled outside of the
> > > mode, the mode just sets it up, that way not every mode has to
> > > have the horsepower to also execute it.
> > >
> > > Keep on using the source, Luke! Line 198 looks suspicious, as
> > > do 509...
> > >
> > > --
> > > underground experts united
> > > http://user.it.uu.se/~embe8573
> > > https://dataswamp.org/~incal
> > >
> > >
> > >
> >
> >
>
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-02-02 13:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-31 13:18 Changing into greek glyphs in texinfo-mode pietru
2021-01-31 21:03 ` pietru
2021-01-31 22:08 ` Stefan Monnier
2021-01-31 22:17   ` pietru
2021-02-01 13:35     ` pietru
2021-02-01 13:51       ` Gregory Heytings
2021-02-01 14:02         ` pietru
2021-02-01 14:01       ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-01 14:59         ` pietru
2021-02-01 17:30           ` pietru
2021-02-02  4:10             ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-02  5:04               ` pietru
2021-02-02 12:56                 ` pietru
2021-02-02 13:26                   ` pietru

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.