bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62892: proposal to extend mark-sexp to go forward and backward on co


From: Juri Linkov
Subject: bug#62892: proposal to extend mark-sexp to go forward and backward on command
Date: Fri, 28 Apr 2023 20:04:48 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> Attached is a patch with a few updates:

Thanks for the patch.  It would be nice to have such commands
even not bound to default keys, so the users are free to bind
them to any keys.

> I'm not exactly sure of the best place to put the helper function, nor
> exactly how the different lisp files in Emacs work together. There's no
> provide statement; are all the files in lisp/emacs-lisp loaded at the same
> time? If so, I'll make the other relevant functions (for marking word,
> defun, page, paragraph, line, and char).

Let's see:
- mark-sexp and mark-defun are defined in emacs-lisp/lisp.el
- mark-page in textmodes/page.el
- mark-paragraph in textmodes/paragraphs.el
- mark-word in simple.el

So looks like the best place to define the helper is simple.el,
before mark-word.

> +(defun mark--helper (move-fn number-of-things)

A nicer name would be 'mark-thing' as a reference to thingatpt.el.

> +  "Use MOVE-FN to move NUMBER-OF-THINGS things, extending region over them.
> +
> +The MOVE-FN should take a numeric argument, and move that many
> +items forward (negative means backward).
> +
> +NUMBER-OF-THINGS is the number of additional things to move."

Another variant is to use a single argument JUMPFORM like
in 'isearch-yank-internal' that allows not to leak the
prefix argument to the helper function:

  (defun isearch-yank-char (&optional arg)
    (isearch-yank-internal (lambda () (forward-char arg) (point))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]