all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Karl Voit <devnull@Karl-Voit.at>
To: help-gnu-emacs@gnu.org
Subject: Re: Elisp: help on string operations
Date: Tue, 8 Nov 2016 18:36:01 +0100	[thread overview]
Message-ID: <2016-11-08T18-33-51@devnull.Karl-Voit.at> (raw)
In-Reply-To: 87vavyxdjn.fsf@web.de

* Michael Heerdegen <michael_heerdegen@web.de> wrote:
> Hello Karl,

Hallo Michael!

>> I'd like to get a "Sorry" message for (1). Easy, if only I know how to
>> count lines in strings (as opposed to buffers).
>
> You could use `with-temp-buffer', insert the string and do your work
> there.  Alternatively, go with `count-matches' or `split-string'.

Ah, so there are no string operations on strings in "memory" but
rather (lots of) string operations on strings in buffers. I see.

>>       (message (concat "result -> " result))
>
> To avoid that a dynamically computed argument of `message' gets
> interpreted with format specifier syntax considered, it's better to use
> it like
>
>         (message "%s" (compute-some-string-here))

Good point.

>>       (re-search-forward " \[\[.+\]\[" nil t 1)
>                              ^^^^^^^^^^ 
> That looks wrong.  You want to have a backslash char before the
> brackets.  But since backslash is an escape character in the read syntax
> of strings, you need to escape the backslash characters, which means
> you need to double the backslashes.

That's it, I see.

Man, I hate those different levels of escaping everywhere :-(

> Any questions left?

I got help from John Kitchin as well. So far I need to digest
everything I learned for now and try to come up with a solution that
works.

Danke!

-- 
All in all, one of the most disturbing things today is the definitive
fact that the NSA, GCHQ, and many more government organizations are
massively terrorizing the freedom of us and the next generations.
                                                  http://Karl-Voit.at




  reply	other threads:[~2016-11-08 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-05 19:17 Elisp: help on string operations Karl Voit
2016-11-08 14:16 ` Michael Heerdegen
2016-11-08 17:36   ` Karl Voit [this message]
2016-11-08 22:29     ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2016-11-08T18-33-51@devnull.Karl-Voit.at \
    --to=devnull@karl-voit.at \
    --cc=help-gnu-emacs@gnu.org \
    --cc=news1142@Karl-Voit.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.