* Pushing the mark from a primitive like goto-char [not found] <m1im8mgmb7.fsf.ref@yahoo.es> @ 2020-12-28 12:14 ` Daniel Martín 2020-12-28 14:17 ` Philipp Stephani 0 siblings, 1 reply; 32+ messages in thread From: Daniel Martín @ 2020-12-28 12:14 UTC (permalink / raw) To: emacs-devel goto-char is an interactive function that has the potential to take you long distances, so it might be a good idea, for user convenience, to push the mark as a documented side effect (is it a good idea?). If it's a good idea, what's the cleanest and simplest way to do that? goto-char is implemented in C, so it'd need to call push-mark, which is implemented in ELisp. Should it call push-mark via eval_sub or Feval, or is there an alternative C primitive to push the mark into the mark ring correctly? TIA ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-28 12:14 ` Pushing the mark from a primitive like goto-char Daniel Martín @ 2020-12-28 14:17 ` Philipp Stephani 2020-12-28 14:45 ` Daniel Martín ` (2 more replies) 0 siblings, 3 replies; 32+ messages in thread From: Philipp Stephani @ 2020-12-28 14:17 UTC (permalink / raw) To: Daniel Martín; +Cc: Emacs developers Am Mo., 28. Dez. 2020 um 13:15 Uhr schrieb Daniel Martín <mardani29@yahoo.es>: > > > goto-char is an interactive function that has the potential to take you > long distances, so it might be a good idea, for user convenience, to > push the mark as a documented side effect (is it a good idea?). goto-char is a low-level primitive that's used pervasively in Emacs Lisp code. I think that pushing the mark would be a way too drastic change. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-28 14:17 ` Philipp Stephani @ 2020-12-28 14:45 ` Daniel Martín 2020-12-28 14:49 ` Eli Zaretskii 2020-12-28 14:56 ` Stefan Kangas 2 siblings, 0 replies; 32+ messages in thread From: Daniel Martín @ 2020-12-28 14:45 UTC (permalink / raw) To: Philipp Stephani; +Cc: Emacs developers Philipp Stephani <p.stephani2@gmail.com> writes: > Am Mo., 28. Dez. 2020 um 13:15 Uhr schrieb Daniel Martín <mardani29@yahoo.es>: >> >> >> goto-char is an interactive function that has the potential to take you >> long distances, so it might be a good idea, for user convenience, to >> push the mark as a documented side effect (is it a good idea?). > > goto-char is a low-level primitive that's used pervasively in Emacs > Lisp code. I think that pushing the mark would be a way too drastic > change. But, AFAIK, goto-char is a function that is used both interactively and in ELisp programs. I meant to suggest pushing the mark only when used interactively. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-28 14:17 ` Philipp Stephani 2020-12-28 14:45 ` Daniel Martín @ 2020-12-28 14:49 ` Eli Zaretskii 2020-12-28 14:56 ` Stefan Kangas 2 siblings, 0 replies; 32+ messages in thread From: Eli Zaretskii @ 2020-12-28 14:49 UTC (permalink / raw) To: Philipp Stephani; +Cc: emacs-devel, mardani29 > From: Philipp Stephani <p.stephani2@gmail.com> > Date: Mon, 28 Dec 2020 15:17:30 +0100 > Cc: Emacs developers <emacs-devel@gnu.org> > > Am Mo., 28. Dez. 2020 um 13:15 Uhr schrieb Daniel Martín <mardani29@yahoo.es>: > > goto-char is an interactive function that has the potential to take you > > long distances, so it might be a good idea, for user convenience, to > > push the mark as a documented side effect (is it a good idea?). > > goto-char is a low-level primitive that's used pervasively in Emacs > Lisp code. I think that pushing the mark would be a way too drastic > change. I tend to agree. I think this is the reason why goto-char was not made to push the mark in the first place. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-28 14:17 ` Philipp Stephani 2020-12-28 14:45 ` Daniel Martín 2020-12-28 14:49 ` Eli Zaretskii @ 2020-12-28 14:56 ` Stefan Kangas 2020-12-28 15:32 ` Philipp Stephani 2 siblings, 1 reply; 32+ messages in thread From: Stefan Kangas @ 2020-12-28 14:56 UTC (permalink / raw) To: Philipp Stephani, Daniel Martín; +Cc: Emacs developers Philipp Stephani <p.stephani2@gmail.com> writes: >> goto-char is an interactive function that has the potential to take you >> long distances, so it might be a good idea, for user convenience, to >> push the mark as a documented side effect (is it a good idea?). > > goto-char is a low-level primitive that's used pervasively in Emacs > Lisp code. I think that pushing the mark would be a way too drastic > change. Agreed. But would it perhaps make sense to push the mark only when it is called interactively? Or to replace `M-g c' with a new command that also pushes mark? ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-28 14:56 ` Stefan Kangas @ 2020-12-28 15:32 ` Philipp Stephani 2020-12-28 16:49 ` martin rudalics 0 siblings, 1 reply; 32+ messages in thread From: Philipp Stephani @ 2020-12-28 15:32 UTC (permalink / raw) To: Stefan Kangas; +Cc: Emacs developers, Daniel Martín Am Mo., 28. Dez. 2020 um 15:56 Uhr schrieb Stefan Kangas <stefankangas@gmail.com>: > > Philipp Stephani <p.stephani2@gmail.com> writes: > > >> goto-char is an interactive function that has the potential to take you > >> long distances, so it might be a good idea, for user convenience, to > >> push the mark as a documented side effect (is it a good idea?). > > > > goto-char is a low-level primitive that's used pervasively in Emacs > > Lisp code. I think that pushing the mark would be a way too drastic > > change. > > Agreed. > > But would it perhaps make sense to push the mark only when it is called > interactively? I don't think we should have functions that behave significantly differently when called interactively - too much confusion. > Or to replace `M-g c' with a new command that also > pushes mark? That sounds feasible. Maybe we should then also introduce a customization option to control the behavior. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-28 15:32 ` Philipp Stephani @ 2020-12-28 16:49 ` martin rudalics 2020-12-28 17:15 ` Juri Linkov 0 siblings, 1 reply; 32+ messages in thread From: martin rudalics @ 2020-12-28 16:49 UTC (permalink / raw) To: Philipp Stephani, Stefan Kangas; +Cc: Daniel Martín, Emacs developers >> Or to replace `M-g c' with a new command that also >> pushes mark? > > That sounds feasible. Maybe we should then also introduce a > customization option to control the behavior. I'd then try to make it behave like 'M-g g' in this regard. martin ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-28 16:49 ` martin rudalics @ 2020-12-28 17:15 ` Juri Linkov 2020-12-29 8:54 ` martin rudalics 0 siblings, 1 reply; 32+ messages in thread From: Juri Linkov @ 2020-12-28 17:15 UTC (permalink / raw) To: martin rudalics Cc: Philipp Stephani, Emacs developers, Stefan Kangas, Daniel Martín >>> Or to replace `M-g c' with a new command that also >>> pushes mark? >> >> That sounds feasible. Maybe we should then also introduce a >> customization option to control the behavior. > > I'd then try to make it behave like 'M-g g' in this regard. Some interactive versions of low-level primitives have the suffix `...-command' in their names, so a command like 'M-g g' and bound to 'M-g c' could be named 'goto-char-command'. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-28 17:15 ` Juri Linkov @ 2020-12-29 8:54 ` martin rudalics 2020-12-29 14:41 ` Stefan Kangas 2021-01-05 19:06 ` Daniel Martín via "Emacs development discussions. 0 siblings, 2 replies; 32+ messages in thread From: martin rudalics @ 2020-12-29 8:54 UTC (permalink / raw) To: Juri Linkov Cc: Philipp Stephani, Daniel Martín, Stefan Kangas, Emacs developers >> I'd then try to make it behave like 'M-g g' in this regard. > > Some interactive versions of low-level primitives have the suffix > `...-command' in their names, so a command like 'M-g g' and bound to > 'M-g c' could be named 'goto-char-command'. I was more concerned about not pushing the mark when the region is already active so one can use M-g c to extend the region. BTW, is there a reason why 'goto-map' is so terribly unpopulated? martin ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-29 8:54 ` martin rudalics @ 2020-12-29 14:41 ` Stefan Kangas 2020-12-29 16:59 ` martin rudalics 2021-01-05 19:06 ` Daniel Martín via "Emacs development discussions. 1 sibling, 1 reply; 32+ messages in thread From: Stefan Kangas @ 2020-12-29 14:41 UTC (permalink / raw) To: martin rudalics, Juri Linkov Cc: Philipp Stephani, Daniel Martín, Emacs developers martin rudalics <rudalics@gmx.at> writes: > BTW, is there a reason why 'goto-map' is so terribly unpopulated? Do you have any ideas for what to add? FWIW, here I have `M-g M-j' for `bookmark-jump' and `M-g M-r' for `goto-random-line' (local function). ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-29 14:41 ` Stefan Kangas @ 2020-12-29 16:59 ` martin rudalics 2020-12-29 17:56 ` Drew Adams ` (3 more replies) 0 siblings, 4 replies; 32+ messages in thread From: martin rudalics @ 2020-12-29 16:59 UTC (permalink / raw) To: Stefan Kangas, Juri Linkov Cc: Philipp Stephani, Emacs developers, Daniel Martín >> BTW, is there a reason why 'goto-map' is so terribly unpopulated? > > Do you have any ideas for what to add? Not really - it's the first time I've been looking into it. But given the recent discussions about stealing each other's bindings I wonder why such a convenient prefix like M-g is not more exploited. Maybe because ESC on a terminal is not so convenient. martin ^ permalink raw reply [flat|nested] 32+ messages in thread
* RE: Pushing the mark from a primitive like goto-char 2020-12-29 16:59 ` martin rudalics @ 2020-12-29 17:56 ` Drew Adams 2020-12-29 19:25 ` Juri Linkov ` (2 subsequent siblings) 3 siblings, 0 replies; 32+ messages in thread From: Drew Adams @ 2020-12-29 17:56 UTC (permalink / raw) To: martin rudalics, Stefan Kangas, Juri Linkov Cc: Philipp Stephani, Daniel Martín, Emacs developers >>> BTW, is there a reason why 'goto-map' is so terribly unpopulated? >> Do you have any ideas for what to add? > > Not really - it's the first time I've been looking into it. But given > the recent discussions about stealing each other's bindings I wonder why > such a convenient prefix like M-g is not more exploited. Maybe because > ESC on a terminal is not so convenient. You might consider adding `(beginning|end)-of-buffer' to `goto-map'. FWIW, my library `menu-bar+.el' has this for the `Go To' menu (not quite the same thing as `goto-map'): Line... M-g g Column (Position in Line)... M-g TAB Buffer Position... M-g c Beginning of Buffer M-< End of Buffer M-> Next Error C-x ` Previous Error M-g p And if Bookmark+ is available (which has many kinds of jump commands), submenu `Bookmark' (jumping only). (Those jump items are also on a more general `Bookmarks' menu, along with non-jump bookmark commands.) And if Icicles is available, submenu `Icicles', which has multi-command items for moving among markers etc. ___ And tag-finding (now "xref") items could be moved from `goto-map' to a search map (such as `search-map'). They're not so much about going to a predefined position as they are about finding something. A user is more likely to look for finding and searching in the same place. `menu-bar+.el' puts them on a menu-bar `Search' menu, submenu `Tags': Find Tag... Find Next Tag ___________ Find Tag Regexp... Search Tagged Files... Continue Search/Replace ___________ Tags Apropos... Set Tags File Name... ___ `menu-bar+.el' also puts `grep' and similar on the `Search' menu, not `Tools' -- they're about finding or searching. The `Tools' menu is a catch-all. Something should be there only if there's no more specific kind of "tool"/action place to put it. Searching/finding tools are better on a `Search' menu. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-29 16:59 ` martin rudalics 2020-12-29 17:56 ` Drew Adams @ 2020-12-29 19:25 ` Juri Linkov 2020-12-29 19:47 ` Eli Zaretskii 2020-12-29 19:54 ` Drew Adams 2020-12-30 5:26 ` Richard Stallman 2020-12-31 2:43 ` Howard Melman 3 siblings, 2 replies; 32+ messages in thread From: Juri Linkov @ 2020-12-29 19:25 UTC (permalink / raw) To: martin rudalics Cc: Philipp Stephani, Emacs developers, Stefan Kangas, Daniel Martín >>> BTW, is there a reason why 'goto-map' is so terribly unpopulated? >> >> Do you have any ideas for what to add? > > Not really - it's the first time I've been looking into it. But given > the recent discussions about stealing each other's bindings I wonder why > such a convenient prefix like M-g is not more exploited. Maybe because > ESC on a terminal is not so convenient. Since there is a new unbound command 'goto-line-relative' maybe then we could add it to 'goto-map' it as follows: M-g M-G goto-line M-g M-g goto-line-relative ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-29 19:25 ` Juri Linkov @ 2020-12-29 19:47 ` Eli Zaretskii 2020-12-30 9:36 ` Juri Linkov 2020-12-29 19:54 ` Drew Adams 1 sibling, 1 reply; 32+ messages in thread From: Eli Zaretskii @ 2020-12-29 19:47 UTC (permalink / raw) To: Juri Linkov; +Cc: rudalics, p.stephani2, mardani29, stefankangas, emacs-devel > From: Juri Linkov <juri@linkov.net> > Date: Tue, 29 Dec 2020 21:25:40 +0200 > Cc: Philipp Stephani <p.stephani2@gmail.com>, > Emacs developers <emacs-devel@gnu.org>, Stefan Kangas <stefankangas@gmail.com>, > Daniel Martín <mardani29@yahoo.es> > > Since there is a new unbound command 'goto-line-relative' It isn't unbound. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-29 19:47 ` Eli Zaretskii @ 2020-12-30 9:36 ` Juri Linkov 0 siblings, 0 replies; 32+ messages in thread From: Juri Linkov @ 2020-12-30 9:36 UTC (permalink / raw) To: Eli Zaretskii; +Cc: rudalics, p.stephani2, mardani29, stefankangas, emacs-devel >> Since there is a new unbound command 'goto-line-relative' > > It isn't unbound. I don't think its current binding is the best. A binding in 'goto-map' would be more discoverable. ^ permalink raw reply [flat|nested] 32+ messages in thread
* RE: Pushing the mark from a primitive like goto-char 2020-12-29 19:25 ` Juri Linkov 2020-12-29 19:47 ` Eli Zaretskii @ 2020-12-29 19:54 ` Drew Adams 2020-12-30 9:41 ` Juri Linkov 1 sibling, 1 reply; 32+ messages in thread From: Drew Adams @ 2020-12-29 19:54 UTC (permalink / raw) To: Juri Linkov, martin rudalics Cc: Philipp Stephani, Daniel Martín, Stefan Kangas, Emacs developers > Since there is a new unbound command 'goto-line-relative' > maybe then we could add it to 'goto-map' it as follows: > > M-g M-G goto-line > M-g M-g goto-line-relative Isn't `M-g M-g' already bound to `goto-line'? Why would you move that command to `M-g M-G' and give its longstanding binding, `M-g M-g', to the new command? I'm sure there must be some logic behind your suggestion (you typically give reasons, thankfully), but it's not clear to me why we'd want to move `goto-line'. (And I can't think about it, as I have no idea what `goto-line-relative' is/does.) ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-29 19:54 ` Drew Adams @ 2020-12-30 9:41 ` Juri Linkov 2020-12-30 17:32 ` Drew Adams 0 siblings, 1 reply; 32+ messages in thread From: Juri Linkov @ 2020-12-30 9:41 UTC (permalink / raw) To: Drew Adams Cc: martin rudalics, Philipp Stephani, Daniel Martín, Stefan Kangas, Emacs developers >> Since there is a new unbound command 'goto-line-relative' >> maybe then we could add it to 'goto-map' it as follows: >> >> M-g M-G goto-line >> M-g M-g goto-line-relative > > Isn't `M-g M-g' already bound to `goto-line'? > > Why would you move that command to `M-g M-G' and give > its longstanding binding, `M-g M-g', to the new command? > > I'm sure there must be some logic behind your > suggestion (you typically give reasons, thankfully), > but it's not clear to me why we'd want to move > `goto-line'. (And I can't think about it, as I have > no idea what `goto-line-relative' is/does.) Because there is no difference between them when the buffer is not narrowed, i.e. most users won't notice the difference. Alternatively, 'M-g M-G' could be bound to goto-line-relative (if it's still easy to type on tty). The choice mostly depends on what the users will mostly use: goto-line or goto-line-relative? ^ permalink raw reply [flat|nested] 32+ messages in thread
* RE: Pushing the mark from a primitive like goto-char 2020-12-30 9:41 ` Juri Linkov @ 2020-12-30 17:32 ` Drew Adams 0 siblings, 0 replies; 32+ messages in thread From: Drew Adams @ 2020-12-30 17:32 UTC (permalink / raw) To: Juri Linkov Cc: martin rudalics, Philipp Stephani, Daniel Martín, Stefan Kangas, Emacs developers > > it's not clear to me why we'd want to move > > `goto-line'. (And I can't think about it, as I have > > no idea what `goto-line-relative' is/does.) > > Because there is no difference between them when the buffer > is not narrowed, i.e. most users won't notice the difference. > Alternatively, 'M-g M-G' could be bound to goto-line-relative > (if it's still easy to type on tty). The choice mostly depends on > what the users will mostly use: goto-line or goto-line-relative? As I said - no idea what `goto-line-relative' is/does. From what you say now, it's like `goto-line', except when the buffer is narrowed. Other than that, I still have no idea. Anyway, a priori it makes more sense to bind the new command to a new key sequence (if we bind it at all), no? ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-29 16:59 ` martin rudalics 2020-12-29 17:56 ` Drew Adams 2020-12-29 19:25 ` Juri Linkov @ 2020-12-30 5:26 ` Richard Stallman 2020-12-31 2:43 ` Howard Melman 3 siblings, 0 replies; 32+ messages in thread From: Richard Stallman @ 2020-12-30 5:26 UTC (permalink / raw) To: martin rudalics; +Cc: p.stephani2, emacs-devel, mardani29, stefankangas, juri [[[ 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. ]]] > But given > the recent discussions about stealing each other's bindings I wonder why > such a convenient prefix like M-g is not more exploited. Maybe because > ESC on a terminal is not so convenient. I don't think it is that. There's nothing hard about typing M-g on the Linux ttys. Does anyone actally use a terminal on which M-g requires more than holding the Alt key? I think the reason there is not much on the M-g prefix is that we haven't seen many ideas of what to put in it. -- Dr Richard Stallman 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] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-29 16:59 ` martin rudalics ` (2 preceding siblings ...) 2020-12-30 5:26 ` Richard Stallman @ 2020-12-31 2:43 ` Howard Melman 3 siblings, 0 replies; 32+ messages in thread From: Howard Melman @ 2020-12-31 2:43 UTC (permalink / raw) To: emacs-devel martin rudalics <rudalics@gmx.at> writes: >>> BTW, is there a reason why 'goto-map' is so terribly unpopulated? >> >> Do you have any ideas for what to add? FWIW I do: (global-set-key (kbd "M-g d") 'dired-jump) (global-set-key (kbd "M-g b") 'ibuffer-jump) (global-set-key (kbd "M-g f") 'reveal-in-finder) ;custom mac command (global-set-key (kbd "M-g s") 'shell) ; eshell? (global-set-key (kbd "M-g i") 'consult-imenu) (global-set-key (kbd "M-g M-i") 'imenu-anywhere) (global-set-key (kbd "M-g t") 'move-to-window-line-top-bottom) -- Howard ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2020-12-29 8:54 ` martin rudalics 2020-12-29 14:41 ` Stefan Kangas @ 2021-01-05 19:06 ` Daniel Martín via "Emacs development discussions. 2021-01-05 19:17 ` Stefan Monnier ` (4 more replies) 1 sibling, 5 replies; 32+ messages in thread From: Daniel MartÃn via "Emacs development discussions. @ 2021-01-05 19:06 UTC (permalink / raw) To: martin rudalics Cc: Philipp Stephani, Emacs developers, Stefan Kangas, Juri Linkov martin rudalics <rudalics@gmx.at> writes: >>> I'd then try to make it behave like 'M-g g' in this regard. >> >> Some interactive versions of low-level primitives have the suffix >> `...-command' in their names, so a command like 'M-g g' and bound to >> 'M-g c' could be named 'goto-char-command'. > > I was more concerned about not pushing the mark when the region is > already active so one can use M-g c to extend the region. BTW, is there > a reason why 'goto-map' is so terribly unpopulated? > This sounds like a good idea: - Create a 'goto-char-command' command in ELisp. - Move the interactive spec that is in 'goto-char' to this new command and make it push the mark smartly (e.g. be careful when a region is active). Then call 'goto-char'. - Rebind 'M-g c' to 'goto-char-command'. - Announce the new command. What do you think? Could it break something? Thanks. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 19:06 ` Daniel Martín via "Emacs development discussions. @ 2021-01-05 19:17 ` Stefan Monnier 2021-01-05 19:19 ` Stefan Monnier ` (3 subsequent siblings) 4 siblings, 0 replies; 32+ messages in thread From: Stefan Monnier @ 2021-01-05 19:17 UTC (permalink / raw) To: Daniel Martín via Emacs development discussions. Cc: martin rudalics, Philipp Stephani, Juri Linkov, Stefan Kangas, Daniel Martín > What do you think? Sounds good. Don't forget to mark the `goto-char-command` as `interactive-only` (with `declare`). Stefan ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 19:06 ` Daniel Martín via "Emacs development discussions. 2021-01-05 19:17 ` Stefan Monnier @ 2021-01-05 19:19 ` Stefan Monnier 2021-01-05 19:52 ` Philipp Stephani 2021-01-05 19:29 ` Eli Zaretskii ` (2 subsequent siblings) 4 siblings, 1 reply; 32+ messages in thread From: Stefan Monnier @ 2021-01-05 19:19 UTC (permalink / raw) To: Daniel Martín via Emacs development discussions. Cc: martin rudalics, Philipp Stephani, Juri Linkov, Stefan Kangas, Daniel Martín >>>> I'd then try to make it behave like 'M-g g' in this regard. >>> >>> Some interactive versions of low-level primitives have the suffix >>> `...-command' in their names, so a command like 'M-g g' and bound to >>> 'M-g c' could be named 'goto-char-command'. >> >> I was more concerned about not pushing the mark when the region is >> already active so one can use M-g c to extend the region. BTW, is there >> a reason why 'goto-map' is so terribly unpopulated? >> > > This sounds like a good idea: > > - Create a 'goto-char-command' command in ELisp. > > - Move the interactive spec that is in 'goto-char' to this new command > and make it push the mark smartly (e.g. be careful when a region is > active). Then call 'goto-char'. > > - Rebind 'M-g c' to 'goto-char-command'. > > - Announce the new command. > > What do you think? Could it break something? Thanks. Actually, now that I think about it: do we really need a new command, or can we instead arrange to do all the mark-handling from within the interactive spec? Stefan ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 19:19 ` Stefan Monnier @ 2021-01-05 19:52 ` Philipp Stephani 2021-01-05 20:01 ` Stefan Monnier 2021-01-05 20:29 ` Drew Adams 0 siblings, 2 replies; 32+ messages in thread From: Philipp Stephani @ 2021-01-05 19:52 UTC (permalink / raw) To: Stefan Monnier Cc: martin rudalics, Juri Linkov, Daniel Martín, Stefan Kangas, Daniel Martín via Emacs development discussions. Am Di., 5. Jan. 2021 um 20:19 Uhr schrieb Stefan Monnier <monnier@iro.umontreal.ca>: > > >>>> I'd then try to make it behave like 'M-g g' in this regard. > >>> > >>> Some interactive versions of low-level primitives have the suffix > >>> `...-command' in their names, so a command like 'M-g g' and bound to > >>> 'M-g c' could be named 'goto-char-command'. > >> > >> I was more concerned about not pushing the mark when the region is > >> already active so one can use M-g c to extend the region. BTW, is there > >> a reason why 'goto-map' is so terribly unpopulated? > >> > > > > This sounds like a good idea: > > > > - Create a 'goto-char-command' command in ELisp. > > > > - Move the interactive spec that is in 'goto-char' to this new command > > and make it push the mark smartly (e.g. be careful when a region is > > active). Then call 'goto-char'. > > > > - Rebind 'M-g c' to 'goto-char-command'. > > > > - Announce the new command. > > > > What do you think? Could it break something? Thanks. > > Actually, now that I think about it: do we really need a new command, or > can we instead arrange to do all the mark-handling from within the > interactive spec? > I think that would be too confusing. The interactive specification should only gather input, but not perform state changes. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 19:52 ` Philipp Stephani @ 2021-01-05 20:01 ` Stefan Monnier 2021-01-05 20:29 ` Drew Adams 1 sibling, 0 replies; 32+ messages in thread From: Stefan Monnier @ 2021-01-05 20:01 UTC (permalink / raw) To: Philipp Stephani Cc: martin rudalics, Juri Linkov, Daniel Martín, Stefan Kangas, Daniel Martín via Emacs development discussions. > I think that would be too confusing. The interactive specification > should only gather input, but not perform state changes. I'd have to see it before I could judge, but I don't think it would necessarily be confusing, no. We already do similar things in some interactive specs, for example for the `handle-shift-selection`. Stefan ^ permalink raw reply [flat|nested] 32+ messages in thread
* RE: Pushing the mark from a primitive like goto-char 2021-01-05 19:52 ` Philipp Stephani 2021-01-05 20:01 ` Stefan Monnier @ 2021-01-05 20:29 ` Drew Adams 2021-01-06 5:12 ` Richard Stallman 1 sibling, 1 reply; 32+ messages in thread From: Drew Adams @ 2021-01-05 20:29 UTC (permalink / raw) To: Philipp Stephani, Stefan Monnier Cc: martin rudalics, Daniel Martín, Daniel Martín via Emacs development discussions., Stefan Kangas, Juri Linkov > The interactive specification should only > gather input, but not perform state changes. Why? In what contexts? Or are you proposing this as a blanket rule? The interactive spec is just code evaluated when the function is invoked interactively, and which can (but need not) return values to be used as args for the function. Nothing more. The interactive spec can do anything you need/want it to do. Likewise, the function's non-interactive code (aka body). This is Lisp. Code can change state. It's up to the author - you get the behavior you code. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 20:29 ` Drew Adams @ 2021-01-06 5:12 ` Richard Stallman 0 siblings, 0 replies; 32+ messages in thread From: Richard Stallman @ 2021-01-06 5:12 UTC (permalink / raw) To: Drew Adams Cc: juri, emacs-devel, rudalics, p.stephani2, stefankangas, mardani29, monnier [[[ 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. ]]] In general, the interactive spec should only read the arguments. The "real work" should be done in the function body once it gets the arguments. The reason for this is clean design, and to gives the right relationship between interactive calls and noninteractive. However, reading the arguments can legitimately have side effects, byproducts of reading the arguments -- for instance, changing the obarray if you need to intern something. -- Dr Richard Stallman 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] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 19:06 ` Daniel Martín via "Emacs development discussions. 2021-01-05 19:17 ` Stefan Monnier 2021-01-05 19:19 ` Stefan Monnier @ 2021-01-05 19:29 ` Eli Zaretskii 2021-01-05 19:53 ` Philipp Stephani 2021-01-08 19:30 ` Daniel Martín via "Emacs development discussions. 2021-01-05 19:56 ` Philipp Stephani 2021-01-06 19:26 ` Gabriel do Nascimento Ribeiro 4 siblings, 2 replies; 32+ messages in thread From: Eli Zaretskii @ 2021-01-05 19:29 UTC (permalink / raw) To: Daniel Martín; +Cc: rudalics, p.stephani2, juri, stefankangas, emacs-devel > Date: Tue, 05 Jan 2021 20:06:28 +0100 > Cc: Philipp Stephani <p.stephani2@gmail.com>, > Emacs developers <emacs-devel@gnu.org>, Stefan Kangas <stefankangas@gmail.com>, > Juri Linkov <juri@linkov.net> > From: Daniel Martín via "Emacs development discussions." <emacs-devel@gnu.org> > > - Create a 'goto-char-command' command in ELisp. > > - Move the interactive spec that is in 'goto-char' to this new command > and make it push the mark smartly (e.g. be careful when a region is > active). Then call 'goto-char'. > > - Rebind 'M-g c' to 'goto-char-command'. You mean, it will be impossible to invoke "M-x goto-char"? ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 19:29 ` Eli Zaretskii @ 2021-01-05 19:53 ` Philipp Stephani 2021-01-08 19:30 ` Daniel Martín via "Emacs development discussions. 1 sibling, 0 replies; 32+ messages in thread From: Philipp Stephani @ 2021-01-05 19:53 UTC (permalink / raw) To: Eli Zaretskii Cc: martin rudalics, Juri Linkov, Emacs developers, Stefan Kangas, Daniel Martín Am Di., 5. Jan. 2021 um 20:29 Uhr schrieb Eli Zaretskii <eliz@gnu.org>: > > > Date: Tue, 05 Jan 2021 20:06:28 +0100 > > Cc: Philipp Stephani <p.stephani2@gmail.com>, > > Emacs developers <emacs-devel@gnu.org>, Stefan Kangas <stefankangas@gmail.com>, > > Juri Linkov <juri@linkov.net> > > From: Daniel Martín via "Emacs development discussions." <emacs-devel@gnu.org> > > > > - Create a 'goto-char-command' command in ELisp. > > > > - Move the interactive spec that is in 'goto-char' to this new command > > and make it push the mark smartly (e.g. be careful when a region is > > active). Then call 'goto-char'. > > > > - Rebind 'M-g c' to 'goto-char-command'. > > You mean, it will be impossible to invoke "M-x goto-char"? Yes, goto-char should retain its interactive spec, there's no harm in that. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 19:29 ` Eli Zaretskii 2021-01-05 19:53 ` Philipp Stephani @ 2021-01-08 19:30 ` Daniel Martín via "Emacs development discussions. 1 sibling, 0 replies; 32+ messages in thread From: Daniel MartÃn via "Emacs development discussions. @ 2021-01-08 19:30 UTC (permalink / raw) To: Eli Zaretskii; +Cc: rudalics, p.stephani2, emacs-devel, stefankangas, juri Eli Zaretskii <eliz@gnu.org> writes: >> Date: Tue, 05 Jan 2021 20:06:28 +0100 >> Cc: Philipp Stephani <p.stephani2@gmail.com>, >> Emacs developers <emacs-devel@gnu.org>, Stefan Kangas <stefankangas@gmail.com>, >> Juri Linkov <juri@linkov.net> >> From: Daniel Martín via "Emacs development discussions." <emacs-devel@gnu.org> >> >> - Create a 'goto-char-command' command in ELisp. >> >> - Move the interactive spec that is in 'goto-char' to this new command >> and make it push the mark smartly (e.g. be careful when a region is >> active). Then call 'goto-char'. >> >> - Rebind 'M-g c' to 'goto-char-command'. > > You mean, it will be impossible to invoke "M-x goto-char"? Yes, what'd happen is that "M-x goto-char" RET will produce "goto-char-", and the user would need to press another TAB to get "goto-char-command", which may be inconvenient. Having both "M-x goto-char" and "M-x goto-char-command" could be confusing as well. I'll give a try to implementing this as a side effect in the interactive spec. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 19:06 ` Daniel Martín via "Emacs development discussions. ` (2 preceding siblings ...) 2021-01-05 19:29 ` Eli Zaretskii @ 2021-01-05 19:56 ` Philipp Stephani 2021-01-06 19:26 ` Gabriel do Nascimento Ribeiro 4 siblings, 0 replies; 32+ messages in thread From: Philipp Stephani @ 2021-01-05 19:56 UTC (permalink / raw) To: Daniel Martín Cc: martin rudalics, Emacs developers, Stefan Kangas, Juri Linkov Am Di., 5. Jan. 2021 um 20:06 Uhr schrieb Daniel Martín <mardani29@yahoo.es>: > > martin rudalics <rudalics@gmx.at> writes: > > >>> I'd then try to make it behave like 'M-g g' in this regard. > >> > >> Some interactive versions of low-level primitives have the suffix > >> `...-command' in their names, so a command like 'M-g g' and bound to > >> 'M-g c' could be named 'goto-char-command'. > > > > I was more concerned about not pushing the mark when the region is > > already active so one can use M-g c to extend the region. BTW, is there > > a reason why 'goto-map' is so terribly unpopulated? > > > > This sounds like a good idea: > > - Create a 'goto-char-command' command in ELisp. > > - Move the interactive spec that is in 'goto-char' to this new command > and make it push the mark smartly (e.g. be careful when a region is > active). Then call 'goto-char'. There's no need the change goto-char; it can remain an interactive command. > > - Rebind 'M-g c' to 'goto-char-command'. > > - Announce the new command. > > What do you think? Could it break something? Thanks. It will break users that expect the current behavior, so maybe there should be a customization option that initially defaults to off. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Pushing the mark from a primitive like goto-char 2021-01-05 19:06 ` Daniel Martín via "Emacs development discussions. ` (3 preceding siblings ...) 2021-01-05 19:56 ` Philipp Stephani @ 2021-01-06 19:26 ` Gabriel do Nascimento Ribeiro 4 siblings, 0 replies; 32+ messages in thread From: Gabriel do Nascimento Ribeiro @ 2021-01-06 19:26 UTC (permalink / raw) To: emacs-devel "Daniel MartÃn via \"Emacs development discussions." <emacs-devel@gnu.org> writes: > martin rudalics <rudalics@gmx.at> writes: > >>>> I'd then try to make it behave like 'M-g g' in this regard. >>> >>> Some interactive versions of low-level primitives have the suffix >>> `...-command' in their names, so a command like 'M-g g' and bound to >>> 'M-g c' could be named 'goto-char-command'. >> >> I was more concerned about not pushing the mark when the region is >> already active so one can use M-g c to extend the region. BTW, is there >> a reason why 'goto-map' is so terribly unpopulated? >> > > This sounds like a good idea: > > - Create a 'goto-char-command' command in ELisp. > > - Move the interactive spec that is in 'goto-char' to this new command > and make it push the mark smartly (e.g. be careful when a region is > active). Then call 'goto-char'. > > - Rebind 'M-g c' to 'goto-char-command'. > > - Announce the new command. > > What do you think? Could it break something? Thanks. Thank you! I guess we missed the :group definition, here is a patch: ======================================================== diff --git a/lisp/mb-depth.el b/lisp/mb-depth.el index ea2ea174b5..22315cd93f 100644 --- a/lisp/mb-depth.el +++ b/lisp/mb-depth.el @@ -37,7 +37,8 @@ minibuffer-depth-indicator-function (defface minibuffer-depth-indicator '((t :inherit highlight)) "Face to use for minibuffer depth indicator." - :version "28.1") + :version "28.1" + :group 'basic-faces) ;; An overlay covering the prompt. This is a buffer-local variable in ;; each affected minibuffer. ======================================================== ^ permalink raw reply related [flat|nested] 32+ messages in thread
end of thread, other threads:[~2021-01-08 19:30 UTC | newest] Thread overview: 32+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <m1im8mgmb7.fsf.ref@yahoo.es> 2020-12-28 12:14 ` Pushing the mark from a primitive like goto-char Daniel Martín 2020-12-28 14:17 ` Philipp Stephani 2020-12-28 14:45 ` Daniel Martín 2020-12-28 14:49 ` Eli Zaretskii 2020-12-28 14:56 ` Stefan Kangas 2020-12-28 15:32 ` Philipp Stephani 2020-12-28 16:49 ` martin rudalics 2020-12-28 17:15 ` Juri Linkov 2020-12-29 8:54 ` martin rudalics 2020-12-29 14:41 ` Stefan Kangas 2020-12-29 16:59 ` martin rudalics 2020-12-29 17:56 ` Drew Adams 2020-12-29 19:25 ` Juri Linkov 2020-12-29 19:47 ` Eli Zaretskii 2020-12-30 9:36 ` Juri Linkov 2020-12-29 19:54 ` Drew Adams 2020-12-30 9:41 ` Juri Linkov 2020-12-30 17:32 ` Drew Adams 2020-12-30 5:26 ` Richard Stallman 2020-12-31 2:43 ` Howard Melman 2021-01-05 19:06 ` Daniel Martín via "Emacs development discussions. 2021-01-05 19:17 ` Stefan Monnier 2021-01-05 19:19 ` Stefan Monnier 2021-01-05 19:52 ` Philipp Stephani 2021-01-05 20:01 ` Stefan Monnier 2021-01-05 20:29 ` Drew Adams 2021-01-06 5:12 ` Richard Stallman 2021-01-05 19:29 ` Eli Zaretskii 2021-01-05 19:53 ` Philipp Stephani 2021-01-08 19:30 ` Daniel Martín via "Emacs development discussions. 2021-01-05 19:56 ` Philipp Stephani 2021-01-06 19:26 ` Gabriel do Nascimento Ribeiro
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.