unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Face for literal numbers.
@ 2019-09-08  2:41 Ergus
  2019-09-08  3:37 ` Stefan Monnier
  2019-09-08 13:25 ` Alan Mackenzie
  0 siblings, 2 replies; 9+ messages in thread
From: Ergus @ 2019-09-08  2:41 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

Hi I have seen that vim provides a color for the literal numbers in
prog-modes. I was looking for something similar en emacs and
surprisingly there is nothing within emacs or at least in elpa. The only
similar (fully functional) package is in melpa:

https://github.com/Fanael/highlight-numbers

Could we provide some basic support for this without depending of
melpa. Such simple functionalities must be at least in elpa right?



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

* Re: Face for literal numbers.
  2019-09-08  2:41 Face for literal numbers Ergus
@ 2019-09-08  3:37 ` Stefan Monnier
  2019-09-08 13:25 ` Alan Mackenzie
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2019-09-08  3:37 UTC (permalink / raw)
  To: Ergus; +Cc: Paul Eggert, emacs-devel

> Could we provide some basic support for this without depending of melpa.

Noone's contributed such a package to GNU ELPA yet.  But of course, I'd
be happy to add such a thing to it.

> Such simple functionalities must be at least in elpa right?

I don't see the purpose of such a functionality, so I'm probably not the
right person to answer this question ;-)


        Stefan




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

* Re: Face for literal numbers.
  2019-09-08  2:41 Face for literal numbers Ergus
  2019-09-08  3:37 ` Stefan Monnier
@ 2019-09-08 13:25 ` Alan Mackenzie
  2019-09-08 14:49   ` Ergus
  2019-09-08 17:57   ` Stefan Monnier
  1 sibling, 2 replies; 9+ messages in thread
From: Alan Mackenzie @ 2019-09-08 13:25 UTC (permalink / raw)
  To: Ergus; +Cc: Paul Eggert, emacs-devel

Hello, Ergus.

On Sun, Sep 08, 2019 at 04:41:46 +0200, Ergus wrote:
> Hi I have seen that vim provides a color for the literal numbers in
> prog-modes. I was looking for something similar en emacs and
> surprisingly there is nothing within emacs or at least in elpa. The only
> similar (fully functional) package is in melpa:

> https://github.com/Fanael/highlight-numbers

> Could we provide some basic support for this without depending of
> melpa. Such simple functionalities must be at least in elpa right?

I'm against such a feature.  "Because vim has it" doesn't seem like a
sufficient justification.

I'm against such a feature because it would be complicated.  All of the
following would need to get the new face:
    5
    -5
    0x27
    0xffff'ffff       /* in C++ Mode */
    'a'               /* in C Mode, etc. */
    ?a                ; Emacs Lisp Mode

The last two of these would be controversial: should an C or Elisp
literal character count as a number for this purpose or not?

We could spend quite a lot of time bikeshedding about this proposed
feature.  Do we need it?  I don't think we do.

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: Face for literal numbers.
  2019-09-08 13:25 ` Alan Mackenzie
@ 2019-09-08 14:49   ` Ergus
  2019-09-08 17:57   ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Ergus @ 2019-09-08 14:49 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Paul Eggert, emacs-devel

On Sun, Sep 08, 2019 at 01:25:39PM +0000, Alan Mackenzie wrote:
>Hello, Ergus.
>
>On Sun, Sep 08, 2019 at 04:41:46 +0200, Ergus wrote:
>> Hi I have seen that vim provides a color for the literal numbers in
>> prog-modes. I was looking for something similar en emacs and
>> surprisingly there is nothing within emacs or at least in elpa. The only
>> similar (fully functional) package is in melpa:
>
>> https://github.com/Fanael/highlight-numbers
>
>> Could we provide some basic support for this without depending of
>> melpa. Such simple functionalities must be at least in elpa right?
>
>I'm against such a feature.  "Because vim has it" doesn't seem like a
>sufficient justification.
>

Hi Alan:

I will not insist on this too much because it is basically an aesthetic
preference. I find it more "elegant" and up to now the package works
pretty fine for me (and it is not so complex actually).

And it is not only vim, but many other editors do (even very dumb ones)
at least for simple numeric constants.

>I'm against such a feature because it would be complicated.  All of the
>following would need to get the new face:
>    5
>    -5
>    0x27
>    0xffff'ffff       /* in C++ Mode */
>    'a'               /* in C Mode, etc. */
>    ?a                ; Emacs Lisp Mode
>
The code in the link supports most of those. And it is mode dependent already.

And it doesn't look to be very complex actually.

>The last two of these would be controversial: should an C or Elisp
>literal character count as a number for this purpose or not?
>
I don't think so; but there will be many opinions about if we ask, so I
won't ask again. I promise.

But in my opinion it makes more sense to support at least the most
general ones (the ones supported in the package, for example) than not
support anything.

>We could spend quite a lot of time bikeshedding about this proposed
>feature.  Do we need it?  I don't think we do.
>
>-- 
>Alan Mackenzie (Nuremberg, Germany).
>
I know how it works actually... So I will just ask the author if he is
fine adding it to elpa... half a loaf is better than no bread.



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

* Re: Face for literal numbers.
  2019-09-08 13:25 ` Alan Mackenzie
  2019-09-08 14:49   ` Ergus
@ 2019-09-08 17:57   ` Stefan Monnier
  2019-09-08 18:15     ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2019-09-08 17:57 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Ergus, Paul Eggert, emacs-devel

Hi Alan,

> I'm against such a feature.  "Because vim has it" doesn't seem like a
> sufficient justification.

I don't personally like this feature either, but I don't see that as
a reason not to accept a package into GNU ELPA which provides it.


        Stefan




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

* Re: Face for literal numbers.
  2019-09-08 17:57   ` Stefan Monnier
@ 2019-09-08 18:15     ` Eli Zaretskii
  2019-09-09 12:04       ` Ergus via Emacs development discussions.
  2019-09-09 17:50       ` Stephen Leake
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2019-09-08 18:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: acm, spacibba, eggert, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Sun, 08 Sep 2019 13:57:26 -0400
> Cc: Ergus <spacibba@aol.com>, Paul Eggert <eggert@cs.ucla.edu>,
>  emacs-devel@gnu.org
> 
> Hi Alan,
> 
> > I'm against such a feature.  "Because vim has it" doesn't seem like a
> > sufficient justification.
> 
> I don't personally like this feature either, but I don't see that as
> a reason not to accept a package into GNU ELPA which provides it.

And I actually don't understand why not define a font-lock face for
numbers, and leave it to major modes whether to support it always, as
an option, or not at all.

We don't have to "like" a feature to admit it, if some users might
want it.  E.g., I don't "like" line numbers at all, but it didn't
prevent me from agreeing to have them, nor from taking time to
implement them.



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

* Re: Face for literal numbers.
  2019-09-08 18:15     ` Eli Zaretskii
@ 2019-09-09 12:04       ` Ergus via Emacs development discussions.
  2019-09-13  8:18         ` Richard Stallman
  2019-09-09 17:50       ` Stephen Leake
  1 sibling, 1 reply; 9+ messages in thread
From: Ergus via Emacs development discussions. @ 2019-09-09 12:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: acm, eggert, Stefan Monnier, emacs-devel

Hi all:

After asking the author to add the package to elpa he replied:

https://github.com/Fanael/highlight-numbers/issues/16

So this package won't go to elpa. I think this closes this discussion
with no numbers highlight and with no package in elpa :( unless we
provide it somehow. But I won't ask for it anymore...

On Sun, Sep 08, 2019 at 09:15:33PM +0300, Eli Zaretskii wrote:
>
>And I actually don't understand why not define a font-lock face for
>numbers, and leave it to major modes whether to support it always, as
>an option, or not at all.
>
>We don't have to "like" a feature to admit it, if some users might
>want it.  E.g., I don't "like" line numbers at all, but it didn't
>prevent me from agreeing to have them, nor from taking time to
>implement them.
>



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

* Re: Face for literal numbers.
  2019-09-08 18:15     ` Eli Zaretskii
  2019-09-09 12:04       ` Ergus via Emacs development discussions.
@ 2019-09-09 17:50       ` Stephen Leake
  1 sibling, 0 replies; 9+ messages in thread
From: Stephen Leake @ 2019-09-09 17:50 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Stefan Monnier <monnier@iro.umontreal.ca>
>> Date: Sun, 08 Sep 2019 13:57:26 -0400
>> Cc: Ergus <spacibba@aol.com>, Paul Eggert <eggert@cs.ucla.edu>,
>>  emacs-devel@gnu.org
>> 
>> Hi Alan,
>> 
>> > I'm against such a feature.  "Because vim has it" doesn't seem like a
>> > sufficient justification.
>> 
>> I don't personally like this feature either, but I don't see that as
>> a reason not to accept a package into GNU ELPA which provides it.
>
> And I actually don't understand why not define a font-lock face for
> numbers, and leave it to major modes whether to support it always, as
> an option, or not at all.

There is one: font-lock-constant-face. At least, that's what Ada mode
uses for numeric literals.

I agree the major mode should apply the face to the literals, rather
than having some minor mode do it.

If there is some language that does not yet have a major mode, it is
very easy to tell font-lock to highlight the keywords and literals.

-- 
-- Stephe



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

* Re: Face for literal numbers.
  2019-09-09 12:04       ` Ergus via Emacs development discussions.
@ 2019-09-13  8:18         ` Richard Stallman
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Stallman @ 2019-09-13  8:18 UTC (permalink / raw)
  To: Ergus; +Cc: acm, eliz, eggert, monnier, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

What does Fanael do?  Maybe someone else would like to implement
a similar feature.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

end of thread, other threads:[~2019-09-13  8:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-08  2:41 Face for literal numbers Ergus
2019-09-08  3:37 ` Stefan Monnier
2019-09-08 13:25 ` Alan Mackenzie
2019-09-08 14:49   ` Ergus
2019-09-08 17:57   ` Stefan Monnier
2019-09-08 18:15     ` Eli Zaretskii
2019-09-09 12:04       ` Ergus via Emacs development discussions.
2019-09-13  8:18         ` Richard Stallman
2019-09-09 17:50       ` Stephen Leake

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).