edit screen column, line, buffer - command-line

Right now I use mode con: cols=40 lines=5 in simple batch scripts to change the screen size since it doesn't need to be that big, but in some cases, the data goes off screen and I need a buffer size. I was wondering if there is another command to reset the command line window to default view like when you open it normally?

Related

Why is there so much whitespace (carriage returns) at the bottom of Command Prompt and Powershell?

I've always wondered why the Command Prompt and Powershell both have so many carriage returns preloaded when you run each of the applications. You can scroll forever and ever (ok, not really, but several dozen, if not hundreds of page lengths of empty space). I don't have my Unix machine right now, but I'm pretty sure Terminal doesn't have that padding.
I have tried searching for a reason, but I have come up empty. It's not exactly a bug, so I guess not many people are searching for an answer.
I think you may be referring to the screen buffer size as described here: https://mcpmag.com/articles/2013/03/12/powershell-screen-buffer-size.aspx?m=1
This article explains it in more detail:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682088(v=vs.85).aspx
When a screen buffer is created, it contains blanks. Its cursor is
visible and positioned at the buffer's origin (0,0), and the window is
positioned with its upper left corner at the buffer's origin. The size
of the console screen buffer, the window size, the text attributes,
and the appearance of the cursor are determined by the user or by the
system defaults.
Unix works in a slightly different way, via a scrollback buffer, as explained here: https://unix.stackexchange.com/questions/145050/what-exactly-is-scrollback-and-scrollback-buffer

how to set variables interactively for ediff

I'm using ediff mode, and I'd like to split the windows horizontally instead of the vertical default. The ediff manual says this can be done interactively.
ediff-split-window-function
Controls the way you want the window be split between file-A and
file-B (and file-C, if applicable). It defaults to the vertical split
(split-window-vertically, but you can set it to
split-window-horizontally, if you so wish. Ediff also lets you switch
from vertical to horizontal split and back interactively.
Note that if Ediff detects that all the buffers it compares are
displayed in separate frames, it assumes that the user wants them to
be so displayed and stops splitting windows. Instead, it arranges for
each buffer to be displayed in a separate frame. You can switch to the
one-frame mode by hiding one of the buffers A/B/C.
You can also swap the windows where buffers are displayed by typing ~
I've tried using M-x set-variable to set this variable to split-window-horiztonally, but that did not change the layout. I want to do this interactively, I know I can set it as default in .emacs but I dont want to do that at this stage.
I want to do this interactively, I know I can set it as default in .emacs but I dont want to do that at this stage.
Type |
(n.b. that's the | pipe character; as opposed to I or l or 1.)
You should probably also type ? and review the information it shows you.

emacs sql-mode: how to scroll the the output window after run the sql?

I am pretty happy with emacs sql-mode with vertica. But one problem is after run the sql using C-c C-c, ifoutput window is full of text, and the output text I want to see in not visible, so I have to jump to the output window, scroll down to the bottom to see the result. Is there anyway to scroll down automatically? like tail -f?
You can try turning on auto-revert-tail-mode for that buffer, though I've only used this with buffers that are linked to files. This works just like tail -f.
Alternatively, you could also use scroll-other-window, bound to C-M-v by default, to scroll your SQL output window from your main one.

Can I disable window-splitting in a particular frame?

I'm a developer who uses emacs. In emacs I use multiple frames (what most people would call X windows), and the compile function for my builds. I like to have one frame for my compilation buffer, and the others for source. That allows me to navigate to build errors easily and get a nice big view of the source I'm investigating along side a nice big view of my build output. This works fine when I use the 'next-error' function from a source frame.
But when I move my pointer into the compilation frame, and click on an error, it vertically splits that frame to show the relevant source. I want it to show the relevant source in one of my other frames.
Is there a way to "lock" a frame so that it won't be split into windows, and so other frames will be used instead? I'm OK if it splits one of my other frames to display the new source files - just not the compilation frame (because that means I have to unsplit that frame and then switch the buffer of a different frame to display the buffer in question - that's cumbersome).
Alternatively it would be fine if I could use a different mouse button on an error in the compilation buffer to say "visit this file and line in a different frame".
I believe you can achieve your goals by making the window in your "compile frame" dedicated:
Functions for displaying a buffer can be told to not use specific windows by marking these windows as dedicated to their buffers.
Interactively, M-x set-window-dedicated-p should make your window dedicated.
From elisp, something like
(set-window-dedicated-p (selected-window) 1)
should do the same. Replacing 1 with t will make the window strongly dedicated:
As a special case, if flag is t, window becomes strongly dedicated to its buffer. set-window-buffer signals an error when the window it acts upon is strongly dedicated to its buffer and does not already display the buffer it is asked to display. Other functions do not treat t differently from any non-nil value.

How can I get the compile buffer place the point at its end?

When I compile (using Make, g++), the compile-buffer opens in a new window, and starts filling up with lines of compiler output. What I don't like is that when the number of lines exceeds the window height, the window doesn't scroll to show the most recent messages at the bottom. Instead it just stays at the top of the buffer, adding the newest messages below the bottom of the window, out of view.
I work around this by switching to the compile window and moving the point to the end of the buffer using M-shift-'>'. Once the point is at the end, it stays there even when additional lines are added, so the bottom-most line stays visible in the window.
How can I automate this behavior, so that compiling not only opens up the compile buffer in a new window, but also moves (that window's) point to the end?
Look into the compilation-scroll-output variable. Instead of just scrolling to the end (setting it to t) I propose 'first-error that scrolls to the first error.