all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Karl Voit <devnull@Karl-Voit.at>
Cc: Karl Voit <news1142@Karl-Voit.at>, help-gnu-emacs@gnu.org
Subject: Re: Elisp: help on string operations
Date: Tue, 08 Nov 2016 15:16:12 +0100	[thread overview]
Message-ID: <87vavyxdjn.fsf@web.de> (raw)
In-Reply-To: 2016-11-05T20-07-58@devnull.Karl-Voit.at

Hello Karl,

> 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'.


>       (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))


>       (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.

Any questions left?


Regards,

Michael.



  reply	other threads:[~2016-11-08 14:16 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 [this message]
2016-11-08 17:36   ` Karl Voit
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=87vavyxdjn.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=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.