Timeline for open the shell buffer in the same frame as compilation buffer -- C compilation
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:52 | history | edited | CommunityBot |
replaced http://emacs.stackexchange.com/ with https://emacs.stackexchange.com/
|
|
Mar 30, 2017 at 11:36 | comment | added | stevoooo |
I know this doesn't really answer your actual question, but I think you're fighting the wrong battle in trying to make Emacs open the shell window somewhere else. If you're just opening the shell to run the programme that you just compiled, you'd probably be better off running the programme as part of the compilation. For example, use M-x compile and instead of just putting "make" or "gcc foo.c -o foo" use gcc foo.c -o foo && ./foo and then, if the compilation succeeds the command will be run and you'll get the output in the compilation buffer.
|
|
Nov 2, 2016 at 16:31 | comment | added | lawlist |
No special skills are needed. Just type M-x find-function RET term RET . Copy the entire 15-line long term function to your .emacs or init.el file, change the function name from term to my-term , change (switch-to-buffer "*terminal*") to (pop-to-buffer "*terminal*") , and save your .emacs or init.el file. Either evaluate the function, or evaluate the entire buffer, or simply restart Emacs. Then try it out with M-x my-term
|
|
Nov 2, 2016 at 16:24 | comment | added | loukios | I'll try to do it but I guess I've to work on my emacs lisp first.. | |
Nov 2, 2016 at 16:17 | comment | added | lawlist |
The same concept with term , but it is reversed -- since the function term uses (switch-to-buffer "*terminal*") and perhaps you want (pop-to-buffer "*terminal*") . To read about pop-to-buffer , type M-x describe-function RET pop-to-buffer RET : "Select buffer BUFFER in some window, preferably a different one. BUFFER may be a buffer, a string (a buffer name), or nil. If it is a string not naming an existent buffer, create a buffer with that name. If BUFFER is nil, choose some other buffer. Return the buffer."
|
|
Nov 2, 2016 at 16:11 | comment | added | lawlist |
I like to modify the source code and/or create new functions, whereas most people prefer things like advice , the display-buffer-alist , special-display-regexps , etc. If it were me, I would just copy the shell function and rename it to something like my-shell and I would change (pop-to-buffer buffer) to whatever floats my boat -- e.g., (switch-to-buffer buffer) assuming that I am in the window that I want to contain the *shell* buffer when I'm done typing M-x my-shell . I suspect there are already several threads that suggest the other three (3) above-mentioned alternatives.
|
|
Nov 2, 2016 at 16:10 | history | edited | loukios | CC BY-SA 3.0 |
added a screenshot
|
Nov 2, 2016 at 15:58 | comment | added | lawlist |
I would recommend specifying how many windows are open and in what layout -- e.g., side by side, and label them such as A = left window = source code buffer and B = right window = compilation buffer; the window that has focus before calling M-x shell is A or B; after calling M-x shell , B should become *shell* or A should become *shell* . Focus should be in the *shell* buffer (window A or B) when done.
|
|
Nov 2, 2016 at 15:56 | history | edited | loukios | CC BY-SA 3.0 |
for terminology's sake
|
Nov 2, 2016 at 15:54 | comment | added | loukios | Yes you're right, I may edit my question accordingly. I hope my question makes sense though. | |
Nov 2, 2016 at 15:48 | comment | added | lawlist | Are you familiar with the difference between Emacs terminology of a frame and a window, and do you really mean frame? What's the difference between a buffer, a file, a window, and a frame?: emacs.stackexchange.com/questions/13583/… | |
Nov 2, 2016 at 15:37 | history | asked | loukios | CC BY-SA 3.0 |