Fork me on GitHub
vishal sharma12:07:22

Hi, i need a suggestion, i am getting some events, i want to be able to search and visualize the events(aggregate query) should i store those events in db, or in file or somewhere different at all?


What's the preferred way to automate opening buffers, splitting frames, running commands, etc. in emacs like split-pane, select-pane, send-keys, etc. in tmux? I'm not looking to save some random state to go back to it later, nor are these things confined to a project.


Emacs has a programming language elisp that can do all these things. So you can write an elisp program that opens files, selects buffers, splits windows, etc and then just tell emacs to evaluate it


Thanks @U0NCTKEV8. There's a better description of what I'm after in this thread


@tvaughan dvtm is often mentioned for this


dvtm + abduco would be the equivalent of tmux


Thanks @U050SC7SV but I'm not looking to replace tmux. I want tmux like scripting capabilities in emacs. I want to automate the opening of emacs buffers, splitting frames, running emacs lisp commands, etc. but in emacs lisp


oh I missread


I don't know if I am missreading too, but in elisp you have functions like split-window-{vertically,horizontally}, new-frame, generate-new-buffer and you can execute shell commands using several options like shell-command-to-string


you want to write elisp functions to automate your processes, is that right?


I'm hoping I don't have to write much. I'm hoping there's a package out there that can do most of this already. For example, I want to split emacs into two halves C-x 3, select the right most window, open a file over tramp, run cider-jack-in, select the left most window, run an elisp function I wrote to expand the window width, then open a file, then run C-c k to eval the buffer in the repl.


That looks like its mostly centered around editing. I'm looking for something higher-level. A generic way of saying "select this window and run these keystrokes." I'm not looking for a set of interactive commands, but rather something that takes some sequence of instructions that I have stored in a .el start-up script and runs them on command. I want to be able to type M-x start-clojure-devel where I say, most likely in .dir-locals.el, start-clojure-devel means run the sequence of commands listed above


Running keystrokes is not the way to think about it, keys are generally bound to run some elisp function, when you are automate things you don't send keystrokes (you can but typically don't) you just call the elisp functions directly


Not everything associated with a keystroke has a similar function that can be called programatically

hiredman15:07:57 is a setup.el I have for a project that sets up the window like I want for that project and fiddles with opacity and font sizes


Cool. Maybe this could be simple enough I don't need a package for this. Thanks


I thought everything in Emacs with a keystroke did have a function that can be called programmatically?


If I type C-h k <keystrokes>, for example C-h k C-x 3, I see a buffer appear that starts with the text "C-x 3 runs the command split-window-right ..."


And split-window-right is a function that can be called in Elisp code.


Here is a simple Elisp function I wrote that is loaded from my init.el, and I bind a function key that when pressed, executes that function:


You're probably right @U0CMVHBL2. But how does that function know which window to split? Isn't that determined by which window was active when the keystrokes were entered?


The rest of the documentation that appears when I type C-h k C-x 3 includes this text:


Split the selected window into two side-by-side windows. The selected window is on the left. The newly split-off window is on the right and displays the same buffer. Return the new window.


I am pretty sure that "the selected window" is accessible via either an Elisp function, or perhaps some global Elisp variable, and it is updated by whatever operations cause the selected window to change.


I haven't used them before, but I believe there are Elisp functions to list all buffers, create new ones, delete buffers, etc., and all of those are what are used to implement the behaviors you get when you enter the appropriate key strokes that do those things.


That's good news, thanks. But this is sounding like a much bigger project than installing a package and setting a few things. 😞


Oh, I'm aware. I just don't consider myself one of them. hahaha 🙂 Besides maintaining my own setup for decades I still consider myself an emacs newbie


otherwise if you prefer emacs at the root, libvterm is supposedly really good