all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Get second character from comment-start
@ 2024-08-12 19:47 Heime
  2024-08-13  5:15 ` Joel Reicher
  0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2024-08-12 19:47 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

I want to get the second character from comment-start.

Would one use (aref kmnt 1) ?

 (let* ( (kmnt (string-trim comment-start))   
         (lngt (length kmnt)
         (ankr (if (= lngt 2) 
                   (aref kmnt 1)
                 kmnt)) )







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

* Re: Get second character from comment-start
  2024-08-12 19:47 Get second character from comment-start Heime
@ 2024-08-13  5:15 ` Joel Reicher
  2024-08-13  8:10   ` Heime
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Reicher @ 2024-08-13  5:15 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

Heime <heimeborgia@protonmail.com> writes:

> I want to get the second character from comment-start.
>
> Would one use (aref kmnt 1) ?

Any reason not to do (aref ... 1)? Not sure what you're worried 
about.

Regards,

        - Joel



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

* Re: Get second character from comment-start
  2024-08-13  5:15 ` Joel Reicher
@ 2024-08-13  8:10   ` Heime
  2024-08-13 10:39     ` Joel Reicher
  0 siblings, 1 reply; 5+ messages in thread
From: Heime @ 2024-08-13  8:10 UTC (permalink / raw)
  To: Joel Reicher; +Cc: Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

On Tuesday, August 13th, 2024 at 5:15 PM, Joel Reicher <joel.reicher@gmail.com> wrote:

> Heime heimeborgia@protonmail.com writes:
> 
> > I want to get the second character from comment-start.
> > 
> > Would one use (aref kmnt 1) ?
> 
> 
> Any reason not to do (aref ... 1)? Not sure what you're worried
> about.  - Joel

What is the standard way of capturing characters from strings, is it with aref ?



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

* Re: Get second character from comment-start
  2024-08-13  8:10   ` Heime
@ 2024-08-13 10:39     ` Joel Reicher
  2024-08-13 13:36       ` uzibalqa
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Reicher @ 2024-08-13 10:39 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

Heime <heimeborgia@protonmail.com> writes:

> On Tuesday, August 13th, 2024 at 5:15 PM, Joel Reicher 
> <joel.reicher@gmail.com> wrote:
>
>> Any reason not to do (aref ... 1)? Not sure what you're worried 
>> about.
>
> What is the standard way of capturing characters from strings, 
> is it with aref ?

I don't know what makes something "standard" for you. As covered 
in (info "(elisp) String Basics") a string is an array, and as 
covered in (info "(elisp) Array Functions"), aref can be used to 
fetch an element of an array.

And as a random sample of some core code, aref is used 17 times in 
files.el from what I can see.

Cheers,

        - Joel



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

* Re: Get second character from comment-start
  2024-08-13 10:39     ` Joel Reicher
@ 2024-08-13 13:36       ` uzibalqa
  0 siblings, 0 replies; 5+ messages in thread
From: uzibalqa @ 2024-08-13 13:36 UTC (permalink / raw)
  To: Joel Reicher; +Cc: Heime, Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

On Tuesday, August 13th, 2024 at 10:39 PM, Joel Reicher <joel.reicher@gmail.com> wrote:

> Heime heimeborgia@protonmail.com writes:
> 
> > On Tuesday, August 13th, 2024 at 5:15 PM, Joel Reicher
> > joel.reicher@gmail.com wrote:
> > 
> > > Any reason not to do (aref ... 1)? Not sure what you're worried
> > > about.
> > 
> > What is the standard way of capturing characters from strings,
> > is it with aref ?
> 
> 
> I don't know what makes something "standard" for you. As covered
> in (info "(elisp) String Basics") a string is an array, and as
> covered in (info "(elisp) Array Functions"), aref can be used to
> fetch an element of an array.
> 
> And as a random sample of some core code, aref is used 17 times in
> files.el from what I can see.  - Joel

I shall use aref as already done



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

end of thread, other threads:[~2024-08-13 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-12 19:47 Get second character from comment-start Heime
2024-08-13  5:15 ` Joel Reicher
2024-08-13  8:10   ` Heime
2024-08-13 10:39     ` Joel Reicher
2024-08-13 13:36       ` uzibalqa

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.