From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Luis Henriquez-Perez Newsgroups: gmane.emacs.bugs Subject: bug#21922: Fwd: bug#21922: Fwd: Patch for fixing "straigh-quote" case Date: Tue, 22 Oct 2019 20:42:38 -0400 Message-ID: References: <871rv4e3gk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000004be3ae05958931ba" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="156557"; mail-complaints-to="usenet@blaine.gmane.org" To: 21922@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 23 02:43:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iN4k5-000eZi-6s for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Oct 2019 02:43:13 +0200 Original-Received: from localhost ([::1]:49866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iN4k3-0003xq-Ds for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Oct 2019 20:43:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38999) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iN4jw-0003xP-AA for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 20:43:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iN4ju-0000PL-Ne for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 20:43:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51849) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iN4ju-0000PB-CJ for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 20:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iN4ju-0006yt-8F for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 20:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Luis Henriquez-Perez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Oct 2019 00:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21922 X-GNU-PR-Package: emacs Original-Received: via spool by 21922-submit@debbugs.gnu.org id=B21922.157179136126807 (code B ref 21922); Wed, 23 Oct 2019 00:43:02 +0000 Original-Received: (at 21922) by debbugs.gnu.org; 23 Oct 2019 00:42:41 +0000 Original-Received: from localhost ([127.0.0.1]:60670 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iN4jZ-0006yI-8k for submit@debbugs.gnu.org; Tue, 22 Oct 2019 20:42:41 -0400 Original-Received: from mail-qt1-f176.google.com ([209.85.160.176]:43932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iN4jX-0006y6-GW for 21922@debbugs.gnu.org; Tue, 22 Oct 2019 20:42:40 -0400 Original-Received: by mail-qt1-f176.google.com with SMTP id t20so29749492qtr.10 for <21922@debbugs.gnu.org>; Tue, 22 Oct 2019 17:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=5ZBDflZwi9dUOarkZ6D0R3kekP72ptF1uQVZkCFbuTI=; b=QA6k+X/AsEYkKN0y+fQ5csYoNi4XLq74QVPa8RrxNMcWcLEtmUtbk0mfDxyB/hZv6C j62elvMQqSPrInya60pfWRwgEHxYr2pSpJN1CQEQdA1CMpRqEIkrC/YXkSFHLX+Z8duK zlp5EveF8mbqV4hMRINQebId3RvDBRCejHyFjKuE2NcPbkVIyH/7Ka92dKVL2Bq1KzBH DBXMkxakBJJTRUWycffs27smNu0HZHBPQQgabP68hVtNYtQIsLNd/EKBt4ut4gAQJXlb snQV3j9za1LRTb9udPhmIAfA7CMpdG7WPAEWoKdMU+siRfesuc41GQRsQqZk29u7t3Ku TTtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=5ZBDflZwi9dUOarkZ6D0R3kekP72ptF1uQVZkCFbuTI=; b=BgC5+BN9bB2eAwD4zETHgsQhOuf9OYLEN+uMPG/N1varbs0AGeP6PoszNIs5YHeNkZ 7p4ABRqZ/hHsJE+Dw6uZRCyOkRNoposlpr00pYFlDk0ycvZdPDiLDDAptQHlLF4rVy07 DfEq0rYKM9Lh/dScVy0n0/Yn8JF4Huq8iYXpOg0PGezlpCvu8HK9tTglmbOq26y0DPnE ydEP3VjDnmIpVkdwv2eXfOZtSawSc682wLiADYVBomeZlwLLVEz2zxIkD7BEnsF7Ibec FxnkbThmw1X/3v1ariiH2F3IVcE0csdnuJaKXjKSClZnP+f2eQpMl2u7SG+xxMtzmr3w wYWA== X-Gm-Message-State: APjAAAU3ToCjD+BIt0g3WNyfB/Bhro/yGOcLCTeI92VN1LaBK/bmZwWn gsmGlyCupTRg/ykOySjlB79pBPsLDQtIkMzMVq39giWx X-Google-Smtp-Source: APXvYqyTcekEKgBJwTCsa5/OTAEevHJLT0v5biDTEdsyQXOZ95vSH5wShF5cdDPTF+w8dNWMAZRXMc3gxzyoBiSf4R8= X-Received: by 2002:ac8:470e:: with SMTP id f14mr5756087qtp.106.1571791353667; Tue, 22 Oct 2019 17:42:33 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:170022 Archived-At: --0000000000004be3ae05958931ba Content-Type: text/plain; charset="UTF-8" ---------- Forwarded message --------- From: Luis Henriquez-Perez Date: Tue, Oct 22, 2019 at 8:41 PM Subject: Re: bug#21922: Fwd: Patch for fixing "straigh-quote" case To: Noam Postavsky >> I did see your message. Ok, take your time. I just wanted to make sure I sent this to the right place. >> I meant to say (looking-at-p "[[:space:]\n]*quote\\_>") I changed "[[:space:]\n]" -> "[[:space:]]\n" because I think that's what you meant. I posted the result of these change at the bottom of this reply. I'm new to contributing patches. Is there anything else I need to do to get this into emacs? ```elisp (if (or (= (point) calculate-lisp-indent-last-sexp) (eq (char-after (1+ containing-sexp)) ?:) (eq (char-before containing-sexp) ?') (let ((quoted-p nil) (point nil) (positions (nreverse (butlast (elt state 9))))) (save-excursion (while (and positions (not quoted-p)) (setq point (pop positions)) (setq quoted-p (or (eq (char-before point) ?') (goto-char (1+ point)) (looking-at-p "[[:space:]]\n*quote\\_>"))))) quoted-p)) ;; Containing sexp has nothing before this line ;; except the first element. Indent under that element. nil ;; Skip the first element, find start of second (the first ;; argument of the function call) and indent under. (progn (forward-sexp 1) (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t))) ``` On Tue, Oct 22, 2019 at 7:59 PM Noam Postavsky wrote: > Luis Henriquez-Perez writes: > > > I replied to your personal email instead of this thread. I thought maybe > my > > replies had not been seen (and also that this should be recorded in the > > thread). So this is what I had said: > > I did you see your messages, just haven't had so much time for handling > Emacs bugs recently. I was going to forward it to the list before > replying, so thanks for doing that. > > > question 1: > > I get an `unknown posix character class` error when I try (looking-at-p > > "[[:whitespace:]\n]*quote\_>"). Did you mean to use [[:space:]] instead? > > Did you mean: (looking-at-p "[[:space:]]*quote\\>")? > > I mixed things up a bit, I meant to say > > (looking-at-p "[[:space:]\n]*quote\\_>") > > The "\n" is needed because it typically has comment-ender syntax instead > of space syntax. "\\>" matches end of word, "\\_>" is end of symbol. > > > question 2: > > The reason I used explicit whitespace character is because matches for > > character classes like [[:space:]] are dependent on the active syntax > table > > in the buffer (see this issue > > < > https://emacs.stackexchange.com/questions/40911/why-do-regexp-that-matches-text-in-buffer-does-not-necessarily-match-same-text > >). > > Not sure if this will be a problem though, what do you think? > > I think relying on the mode's syntax table makes sense, though it > probably doesn't matter a whole lot either way. > --0000000000004be3ae05958931ba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


---------- Forwarded message ---------
From: Luis Henriquez-Perez <luishenrique= zperez@gmail.com>
Date: Tue, Oct 22, 2019 at 8:41 PM
Su= bject: Re: bug#21922: Fwd: Patch for fixing "straigh-quote" case<= br>To: Noam Postavsky <npostavs@gm= ail.com>



>> I did see yo= ur message.

Ok, take your time. I just wanted to make sure I sent th= is to the right place.

>> I meant to say (looking-at-p "[= [:space:]\n]*quote\\_>")

I changed "[[:space:]\n]"= -> "[[:space:]]\n" because I think that's what you meant.=


I posted the result of these change at the bottom of this reply= .

I'm new to contributing patches. Is there anything else I need= to do to get this
into emacs?

```elisp
(if (or
=C2=A0 =C2= =A0 =C2=A0(=3D (point) calculate-lisp-indent-last-sexp)

=C2=A0 =C2= =A0 =C2=A0(eq (char-after (1+ containing-sexp)) ?:)

=C2=A0 =C2=A0 = =C2=A0(eq (char-before containing-sexp) ?')

=C2=A0 =C2=A0 =C2=A0= (let ((quoted-p nil)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(point nil= )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(positions (nreverse (butlast= (elt state 9)))))
=C2=A0 =C2=A0 =C2=A0 (save-excursion
=C2=A0 =C2=A0= =C2=A0 =C2=A0 (while (and positions (not quoted-p))
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(setq point (pop positions))
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(setq quoted-p
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or (eq (cha= r-before point) ?')
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-c= har (1+ point))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(looking-at-p &= quot;[[:space:]]\n*quote\\_>")))))
=C2=A0 =C2=A0 =C2=A0 quoted-p= ))
=C2=A0 =C2=A0 ;; Containing sexp has nothing before this line
=C2= =A0 =C2=A0 ;; except the first element.=C2=A0 Indent under that element.=C2=A0 =C2=A0 nil
=C2=A0 ;; Skip the first element, find start of secon= d (the first
=C2=A0 ;; argument of the function call) and indent under.<= br>=C2=A0 (progn (forward-sexp 1)
=C2=A0 =C2=A0(parse-partial-sexp (poin= t)
=C2=A0 =C2=A0 calculate-lisp-indent-last-sexp
=C2=A0 =C2=A0 0 t)))=
```

On Tue, Oct 22, 2019 at 7:59 PM Noam Postavsky <npostavs@gmail.com>= ; wrote:
Luis He= nriquez-Perez <luishenriquezperez@gmail.com> writes:

> I replied to your personal email instead of this thread. I thought may= be my
> replies had not been seen (and also that this should be recorded in th= e
> thread). So this is what I had said:

I did you see your messages, just haven't had so much time for handling=
Emacs bugs recently.=C2=A0 I was going to forward it to the list before
replying, so thanks for doing that.

> question 1:
> I get an `unknown posix character class` error when I try (looking-at-= p
> "[[:whitespace:]\n]*quote\_>").=C2=A0 Did you mean to use= [[:space:]] instead?
> Did you mean:=C2=A0 (looking-at-p "[[:space:]]*quote\\>")= ?

I mixed things up a bit, I meant to say

=C2=A0 =C2=A0 (looking-at-p "[[:space:]\n]*quote\\_>")

The "\n" is needed because it typically has comment-ender syntax = instead
of space syntax.=C2=A0 "\\>" matches end of word, "\\_>= ;" is end of symbol.

> question 2:
> The reason I used explicit whitespace character is because matches for=
> character classes like [[:space:]] are dependent on the active syntax = table
> in the buffer (see this issue
> <https://emacs.stackexchange.com/question= s/40911/why-do-regexp-that-matches-text-in-buffer-does-not-necessarily-matc= h-same-text>).
> Not sure if this will be a problem though, what do you think?

I think relying on the mode's syntax table makes sense, though it
probably doesn't matter a whole lot either way.
--0000000000004be3ae05958931ba--