From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pierre Rouleau Newsgroups: gmane.emacs.help Subject: Re: Getting substring Date: Thu, 17 Aug 2023 08:37:02 -0400 Message-ID: References: <9fm604dCSvQkhO587DywcXOS5jONHikAYJ4WtrWnM8ZR89XF9PXE6TEG0R852J8kUWBUoxIWk6oZZcbgG7kgVG5jcX_UlCMSlESsIeywEhw=@protonmail.com> <3Ib3MaXSJe_ADwtMJwdXW7srSPXc8MY12cMtwL48iSjE6QV010b8LWdO_uToUBzF-dqjEje0HzPXKEP9cAJzjvh54V-RA1YQoVNf01wVW5k=@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5592"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 17 14:37:58 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qWcGD-0001Bc-Bt for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 17 Aug 2023 14:37:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWcFc-0002XD-TI; Thu, 17 Aug 2023 08:37:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWcFa-0002VK-B7 for help-gnu-emacs@gnu.org; Thu, 17 Aug 2023 08:37:19 -0400 Original-Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWcFX-0004oP-ER for help-gnu-emacs@gnu.org; Thu, 17 Aug 2023 08:37:18 -0400 Original-Received: by mail-vs1-xe33.google.com with SMTP id ada2fe7eead31-4476a2a5bc9so3035728137.2 for ; Thu, 17 Aug 2023 05:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692275834; x=1692880634; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NHEPnfbpnHhiOxXvv40TwlRnsSl7pjy4sHy4jNdfRNE=; b=WfFZ6+7AltwikmK1AftNnRFFaiOe0q1Ic9yYhfOISvH+giQoFca228MLEdg1VW0TN+ Za+hlq77VQObCRZz6bJ+UIBTQ/oEuyicvBklHHCus0szohQOt/QKaWKloTSWy/mquDsg oqNnAcuBmiWvKERRHnbjFZH8h27TW9FRs2jAHY4SbW48jiCeZVm0oIpaTNy7IL35f0ji KTicAoCoYZUFGIsL/PoqcCbkQLHMLFnIX/1T0EGrFDrtWe9mcWWntPdY4lMqSlQ51v5P fe3X02ZmAOhdwEvK3oKDu+lFkfphM3V5d16dkakkdNHlBk5OJ/iu6dqQmK/KHsoWmtvQ QgJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692275834; x=1692880634; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NHEPnfbpnHhiOxXvv40TwlRnsSl7pjy4sHy4jNdfRNE=; b=J1bTOaFnoUMVXJGYcd1v4vgNiUxvKtCGMhjLMO5K1GF3G6j4FzJXQ8hDzcuQZM94cK TXINnDLzb4UaAgUc+mXnfNQNzCSbMwsz2z1W5E8/C8RTysz2HOORSwEWszCNKNKBwGA+ qbXWqp+XGgi3tAFfb8x8r3RQMcjFh15x3jye5MCdDAMrHZS/Jh5CoUElKHzdO8lioF1e 4ZqJhSEua8Kcq6LoHyRDQU2Wx2jRF4JZXzCI6o/ZOxbUU7jGtinLpSDs3mXDJTsrOoC7 BbhzFt49r5He7hCg7l1ZnXnUPA16FtymiNHQ47H6FarSy3nGTVyCmlA4wZhtuTrYDzBC 8LiQ== X-Gm-Message-State: AOJu0Yy4Bdo2ovMVFOs3aTuhkLBUrOlxl5+Dts6XjNaPqBnfsq4W0TQC PAvLUJVfQqcuvxLBU+WHfx1xxn0//1EvDaujoj6K4hK08yA= X-Google-Smtp-Source: AGHT+IHcUu76gnlUpT1BZZT2deLfaS1enQZOKFsFTYqlyaeKgTie1wAVKXk218PC6s9jVY/mgeQkC+WQkzqCPYdWjSY= X-Received: by 2002:a67:eb43:0:b0:445:1ede:4e7d with SMTP id x3-20020a67eb43000000b004451ede4e7dmr3910390vso.21.1692275834057; Thu, 17 Aug 2023 05:37:14 -0700 (PDT) In-Reply-To: <3Ib3MaXSJe_ADwtMJwdXW7srSPXc8MY12cMtwL48iSjE6QV010b8LWdO_uToUBzF-dqjEje0HzPXKEP9cAJzjvh54V-RA1YQoVNf01wVW5k=@protonmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::e33; envelope-from=prouleau001@gmail.com; helo=mail-vs1-xe33.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:144858 Archived-At: Heime, reading the following might help - https://www.gnu.org/software/emacs/manual/html_node/elisp/pcase-Macro.htm= l - https://www.emacswiki.org/emacs/PatternMatching On Wed, Aug 16, 2023 at 11:16=E2=80=AFPM Heime = wrote: > > > > > > Sent with Proton Mail secure email. > > ------- Original Message ------- > On Thursday, August 17th, 2023 at 3:07 PM, Pierre Rouleau < > prouleau001@gmail.com> wrote: > > > > Heime, > > > > I think you need to learn a little bit of Emacs Lisp, or Lisp. Read a > book > > on Lisp to get you going. Asking questions like you do won't help you > > much. You first need to understand LIsp and the way it deals with > > functions, the concepts. > > > > LISPcraft from Robert Wilensky is old (1984) but small and it covers th= e > > basics which apply to Emacs Lisp. It's a nice read and the book is > > relatively small. > > The error message (wrong-type-argument listp "bigoplus"), suggests that > the code > expects a list argument but is receiving a string instead. > > Doing C-h f pcase says > > (pcase EXP &rest CASES) > > Evaluate EXP to get EXPVAL; try passing control to one of CASES. > > Does not specify whether EXP is a string or whatever. > > > On Wed, Aug 16, 2023 at 11:01=E2=80=AFPM Heime heimeborgia@protonmail.c= om wrote: > > > > > Sent with Proton Mail secure email. > > > > > > ------- Original Message ------- > > > On Thursday, August 17th, 2023 at 2:52 PM, Heime < > > > heimeborgia@protonmail.com> wrote: > > > > > > > Sent with Proton Mail secure email. > > > > > > > > ------- Original Message ------- > > > > On Thursday, August 17th, 2023 at 2:33 PM, Pierre Rouleau > > > > prouleau001@gmail.com wrote: > > > > > > > > > I mean, > > > > > Executing : > > > > > > > > > > > (setq str "bigoplus =E2=A8=81=EF=B8=81") > > > > > > (message "%s TEST: " (car (split-string str))) > > > > > > > > > > prints bigoplus. > > > > > > > > > > but > > > > > > > > > > (message "%s TEST: " (car (split-string grafm))) > > > > > > > > > > will depend of what grafm holds. > > > > > > > > > > On Wed, Aug 16, 2023 at 10:30=E2=80=AFPM Pierre Rouleau > prouleau001@gmail.com > > > > > > > > > > wrote: > > > > > > > > > > > Why does the following not print the first word? > > > > > > > > > > > > > (message "%s TEST: " (car (split-string grafm))) > > > > > > > > > > > > Are you sure it does not print it? It prints bigoplus for me. > > > > > > You can also look into the 'Message' buffer to see what was > printed > > > > > > by > > > > > > the message function. - Pierre > > > > > > > > I now realise my mistake of putting "%s" before "TEST". I was thus > doing > > > > things > > > > correctly after all. > > > > > > > > The command (car (split-string grafm)) also works if there are no > spaces > > > > in > > > > 'grafm', it still returns the string as a first element in the list > > > > result. > > > > > > Have started to wonder whether the following is wrong to do > > > > > > (setq grafm "bigoplus =E2=A8=81=EF=B8=81") > > > (pcase (car (split-string grafm)) > > > "bigoplus" ("Detected bigoplus")) > > > > > > It is not a string. > > > > > > -- > > /Pierre > --=20 /Pierre