From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Karl Voit Newsgroups: gmane.emacs.help Subject: Re: Elisp: help on string operations Date: Tue, 8 Nov 2016 18:36:01 +0100 Organization: www.karl-voit.at Message-ID: <2016-11-08T18-33-51@devnull.Karl-Voit.at> References: <2016-11-05T20-07-58@devnull.Karl-Voit.at> <87vavyxdjn.fsf@web.de> Reply-To: Karl Voit NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1478639924 27350 195.159.176.226 (8 Nov 2016 21:18:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 Nov 2016 21:18:44 +0000 (UTC) User-Agent: slrn/pre1.0.0-18 (Linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 08 22:18:40 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c4Dmj-00050I-9E for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Nov 2016 22:18:25 +0100 Original-Received: from localhost ([::1]:35558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4Dmm-0004x6-CB for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Nov 2016 16:18:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4AKj-000516-95 for help-gnu-emacs@gnu.org; Tue, 08 Nov 2016 12:37:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4AKg-00041l-2v for help-gnu-emacs@gnu.org; Tue, 08 Nov 2016 12:37:17 -0500 Original-Received: from [195.159.176.226] (port=43003 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c4AKf-00041V-Sl for help-gnu-emacs@gnu.org; Tue, 08 Nov 2016 12:37:14 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1c4AJq-0005zx-UU for help-gnu-emacs@gnu.org; Tue, 08 Nov 2016 18:36:22 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@blaine.gmane.org X-GPG-Key: http://www.Karl-Voit.at/Karl_Voit_GnuPG_public_key.gpg X-Registered-Linux-User: 224337 X-Confession: Pastafarian http://www.venganza.org/ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-Mailman-Approved-At: Tue, 08 Nov 2016 16:16:22 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111690 Archived-At: * Michael Heerdegen 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