* Re: master f117b5df4d: Add new functions eol and bol [not found] ` <20220819132245.AE2BBC0088A@vcs2.savannah.gnu.org> @ 2022-08-19 13:25 ` Lars Ingebrigtsen 2022-08-19 13:34 ` Stefan Monnier ` (2 more replies) 0 siblings, 3 replies; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-19 13:25 UTC (permalink / raw) To: emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: > Add new functions eol and bol Bikeshed welcome about the names, though. I considered `point-bol', for instance, but that's very similar to `point-at-bol' (which is an alias for `line-beginning-position'). The nice thing about `point-bol' is that it'd be symmetric with `point-min': (goto-char (point-min)) (bobp) => t vs (goto-char (point-bol)) (bolp) => t ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 13:25 ` master f117b5df4d: Add new functions eol and bol Lars Ingebrigtsen @ 2022-08-19 13:34 ` Stefan Monnier 2022-08-19 13:36 ` Lars Ingebrigtsen 2022-08-19 13:55 ` Stefan Kangas 2022-08-19 22:15 ` Dmitry Gutov 2 siblings, 1 reply; 42+ messages in thread From: Stefan Monnier @ 2022-08-19 13:34 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel > Bikeshed welcome about the names, though. I considered `point-bol', for > instance, but that's very similar to `point-at-bol' (which is an alias > for `line-beginning-position'). I suggest `point-at-bol` (i.e. stop making it an alias). Stefan ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 13:34 ` Stefan Monnier @ 2022-08-19 13:36 ` Lars Ingebrigtsen 2022-08-19 21:02 ` Stefan Monnier 0 siblings, 1 reply; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-19 13:36 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Bikeshed welcome about the names, though. I considered `point-bol', for >> instance, but that's very similar to `point-at-bol' (which is an alias >> for `line-beginning-position'). > > I suggest `point-at-bol` (i.e. stop making it an alias). That'd change the behaviour, though. (`point-at-bol' is used extensively both in-tree and out of tree, since that was the original name for the function.) ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 13:36 ` Lars Ingebrigtsen @ 2022-08-19 21:02 ` Stefan Monnier 2022-08-19 21:24 ` Lars Ingebrigtsen 0 siblings, 1 reply; 42+ messages in thread From: Stefan Monnier @ 2022-08-19 21:02 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel Lars Ingebrigtsen [2022-08-19 15:36:30] wrote: > Stefan Monnier <monnier@iro.umontreal.ca> writes: >>> Bikeshed welcome about the names, though. I considered `point-bol', for >>> instance, but that's very similar to `point-at-bol' (which is an alias >>> for `line-beginning-position'). >> >> I suggest `point-at-bol` (i.e. stop making it an alias). > That'd change the behaviour, though. (`point-at-bol' is used > extensively both in-tree and out of tree, since that was the original > name for the function.) But `point-at-bol` is a function imported from XEmacs where they don't have fields, AFAIK. Stefan ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 21:02 ` Stefan Monnier @ 2022-08-19 21:24 ` Lars Ingebrigtsen 0 siblings, 0 replies; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-19 21:24 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: > But `point-at-bol` is a function imported from XEmacs where they don't > have fields, AFAIK. It's an alias for `line-beginning-position', so some of the places where it's used are expecting the semantics that `line-beginning-position' has now. (The function originated in XEmacs, was imported to Emacs and renamed because of course, and was then given different semantics.) ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 13:25 ` master f117b5df4d: Add new functions eol and bol Lars Ingebrigtsen 2022-08-19 13:34 ` Stefan Monnier @ 2022-08-19 13:55 ` Stefan Kangas 2022-08-19 14:04 ` Eli Zaretskii ` (2 more replies) 2022-08-19 22:15 ` Dmitry Gutov 2 siblings, 3 replies; 42+ messages in thread From: Stefan Kangas @ 2022-08-19 13:55 UTC (permalink / raw) To: Lars Ingebrigtsen, emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: > Bikeshed welcome about the names, though. I considered `point-bol', for > instance, but that's very similar to `point-at-bol' (which is an alias > for `line-beginning-position'). How about `point-bol' (while making `point-at-bol' obsolete to avoid confusion)? ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 13:55 ` Stefan Kangas @ 2022-08-19 14:04 ` Eli Zaretskii 2022-08-19 14:14 ` Robert Pluim ` (3 more replies) 2022-08-19 14:08 ` Lars Ingebrigtsen 2022-08-20 8:12 ` Po Lu 2 siblings, 4 replies; 42+ messages in thread From: Eli Zaretskii @ 2022-08-19 14:04 UTC (permalink / raw) To: Stefan Kangas; +Cc: larsi, emacs-devel > From: Stefan Kangas <stefankangas@gmail.com> > Date: Fri, 19 Aug 2022 06:55:27 -0700 > > Lars Ingebrigtsen <larsi@gnus.org> writes: > > > Bikeshed welcome about the names, though. I considered `point-bol', for > > instance, but that's very similar to `point-at-bol' (which is an alias > > for `line-beginning-position'). > > How about `point-bol' (while making `point-at-bol' obsolete to avoid > confusion)? How about position-at-bol or pos-at-bol? (IMO, it's confusing to talk about "point at SOMEWHERE" because that's not how we use the term "point", except in the context of describing point's position.) ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 14:04 ` Eli Zaretskii @ 2022-08-19 14:14 ` Robert Pluim 2022-08-19 14:56 ` Lars Ingebrigtsen ` (2 subsequent siblings) 3 siblings, 0 replies; 42+ messages in thread From: Robert Pluim @ 2022-08-19 14:14 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Stefan Kangas, larsi, emacs-devel >>>>> On Fri, 19 Aug 2022 17:04:04 +0300, Eli Zaretskii <eliz@gnu.org> said: >> From: Stefan Kangas <stefankangas@gmail.com> >> Date: Fri, 19 Aug 2022 06:55:27 -0700 >> >> Lars Ingebrigtsen <larsi@gnus.org> writes: >> >> > Bikeshed welcome about the names, though. I considered `point-bol', for >> > instance, but that's very similar to `point-at-bol' (which is an alias >> > for `line-beginning-position'). >> >> How about `point-bol' (while making `point-at-bol' obsolete to avoid >> confusion)? Eli> How about position-at-bol or pos-at-bol? Eli> (IMO, it's confusing to talk about "point at SOMEWHERE" because that's Eli> not how we use the term "point", except in the context of describing Eli> point's position.) I agree. "point" is "here", itʼs not at eol/bol unless itʼs moved there. Weʼre talking about the characteristics of whatʼs at the beginning/end of the line, which suggests `position-of-bol' and `position-of-eol' (or even `pos-of-bol'). Robert -- ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 14:04 ` Eli Zaretskii 2022-08-19 14:14 ` Robert Pluim @ 2022-08-19 14:56 ` Lars Ingebrigtsen 2022-08-19 16:24 ` [External] : " Drew Adams 2022-08-19 21:03 ` Stefan Monnier 3 siblings, 0 replies; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-19 14:56 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Stefan Kangas, emacs-devel Eli Zaretskii <eliz@gnu.org> writes: > How about position-at-bol or pos-at-bol? > > (IMO, it's confusing to talk about "point at SOMEWHERE" because that's > not how we use the term "point", except in the context of describing > point's position.) We don't have many functions that start with `point-', but there's `point-min'/`point-max', which are very popular indeed and work analogously to `point-bol'/`point-eol'. So I think the scope for confusion here is slim. ^ permalink raw reply [flat|nested] 42+ messages in thread
* RE: [External] : Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 14:04 ` Eli Zaretskii 2022-08-19 14:14 ` Robert Pluim 2022-08-19 14:56 ` Lars Ingebrigtsen @ 2022-08-19 16:24 ` Drew Adams 2022-08-19 21:42 ` Tim Cross 2022-08-19 21:03 ` Stefan Monnier 3 siblings, 1 reply; 42+ messages in thread From: Drew Adams @ 2022-08-19 16:24 UTC (permalink / raw) To: Eli Zaretskii, Stefan Kangas; +Cc: larsi@gnus.org, emacs-devel@gnu.org > How about position-at-bol or pos-at-bol? > > (IMO, it's confusing to talk about "point at SOMEWHERE" because that's > not how we use the term "point", except in the context of describing > point's position.) <nitpick> +1. `position-at-...' makes sense, and `point-at...' does not. Point is the _current_ cursor position in some buffer. And window point is the cursor position for the buffer displayed in some window. The names `point-min|max' are legacy. No need to change them to `position-min|max'. But they shouldn't be used as a precedent for starting to name position variables and functions with "point" instead of "position" (or "pos"). ___ (Separate point (!), but related: we shouldn't talk about the "position of point". Point _is_ a position - the position of the cursor. E.g., +1 for Eli's point (!) here, but not for speaking of "point's position", which just means the _position of the position_ of the cursor.) </nitpick> ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [External] : Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 16:24 ` [External] : " Drew Adams @ 2022-08-19 21:42 ` Tim Cross 0 siblings, 0 replies; 42+ messages in thread From: Tim Cross @ 2022-08-19 21:42 UTC (permalink / raw) To: Drew Adams; +Cc: Eli Zaretskii, Stefan Kangas, larsi@gnus.org, emacs-devel Drew Adams <drew.adams@oracle.com> writes: >> How about position-at-bol or pos-at-bol? >> >> (IMO, it's confusing to talk about "point at SOMEWHERE" because that's >> not how we use the term "point", except in the context of describing >> point's position.) > > <nitpick> > > +1. `position-at-...' makes sense, and > `point-at...' does not. > > Point is the _current_ cursor position in some > buffer. And window point is the cursor position > for the buffer displayed in some window. > > The names `point-min|max' are legacy. No need > to change them to `position-min|max'. But they > shouldn't be used as a precedent for starting > to name position variables and functions with > "point" instead of "position" (or "pos"). > ___ > > (Separate point (!), but related: we shouldn't > talk about the "position of point". Point _is_ > a position - the position of the cursor. > > E.g., +1 for Eli's point (!) here, but not for > speaking of "point's position", which just means > the _position of the position_ of the cursor.) > > </nitpick> +1 ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 14:04 ` Eli Zaretskii ` (2 preceding siblings ...) 2022-08-19 16:24 ` [External] : " Drew Adams @ 2022-08-19 21:03 ` Stefan Monnier 2022-08-19 21:26 ` Lars Ingebrigtsen 3 siblings, 1 reply; 42+ messages in thread From: Stefan Monnier @ 2022-08-19 21:03 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Stefan Kangas, larsi, emacs-devel > (IMO, it's confusing to talk about "point at SOMEWHERE" because that's > not how we use the term "point", except in the context of describing > point's position.) Agreed. If re-using `point-at-bol` is not an option, then I'd rather not have "point" in the name. Stefan ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 21:03 ` Stefan Monnier @ 2022-08-19 21:26 ` Lars Ingebrigtsen 2022-08-20 16:28 ` Gregory Heytings 0 siblings, 1 reply; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-19 21:26 UTC (permalink / raw) To: Stefan Monnier; +Cc: Eli Zaretskii, Stefan Kangas, emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: > Agreed. If re-using `point-at-bol` is not an option, then I'd rather > not have "point" in the name. Let's rename `point-min' to `position-at-start-of-buffer'. Or `bob'. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 21:26 ` Lars Ingebrigtsen @ 2022-08-20 16:28 ` Gregory Heytings 0 siblings, 0 replies; 42+ messages in thread From: Gregory Heytings @ 2022-08-20 16:28 UTC (permalink / raw) To: Lars Ingebrigtsen Cc: Stefan Monnier, Eli Zaretskii, Stefan Kangas, emacs-devel [-- Attachment #1: Type: text/plain, Size: 263 bytes --] >> Agreed. If re-using `point-at-bol` is not an option, then I'd rather >> not have "point" in the name. > > Let's rename `point-min' to `position-at-start-of-buffer'. > That's too short! I suggest `position-at-start-of-visible-portion-of-buffer' 😉 ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 13:55 ` Stefan Kangas 2022-08-19 14:04 ` Eli Zaretskii @ 2022-08-19 14:08 ` Lars Ingebrigtsen 2022-08-19 16:00 ` Stefan Kangas 2022-08-20 8:12 ` Po Lu 2 siblings, 1 reply; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-19 14:08 UTC (permalink / raw) To: Stefan Kangas; +Cc: emacs-devel Stefan Kangas <stefankangas@gmail.com> writes: > How about `point-bol' (while making `point-at-bol' obsolete to avoid > confusion)? That's a possibility. But then somebody would have to take on the dreary job of going through the >600 places where point-at-bol/eol is used in the Emacs tree and decide whether to use `point-bol' or `line-beginning-position'. My guesstimate is that `point-bol' is the correct answer in more than 90% of the cases, so the upside to this plan is that Emacs would, in general, end up faster afterwards. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 14:08 ` Lars Ingebrigtsen @ 2022-08-19 16:00 ` Stefan Kangas 2022-08-19 21:49 ` Lars Ingebrigtsen 0 siblings, 1 reply; 42+ messages in thread From: Stefan Kangas @ 2022-08-19 16:00 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: >> How about `point-bol' (while making `point-at-bol' obsolete to avoid >> confusion)? > > That's a possibility. But then somebody would have to take on the > dreary job of going through the >600 places where point-at-bol/eol is > used in the Emacs tree and decide whether to use `point-bol' or > `line-beginning-position'. We could make the task less daunting by starting with something like: diff --git a/lisp/subr.el b/lisp/subr.el index cd6a9be099..4237031ff3 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1912,8 +1912,10 @@ 'store-match-data (defalias 'chmod #'set-file-modes) (defalias 'mkdir #'make-directory) ;; These are the XEmacs names: -(defalias 'point-at-eol #'line-end-position) -(defalias 'point-at-bol #'line-beginning-position) +(defalias 'point-at-eol #'line-end-position + "Obsolete; use `point-eol' or `line-end-position' instead.") +(defalias 'point-at-bol #'line-beginning-position + "Obsolete; use `point-bol' or `line-beginning-position' instead.") (define-obsolete-function-alias 'user-original-login-name #'user-login-name "28.1") ^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 16:00 ` Stefan Kangas @ 2022-08-19 21:49 ` Lars Ingebrigtsen 2022-08-20 6:21 ` Eli Zaretskii ` (2 more replies) 0 siblings, 3 replies; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-19 21:49 UTC (permalink / raw) To: Stefan Kangas; +Cc: emacs-devel Stefan Kangas <stefankangas@gmail.com> writes: > We could make the task less daunting by starting with something like: [...] > +(defalias 'point-at-eol #'line-end-position > + "Obsolete; use `point-eol' or `line-end-position' instead.") Yes, I guess. We could also just rename all the calls to point-at-eol to line-end-position (etc) and obsolete the names for real. It's some churn, but... And then someone could audit all these calls at leisure, if they want to. By the way, I wasn't quite aware of how DWIM-ey the `end-of-line' function is. It also does the field stuff, but then: while (1) { newpos = XFIXNUM (Fline_end_position (n)); SET_PT (newpos); if (PT > newpos && FETCH_BYTE (PT_BYTE - 1) == '\n') { /* If we skipped over a newline that follows an invisible intangible run, move back to the last tangible position within the line. */ SET_PT (PT - 1); break; } else if (PT > newpos && PT < ZV && FETCH_BYTE (PT_BYTE) != '\n') /* If we skipped something intangible and now we're not really at eol, keep going. */ n = make_fixnum (1); else break; } Now, the `C-e' command (`move-end-of-line') is another layer of DWIM-ness on top of this... I guess these things have evolved over time. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 21:49 ` Lars Ingebrigtsen @ 2022-08-20 6:21 ` Eli Zaretskii 2022-08-20 16:47 ` Stefan Monnier 2022-08-21 16:19 ` Stefan Kangas 2 siblings, 0 replies; 42+ messages in thread From: Eli Zaretskii @ 2022-08-20 6:21 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: stefankangas, emacs-devel > From: Lars Ingebrigtsen <larsi@gnus.org> > Cc: emacs-devel@gnu.org > Date: Fri, 19 Aug 2022 23:49:07 +0200 > > By the way, I wasn't quite aware of how DWIM-ey the `end-of-line' > function is. It also does the field stuff, but then: > > while (1) > { > newpos = XFIXNUM (Fline_end_position (n)); > SET_PT (newpos); > > if (PT > newpos > && FETCH_BYTE (PT_BYTE - 1) == '\n') > { > /* If we skipped over a newline that follows > an invisible intangible run, > move back to the last tangible position > within the line. */ > > SET_PT (PT - 1); > break; > } > else if (PT > newpos && PT < ZV > && FETCH_BYTE (PT_BYTE) != '\n') > /* If we skipped something intangible > and now we're not really at eol, > keep going. */ > n = make_fixnum (1); > else > break; > } > > Now, the `C-e' command (`move-end-of-line') is another layer of > DWIM-ness on top of this... Many commands are DWIM-ish, so the above shouldn't be a surprise. > I guess these things have evolved over time. See this old discussion: https://lists.gnu.org/archive/html/emacs-devel/2002-04/msg00407.html ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 21:49 ` Lars Ingebrigtsen 2022-08-20 6:21 ` Eli Zaretskii @ 2022-08-20 16:47 ` Stefan Monnier 2022-08-21 16:19 ` Stefan Kangas 2 siblings, 0 replies; 42+ messages in thread From: Stefan Monnier @ 2022-08-20 16:47 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: Stefan Kangas, emacs-devel > if (PT > newpos > && FETCH_BYTE (PT_BYTE - 1) == '\n') > { > /* If we skipped over a newline that follows > an invisible intangible run, > move back to the last tangible position > within the line. */ > > SET_PT (PT - 1); > break; > } > else if (PT > newpos && PT < ZV > && FETCH_BYTE (PT_BYTE) != '\n') > /* If we skipped something intangible > and now we're not really at eol, > keep going. */ Note: this code should disappear when we remove the obsolete `inhibit-point-motion-hooks`. Stefan ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 21:49 ` Lars Ingebrigtsen 2022-08-20 6:21 ` Eli Zaretskii 2022-08-20 16:47 ` Stefan Monnier @ 2022-08-21 16:19 ` Stefan Kangas 2022-08-22 10:03 ` Lars Ingebrigtsen 2 siblings, 1 reply; 42+ messages in thread From: Stefan Kangas @ 2022-08-21 16:19 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: > We could also just rename all the calls to point-at-eol to > line-end-position (etc) and obsolete the names for real. There's more risk for confusion now that we have three names for getting bol/eol, so I think we should go ahead and do this. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-21 16:19 ` Stefan Kangas @ 2022-08-22 10:03 ` Lars Ingebrigtsen 2022-08-23 3:05 ` Stefan Kangas 0 siblings, 1 reply; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-22 10:03 UTC (permalink / raw) To: Stefan Kangas; +Cc: emacs-devel Stefan Kangas <stefankangas@gmail.com> writes: >> We could also just rename all the calls to point-at-eol to >> line-end-position (etc) and obsolete the names for real. > > There's more risk for confusion now that we have three names for > getting bol/eol, so I think we should go ahead and do this. Yup. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-22 10:03 ` Lars Ingebrigtsen @ 2022-08-23 3:05 ` Stefan Kangas 2022-08-23 3:52 ` Po Lu 0 siblings, 1 reply; 42+ messages in thread From: Stefan Kangas @ 2022-08-23 3:05 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: >>> We could also just rename all the calls to point-at-eol to >>> line-end-position (etc) and obsolete the names for real. >> >> There's more risk for confusion now that we have three names for >> getting bol/eol, so I think we should go ahead and do this. > > Yup. Thanks, now done (commit b7e867b841). ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-23 3:05 ` Stefan Kangas @ 2022-08-23 3:52 ` Po Lu 2022-08-23 13:12 ` Stefan Monnier 0 siblings, 1 reply; 42+ messages in thread From: Po Lu @ 2022-08-23 3:52 UTC (permalink / raw) To: Stefan Kangas; +Cc: Lars Ingebrigtsen, emacs-devel Stefan Kangas <stefankangas@gmail.com> writes: > Thanks, now done (commit b7e867b841). Let's still please not call the new function "pos-bol" or "pos-eol". As I said, the name doesn't make sense. If what I said earlier isn't good enough, how about "pos-of-bol" or "pos-of-eol"? ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-23 3:52 ` Po Lu @ 2022-08-23 13:12 ` Stefan Monnier 2022-08-24 3:53 ` Richard Stallman 0 siblings, 1 reply; 42+ messages in thread From: Stefan Monnier @ 2022-08-23 13:12 UTC (permalink / raw) To: Po Lu; +Cc: Stefan Kangas, Lars Ingebrigtsen, emacs-devel > Let's still please not call the new function "pos-bol" or "pos-eol". > As I said, the name doesn't make sense. It depends how you read them. If you try to pretend they're some kind of English sentence, indeed they don't make as much sense as `pos-at-bol` or `line-end-position`, but you read them as "the `bol` function in the `pos` package", then I think they make perfect sense. Stefan ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-23 13:12 ` Stefan Monnier @ 2022-08-24 3:53 ` Richard Stallman 2022-08-24 4:28 ` Po Lu 2022-08-24 11:58 ` Stefan Monnier 0 siblings, 2 replies; 42+ messages in thread From: Richard Stallman @ 2022-08-24 3:53 UTC (permalink / raw) To: Stefan Monnier; +Cc: luangruo, stefan, larsi, emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > It depends how you read them. If you try to pretend they're some kind > of English sentence, indeed they don't make as much sense as > `pos-at-bol` or `line-end-position`, but you read them as "the `bol` > function in the `pos` package", then I think they make perfect sense. I agree that those names make sense. I'd expect them to be defined in a bare Emacs -- so does it make sense to think of `pos' as a "package"? -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-24 3:53 ` Richard Stallman @ 2022-08-24 4:28 ` Po Lu 2022-08-24 11:58 ` Stefan Monnier 1 sibling, 0 replies; 42+ messages in thread From: Po Lu @ 2022-08-24 4:28 UTC (permalink / raw) To: Richard Stallman; +Cc: Stefan Monnier, stefan, larsi, emacs-devel Richard Stallman <rms@gnu.org> writes: > > It depends how you read them. If you try to pretend they're some kind > > of English sentence, indeed they don't make as much sense as > > `pos-at-bol` or `line-end-position`, but you read them as "the `bol` > > function in the `pos` package", then I think they make perfect sense. > > I agree that those names make sense. I'd expect them to be defined in > a bare Emacs -- so does it make sense to think of `pos' as a "package"? Why would pos be a package? ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-24 3:53 ` Richard Stallman 2022-08-24 4:28 ` Po Lu @ 2022-08-24 11:58 ` Stefan Monnier 1 sibling, 0 replies; 42+ messages in thread From: Stefan Monnier @ 2022-08-24 11:58 UTC (permalink / raw) To: Richard Stallman; +Cc: luangruo, stefan, larsi, emacs-devel > I agree that those names make sense. I'd expect them to be defined in > a bare Emacs -- so does it make sense to think of `pos' as a "package"? Yes, I was using the term "package" here as a form of namespace control, not one of used to cut up the code into separate files some of which are not loaded initially. Stefan ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 13:55 ` Stefan Kangas 2022-08-19 14:04 ` Eli Zaretskii 2022-08-19 14:08 ` Lars Ingebrigtsen @ 2022-08-20 8:12 ` Po Lu 2022-08-20 9:22 ` Lars Ingebrigtsen 2 siblings, 1 reply; 42+ messages in thread From: Po Lu @ 2022-08-20 8:12 UTC (permalink / raw) To: Stefan Kangas; +Cc: Lars Ingebrigtsen, emacs-devel Stefan Kangas <stefankangas@gmail.com> writes: > How about `point-bol' (while making `point-at-bol' obsolete to avoid > confusion)? That isn't a very good name. point-bol screams "point what?", where "what" could either be "at", "after", or "before". How about "pos-at-bol" or "bol-from-point" (which would also accept an optional arg POINT, telling the function where to search from?) ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 8:12 ` Po Lu @ 2022-08-20 9:22 ` Lars Ingebrigtsen 2022-08-20 11:37 ` Po Lu 0 siblings, 1 reply; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-20 9:22 UTC (permalink / raw) To: Po Lu; +Cc: Stefan Kangas, emacs-devel Po Lu <luangruo@yahoo.com> writes: > That isn't a very good name. point-bol screams "point what?", where > "what" could either be "at", "after", or "before". Does `point-min' scream the same thing? > How about "pos-at-bol" or "bol-from-point" (which would also accept an > optional arg POINT, telling the function where to search from?) I don't think that would be very useful in general -- if you look at how these functions are used, you're usually traversing a buffer, and then you find something, and then you want to do something with what you find. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 9:22 ` Lars Ingebrigtsen @ 2022-08-20 11:37 ` Po Lu 2022-08-20 13:00 ` Lars Ingebrigtsen 0 siblings, 1 reply; 42+ messages in thread From: Po Lu @ 2022-08-20 11:37 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: Stefan Kangas, emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: >> That isn't a very good name. point-bol screams "point what?", where >> "what" could either be "at", "after", or "before". > Does `point-min' scream the same thing? No, point-min doesn't depend on the value of point, unlike bol. > I don't think that would be very useful in general -- if you look at how > these functions are used, you're usually traversing a buffer, and then > you find something, and then you want to do something with what you > find. Fair, though I meant the optional arg POINT specifically for "bol-from-point", mainly to solve the naming problem. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 11:37 ` Po Lu @ 2022-08-20 13:00 ` Lars Ingebrigtsen 2022-08-20 13:26 ` Po Lu 0 siblings, 1 reply; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-20 13:00 UTC (permalink / raw) To: Po Lu; +Cc: Stefan Kangas, emacs-devel Po Lu <luangruo@yahoo.com> writes: >> I don't think that would be very useful in general -- if you look at how >> these functions are used, you're usually traversing a buffer, and then >> you find something, and then you want to do something with what you >> find. > > Fair, though I meant the optional arg POINT specifically for > "bol-from-point", mainly to solve the naming problem. Sure, OK, but there's already an N optional here (which is used surprisingly much), so that'd mean `(bol-from-point nil 2)' (etc) a lot... ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 13:00 ` Lars Ingebrigtsen @ 2022-08-20 13:26 ` Po Lu 0 siblings, 0 replies; 42+ messages in thread From: Po Lu @ 2022-08-20 13:26 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: Stefan Kangas, emacs-devel Lars Ingebrigtsen <larsi@gnus.org> writes: > Po Lu <luangruo@yahoo.com> writes: > >>> I don't think that would be very useful in general -- if you look at how >>> these functions are used, you're usually traversing a buffer, and then >>> you find something, and then you want to do something with what you >>> find. >> >> Fair, though I meant the optional arg POINT specifically for >> "bol-from-point", mainly to solve the naming problem. > > Sure, OK, but there's already an N optional here (which is used > surprisingly much), so that'd mean `(bol-from-point nil 2)' (etc) a > lot... How about adding POINT after N? So it would be: (bol-from-point 2) or (bol-from-point 2 point) but then I guess the name should be "bol-at-n-from-point" instead, which is a bit unwieldy... ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 13:25 ` master f117b5df4d: Add new functions eol and bol Lars Ingebrigtsen 2022-08-19 13:34 ` Stefan Monnier 2022-08-19 13:55 ` Stefan Kangas @ 2022-08-19 22:15 ` Dmitry Gutov 2022-08-20 7:33 ` Lars Ingebrigtsen 2 siblings, 1 reply; 42+ messages in thread From: Dmitry Gutov @ 2022-08-19 22:15 UTC (permalink / raw) To: Lars Ingebrigtsen, emacs-devel On 19.08.2022 16:25, Lars Ingebrigtsen wrote: > Bikeshed welcome about the names, though. I considered `point-bol', for > instance, but that's very similar to `point-at-bol' (which is an alias > for `line-beginning-position'). > > The nice thing about `point-bol' is that it'd be symmetric with > `point-min': I guess the main problem is one cannot tell, from the names only, that these functions are different (not aliases), and that the difference is related to "fields". Adding an optional argument to existing functions is not an option, I take it? It could also be a dynamic var which alters behavior. At some point we could flip its default value. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-19 22:15 ` Dmitry Gutov @ 2022-08-20 7:33 ` Lars Ingebrigtsen 2022-08-20 7:43 ` Eli Zaretskii ` (3 more replies) 0 siblings, 4 replies; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-20 7:33 UTC (permalink / raw) To: Dmitry Gutov; +Cc: emacs-devel Dmitry Gutov <dgutov@yandex.ru> writes: > Adding an optional argument to existing functions is not an option, I > take it? No, too cumbersome. > It could also be a dynamic var which alters behavior. At some point we > could flip its default value. That variable already exists, but we can't expect people to type (let ((inhibit-field-text-motion t)) (line-beginning-position)) all over the place. Anyway, back to the naming issue -- `pos-eol' would also be short and snappy... or `eol-pos'? Hm. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 7:33 ` Lars Ingebrigtsen @ 2022-08-20 7:43 ` Eli Zaretskii 2022-08-20 9:21 ` Lars Ingebrigtsen 2022-08-20 16:46 ` Gregory Heytings ` (2 subsequent siblings) 3 siblings, 1 reply; 42+ messages in thread From: Eli Zaretskii @ 2022-08-20 7:43 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: dgutov, emacs-devel > From: Lars Ingebrigtsen <larsi@gnus.org> > Cc: emacs-devel@gnu.org > Date: Sat, 20 Aug 2022 09:33:20 +0200 > > Anyway, back to the naming issue -- `pos-eol' would also be short and > snappy... or `eol-pos'? Hm. IMO, pos-at-eol, similar to pos-visible-in-window-p. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 7:43 ` Eli Zaretskii @ 2022-08-20 9:21 ` Lars Ingebrigtsen 0 siblings, 0 replies; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-20 9:21 UTC (permalink / raw) To: Eli Zaretskii; +Cc: dgutov, emacs-devel Eli Zaretskii <eliz@gnu.org> writes: > IMO, pos-at-eol, similar to pos-visible-in-window-p. It's possible -- I wanted to avoid the -at to avoid reminding people of `point-at-eol'. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 7:33 ` Lars Ingebrigtsen 2022-08-20 7:43 ` Eli Zaretskii @ 2022-08-20 16:46 ` Gregory Heytings 2022-08-20 16:49 ` Stefan Monnier 2022-08-20 18:46 ` Dmitry Gutov 3 siblings, 0 replies; 42+ messages in thread From: Gregory Heytings @ 2022-08-20 16:46 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel > > Anyway, back to the naming issue -- `pos-eol' would also be short and > snappy... or `eol-pos'? Hm. > FWIW, I would suggest the following: bobp bobpos bolp bolpos eolp eolpos eobp eobpos ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 7:33 ` Lars Ingebrigtsen 2022-08-20 7:43 ` Eli Zaretskii 2022-08-20 16:46 ` Gregory Heytings @ 2022-08-20 16:49 ` Stefan Monnier 2022-08-20 17:14 ` Stefan Kangas 2022-08-20 18:46 ` Dmitry Gutov 3 siblings, 1 reply; 42+ messages in thread From: Stefan Monnier @ 2022-08-20 16:49 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: Dmitry Gutov, emacs-devel > Anyway, back to the naming issue -- `pos-eol' would also be short and > snappy... or `eol-pos'? Hm. I like using the `pos-` prefix. No opinion on the use of `at-` in there. Stefan ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 16:49 ` Stefan Monnier @ 2022-08-20 17:14 ` Stefan Kangas 2022-08-21 12:01 ` Lars Ingebrigtsen 0 siblings, 1 reply; 42+ messages in thread From: Stefan Kangas @ 2022-08-20 17:14 UTC (permalink / raw) To: Stefan Monnier, Lars Ingebrigtsen; +Cc: Dmitry Gutov, emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: > I like using the `pos-` prefix. Using a prefix is more discoverable than a postfix: you can find all functions by saying, e.g., `C-h f pos TAB'. So I'd prefer that. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 17:14 ` Stefan Kangas @ 2022-08-21 12:01 ` Lars Ingebrigtsen 0 siblings, 0 replies; 42+ messages in thread From: Lars Ingebrigtsen @ 2022-08-21 12:01 UTC (permalink / raw) To: Stefan Kangas; +Cc: Stefan Monnier, Dmitry Gutov, emacs-devel Stefan Kangas <stefankangas@gmail.com> writes: >> I like using the `pos-` prefix. > > Using a prefix is more discoverable than a postfix: you can find all > functions by saying, e.g., `C-h f pos TAB'. So I'd prefer that. So I think the votes are in, and `pos-eol' seems to be the winner. I don't think the "-at" is necessary -- I mean, from a grammatical point of view, it's better, but I don't think it makes the code clearer, especially in the presence of the `point-min' and `point-max' work horses. (And it adds confusability with `point-at-eol'.) So I think we'll go with `pos-eol', and I'm adjusting the code in that direction now. ^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 7:33 ` Lars Ingebrigtsen ` (2 preceding siblings ...) 2022-08-20 16:49 ` Stefan Monnier @ 2022-08-20 18:46 ` Dmitry Gutov 2022-08-20 21:02 ` [External] : " Drew Adams 3 siblings, 1 reply; 42+ messages in thread From: Dmitry Gutov @ 2022-08-20 18:46 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: emacs-devel On 20.08.2022 10:33, Lars Ingebrigtsen wrote: > Anyway, back to the naming issue -- `pos-eol' would also be short and > snappy... or `eol-pos'? Hm. eol-pos and bol-pos sound pretty nice, but the common prefix has its benefits. So pos-bol and pos-eol is a good option too. ^ permalink raw reply [flat|nested] 42+ messages in thread
* RE: [External] : Re: master f117b5df4d: Add new functions eol and bol 2022-08-20 18:46 ` Dmitry Gutov @ 2022-08-20 21:02 ` Drew Adams 0 siblings, 0 replies; 42+ messages in thread From: Drew Adams @ 2022-08-20 21:02 UTC (permalink / raw) To: Dmitry Gutov, Lars Ingebrigtsen; +Cc: emacs-devel@gnu.org Not sure what these new functions are for. Couldn't find the start of the thread - couldn't find further back than this start (?), which doesn't explain anything about them: Lars Ingebrigtsen <larsi@gnus.org> writes: > Add new functions eol and bol Bikeshed welcome about the names, though. https://lists.gnu.org/archive/html/emacs-devel/2022-08/msg00702.html _________ Anyway... Checking names that currently exist (18.1, emacs -Q) - prefix position-: position-bytes - returns a buffer position, but in bytes, not chars prefix pos-: pos-visible-in-window-group-p pos-visible-in-window-p Neither returns a buffer position. prefix posn-: posn-actual-col-row posn-area posn-at-point posn-at-x-y posn-col-row posn-image posn-object posn-object-width-height posn-object-x-y posn-point posn-set-point posn-string posn-timestamp posn-window posn-x-y These are mainly about a buffer position. _________ (Tried getting substring matches for `-pos-', `posn', and `-position-', but it seems Emacs's `substring' completion style doesn't work, and just shows prefix matches? Perhaps there's a category override that renders trying to find substring matches for `C-h f' useless?) Finagling a bit I found these too, which also refer to buffer positions: get-pos-property Some mouse functions Quite a few functions that end in `-position' ^ permalink raw reply [flat|nested] 42+ messages in thread
end of thread, other threads:[~2022-08-24 11:58 UTC | newest] Thread overview: 42+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <166091536530.20326.14174671546998200051@vcs2.savannah.gnu.org> [not found] ` <20220819132245.AE2BBC0088A@vcs2.savannah.gnu.org> 2022-08-19 13:25 ` master f117b5df4d: Add new functions eol and bol Lars Ingebrigtsen 2022-08-19 13:34 ` Stefan Monnier 2022-08-19 13:36 ` Lars Ingebrigtsen 2022-08-19 21:02 ` Stefan Monnier 2022-08-19 21:24 ` Lars Ingebrigtsen 2022-08-19 13:55 ` Stefan Kangas 2022-08-19 14:04 ` Eli Zaretskii 2022-08-19 14:14 ` Robert Pluim 2022-08-19 14:56 ` Lars Ingebrigtsen 2022-08-19 16:24 ` [External] : " Drew Adams 2022-08-19 21:42 ` Tim Cross 2022-08-19 21:03 ` Stefan Monnier 2022-08-19 21:26 ` Lars Ingebrigtsen 2022-08-20 16:28 ` Gregory Heytings 2022-08-19 14:08 ` Lars Ingebrigtsen 2022-08-19 16:00 ` Stefan Kangas 2022-08-19 21:49 ` Lars Ingebrigtsen 2022-08-20 6:21 ` Eli Zaretskii 2022-08-20 16:47 ` Stefan Monnier 2022-08-21 16:19 ` Stefan Kangas 2022-08-22 10:03 ` Lars Ingebrigtsen 2022-08-23 3:05 ` Stefan Kangas 2022-08-23 3:52 ` Po Lu 2022-08-23 13:12 ` Stefan Monnier 2022-08-24 3:53 ` Richard Stallman 2022-08-24 4:28 ` Po Lu 2022-08-24 11:58 ` Stefan Monnier 2022-08-20 8:12 ` Po Lu 2022-08-20 9:22 ` Lars Ingebrigtsen 2022-08-20 11:37 ` Po Lu 2022-08-20 13:00 ` Lars Ingebrigtsen 2022-08-20 13:26 ` Po Lu 2022-08-19 22:15 ` Dmitry Gutov 2022-08-20 7:33 ` Lars Ingebrigtsen 2022-08-20 7:43 ` Eli Zaretskii 2022-08-20 9:21 ` Lars Ingebrigtsen 2022-08-20 16:46 ` Gregory Heytings 2022-08-20 16:49 ` Stefan Monnier 2022-08-20 17:14 ` Stefan Kangas 2022-08-21 12:01 ` Lars Ingebrigtsen 2022-08-20 18:46 ` Dmitry Gutov 2022-08-20 21:02 ` [External] : " Drew Adams
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).