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: Patch for fixing "straigh-quote" case Date: Tue, 22 Oct 2019 19:40:38 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000091978d059588535d" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="183418"; 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 01:41:32 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 1iN3mM-000lZ8-6G for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Oct 2019 01:41:30 +0200 Original-Received: from localhost ([::1]:49032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iN3mK-00078Z-3Z for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Oct 2019 19:41:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35374) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iN3lw-00076T-2g for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 19:41:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iN3lu-0007C0-G5 for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 19:41:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51799) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iN3lu-0007Bw-Ch for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 19:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iN3lu-0003RX-7D for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 19:41: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: Tue, 22 Oct 2019 23:41: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.157178764213195 (code B ref 21922); Tue, 22 Oct 2019 23:41:02 +0000 Original-Received: (at 21922) by debbugs.gnu.org; 22 Oct 2019 23:40:42 +0000 Original-Received: from localhost ([127.0.0.1]:60620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iN3lZ-0003Ql-OR for submit@debbugs.gnu.org; Tue, 22 Oct 2019 19:40:42 -0400 Original-Received: from mail-qk1-f173.google.com ([209.85.222.173]:37389) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iN3lX-0003QX-G4 for 21922@debbugs.gnu.org; Tue, 22 Oct 2019 19:40:39 -0400 Original-Received: by mail-qk1-f173.google.com with SMTP id u184so18096348qkd.4 for <21922@debbugs.gnu.org>; Tue, 22 Oct 2019 16:40: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=PT+6trWEAZR4vq/UoBet4F3DqwK3OOMfOV48bbh+VsE=; b=fn8eSW08OpZmEsvCO8H7RECYsB6sJ9byZR5weSpqJ6AzvSiEaxOEFm/DVnWqBUUEKc nNwL4qtQUbq7+lM1qw2hTeChvWAPmH4pFkDLW2zFsYXVy619vFtF0265Wrl1uUCmtNA+ +lrua4/lqLR7h7Sw2Zobz2gLu/FzBhx7ofElTuHY3jWcfmJKYwpqQA8izK+Z4bTncq+j utDqBuFytQyMLXRk3eD/O4vDZfimSfuqaYClLyHiAsFZVgXT0TW0wkahO+l+PRUfSwpj 7JN4Z7TPMi+CBdJ8ylAzTFouVNIHKmMSiyP+kQofS5dRjXEiuNI8iDA/sOyzodUYR8TI dZnA== 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=PT+6trWEAZR4vq/UoBet4F3DqwK3OOMfOV48bbh+VsE=; b=BFyb12sTuZ5gEiYxEHs9Ojj3xrAI0ucWlFppxmr7+f/DBsclQK+pPEnugqTWXsXmI+ mqgC03rs1J2X3sSkRQiotFrud1bUabNXYYrrhRdCA3RVwncewE72yH2E4iJ3ZuyPbtvx LpFDRaoDLyB6RJvJmxaMs43f/HWFWaOPX7BKGA9KIrnSJZEH9yKwgHiVWNZtBPkoEHcy uILEIziRWEmxKeJ/fiVzCQr7PHTz9C4zegBEuzkihOsOEVXkm2WibWiKf16ySBOPcUXA FB78BKyS6lSNzU7ViiocgP5O4KmrybsqfQaEbC52QPMLGxmTOjItulKmUPn3syuUHe/r HnbQ== X-Gm-Message-State: APjAAAV26qvnua7q0KZrJQcRVQJvbIUNlekgHjwVFChnLpMzEqVicH1b 72wGswtOIJRpoeMj5C5wlQCAsff4QfDkaCmj6BQ4ogPh X-Google-Smtp-Source: APXvYqzwMBqomyWaFBa1KxkXyxqsZf87wkOuhWKGhe95exvC5/DKICxW23mkNV+hllJ3Pum6Cc9ggAHMCoEo/xqRE3c= X-Received: by 2002:a37:5d06:: with SMTP id r6mr5676457qkb.16.1571787633693; Tue, 22 Oct 2019 16:40: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:170016 Archived-At: --00000000000091978d059588535d Content-Type: text/plain; charset="UTF-8" ---------- Forwarded message --------- From: Luis Henriquez-Perez Date: Tue, Oct 22, 2019 at 7:38 PM Subject: Patch for fixing "straigh-quote" case To: <21922@debbug.org> 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: Thanks for your suggestions. Here's what the relevant sectiion of code would look like. (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:]]*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))) 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\\>")? 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 ). Not sure if this will be a problem though, what do you think? --00000000000091978d059588535d 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 7:38 PM
Su= bject: Patch for fixing "straigh-quote" case
To: <21922@debbug.org>


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:

Thanks for your suggestions.

Here's what the rele= vant sectiion of code would look like.

(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 (nrevers= e (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 (o= r (eq (char-before point) ?')
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(goto-char (1+ point))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(look= ing-at-p "[[:space:]]*quote\\>")))))
=C2=A0 =C2=A0 =C2=A0 q= uoted-p))
=C2=A0 =C2=A0 ;; Containing sexp has nothing before this line<= br>=C2=A0 =C2=A0 ;; except the first element.=C2=A0 Indent under that eleme= nt.
=C2=A0 =C2=A0 nil
=C2=A0 ;; Skip the first element, find start of= second (the first
=C2=A0 ;; argument of the function call) and indent u= nder.
=C2=A0 (progn (forward-sexp 1)
=C2=A0 =C2=A0(parse-partial-sexp= (point)
=C2=A0 =C2=A0 calculate-lisp-indent-last-sexp
=C2=A0 =C2=A0 = 0 t)))

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

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 (<= a href=3D"https://emacs.stackexchange.com/questions/40911/why-do-regexp-tha= t-matches-text-in-buffer-does-not-necessarily-match-same-text" target=3D"_b= lank">see this issue). Not sure if this will be a problem though, what = do you think?
--00000000000091978d059588535d--