GNU bug report logs -
#21922
Indentation of Emacs Lisp list constants is surprising
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
---------- Forwarded message ---------
From: Luis Henriquez-Perez <luishenriquezperez <at> gmail.com>
Date: Tue, Oct 22, 2019 at 8:41 PM
Subject: Re: bug#21922: Fwd: Patch for fixing "straigh-quote" case
To: Noam Postavsky <npostavs <at> gmail.com>
>> 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 <npostavs <at> gmail.com> wrote:
> Luis Henriquez-Perez <luishenriquezperez <at> gmail.com> 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.
>
[Message part 2 (text/html, inline)]
This bug report was last modified 3 years and 168 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.