all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* interactive spec with reasonable numbers for c-u
@ 2022-09-08  0:47 Samuel Wales
  2022-09-08  1:03 ` Emanuel Berg
  2022-09-08  5:45 ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Samuel Wales @ 2022-09-08  0:47 UTC (permalink / raw)
  To: help-gnu-emacs, emacs-devel

not on these lists.

some commands use c-u a few times, and the code does some stuff with
interactive p or P that works with base 4 artithmetic and navigation
commands.

e.g. you will get number slike 1 for c-u, then 4 for c-u c-u.

or you will get a list with base 4 artithmetic.

then the programmer uses those to make a decision of what the command
should do.  iirc (64) i ssomething like c-u c-u c-u.

our bodies are constructed and maintained by base 4 arithmentic.  it
is great stuff.  but i think programmers migh want things like 1, 2, 3
for, respectively, c-u, c-u c-u.  so, idk,  if a number really is
provided, then it an be in a list.

but most of the time i am not talking about entering a number using m-
or using c-u, but merely going c-u c-u c-u m-x ....
so i was wondering if there exists an interactie spec that returns 0 1
2 3 for the number of c-u gien to the command.



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

* Re: interactive spec with reasonable numbers for c-u
  2022-09-08  0:47 interactive spec with reasonable numbers for c-u Samuel Wales
@ 2022-09-08  1:03 ` Emanuel Berg
  2022-09-08  5:45 ` Eli Zaretskii
  1 sibling, 0 replies; 10+ messages in thread
From: Emanuel Berg @ 2022-09-08  1:03 UTC (permalink / raw)
  To: emacs-devel; +Cc: help-gnu-emacs

Samuel Wales wrote:

> not on these lists.

What does that mean, if I don't mail you, you can't read this?

Are you reading here

  http://lists.gnu.org/archive/html/help-gnu-emacs/

?

I'll yank your mail manually then ... This means you'll will
get mail with a message saying this is a courtesy copy, this
is because I add your mail to the TO header LOL :)

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: interactive spec with reasonable numbers for c-u
  2022-09-08  0:47 interactive spec with reasonable numbers for c-u Samuel Wales
  2022-09-08  1:03 ` Emanuel Berg
@ 2022-09-08  5:45 ` Eli Zaretskii
  2022-09-08  9:39   ` Emanuel Berg
  2022-09-09  0:49   ` Samuel Wales
  1 sibling, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2022-09-08  5:45 UTC (permalink / raw)
  To: help-gnu-emacs

[Please don't cross-post to both help-gnu-emacs and emacs-devel.]

> From: Samuel Wales <samologist@gmail.com>
> Date: Wed, 7 Sep 2022 17:47:29 -0700
> 
> not on these lists.
> 
> some commands use c-u a few times, and the code does some stuff with
> interactive p or P that works with base 4 artithmetic and navigation
> commands.
> 
> e.g. you will get number slike 1 for c-u, then 4 for c-u c-u.
> 
> or you will get a list with base 4 artithmetic.
> 
> then the programmer uses those to make a decision of what the command
> should do.  iirc (64) i ssomething like c-u c-u c-u.
> 
> our bodies are constructed and maintained by base 4 arithmentic.  it
> is great stuff.  but i think programmers migh want things like 1, 2, 3
> for, respectively, c-u, c-u c-u.  so, idk,  if a number really is
> provided, then it an be in a list.
> 
> but most of the time i am not talking about entering a number using m-
> or using c-u, but merely going c-u c-u c-u m-x ....
> so i was wondering if there exists an interactie spec that returns 0 1
> 2 3 for the number of c-u gien to the command.

How about using (log N 4), where N is what you get from the prefix,
i.e. 4, 16, 64, etc.?



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

* Re: interactive spec with reasonable numbers for c-u
  2022-09-08  5:45 ` Eli Zaretskii
@ 2022-09-08  9:39   ` Emanuel Berg
       [not found]     ` <CAJcAo8vg6_Ej-0TtdKQdKDTJ32f=-UJExeyS0Wd-0SCSQyY2jw@mail.gmail.com>
  2022-09-09  0:49   ` Samuel Wales
  1 sibling, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2022-09-08  9:39 UTC (permalink / raw)
  To: help-gnu-emacs

Samuel Wales wrote:

> our bodies are constructed and maintained by base
> 4 arithmentic.

They are?

What do you mean? :O

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: interactive spec with reasonable numbers for c-u
  2022-09-08  5:45 ` Eli Zaretskii
  2022-09-08  9:39   ` Emanuel Berg
@ 2022-09-09  0:49   ` Samuel Wales
  2022-09-09  3:36     ` Emanuel Berg
  1 sibling, 1 reply; 10+ messages in thread
From: Samuel Wales @ 2022-09-09  0:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On 9/7/22, Eli Zaretskii <eliz@gnu.org> wrote:
> [Please don't cross-post to both help-gnu-emacs and emacs-devel.]

apologies to both, then.  was in a moment of uncertainty and not doing
well and sent too soon.

> How about using (log N 4), where N is what you get from the prefix,
> i.e. 4, 16, 64, etc.?

that would work.  but it being just about as easy to use the number
directly, i was thinking there might be a new interactive spec, and
another possibility might be something that allows symbols to be used
in conditionals.

never mind whole thing.  there are surely greater things to be done
with emacs than to mind this silly post.



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

* Re: interactive spec with reasonable numbers for c-u
  2022-09-09  0:49   ` Samuel Wales
@ 2022-09-09  3:36     ` Emanuel Berg
       [not found]       ` <CAJcAo8v1ygssXWXHN2yu7OCk9UagSG48-DEPvU7bnZg691JjRg@mail.gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2022-09-09  3:36 UTC (permalink / raw)
  To: help-gnu-emacs

Samuel Wales wrote:

>> How about using (log N 4), where N is what you get from the
>> prefix, i.e. 4, 16, 64, etc.?
>
> that would work. but it being just about as easy to use the
> number directly, i was thinking there might be a new
> interactive spec, and another possibility might be something
> that allows symbols to be used in conditionals.

Do it, I've never heard of anyone writing his own interactive
spec so it's an original idea ...

As for getting 1, 2, 3 or anything else out of the 4, 16, 64
etc there is no other way than to convert them with Lisp as
suggested or in whatever other way one would prefer to get the
desired result.

> never mind whole thing. there are surely greater things to
> be done with emacs than to mind this silly post.

Stop it, you ruin your self esteem ...

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: interactive spec with reasonable numbers for c-u
       [not found]     ` <CAJcAo8vg6_Ej-0TtdKQdKDTJ32f=-UJExeyS0Wd-0SCSQyY2jw@mail.gmail.com>
@ 2022-09-10  2:03       ` Emanuel Berg
  2022-09-17  6:19         ` Samuel Wales
  0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2022-09-10  2:03 UTC (permalink / raw)
  To: help-gnu-emacs

Samuel Wales wrote:

> dna has 4 base pairs that comes in sequences. so loosely
> speaking it is base 4 arithmetic. of coure it is not that
> simple and i am not making the claim that arithmetic per se
> is performed. among the lack of simplicity, there are
> codons, there is rna which substitutes uracil, and probably
> various other footnotes. but it's not wrong to say that our
> dna has 4 nucleotides in sequences.

Ah, of course, DNA!

Cool, but surely that isn't the reason why we have that
sequence in Emacs? :O

$ for i in {0..4}; do echo $(( (2**2)**i )); done

  1
  4
 16
 64
256

Here's an interesting textfile BTW,
https://dataswamp.org/~incal/data/BINARY-UNITS

-------------------------------------------------------------------------------
  BINARY UNITS                                            incal@dataswamp.org
-------------------------------------------------------------------------------


      unit              bytes               bits             max value (eval)
-------------------------------------------------------------------------------
 char/byte                  1                  8  (1- (** 2    8))
      word                  2                 16  (1- (** 2 (* 8        2)))
doubleword                  4                 32  (1- (** 2 (* 8        4)))
  quadword                  8                 64  (1- (** 2 (* 8        8)))
 paragraph                 16                128  (1- (** 2 (* 8       16)))
  kilobyte              1 024              8 192  (1- (** 2 (* 8     1024)))
  megabyte          1 048 576          8 388 608  (1- (** 2 (* 8 (** 1024 2))))
  gigabyte      1 073 741 824      8 589 934 592  (1- (** 2 (* 8 (** 1024 3))))
  terabyte  1 099 511 627 776  8 796 093 022 208  (1- (** 2 (* 8 (** 1024 4))))
-------------------------------------------------------------------------------
                                                       (defalias '** #'expt)
1 kilobyte = 1024^1 bytes
1 megabyte = 1024^2  -"-
1 gigabyte = 1024^3  -"-
1 terabyte = 1024^4  -"-


-------------------------------------------------------------------------------
  https://dataswamp.org/~incal/data/BINARY-UNITS                   2022-09-10
-------------------------------------------------------------------------------

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: interactive spec with reasonable numbers for c-u
  2022-09-10  2:03       ` Emanuel Berg
@ 2022-09-17  6:19         ` Samuel Wales
  0 siblings, 0 replies; 10+ messages in thread
From: Samuel Wales @ 2022-09-17  6:19 UTC (permalink / raw)
  To: help-gnu-emacs

all i know about the decision to use 4 is the tutoria in 1980s that
asked the user if he or she thought 4 was a good choice.

i belive it was for navigation.  i thik some interactive spec that
spits out a symbol like, this syuntax is maybe wrong but the semantics
would be like (interactive "x" apple banana cherry rest) where x is
whatever character is unassigned for this purpose and if c-u, arg gets
apple; c-u c-u arg gets banana.  and perhaps rest gets whatever the
arg to c-u is if that is ever used.

which is what elispers would want instead of taking the log of a base
4 number.  drawing from my sample of n=1.

On 9/9/22, Emanuel Berg <incal@dataswamp.org> wrote:
> Samuel Wales wrote:
>
>> dna has 4 base pairs that comes in sequences. so loosely
>> speaking it is base 4 arithmetic. of coure it is not that
>> simple and i am not making the claim that arithmetic per se
>> is performed. among the lack of simplicity, there are
>> codons, there is rna which substitutes uracil, and probably
>> various other footnotes. but it's not wrong to say that our
>> dna has 4 nucleotides in sequences.
>
> Ah, of course, DNA!
>
> Cool, but surely that isn't the reason why we have that
> sequence in Emacs? :O
>
> $ for i in {0..4}; do echo $(( (2**2)**i )); done
>
>   1
>   4
>  16
>  64
> 256
>
> Here's an interesting textfile BTW,
> https://dataswamp.org/~incal/data/BINARY-UNITS
>
> -------------------------------------------------------------------------------
>   BINARY UNITS
> incal@dataswamp.org
> -------------------------------------------------------------------------------
>
>
>       unit              bytes               bits             max value
> (eval)
> -------------------------------------------------------------------------------
>  char/byte                  1                  8  (1- (** 2    8))
>       word                  2                 16  (1- (** 2 (* 8
> 2)))
> doubleword                  4                 32  (1- (** 2 (* 8
> 4)))
>   quadword                  8                 64  (1- (** 2 (* 8
> 8)))
>  paragraph                 16                128  (1- (** 2 (* 8
> 16)))
>   kilobyte              1 024              8 192  (1- (** 2 (* 8
> 1024)))
>   megabyte          1 048 576          8 388 608  (1- (** 2 (* 8 (** 1024
> 2))))
>   gigabyte      1 073 741 824      8 589 934 592  (1- (** 2 (* 8 (** 1024
> 3))))
>   terabyte  1 099 511 627 776  8 796 093 022 208  (1- (** 2 (* 8 (** 1024
> 4))))
> -------------------------------------------------------------------------------
>                                                        (defalias '**
> #'expt)
> 1 kilobyte = 1024^1 bytes
> 1 megabyte = 1024^2  -"-
> 1 gigabyte = 1024^3  -"-
> 1 terabyte = 1024^4  -"-
>
>
> -------------------------------------------------------------------------------
>   https://dataswamp.org/~incal/data/BINARY-UNITS
> 2022-09-10
> -------------------------------------------------------------------------------
>
> --
> underground experts united
> https://dataswamp.org/~incal
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



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

* Re: interactive spec with reasonable numbers for c-u
       [not found]         ` <CAJcAo8v9XaoT8c8f=9_a=8LOh3euerW5mnfjfNGjDfGjsvPvSg@mail.gmail.com>
@ 2022-09-19  7:10           ` Emanuel Berg
       [not found]             ` <CAJcAo8v1zKzp1A8s=16V=k3G94naPMhiSEjDoA8hP+qFq5oXsQ@mail.gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2022-09-19  7:10 UTC (permalink / raw)
  To: help-gnu-emacs

Samuel Wales wrote:

> example of old ny code that sets prefix acc number

Maybe it's 4 because with 1, 2, 3 ... and even 2, 4, 8 ... it
doesn't happen quickly enough to move thru stuff and move
point around a buffer. For 2, you might as well hit the
ordinary key well - two times! which is probably as fast
or faster.

So maybe here Emacs is just (an awesome) text editor?

As for setting it to whatever as you do in your code, I don't
see how it matters what it is based on as long as it isn't the
same for different inputs? You check and set to something
else anyway.

It would be interesting to hear the historical background ...
Maybe it's in the document "Evolution of Emacs Lisp" but not
necessarily since it can maybe be considered just an
implementation detail, important as it may, but from the Elisp
(a programming language, specifically a Lisp dialect)
perspective I mean.

There is also a history on Lisp including hardware.

Is there a history of Emacs or better yet, Emacs-like editors?
Maybe the 4 was there before Emacs.

I had URLs to these documents - and more - and also PDFs on my
HDD but unfortunately all was lost when the conapt was
disintegrated during the events now associated with the
finalization of the Jenova project ...

>     (interactive "p")
>     (message "%s arg" arg)
>     ;; no arg -- add region or word to private alist and run
>     ;; c-u -- same with extra
>     ;; c-u c-u -- CLEAR the private alist
>     ;; c-u c-u c-u -- UPDATE the private string or set it to empty
>     (setq prefix
>           (or (and (= arg 1) 'usual)
>            (and (= arg 4) 'extra)
>            (and (= arg 16) 'clear)
>            (and (= arg 64) 'update)))
>     (message "%s prefix" prefix)

That code can be improved, but if you'd care to include the
whole function first ...

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: interactive spec with reasonable numbers for c-u
       [not found]             ` <CAJcAo8v1zKzp1A8s=16V=k3G94naPMhiSEjDoA8hP+qFq5oXsQ@mail.gmail.com>
@ 2022-09-19 22:43               ` Emanuel Berg
  0 siblings, 0 replies; 10+ messages in thread
From: Emanuel Berg @ 2022-09-19 22:43 UTC (permalink / raw)
  To: help-gnu-emacs

Samuel Wales wrote:

> i don't need to improve the code. looks like it is
> broken anyway.

Interesting ...

> it was just an nyi example of what interactive could do with
> a spec that allows you to supply symbols and then those
> symbols are set acording to number of c-u operatiosn.

Well, of course with programming you can do whatever you want
with data. f(x) = y ...

> i don't like the interactie spec normally. but in this case
> if it is going to exist for p and P then i think it should
> get symbolic.

Write code ...

(defun try (this times)
  (interactive (list "this" 501)) ; <-- here
  (message "try %s %s times" this times) )

-- 
underground experts united
https://dataswamp.org/~incal




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

end of thread, other threads:[~2022-09-19 22:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08  0:47 interactive spec with reasonable numbers for c-u Samuel Wales
2022-09-08  1:03 ` Emanuel Berg
2022-09-08  5:45 ` Eli Zaretskii
2022-09-08  9:39   ` Emanuel Berg
     [not found]     ` <CAJcAo8vg6_Ej-0TtdKQdKDTJ32f=-UJExeyS0Wd-0SCSQyY2jw@mail.gmail.com>
2022-09-10  2:03       ` Emanuel Berg
2022-09-17  6:19         ` Samuel Wales
2022-09-09  0:49   ` Samuel Wales
2022-09-09  3:36     ` Emanuel Berg
     [not found]       ` <CAJcAo8v1ygssXWXHN2yu7OCk9UagSG48-DEPvU7bnZg691JjRg@mail.gmail.com>
     [not found]         ` <CAJcAo8v9XaoT8c8f=9_a=8LOh3euerW5mnfjfNGjDfGjsvPvSg@mail.gmail.com>
2022-09-19  7:10           ` Emanuel Berg
     [not found]             ` <CAJcAo8v1zKzp1A8s=16V=k3G94naPMhiSEjDoA8hP+qFq5oXsQ@mail.gmail.com>
2022-09-19 22:43               ` Emanuel Berg

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.