all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* String length 13 characters made of blank spaces
@ 2020-10-30  3:53 Christopher Dimech
  2020-10-30  5:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christopher Dimech @ 2020-10-30  3:53 UTC (permalink / raw)
  To: Help Gnu Emacs


Can one do the following to have a string length 13 characters
made of blank spaces, or is it better to use some other construct?

(make-string 13 ? )



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

* Re: String length 13 characters made of blank spaces
  2020-10-30  3:53 String length 13 characters made of blank spaces Christopher Dimech
@ 2020-10-30  5:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-30  8:05 ` Joost Kremers
  2020-10-30  8:12 ` tomas
  2 siblings, 0 replies; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-30  5:41 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech wrote:

> Can one do the following to have a string length 13 characters made
> of blank spaces, or is it better to use some other construct?
>
> (make-string 13 ? )

Ask Mats Sundin. I think it's only an unlucky number if you are
a goalie.

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




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

* Re: String length 13 characters made of blank spaces
  2020-10-30  3:53 String length 13 characters made of blank spaces Christopher Dimech
  2020-10-30  5:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-30  8:05 ` Joost Kremers
  2020-10-30  8:13   ` tomas
  2020-11-02 22:34   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-30  8:12 ` tomas
  2 siblings, 2 replies; 6+ messages in thread
From: Joost Kremers @ 2020-10-30  8:05 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: help-gnu-emacs


On Fri, Oct 30 2020, Christopher Dimech wrote:
> Can one do the following to have a string length 13 characters
> made of blank spaces, or is it better to use some other construct?
>
> (make-string 13 ? )

A space character can also be represented as `?\s`, which is better because the
space after the question mark can easily be overlooked. (See (info "(elisp)
Basic Char Syntax") for details.)

Other than that, though, `make-string` is the right function for the job, I'd
say.

-- 
Joost Kremers
Life has its moments



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

* Re: String length 13 characters made of blank spaces
  2020-10-30  3:53 String length 13 characters made of blank spaces Christopher Dimech
  2020-10-30  5:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-30  8:05 ` Joost Kremers
@ 2020-10-30  8:12 ` tomas
  2 siblings, 0 replies; 6+ messages in thread
From: tomas @ 2020-10-30  8:12 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 849 bytes --]

On Fri, Oct 30, 2020 at 04:53:37AM +0100, Christopher Dimech wrote:
> 
> Can one do the following to have a string length 13 characters
> made of blank spaces, or is it better to use some other construct?
> 
> (make-string 13 ? )

That's perfectly fine. For that one character, it is customary
to escape it (i.e. to spell it out as "?\ ". For one, that makes
the space more visible, and then, you need the escape in the
cases where the character has a special meaning (try making a
string of thirteen open parentheses, for example).

Since the escape works always, you get a more consistent (and
arguably, readable) result by always putting a "\" there, i.e.
?\a instead of the equivalent ?a.

But just a matter of taste. In the case of space, since it's
nearly invisible, could send your readers into a tailspin.

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: String length 13 characters made of blank spaces
  2020-10-30  8:05 ` Joost Kremers
@ 2020-10-30  8:13   ` tomas
  2020-11-02 22:34   ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 6+ messages in thread
From: tomas @ 2020-10-30  8:13 UTC (permalink / raw)
  To: Joost Kremers; +Cc: Christopher Dimech, help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

On Fri, Oct 30, 2020 at 09:05:32AM +0100, Joost Kremers wrote:
> 
> On Fri, Oct 30 2020, Christopher Dimech wrote:
> > Can one do the following to have a string length 13 characters
> > made of blank spaces, or is it better to use some other construct?
> >
> > (make-string 13 ? )
> 
> A space character can also be represented as `?\s` [...]

D'oh, yes. Much better, thanks.

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: String length 13 characters made of blank spaces
  2020-10-30  8:05 ` Joost Kremers
  2020-10-30  8:13   ` tomas
@ 2020-11-02 22:34   ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-11-02 22:34 UTC (permalink / raw)
  To: help-gnu-emacs

Joost Kremers wrote:

> A space character can also be represented as `?\s`, which is better
> because the space after the question mark can easily be overlooked.

Didn't know that, thanks. Yes, that looks better.

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




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

end of thread, other threads:[~2020-11-02 22:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-30  3:53 String length 13 characters made of blank spaces Christopher Dimech
2020-10-30  5:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-30  8:05 ` Joost Kremers
2020-10-30  8:13   ` tomas
2020-11-02 22:34   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-30  8:12 ` tomas

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.