all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Passing character ch to make-string
@ 2020-11-01 17:45 jai-bholeki via Users list for the GNU Emacs text editor
  2020-11-01 17:55 ` Jean Louis
  0 siblings, 1 reply; 10+ messages in thread
From: jai-bholeki via Users list for the GNU Emacs text editor @ 2020-11-01 17:45 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

How can I pass a character ch to make-string

(make-string 8 ?ch)

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

* Re: Passing character ch to make-string
  2020-11-01 17:45 Passing character ch to make-string jai-bholeki via Users list for the GNU Emacs text editor
@ 2020-11-01 17:55 ` Jean Louis
  2020-11-01 18:20   ` jai-bholeki
  0 siblings, 1 reply; 10+ messages in thread
From: Jean Louis @ 2020-11-01 17:55 UTC (permalink / raw)
  To: jai-bholeki; +Cc: help-gnu-emacs@gnu.org

* jai-bholeki via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2020-11-01 20:48]:
> How can I pass a character ch to make-string
> 
> (make-string 8 ?ch)

You would always read function documentation by using: C-h f

C-h f make-string RET

it would give:

make-string is a built-in function in ‘C source code’.

(make-string LENGTH INIT &optional MULTIBYTE)

  Other relevant functions are documented in the string group.
  Probably introduced at or before Emacs version 1.12.
  This function does not change global state, including the match data.

Return a newly created string of length LENGTH, with INIT in each element.
LENGTH must be an integer.
INIT must be an integer that represents a character.
If optional argument MULTIBYTE is non-nil, the result will be
a multibyte string even if INIT is an ASCII character.

So now we see that INIT is integer that represents a character.

If character is = you may place cursor on character and do: M-x
describe-char and you would see the integer for character like
codepoint 61.

Then you apply character in (make-string 8 61) to get string like
======== 

-- 
There are 50 messages yet in my incoming mailbox.



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

* Re: Passing character ch to make-string
  2020-11-01 17:55 ` Jean Louis
@ 2020-11-01 18:20   ` jai-bholeki
  2020-11-01 18:25     ` Jean Louis
  0 siblings, 1 reply; 10+ messages in thread
From: jai-bholeki @ 2020-11-01 18:20 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs@gnu.org

I did not understand the documentation.  Now I got more confused.
Is there a function I can use that would not require me to hard code
the number?




Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, 1 November 2020 18:55, Jean Louis <bugs@gnu.support> wrote:

> -   jai-bholeki via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org [2020-11-01 20:48]:
>
> > How can I pass a character ch to make-string
> > (make-string 8 ?ch)
>
> You would always read function documentation by using: C-h f
>
> C-h f make-string RET
>
> it would give:
>
> make-string is a built-in function in ‘C source code’.
>
> (make-string LENGTH INIT &optional MULTIBYTE)
>
> Other relevant functions are documented in the string group.
> Probably introduced at or before Emacs version 1.12.
> This function does not change global state, including the match data.
>
> Return a newly created string of length LENGTH, with INIT in each element.
> LENGTH must be an integer.
> INIT must be an integer that represents a character.
> If optional argument MULTIBYTE is non-nil, the result will be
> a multibyte string even if INIT is an ASCII character.
>
> So now we see that INIT is integer that represents a character.
>
> If character is = you may place cursor on character and do: M-x
> describe-char and you would see the integer for character like
> codepoint 61.
>
> Then you apply character in (make-string 8 61) to get string like
>
> =========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
>
> --
>
> There are 50 messages yet in my incoming mailbox.





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

* Re: Passing character ch to make-string
  2020-11-01 18:20   ` jai-bholeki
@ 2020-11-01 18:25     ` Jean Louis
  2020-11-01 18:40       ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Jean Louis @ 2020-11-01 18:25 UTC (permalink / raw)
  To: jai-bholeki; +Cc: help-gnu-emacs@gnu.org

* jai-bholeki <jai-bholeki@protonmail.com> [2020-11-01 21:21]:
> I did not understand the documentation.  Now I got more confused.
> Is there a function I can use that would not require me to hard code
> the number?

(make-string 10 (string-to-char "="))

-- 
There are 50 messages yet in my incoming mailbox.



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

* Re: Passing character ch to make-string
  2020-11-01 18:25     ` Jean Louis
@ 2020-11-01 18:40       ` Stefan Kangas
  2020-11-01 18:48         ` Jean Louis
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2020-11-01 18:40 UTC (permalink / raw)
  To: Jean Louis, jai-bholeki; +Cc: help-gnu-emacs@gnu.org

Jean Louis <bugs@gnu.support> writes:

> (make-string 10 (string-to-char "="))

Also known as:

    (make-string 10 ?=)



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

* Re: Passing character ch to make-string
  2020-11-01 18:40       ` Stefan Kangas
@ 2020-11-01 18:48         ` Jean Louis
  2020-11-01 18:53           ` jai-bholeki
  0 siblings, 1 reply; 10+ messages in thread
From: Jean Louis @ 2020-11-01 18:48 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: help-gnu-emacs@gnu.org, jai-bholeki

* Stefan Kangas <stefankangas@gmail.com> [2020-11-01 21:41]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > (make-string 10 (string-to-char "="))
> 
> Also known as:
> 
>     (make-string 10 ?=)

Until now I did not know. Thanks.

-- 
There are 50 messages yet in my incoming mailbox.



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

* Re: Passing character ch to make-string
  2020-11-01 18:48         ` Jean Louis
@ 2020-11-01 18:53           ` jai-bholeki
  2020-11-01 19:02             ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: jai-bholeki @ 2020-11-01 18:53 UTC (permalink / raw)
  To: Jean Louis; +Cc: Stefan Kangas, help-gnu-emacs@gnu.org


> >     (make-string 10 ?=)

Good heaven, I like to pass a character from a variable, ch say



‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, 1 November 2020 19:48, Jean Louis <bugs@gnu.support> wrote:

> -   Stefan Kangas stefankangas@gmail.com [2020-11-01 21:41]:
>
> > Jean Louis bugs@gnu.support writes:
> >
> > > (make-string 10 (string-to-char "="))
> >
> > Also known as:
> >
> >     (make-string 10 ?=)
> >
>
> Until now I did not know. Thanks.
>
> ------------------------------------
>
> There are 50 messages yet in my incoming mailbox.





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

* RE: Passing character ch to make-string
  2020-11-01 18:53           ` jai-bholeki
@ 2020-11-01 19:02             ` Drew Adams
  2020-11-01 19:03               ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2020-11-01 19:02 UTC (permalink / raw)
  To: jai-bholeki, Jean Louis; +Cc: help-gnu-emacs, Stefan Kangas

> > >     (make-string 10 ?=)
> 
> Good heaven, I like to pass a character from a variable, ch say

Good earth -

(setq ch  ?=)
(make-string ch)



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

* RE: Passing character ch to make-string
  2020-11-01 19:02             ` Drew Adams
@ 2020-11-01 19:03               ` Drew Adams
  2020-11-01 19:19                 ` jai-bholeki
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2020-11-01 19:03 UTC (permalink / raw)
  To: jai-bholeki, Jean Louis; +Cc: help-gnu-emacs, Stefan Kangas

> > > >     (make-string 10 ?=)
> >
> > Good heaven, I like to pass a character from a variable, ch say
> 
> Good earth -
> 
> (setq ch  ?=)
> (make-string ch)

Sorry - (make-string 42 ch).



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

* RE: Passing character ch to make-string
  2020-11-01 19:03               ` Drew Adams
@ 2020-11-01 19:19                 ` jai-bholeki
  0 siblings, 0 replies; 10+ messages in thread
From: jai-bholeki @ 2020-11-01 19:19 UTC (permalink / raw)
  To: Drew Adams; +Cc: Jean Louis, help-gnu-emacs@gnu.org, Stefan Kangas

Fantastic

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, 1 November 2020 20:03, Drew Adams <drew.adams@oracle.com> wrote:

> > > > >     (make-string 10 ?=)
> > > > >
> > >
> > > Good heaven, I like to pass a character from a variable, ch say
> >
> > Good earth -
> > (setq ch ?=)
> > (make-string ch)
>
> Sorry - (make-string 42 ch).





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

end of thread, other threads:[~2020-11-01 19:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-01 17:45 Passing character ch to make-string jai-bholeki via Users list for the GNU Emacs text editor
2020-11-01 17:55 ` Jean Louis
2020-11-01 18:20   ` jai-bholeki
2020-11-01 18:25     ` Jean Louis
2020-11-01 18:40       ` Stefan Kangas
2020-11-01 18:48         ` Jean Louis
2020-11-01 18:53           ` jai-bholeki
2020-11-01 19:02             ` Drew Adams
2020-11-01 19:03               ` Drew Adams
2020-11-01 19:19                 ` jai-bholeki

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.