GNU bug report logs - #62892
proposal to extend mark-sexp to go forward and backward on command

Previous Next

Package: emacs;

Reported by: Zachary Kanfer <zkanfer <at> gmail.com>

Date: Mon, 17 Apr 2023 02:26:02 UTC

Severity: normal

Full log


Message #68 received at 62892 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>, Zachary Kanfer <zkanfer <at> gmail.com>
Cc: Ruijie Yu <ruijie <at> netyu.xyz>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 "62892 <at> debbugs.gnu.org" <62892 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#62892: proposal to extend mark-sexp to go
 forward and backward on command
Date: Fri, 28 Apr 2023 19:28:43 +0000
> > +(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.





This bug report was last modified 2 years and 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.