* bug#21922: Fwd: Patch for fixing "straigh-quote" case [not found] <CAKVVwxeE8TuHM4-sd6=dAo0Nr3OAU1xD_gxvzrNmLFVoEZY-XQ@mail.gmail.com> @ 2019-10-22 23:40 ` Luis Henriquez-Perez 2019-10-22 23:59 ` Noam Postavsky 0 siblings, 1 reply; 5+ messages in thread From: Luis Henriquez-Perez @ 2019-10-22 23:40 UTC (permalink / raw) To: 21922 [-- 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 --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#21922: Fwd: Patch for fixing "straigh-quote" case 2019-10-22 23:40 ` bug#21922: Fwd: Patch for fixing "straigh-quote" case Luis Henriquez-Perez @ 2019-10-22 23:59 ` Noam Postavsky [not found] ` <CAKVVwxdAqLNG68P6scLKfNSCupCSB1Yc56qYxJuSrHckP=Jiag@mail.gmail.com> 0 siblings, 1 reply; 5+ messages in thread From: Noam Postavsky @ 2019-10-22 23:59 UTC (permalink / raw) To: Luis Henriquez-Perez; +Cc: 21922 Luis Henriquez-Perez <luishenriquezperez@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. ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CAKVVwxdAqLNG68P6scLKfNSCupCSB1Yc56qYxJuSrHckP=Jiag@mail.gmail.com>]
* bug#21922: Fwd: bug#21922: Fwd: Patch for fixing "straigh-quote" case [not found] ` <CAKVVwxdAqLNG68P6scLKfNSCupCSB1Yc56qYxJuSrHckP=Jiag@mail.gmail.com> @ 2019-10-23 0:42 ` Luis Henriquez-Perez 2019-10-23 0:55 ` Noam Postavsky 0 siblings, 1 reply; 5+ messages in thread From: Luis Henriquez-Perez @ 2019-10-23 0:42 UTC (permalink / raw) To: 21922 [-- Attachment #1: Type: text/plain, Size: 3079 bytes --] ---------- Forwarded message --------- From: Luis Henriquez-Perez <luishenriquezperez@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@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@gmail.com> wrote: > Luis Henriquez-Perez <luishenriquezperez@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. > [-- Attachment #2: Type: text/html, Size: 4452 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#21922: Fwd: bug#21922: Fwd: Patch for fixing "straigh-quote" case 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> 0 siblings, 1 reply; 5+ messages in thread From: Noam Postavsky @ 2019-10-23 0:55 UTC (permalink / raw) To: Luis Henriquez-Perez; +Cc: 21922 Luis Henriquez-Perez <luishenriquezperez@gmail.com> writes: >>> I meant to say (looking-at-p "[[:space:]\n]*quote\\_>") > > I changed "[[:space:]\n]" -> "[[:space:]]\n" because I think that's what > you meant. No, this time I actually managed to write what I meant :) "[[:space:]\n]*" will match any number of whitespace-syntax or newline characters, whereas "[[:space:]]\n*" will match exactly one whitespace-syntax character, followed by any number of newlines. > I'm new to contributing patches. Is there anything else I need to do > to get this into emacs? It would be more convenient to have your change as a patch, rather than just the resulting code. If you have the Emacs git repo, committing locally and attaching the result of 'git format-patch' as described in CONTRIBUTE would be the best way. Otherwise, even just the output of diff -u lisp/emacs-lisp/lisp-mode.el.original lisp/emacs-lisp/lisp-mode.el would be helpful. Oh, and adding a test to test/lisp/emacs-lisp/lisp-mode-tests.el would be good as well (e.g., to catch mistakes like using "[[:space:]]\n*" instead of "[[:space:]\n]*"). ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CAKVVwxfCgR6hzmX2O+XrfeeOO-i9ywSan=WLjhfbQ9QArrkqKA@mail.gmail.com>]
* bug#21922: Fwd: bug#21922: Fwd: bug#21922: Fwd: Patch for fixing "straigh-quote" case [not found] ` <CAKVVwxfCgR6hzmX2O+XrfeeOO-i9ywSan=WLjhfbQ9QArrkqKA@mail.gmail.com> @ 2019-10-23 1:28 ` Luis Henriquez-Perez 0 siblings, 0 replies; 5+ messages in thread From: Luis Henriquez-Perez @ 2019-10-23 1:28 UTC (permalink / raw) To: 21922 [-- Attachment #1: Type: text/plain, Size: 2074 bytes --] ---------- Forwarded message --------- From: Luis Henriquez-Perez <luishenriquezperez@gmail.com> Date: Tue, Oct 22, 2019 at 9:27 PM Subject: Re: bug#21922: Fwd: bug#21922: Fwd: Patch for fixing "straigh-quote" case To: Noam Postavsky <npostavs@gmail.com> >> No, this time I ... managed to write what I meant. Oh ok. I learned something new. I had thought that the whitespace syntax needed two pairs of square brackets surrounding it. So I didn't think "[[:space:]\n]" was legal. I thought it had to be written as "[[[:space:]]\n]". After testing it I see that you're right. What you have is what (rx (any space "\n")) returns. >> It would be more convenient to have your change as a patch >> ... adding a test ... would be good as well. Ok I'll set about doing these things and reply to this thread again when I'm done. On Tue, Oct 22, 2019 at 8:55 PM Noam Postavsky <npostavs@gmail.com> wrote: > Luis Henriquez-Perez <luishenriquezperez@gmail.com> writes: > > >>> I meant to say (looking-at-p "[[:space:]\n]*quote\\_>") > > > > I changed "[[:space:]\n]" -> "[[:space:]]\n" because I think that's what > > you meant. > > No, this time I actually managed to write what I meant :) > > "[[:space:]\n]*" will match any number of whitespace-syntax or newline > characters, whereas "[[:space:]]\n*" will match exactly one > whitespace-syntax character, followed by any number of newlines. > > > I'm new to contributing patches. Is there anything else I need to do > > to get this into emacs? > > It would be more convenient to have your change as a patch, rather than > just the resulting code. If you have the Emacs git repo, committing > locally and attaching the result of 'git format-patch' as described in > CONTRIBUTE would be the best way. Otherwise, even just the output of > > diff -u lisp/emacs-lisp/lisp-mode.el.original > lisp/emacs-lisp/lisp-mode.el > > would be helpful. > > Oh, and adding a test to test/lisp/emacs-lisp/lisp-mode-tests.el would > be good as well (e.g., to catch mistakes like using "[[:space:]]\n*" > instead of "[[:space:]\n]*"). > [-- Attachment #2: Type: text/html, Size: 3062 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-23 1:28 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <CAKVVwxeE8TuHM4-sd6=dAo0Nr3OAU1xD_gxvzrNmLFVoEZY-XQ@mail.gmail.com> 2019-10-22 23:40 ` bug#21922: Fwd: Patch for fixing "straigh-quote" case Luis Henriquez-Perez 2019-10-22 23:59 ` 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
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.