unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* bind print-integers-as-characters to t in `describe-variable'?
@ 2024-05-15  9:33 Robert Pluim
  2024-05-15 10:13 ` Mattias Engdegård
  2024-05-15 11:55 ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Robert Pluim @ 2024-05-15  9:33 UTC (permalink / raw)
  To: emacs-devel

It makes the display of eg `electric-quote-chars' much more readable

Robert
-- 

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 182b22549b5..2d85dac22de 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1349,7 +1349,8 @@ describe-variable
 		      (print-rep
 		       (let ((rep
 			      (let ((print-quoted t)
-                                    (print-circle t))
+                                    (print-circle t)
+                                    (print-integers-as-characters t))
                                 (cl-prin1-to-string val))))
                          (if (and (symbolp val) (not (booleanp val)))
 			     (format-message "`%s'" rep)



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

* Re: bind print-integers-as-characters to t in `describe-variable'?
  2024-05-15  9:33 bind print-integers-as-characters to t in `describe-variable'? Robert Pluim
@ 2024-05-15 10:13 ` Mattias Engdegård
  2024-05-15 11:56   ` Eli Zaretskii
  2024-05-15 12:32   ` Robert Pluim
  2024-05-15 11:55 ` Eli Zaretskii
  1 sibling, 2 replies; 10+ messages in thread
From: Mattias Engdegård @ 2024-05-15 10:13 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-devel

15 maj 2024 kl. 11.33 skrev Robert Pluim <rpluim@gmail.com>:

> It makes the display of eg `electric-quote-chars' much more readable

And `fill-column` much less readable. On balance, the loss of readability for numbers that are not characters seems to outweigh the gain for those that are.

We could have stateful buttons controlling the display, which could also include things like printing numbers in hex and control chars in strings as escape sequences.




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

* Re: bind print-integers-as-characters to t in `describe-variable'?
  2024-05-15  9:33 bind print-integers-as-characters to t in `describe-variable'? Robert Pluim
  2024-05-15 10:13 ` Mattias Engdegård
@ 2024-05-15 11:55 ` Eli Zaretskii
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2024-05-15 11:55 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-devel

> From: Robert Pluim <rpluim@gmail.com>
> Date: Wed, 15 May 2024 11:33:58 +0200
> 
> It makes the display of eg `electric-quote-chars' much more readable

Yes, but what does it do to display of blink-cursor-blinks (and any
other variable whose value is a small integer)?



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

* Re: bind print-integers-as-characters to t in `describe-variable'?
  2024-05-15 10:13 ` Mattias Engdegård
@ 2024-05-15 11:56   ` Eli Zaretskii
  2024-05-16  5:46     ` Philip Kaludercic
  2024-05-15 12:32   ` Robert Pluim
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-05-15 11:56 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: rpluim, emacs-devel

> From: Mattias Engdegård <mattias.engdegard@gmail.com>
> Date: Wed, 15 May 2024 12:13:49 +0200
> Cc: emacs-devel@gnu.org
> 
> We could have stateful buttons controlling the display, which could also include things like printing numbers in hex and control chars in strings as escape sequences.

Or maybe the doc string could provide meta-data about how to display
such values?



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

* Re: bind print-integers-as-characters to t in `describe-variable'?
  2024-05-15 10:13 ` Mattias Engdegård
  2024-05-15 11:56   ` Eli Zaretskii
@ 2024-05-15 12:32   ` Robert Pluim
  1 sibling, 0 replies; 10+ messages in thread
From: Robert Pluim @ 2024-05-15 12:32 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

>>>>> On Wed, 15 May 2024 12:13:49 +0200, Mattias Engdegård <mattias.engdegard@gmail.com> said:

    Mattias> 15 maj 2024 kl. 11.33 skrev Robert Pluim <rpluim@gmail.com>:
    >> It makes the display of eg `electric-quote-chars' much more readable

    Mattias> And `fill-column` much less readable. On balance, the
    Mattias> loss of readability for numbers that are not characters
    Mattias> seems to outweigh the gain for those that are.

We could add a limit to print-integers-as-characters above which it
takes effect (default '0').

Or we could look at the custom-type of the variable to see if it is or
contains 'character'.

    Mattias> We could have stateful buttons controlling the display,
    Mattias> which could also include things like printing numbers in
    Mattias> hex and control chars in strings as escape sequences.

Iʼm not entirely sure youʼre being serious here :-) , but that seems
like overkill.

Robert
-- 



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

* Re: bind print-integers-as-characters to t in `describe-variable'?
  2024-05-15 11:56   ` Eli Zaretskii
@ 2024-05-16  5:46     ` Philip Kaludercic
  2024-05-16  8:45       ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Philip Kaludercic @ 2024-05-16  5:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Mattias Engdegård, rpluim, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Mattias Engdegård <mattias.engdegard@gmail.com>
>> Date: Wed, 15 May 2024 12:13:49 +0200
>> Cc: emacs-devel@gnu.org
>> 
>> We could have stateful buttons controlling the display, which could
>> also include things like printing numbers in hex and control chars
>> in strings as escape sequences.
>
> Or maybe the doc string could provide meta-data about how to display
> such values?

Why not bind it depending on the type of the user option?

electric-quote-chars is (list character character character character),
fill-column is integer, for example.

-- 
	Philip Kaludercic on peregrine



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

* Re: bind print-integers-as-characters to t in `describe-variable'?
  2024-05-16  5:46     ` Philip Kaludercic
@ 2024-05-16  8:45       ` Eli Zaretskii
  2024-05-16  9:05         ` Philip Kaludercic
  2024-05-16  9:08         ` Robert Pluim
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2024-05-16  8:45 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: mattias.engdegard, rpluim, emacs-devel

> From: Philip Kaludercic <philipk@posteo.net>
> Cc: Mattias Engdegård <mattias.engdegard@gmail.com>,
>   rpluim@gmail.com,
>   emacs-devel@gnu.org
> Date: Thu, 16 May 2024 05:46:21 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Mattias Engdegård <mattias.engdegard@gmail.com>
> >> Date: Wed, 15 May 2024 12:13:49 +0200
> >> Cc: emacs-devel@gnu.org
> >> 
> >> We could have stateful buttons controlling the display, which could
> >> also include things like printing numbers in hex and control chars
> >> in strings as escape sequences.
> >
> > Or maybe the doc string could provide meta-data about how to display
> > such values?
> 
> Why not bind it depending on the type of the user option?

How do you tell "the type of the user option"?



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

* Re: bind print-integers-as-characters to t in `describe-variable'?
  2024-05-16  8:45       ` Eli Zaretskii
@ 2024-05-16  9:05         ` Philip Kaludercic
  2024-05-16 11:58           ` Eli Zaretskii
  2024-05-16  9:08         ` Robert Pluim
  1 sibling, 1 reply; 10+ messages in thread
From: Philip Kaludercic @ 2024-05-16  9:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mattias.engdegard, rpluim, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: Mattias Engdegård <mattias.engdegard@gmail.com>,
>>   rpluim@gmail.com,
>>   emacs-devel@gnu.org
>> Date: Thu, 16 May 2024 05:46:21 +0000
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> From: Mattias Engdegård <mattias.engdegard@gmail.com>
>> >> Date: Wed, 15 May 2024 12:13:49 +0200
>> >> Cc: emacs-devel@gnu.org
>> >> 
>> >> We could have stateful buttons controlling the display, which could
>> >> also include things like printing numbers in hex and control chars
>> >> in strings as escape sequences.
>> >
>> > Or maybe the doc string could provide meta-data about how to display
>> > such values?
>> 
>> Why not bind it depending on the type of the user option?
>
> How do you tell "the type of the user option"?

E.g. using (get 'fill-column 'custom-type) ;=> integer

As a heuristic, one could check if a type consists just of characters
(e.g. a character, a list of characters, etc.) and only then bind
`print-integers-as-characters'.

-- 
	Philip Kaludercic on peregrine



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

* Re: bind print-integers-as-characters to t in `describe-variable'?
  2024-05-16  8:45       ` Eli Zaretskii
  2024-05-16  9:05         ` Philip Kaludercic
@ 2024-05-16  9:08         ` Robert Pluim
  1 sibling, 0 replies; 10+ messages in thread
From: Robert Pluim @ 2024-05-16  9:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Philip Kaludercic, mattias.engdegard, emacs-devel

>>>>> On Thu, 16 May 2024 11:45:37 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Philip Kaludercic <philipk@posteo.net>
    >> Cc: Mattias Engdegård <mattias.engdegard@gmail.com>,
    >> rpluim@gmail.com,
    >> emacs-devel@gnu.org
    >> Date: Thu, 16 May 2024 05:46:21 +0000
    >> 
    >> Eli Zaretskii <eliz@gnu.org> writes:
    >> 
    >> >> From: Mattias Engdegård <mattias.engdegard@gmail.com>
    >> >> Date: Wed, 15 May 2024 12:13:49 +0200
    >> >> Cc: emacs-devel@gnu.org
    >> >> 
    >> >> We could have stateful buttons controlling the display, which could
    >> >> also include things like printing numbers in hex and control chars
    >> >> in strings as escape sequences.
    >> >
    >> > Or maybe the doc string could provide meta-data about how to display
    >> > such values?
    >> 
    >> Why not bind it depending on the type of the user option?

    Eli> How do you tell "the type of the user option"?

(get 'electric-quote-chars 'custom-type)
=> (list character character character character)

Robert
-- 



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

* Re: bind print-integers-as-characters to t in `describe-variable'?
  2024-05-16  9:05         ` Philip Kaludercic
@ 2024-05-16 11:58           ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2024-05-16 11:58 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: mattias.engdegard, rpluim, emacs-devel

> From: Philip Kaludercic <philipk@posteo.net>
> Cc: mattias.engdegard@gmail.com,  rpluim@gmail.com,  emacs-devel@gnu.org
> Date: Thu, 16 May 2024 09:05:34 +0000
> 
> >> Why not bind it depending on the type of the user option?
> >
> > How do you tell "the type of the user option"?
> 
> E.g. using (get 'fill-column 'custom-type) ;=> integer

You took the easy case.  In a more general case, we'd need a parser to
understand what's TRT:

  (get 'electric-quote-chars 'custom-type)
    => (list character character character character)

And we definitely could have defcustoms which say 'integer', but can
accept both numbers and characters.

And then there are variables, not user options ("C-h v" is not only
for defcustom's).



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

end of thread, other threads:[~2024-05-16 11:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15  9:33 bind print-integers-as-characters to t in `describe-variable'? Robert Pluim
2024-05-15 10:13 ` Mattias Engdegård
2024-05-15 11:56   ` Eli Zaretskii
2024-05-16  5:46     ` Philip Kaludercic
2024-05-16  8:45       ` Eli Zaretskii
2024-05-16  9:05         ` Philip Kaludercic
2024-05-16 11:58           ` Eli Zaretskii
2024-05-16  9:08         ` Robert Pluim
2024-05-15 12:32   ` Robert Pluim
2024-05-15 11:55 ` Eli Zaretskii

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).