unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Zachary Kanfer <zkanfer@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: Ruijie Yu <ruijie@netyu.xyz>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	"62892@debbugs.gnu.org" <62892@debbugs.gnu.org>,
	Juri Linkov <juri@linkov.net>
Subject: bug#62892: proposal to extend mark-sexp to go forward and backward on command
Date: Thu, 4 May 2023 00:48:44 -0400	[thread overview]
Message-ID: <CAFXT+RPcXbpJt+xpvQ0eXLhRiBajY+O0hLFtAM4MEmsMXT5Z3A@mail.gmail.com> (raw)
In-Reply-To: <SJ0PR10MB5488430E2A9639688D8E5C55F36B9@SJ0PR10MB5488.namprd10.prod.outlook.com>

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

> Is it an "internal" function?  Then its name should
> maybe use `--'.  (But why should it be internal?)

Hrm, I figured it would be an internal function because it's intended to be
wrapped by other code. But this describes a whole lot of functions. So it
can't be that.

I suppose that if there are other types of things that are created that one
might want to mark, then a user could use this method to mark them. So
perhaps it shouldn't be internal -- it really could be used by other code.

> Is it a helper function?  Then its name should maybe
> use a suffix that indicates that, such as `-helper'
> or `-1' (old-school Lisp, I suppose).

It's certainly a helper function -- it's intended to be called by a bunch
of different functions we write.

> `mark-thing' should be reserved for a function that
> takes a THING name as arg: `sexp', `page', etc.,
> instead of a movement function such as `forward-sexp'.

This makes a lot of sense to me.

On Fri, Apr 28, 2023 at 3:28 PM Drew Adams <drew.adams@oracle.com> wrote:

> > > +(defun mark--helper (move-fn number-of-things)
> >
> > A nicer name would be 'mark-thing' as a reference to thingatpt.el.
>
> FWIW, I have a different take on this.
>
> Is it an "internal" function?  Then its name should
> maybe use `--'.  (But why should it be internal?)
>
> Is it a helper function?  Then its name should maybe
> use a suffix that indicates that, such as `-helper'
> or `-1' (old-school Lisp, I suppose).
>
> `mark-thing' should be reserved for a function that
> takes a THING name as arg: `sexp', `page', etc.,
> instead of a movement function such as `forward-sexp'.
> ___
>
> FWIW, I think MOVE-FN is a fine name for the argument.
> My own preference, and what I use in my code, is the
> name FORWARD-THING-FUNCTION.
> ___
>
> FWIW, in my library isearch+.el), I use the arg name
> THING for a thing name, not a movement or other
> function.
>
> E.g.: Function `isearchp-in-thing-p' is a helper
> function for defining specific THING-type predicates,
> such as `isearch(-not)-in-email-address-p'.
> ___
>
> FWIW, my library `thing-cmds.el' has a command named
> `mark-things', which prompts for a THING type as arg:
>
>  mark-things is an alias for 'select-things' in 'thing-cmds.el'.
>
>  (mark-things THING &optional ARG ALLOW-EXTEND)
>
>  Set point at one end of THING and set mark ARG THINGs from point.
>  THING is a symbol that names a type of thing.  Interactively, you are
>  prompted for it.  Completion is available (lax).
>
>  (If THING doesn't have an associated `forward-'THING operation then
>  do nothing.)
>
>  Put mark at the same place command `forward-'THING would move point
>  with the same prefix argument.
>
>  Put point at the beginning of THING, unless the prefix argument (ARG)
>  is negative, in which case put it at the end of THING.
>
>  If `select-things' is repeated or if the mark is active (in Transient
>  Mark mode), then it marks the next ARG THINGs, after the ones already
>  marked.  In this case the type of THING used is whatever was used the
>  last time `select-things' was called - you are not prompted for it.
>
>  This region extension reusing the last type of THING happens even if
>  the active region is empty.  This means that you can, for instance,
>  just use `C-SPC' to activate an empty region and then use
>  `select-things' to select more THINGS of the last kind selected.
>
>  If there is no THING at point, and `thgcmd-use-nearest-thing-flag' is
>  non-nil, then select a THING near point.
>
>

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

  reply	other threads:[~2023-05-04  4:48 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17  2:25 bug#62892: proposal to extend mark-sexp to go forward and backward on command Zachary Kanfer
2023-04-17  3:06 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-20  5:25   ` Zachary Kanfer
2023-04-20  7:16     ` Eli Zaretskii
2023-04-21  5:04       ` Zachary Kanfer
2023-04-21  6:07         ` Eli Zaretskii
2023-04-21  7:24           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-21  9:51           ` Visuwesh
2023-04-21 13:10   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-23  5:33     ` Zachary Kanfer
2023-04-25 22:26       ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-26  4:41         ` Zachary Kanfer
2023-04-26  6:28           ` Eli Zaretskii
2023-04-27  2:37             ` Zachary Kanfer
2023-04-27 12:25               ` Eli Zaretskii
2023-04-27 18:12                 ` Juri Linkov
2023-04-28  5:28                   ` Zachary Kanfer
2023-05-06  8:49                   ` Eli Zaretskii
2023-04-28 17:04       ` Juri Linkov
2023-04-28 19:28         ` Drew Adams
2023-05-04  4:48           ` Zachary Kanfer [this message]
2023-05-08 12:28             ` Zachary Kanfer
2023-05-18  3:17               ` Zachary Kanfer
2023-05-18  6:52                 ` Eli Zaretskii
2023-05-21  5:46                   ` Zachary Kanfer
2023-05-21  5:58                     ` Eli Zaretskii
2023-05-21 14:31                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-21 14:39                         ` Eli Zaretskii
2023-05-21 14:54                           ` Eli Zaretskii
2023-05-21 14:56                         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-21 15:11                           ` Eli Zaretskii
2023-05-21 15:41                             ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-22 22:02                 ` Richard Stallman
2023-05-23 14:11                   ` Zachary Kanfer
2023-05-25 22:32                     ` Richard Stallman
2023-05-26  6:06                       ` Eli Zaretskii
2023-05-31  3:23                         ` Zachary Kanfer
2023-05-31 12:01                           ` Eli Zaretskii
2023-06-01  3:54                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-01  6:32                               ` Eli Zaretskii
2023-05-03  6:10         ` Zachary Kanfer
2023-05-03 17:29           ` Juri Linkov
2023-04-17  7:11 ` Juri Linkov

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=CAFXT+RPcXbpJt+xpvQ0eXLhRiBajY+O0hLFtAM4MEmsMXT5Z3A@mail.gmail.com \
    --to=zkanfer@gmail.com \
    --cc=62892@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=juri@linkov.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=ruijie@netyu.xyz \
    /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).