* Universal/prefix argument for "other window" redirection? @ 2021-04-08 9:37 Arthur Miller 2021-04-08 12:16 ` Gregory Heytings ` (2 more replies) 0 siblings, 3 replies; 15+ messages in thread From: Arthur Miller @ 2021-04-08 9:37 UTC (permalink / raw) To: emacs-devel Is there already a way to "automatically" modify interactive commands to "auto-work" in other window instead of current window? I know I can scroll other window already and switch to some buffer in another window with `switch-to-buffer-another-window`, I already use them. What I would like is to have all the cursor motion stuff, expression evals etc, work on in other window so I don't need to switch back and forth two buffers (I like to work with two buffers side-by-side). I wonder if there is already something I could use; prefix command/universal prefix whatever, to autmoatically modify behaviour of interactive commands involved or do I have to write my own (if it's possible :))? ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 9:37 Universal/prefix argument for "other window" redirection? Arthur Miller @ 2021-04-08 12:16 ` Gregory Heytings 2021-04-08 15:58 ` Arthur Miller 2021-04-08 14:56 ` Stefan Monnier 2021-04-08 19:04 ` Sean Whitton 2 siblings, 1 reply; 15+ messages in thread From: Gregory Heytings @ 2021-04-08 12:16 UTC (permalink / raw) To: Arthur Miller; +Cc: emacs-devel > > Is there already a way to "automatically" modify interactive commands to > "auto-work" in other window instead of current window? > > I know I can scroll other window already and switch to some buffer in > another window with `switch-to-buffer-another-window`, I already use > them. > > What I would like is to have all the cursor motion stuff, expression > evals etc, work on in other window so I don't need to switch back and > forth two buffers (I like to work with two buffers side-by-side). I > wonder if there is already something I could use; prefix > command/universal prefix whatever, to autmoatically modify behaviour of > interactive commands involved or do I have to write my own (if it's > possible :))? > (defun next-command-in-other-window () (interactive) (let ((key (read-key-sequence nil))) (let ((window (other-window-for-scrolling))) (with-selected-window window (execute-kbd-macro key))))) ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 12:16 ` Gregory Heytings @ 2021-04-08 15:58 ` Arthur Miller 0 siblings, 0 replies; 15+ messages in thread From: Arthur Miller @ 2021-04-08 15:58 UTC (permalink / raw) To: Gregory Heytings; +Cc: emacs-devel Gregory Heytings <gregory@heytings.org> writes: >> >> Is there already a way to "automatically" modify interactive commands to >> "auto-work" in other window instead of current window? >> >> I know I can scroll other window already and switch to some buffer in another >> window with `switch-to-buffer-another-window`, I already use them. >> >> What I would like is to have all the cursor motion stuff, expression evals >> etc, work on in other window so I don't need to switch back and forth two >> buffers (I like to work with two buffers side-by-side). I wonder if there is >> already something I could use; prefix command/universal prefix whatever, to >> autmoatically modify behaviour of interactive commands involved or do I have >> to write my own (if it's possible :))? >> > > (defun next-command-in-other-window () > (interactive) > (let ((key (read-key-sequence nil))) > (let ((window (other-window-for-scrolling))) > (with-selected-window window > (execute-kbd-macro key))))) ha! It was that simple :-). I had something else in mind, but good I didn't wrote anything. Seems to work very fine with some commands; not so good with others. For example motion commands like forward char, word, line etc, seems to work very good. C-x C-f does not work at all (for me it is helm-find-files). I know there is C-x 4 C-f I have put it on `§` as a shortcut and tested for a while today. I am not sure if like my idea :). For "one-timers" quick commands it saves switching to original buffer and feels overal lighter than switching to other window and back. But some things felt slightly confusing since I don't see the cursor, like evaling last expression. Cool anyway, thanks! ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 9:37 Universal/prefix argument for "other window" redirection? Arthur Miller 2021-04-08 12:16 ` Gregory Heytings @ 2021-04-08 14:56 ` Stefan Monnier 2021-04-08 16:11 ` Arthur Miller 2021-04-08 22:59 ` Arthur Miller 2021-04-08 19:04 ` Sean Whitton 2 siblings, 2 replies; 15+ messages in thread From: Stefan Monnier @ 2021-04-08 14:56 UTC (permalink / raw) To: Arthur Miller; +Cc: emacs-devel > What I would like is to have all the cursor motion stuff, expression > evals etc, work on in other window so I don't need to switch back and > forth two buffers (I like to work with two buffers side-by-side). I > wonder if there is already something I could use; prefix > command/universal prefix whatever, to autmoatically modify behaviour of > interactive commands involved or do I have to write my own (if it's > possible :))? OT1H you mention universal-prefix (which only affects the very next command) but OTOH you say "all the cursor motion stuff ...". For the "all the cursor ..." case, it seems you're saying all the commands should operate on the other window, which is exactly what you get after `C-x o`, so your description needs more details to know what you really mean. I don't think there's already what you want. Gregory's code is a workable starting point for the "just the next command" case. Another direction might be the `vcursor.el` approach. Stefan ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 14:56 ` Stefan Monnier @ 2021-04-08 16:11 ` Arthur Miller 2021-04-08 17:01 ` Yuri Khan 2021-04-09 4:18 ` Eric Abrahamsen 2021-04-08 22:59 ` Arthur Miller 1 sibling, 2 replies; 15+ messages in thread From: Arthur Miller @ 2021-04-08 16:11 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: >> What I would like is to have all the cursor motion stuff, expression >> evals etc, work on in other window so I don't need to switch back and >> forth two buffers (I like to work with two buffers side-by-side). I >> wonder if there is already something I could use; prefix >> command/universal prefix whatever, to autmoatically modify behaviour of >> interactive commands involved or do I have to write my own (if it's >> possible :))? > > OT1H you mention universal-prefix (which only affects the very next > command) but OTOH you say "all the cursor motion stuff ...". > > For the "all the cursor ..." case, it seems you're saying all the > commands should operate on the other window, which is exactly what you > get after `C-x o`, so your description needs more details to know what > you really mean. Haha, yes, I think I myself need more details to know what I mean :). I don't know myself what I really want. I find myself switching a lot between two windows, which sometimes feels redundant. Maybe it is just the shortcut, C-x o, or in my case C-v o. After playing with Gregory's example, I am thinking of just binding the other-window to the `§` key. Maybe that itself will be enough for somewhat "smoother" experience. > I don't think there's already what you want. > Gregory's code is a workable starting point for the "just the next > command" case. Another direction might be the `vcursor.el` approach. Indeed, Gregory's code seems to be very nice tool for some quick fixes. I'll take a look at vcursor.el too. Thanks. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 16:11 ` Arthur Miller @ 2021-04-08 17:01 ` Yuri Khan 2021-04-08 17:42 ` Arthur Miller 2021-04-09 4:18 ` Eric Abrahamsen 1 sibling, 1 reply; 15+ messages in thread From: Yuri Khan @ 2021-04-08 17:01 UTC (permalink / raw) To: Arthur Miller; +Cc: Stefan Monnier, Emacs developers On Thu, 8 Apr 2021 at 23:12, Arthur Miller <arthur.miller@live.com> wrote: > I don't know myself what I really want. I find myself switching a lot > between two windows, which sometimes feels redundant. Maybe it is just > the shortcut, C-x o, or in my case C-v o. After playing with Gregory's > example, I am thinking of just binding the other-window to the `§` key. > Maybe that itself will be enough for somewhat "smoother" experience. Maybe what you want is a foot pedal that emits a ‘C-x o’ when pressed, and another ‘C-x o’ when released. Something like vim-pedal[1] but for Emacs. [1]: https://github.com/foxweb/vim-pedal Or an eye-tracking camera that focuses whichever window you are looking at. (Me, I’m content with binding my local equivalent[^2] of s-[esdf] to windmove-{up,left,down,right}-cycle.) [^2]: It’s actually M-s-[frst] due to using the Colemak layout and having two thumb modifier keys, one mapped to Super and the other to Super+Alt. Super+[frst] switches i3 tiled windows and Super+Alt+[frst] switches panes in whatever application is in focus — Emacs, Kitty terminal, tmux if running in a single-paned Kitty tab. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 17:01 ` Yuri Khan @ 2021-04-08 17:42 ` Arthur Miller 2021-04-08 17:57 ` Stefan Monnier 0 siblings, 1 reply; 15+ messages in thread From: Arthur Miller @ 2021-04-08 17:42 UTC (permalink / raw) To: Yuri Khan; +Cc: Stefan Monnier, Emacs developers Yuri Khan <yuri.v.khan@gmail.com> writes: > On Thu, 8 Apr 2021 at 23:12, Arthur Miller <arthur.miller@live.com> wrote: > >> I don't know myself what I really want. I find myself switching a lot >> between two windows, which sometimes feels redundant. Maybe it is just >> the shortcut, C-x o, or in my case C-v o. After playing with Gregory's >> example, I am thinking of just binding the other-window to the `§` key. >> Maybe that itself will be enough for somewhat "smoother" experience. > > Maybe what you want is a foot pedal that emits a ‘C-x o’ when pressed, > and another ‘C-x o’ when released. Something like vim-pedal[1] but for > Emacs. Ha! I think we are onto something here. One of those el-piano pedals or some old guitar effect pedal? A bluetooth wireless pedal? I mean a whole board of those pedals, like guitar pedal boards. Imagine how many modifiers we could have: ctrl, alt, hyper, super, duper ... maybe all on just one pedal with tactile levels, and then add many pedals to it. I think we have a product here :). > [1]: https://github.com/foxweb/vim-pedal > > Or an eye-tracking camera that focuses whichever window you are looking at. That is not a bad idea at all :). I am not sure how much eye-tracking would this old laptop be able to process and what would happen when I look elsewhere though. But maybe it is possible to make it smart enough? > (Me, I’m content with binding my local equivalent[^2] of s-[esdf] to > windmove-{up,left,down,right}-cycle.) I have also bound those, in my case C-v [lrud] for left right up and down, but I think is as awkward as C-v o. Maybe I'll try vim shortcuts for a while, but I see on Reddit people are switching from evil anyway. > [^2]: It’s actually M-s-[frst] due to using the Colemak layout and > having two thumb modifier keys, Is there two thumb modifier for my hands? Feels I would need some. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 17:42 ` Arthur Miller @ 2021-04-08 17:57 ` Stefan Monnier 2021-04-08 18:26 ` Arthur Miller 0 siblings, 1 reply; 15+ messages in thread From: Stefan Monnier @ 2021-04-08 17:57 UTC (permalink / raw) To: Arthur Miller; +Cc: Emacs developers, Yuri Khan > Ha! I think we are onto something here. One of those el-piano pedals or > some old guitar effect pedal? A bluetooth wireless pedal? I mean a whole Have you considered attaching a screen to a church organ? Stefan ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 17:57 ` Stefan Monnier @ 2021-04-08 18:26 ` Arthur Miller 0 siblings, 0 replies; 15+ messages in thread From: Arthur Miller @ 2021-04-08 18:26 UTC (permalink / raw) To: Stefan Monnier; +Cc: Emacs developers, Yuri Khan Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Ha! I think we are onto something here. One of those el-piano pedals or >> some old guitar effect pedal? A bluetooth wireless pedal? I mean a whole > > Have you considered attaching a screen to a church organ? > That woudl be the ultimate keyaboard for Emacs indeed. Yes, the idea striked me once, but I am not aware of any digital one. I don't think either I could motivate to the best of all best wifes why my keyboard need a separate room alone. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 16:11 ` Arthur Miller 2021-04-08 17:01 ` Yuri Khan @ 2021-04-09 4:18 ` Eric Abrahamsen 2021-04-09 7:58 ` Arthur Miller 1 sibling, 1 reply; 15+ messages in thread From: Eric Abrahamsen @ 2021-04-09 4:18 UTC (permalink / raw) To: Arthur Miller; +Cc: Stefan Monnier, emacs-devel Arthur Miller <arthur.miller@live.com> writes: > Stefan Monnier <monnier@iro.umontreal.ca> writes: > >>> What I would like is to have all the cursor motion stuff, expression >>> evals etc, work on in other window so I don't need to switch back and >>> forth two buffers (I like to work with two buffers side-by-side). I >>> wonder if there is already something I could use; prefix >>> command/universal prefix whatever, to autmoatically modify behaviour of >>> interactive commands involved or do I have to write my own (if it's >>> possible :))? >> >> OT1H you mention universal-prefix (which only affects the very next >> command) but OTOH you say "all the cursor motion stuff ...". >> >> For the "all the cursor ..." case, it seems you're saying all the >> commands should operate on the other window, which is exactly what you >> get after `C-x o`, so your description needs more details to know what >> you really mean. > > Haha, yes, I think I myself need more details to know what I mean :). > > I don't know myself what I really want. I find myself switching a lot > between two windows, which sometimes feels redundant. Maybe it is just > the shortcut, C-x o, or in my case C-v o. After playing with Gregory's > example, I am thinking of just binding the other-window to the `§` key. > Maybe that itself will be enough for somewhat "smoother" experience. I wrote a command that sends the cursor to another buffer window, and lets you do whatever you want in that window, until you hit "q" (this is a special-mode buffer so insertion isn't an issue), whereupon it pops you back to the original window. It uses a transient keymap to do that, which is yet another approach you could consider. https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/ebdb-mua.el?h=externals/ebdb#n1244 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-09 4:18 ` Eric Abrahamsen @ 2021-04-09 7:58 ` Arthur Miller 0 siblings, 0 replies; 15+ messages in thread From: Arthur Miller @ 2021-04-09 7:58 UTC (permalink / raw) To: Eric Abrahamsen; +Cc: Stefan Monnier, emacs-devel Eric Abrahamsen <eric@ericabrahamsen.net> writes: > Arthur Miller <arthur.miller@live.com> writes: > >> Stefan Monnier <monnier@iro.umontreal.ca> writes: >> >>>> What I would like is to have all the cursor motion stuff, expression >>>> evals etc, work on in other window so I don't need to switch back and >>>> forth two buffers (I like to work with two buffers side-by-side). I >>>> wonder if there is already something I could use; prefix >>>> command/universal prefix whatever, to autmoatically modify behaviour of >>>> interactive commands involved or do I have to write my own (if it's >>>> possible :))? >>> >>> OT1H you mention universal-prefix (which only affects the very next >>> command) but OTOH you say "all the cursor motion stuff ...". >>> >>> For the "all the cursor ..." case, it seems you're saying all the >>> commands should operate on the other window, which is exactly what you >>> get after `C-x o`, so your description needs more details to know what >>> you really mean. >> >> Haha, yes, I think I myself need more details to know what I mean :). >> >> I don't know myself what I really want. I find myself switching a lot >> between two windows, which sometimes feels redundant. Maybe it is just >> the shortcut, C-x o, or in my case C-v o. After playing with Gregory's >> example, I am thinking of just binding the other-window to the `§` key. >> Maybe that itself will be enough for somewhat "smoother" experience. > > I wrote a command that sends the cursor to another buffer window, and > lets you do whatever you want in that window, until you hit "q" (this is > a special-mode buffer so insertion isn't an issue), whereupon it pops > you back to the original window. It uses a transient keymap to do that, > which is yet another approach you could consider. > > https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/ebdb-mua.el?h=externals/ebdb#n1244 Interesting; thanks! Cool to see so many different ways to solve a problem in Emacs. Thanks! At this time I think I'll write a blog post as a summary instead of bothering you all here. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 14:56 ` Stefan Monnier 2021-04-08 16:11 ` Arthur Miller @ 2021-04-08 22:59 ` Arthur Miller 2021-04-08 23:03 ` Stefan Monnier 1 sibling, 1 reply; 15+ messages in thread From: Arthur Miller @ 2021-04-08 22:59 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: > command" case. Another direction might be the `vcursor.el` approach. I have tried vcursor now; haven't noticed it ever before. It is very nice indeed. It complements C-x 4 functions and Gregory's approach. I really liked the search in ohter window. That one solves a lot :-). ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 22:59 ` Arthur Miller @ 2021-04-08 23:03 ` Stefan Monnier 0 siblings, 0 replies; 15+ messages in thread From: Stefan Monnier @ 2021-04-08 23:03 UTC (permalink / raw) To: Arthur Miller; +Cc: emacs-devel Arthur Miller [2021-04-09 00:59:13] wrote: > Stefan Monnier <monnier@iro.umontreal.ca> writes: >> command" case. Another direction might be the `vcursor.el` approach. > I have tried vcursor now; haven't noticed it ever before. For the record, I had forgotten about it as well, but was reminded of it a few days ago when I converted it to lexical-binding ;-) Stefan ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 9:37 Universal/prefix argument for "other window" redirection? Arthur Miller 2021-04-08 12:16 ` Gregory Heytings 2021-04-08 14:56 ` Stefan Monnier @ 2021-04-08 19:04 ` Sean Whitton 2021-04-08 21:14 ` Arthur Miller 2 siblings, 1 reply; 15+ messages in thread From: Sean Whitton @ 2021-04-08 19:04 UTC (permalink / raw) To: Arthur Miller, emacs-devel Hello, On Thu 08 Apr 2021 at 11:37AM +02, Arthur Miller wrote: > Is there already a way to "automatically" modify interactive commands to > "auto-work" in other window instead of current window? > > I know I can scroll other window already and switch to some buffer in > another window with `switch-to-buffer-another-window`, I already use > them. > > What I would like is to have all the cursor motion stuff, expression > evals etc, work on in other window so I don't need to switch back and > forth two buffers (I like to work with two buffers side-by-side). I > wonder if there is already something I could use; prefix > command/universal prefix whatever, to autmoatically modify behaviour of > interactive commands involved or do I have to write my own (if it's > possible :))? There is already C-x 4 4 but it doesn't work for every single case. -- Sean Whitton ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Universal/prefix argument for "other window" redirection? 2021-04-08 19:04 ` Sean Whitton @ 2021-04-08 21:14 ` Arthur Miller 0 siblings, 0 replies; 15+ messages in thread From: Arthur Miller @ 2021-04-08 21:14 UTC (permalink / raw) To: Sean Whitton; +Cc: emacs-devel Sean Whitton <spwhitton@spwhitton.name> writes: > Hello, > > On Thu 08 Apr 2021 at 11:37AM +02, Arthur Miller wrote: > >> Is there already a way to "automatically" modify interactive commands to >> "auto-work" in other window instead of current window? >> >> I know I can scroll other window already and switch to some buffer in >> another window with `switch-to-buffer-another-window`, I already use >> them. >> >> What I would like is to have all the cursor motion stuff, expression >> evals etc, work on in other window so I don't need to switch back and >> forth two buffers (I like to work with two buffers side-by-side). I >> wonder if there is already something I could use; prefix >> command/universal prefix whatever, to autmoatically modify behaviour of >> interactive commands involved or do I have to write my own (if it's >> possible :))? > > There is already C-x 4 4 but it doesn't work for every single case. Indeed. I do use C-x 4 with some commands, C-x 4 C-f and C-x 4 b are some I use sometimes. Unfortunately they move cursor over to other window too, but I can wrap them in my own command. ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-04-09 7:58 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-04-08 9:37 Universal/prefix argument for "other window" redirection? Arthur Miller 2021-04-08 12:16 ` Gregory Heytings 2021-04-08 15:58 ` Arthur Miller 2021-04-08 14:56 ` Stefan Monnier 2021-04-08 16:11 ` Arthur Miller 2021-04-08 17:01 ` Yuri Khan 2021-04-08 17:42 ` Arthur Miller 2021-04-08 17:57 ` Stefan Monnier 2021-04-08 18:26 ` Arthur Miller 2021-04-09 4:18 ` Eric Abrahamsen 2021-04-09 7:58 ` Arthur Miller 2021-04-08 22:59 ` Arthur Miller 2021-04-08 23:03 ` Stefan Monnier 2021-04-08 19:04 ` Sean Whitton 2021-04-08 21:14 ` Arthur Miller
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.