> If this is to be accepted, why not extend it to all like mark functions,
> listed below?  Implementing them should be pretty similar, and you might
> even be able to reuse the same helper for all these variants.  Also, the
> helper function might need to contain a double-dash in its name because
> this is inherently a private function.

This makes sense to me, although I have not found the same need for these to be marked. I'm happy to extend them as such; I'll add that in a later patch.

> Please use `quote' to quote things in Emacs docstrings.  Also, both here
> and in other docstrings, the newline immediately after the first line,
> while seems necessary, is usually redundant in Emacs docstrings.  And
> there is a typo: "amrk" -> "mark".
>
> I also think you shouldn't use wildcard-like elements in quotes (in your
> case, you reuse part of the name in the quote), but I'm not sure.

Done. Updated patch attached.

On Sun, Apr 16, 2023 at 11:17 PM Ruijie Yu <ruijie@netyu.xyz> wrote:

Zachary Kanfer <zkanfer@gmail.com> writes:

> Attached is a patch to add #'mark-sexp-forwards and #'mark-sexp-backwards. These functions extend the region by sexps forward and
> backward. They are mutually incremental: you can call mark-sexp-fowards, then mark-sexp-backwards twice, then mark-sexp-forwards. After
> this, the region will consist of the two sexps before point and the two sexps after point.

If this is to be accepted, why not extend it to all like mark functions,
listed below?  Implementing them should be pretty similar, and you might
even be able to reuse the same helper for all these variants.  Also, the
helper function might need to contain a double-dash in its name because
this is inherently a private function.

- `mark-defun'
- `mark-page'
- `mark-paragraph'
- `mark-word'

> +(defun mark-sexp-helper (number-of-expressions)
> +  "A helper function for 'mark-sexp-[forward, backward]'.
> +
> +If NUMBER-OF-EXPRESSIONS is positive, mark that many sexps forward;
> +otherwise, amrk backward."

Please use `quote' to quote things in Emacs docstrings.  Also, both here
and in other docstrings, the newline immediately after the first line,
while seems necessary, is usually redundant in Emacs docstrings.  And
there is a typo: "amrk" -> "mark".

I also think you shouldn't use wildcard-like elements in quotes (in your
case, you reuse part of the name in the quote), but I'm not sure.

--
Best,


RY