unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Luis Henriquez-Perez <luishenriquezperez@gmail.com>
To: 21922@debbugs.gnu.org
Subject: bug#21922: Fwd: Patch for fixing "straigh-quote" case
Date: Tue, 22 Oct 2019 19:40:38 -0400	[thread overview]
Message-ID: <CAKVVwxfPtvcgh_ViiguPFEzRi7uxdNGTVmFUeNihQCra7OQ=6A@mail.gmail.com> (raw)
In-Reply-To: <CAKVVwxeE8TuHM4-sd6=dAo0Nr3OAU1xD_gxvzrNmLFVoEZY-XQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1950 bytes --]

---------- Forwarded message ---------
From: Luis Henriquez-Perez <luishenriquezperez@gmail.com>
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
<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?

[-- Attachment #2: Type: text/html, Size: 2695 bytes --]

       reply	other threads:[~2019-10-22 23:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKVVwxeE8TuHM4-sd6=dAo0Nr3OAU1xD_gxvzrNmLFVoEZY-XQ@mail.gmail.com>
2019-10-22 23:40 ` Luis Henriquez-Perez [this message]
2019-10-22 23:59   ` bug#21922: Fwd: Patch for fixing "straigh-quote" case Noam Postavsky
     [not found]     ` <CAKVVwxdAqLNG68P6scLKfNSCupCSB1Yc56qYxJuSrHckP=Jiag@mail.gmail.com>
2019-10-23  0:42       ` bug#21922: Fwd: " Luis Henriquez-Perez
2019-10-23  0:55         ` Noam Postavsky
     [not found]           ` <CAKVVwxfCgR6hzmX2O+XrfeeOO-i9ywSan=WLjhfbQ9QArrkqKA@mail.gmail.com>
2019-10-23  1:28             ` bug#21922: Fwd: " Luis Henriquez-Perez

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKVVwxfPtvcgh_ViiguPFEzRi7uxdNGTVmFUeNihQCra7OQ=6A@mail.gmail.com' \
    --to=luishenriquezperez@gmail.com \
    --cc=21922@debbugs.gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).