----BEGIN CLASS----
[13:59] <mbuf> #startclass
[13:59] <mbuf> Roll call
[13:59] <shiva> Shiva Saxena
[13:59] <storymode7> Mayank Singhal
[13:59] <cypher01> Naman Sharma
[13:59] <ann> Anu Kumari Gupta
[13:59] <devesh_verma> Devesh Verma
[13:59] <sidntrivedi> Siddhant N. Trivedi
[13:59] <aswanipranjal> Pranjal Aswani
[13:59] <sandeepK> Sandeep Kumar Choudhary
[13:59] <pooja_s> pooja sulakhe
[13:59] <Rayan_d> Rayan Das
[13:59] <sehenaz_> Sehenaz Parvin
[13:59] <priyankasaggu119> Priyanka Saggu
[13:59] <inquiridortechie> Neera Kumar Arya
[13:59] <bhavin192> Bhavin Gandhi
[13:59] <gutsytechster> Prashant Sharma
[13:59] <__rex__> Rakshit Airani
[14:00] <VirtualRcoder> Shubham Sharma
[14:00] <akshayg96> Akshay Gaikwad
[14:00] <RJ722> Rahul Jha
[14:00] <mbuf> Let us begin today's session with Shell mode commands
[14:00] <mbuf> I am having power cut problems, so if I disconnect, do not panic.
[14:01] <mbuf> You can run a shell command using:
[14:01] <mbuf> => M-!
[14:01] <mbuf> Please do start Emacs with "emacs -Q" to try the commands
[14:01] <mbuf> At the minibuffer, it will prompt with "Shell command:"
[14:02] <mbuf> You can then give input as "date", for example, and it will execute the command, and return the result in the minibuffer
[14:03] <mbuf> Try another command at the shell prompt, say "dmesg".
[14:03] <mbuf> The output will show up in *Shell Command Output* buffer in a new window
[14:04] <mbuf> Of course, like any other buffer, you can switch to it, and scroll down and up
[14:05] <brute4s99> Piyush Aggarwal
[14:05] <mbuf> If you want the command output to appear where the cursor is in the current buffer, say *scratch* buffer, you can use:
[14:05] <mbuf> => C-u M-!
[14:07] <mbuf> You can mark a region in a buffer, and run a command on the contents of the selected text
[14:08] <mbuf> For example, mark and select the entire *scratch* buffer using "C-x h", you will see the text "Mark set" in the minibuffer
[14:08] <mbuf> You can then run the following shortcut to execute a command on the selected text:
[14:09] <mbuf> => M-|
[14:09] <mbuf> Now, at the minibuffer, you will be prompted with the string: "Shell command on region:"
[14:09] <brute4s99> !
[14:09] <mbuf> You can give "wc" (word count), and you should see three entries of wc in the minibuffer
[14:09] <mbuf> next
[14:10] <brute4s99> I cannot shutdown my system through Emacs; it says no tty present. Why is that? (would have been convenient to shut it down when I'm done with my work in laptop)
[14:11] <mbuf> brute4s99, you are still talking very abstract; what do you mean 'shutdown my system through Emacs'?
[14:11] <brute4s99> i tried => shutdown now in mini buffer, mbuf
[14:12] <mbuf> brute4s99, 1. You should not do that in the middle of the class 2. See if there is any error in *Messages* buffer
[14:13] <mbuf> brute4s99, first, learn to try the examples I tell you to do; later, you can experiment; you should not experiment when you are learning!
[14:13] <mbuf> You can open a shell inside Emacs using:
[14:13] <mbuf> => M-x shell
[14:14] <mbuf> The cursor should switch to the shell, and you should be able to run your shell commands as is
[14:15] <brute4s99> I apologize, mbuf. I'll try not to jump the gun again. <eom>
[14:15] <mbuf> So, the *shell* is also a buffer, and your C-p and C-n commands will work there as well
[14:16] <mbuf> Inside the *shell* buffer, at the prompt, you can retrieve the previous command you typed using:
[14:17] <mbuf> => M-p
[14:17] <mbuf> So, if you used few commands like "date", "dmesg", "whoami" etc. you can use M-p to cycle back to the commands you used at the prompt
[14:17] <mbuf> Similarly, you can cycle forward to the command you used using:
[14:17] <mbuf> => M-n
[14:19] <mbuf> TAB completion inside the *shell* buffer will also work. So, you can type 'unam' and hit <TAB> and, it will auto-complete to 'uname'
[14:19] <mbuf> If there are more command options, then a new window will be opened, and the auto-completion options will be listed
[14:19] <mbuf> For, example, you can try "un" at the shell prompt and hit TAB
[14:20] <mbuf> Supposed, you used the command 'dmesg' at the shell prompt inside Emacs, and it will produce a huge output. If you want to clear the previous command output, you can use:
[14:20] <mbuf> => C-c C-o
[14:21] <mbuf> You will then see the previous command output replaced with the message "*** output flushed ***"
[14:21] <mbuf> You can quickly go to the first line in the output (say 'dmesg' output) using:
[14:22] <mbuf> => C-c C-r
[14:22] <mbuf> You can move the cursor back to the shell prompt, at the bottom of the window, using:
[14:22] <mbuf> => C-c C-e
[14:24] <mbuf> Suppose, you are running a job in the foreground in the shell prompt (say 'tail -f /var/log/messages'), you can interrupt the currently running job, using:
[14:24] <mbuf> => C-c C-c
[14:24] <mbuf> You can also send the current running job to the background, at the shell prompt using:
[14:24] <mbuf> => C-c C-z
[14:25] <brute4s99> ! !
[14:25] <mbuf> next
[14:25] <brute4s99> how do I cycle between scratch buffer and command prompt buffer?
[14:26] <mbuf> brute4s99, what is your definition of 'cycle'?
[14:26] <brute4s99> take my cursor to the scratch buffer, so when I type the characters are stored in scratch buffer, not in cmd prompt buffer
[14:27] <brute4s99> and back
[14:27] <mbuf> brute4s99, do you mean switch between the two buffers, alternatively, when you have two windows, one showing the scratch buffer, and another the *shell* buffer?
[14:27] <brute4s99> yes, mbuf
[14:27] <mbuf> brute4s99, the *scratch* buffer is not persistent, and whatever you type is not stored permanently
[14:27] <mbuf> brute4s99, we covered this when we addressed "Buffer" commands
[14:28] <mbuf> brute4s99, C-x o
[14:28] <mbuf> brute4s99, 'o' for other window
[14:28] <brute4s99> oh. Thank you mbuf!
[14:28] <mbuf> There are two other terminals that you can use inside Emacs:
[14:29] <mbuf> => M-x ansi-term
[14:29] <mbuf> This will prompt in the minibuffer with "Run program: /bin/bash".
[14:29] <mbuf> So, if you use other shells, you have an option to use them inside Emacs
[14:30] <mbuf> With this terminal, your .bashrc settings are imported as well.
[14:30] <mbuf> The third terminal is completely written in Emacs Lisp, and you can use it using:
[14:30] <mbuf> => M-x eshell
[14:31] <brute4s99> !
[14:32] <mbuf> The advantage of using this is that you can write Emacs Lisp code and have them executed in this environment.
[14:32] <mbuf> Also, since it is Emacs Lisp, it is portable. As long as you have Emacs running, these Emacs Lisp scripts will run.
[14:33] <mbuf> Suppose, you want to open more than one *shell*, for example, you can use:
[14:33] <mbuf> => C-u M-x shell
[14:34] <mbuf> This will prompt you with "Shell buffer (default *shell*<2>):"
[14:34] <mbuf> So, now you have two shells running inside Emacs
[14:34] <mbuf> next
[14:34] <brute4s99> how do I exit these shells? i.e if I don't need the utility anymore, how do I close the shell?
[14:35] <mbuf> brute4s99, you can call exit in them, and it is just another buffer
[14:35] <mbuf> brute4s99, so, you can simply kill it from the *Buffer List*, for example
[14:36] <mbuf> These are some basic shell mode commands.
[14:36] <mbuf> Let us move on to Calendar!
[14:36] <brute4s99> understood! <eom>
[14:36] <mbuf> Emacs has a built-in calendar that you can use. To open it, use:
[14:36] <mbuf> => M-x calendar <enter>
[14:37] <mbuf> The cursor will blink at the current date for the current month, and you will also see the previous and next month
[14:37] <mbuf> You can move forward one day using:
[14:37] <mbuf> => C-f
[14:37] <mbuf> You can move backward one day using:
[14:37] <mbuf> => C-b
[14:38] <mbuf> Remember that C-f was used for character forward and C-b for character backward in a buffer.
[14:38] <mbuf> In this context, they are used for moving a day
[14:39] <mbuf> Anytime, you can move to the current day using:
[14:39] <mbuf> => .
[14:40] <brute4s99> /
[14:40] <mbuf> You can move to the previous week using:
[14:40] <brute4s99> <eom>
[14:40] <mbuf> => C-p
[14:40] <mbuf> You can move to the following week using:
[14:40] <mbuf> => C-n
[14:41] <mbuf> Since, the month is organized week-wise, and moving to the previous line is C-p, and moving to the next line is C-n, in this context, the same shortcut refers to the week
[14:41] <mbuf> Very intuitive and nicely done!
[14:41] <brute4s99> !
[14:42] <mbuf> You can move forward one month using:
[14:42] <mbuf> => M-}
[14:42] <mbuf> You can move backward one month using:
[14:42] <mbuf> => M-{
[14:43] <mbuf> You can move forward past as much as you want, and the calendar will show the months. Similarly, for the previous months.
[14:43] <mbuf> You can then switch to the current date using ".", which you have already tried.
[14:44] <mbuf> You can scroll forward one year using:
[14:44] <mbuf> => C-x ]
[14:44] <mbuf> You can scroll back one year using:
[14:44] <mbuf> => C-x [
[14:46] <mbuf> You can move to the beginning of the week using:
[14:46] <mbuf> => C-a
[14:46] <mbuf> You can move to the end of the week using:
[14:46] <mbuf> => C-e
[14:46] <mbuf> Again, C-a is used to move to the beginning of the line, and C-e to move to the end of the line. In this context, they represent the start and end of a week
[14:47] <mbuf> To move to the beginning of the month, you can use:
[14:47] <mbuf> => M-a
[14:47] <mbuf> To move to the end of the month, you can use:
[14:47] <mbuf> => M-e
[14:48] <mbuf> You can move to the beginning of the year using:
[14:48] <mbuf> => M-<
[14:49] <mbuf> And, you can move to the end of the year using:
[14:49] <mbuf> => M->
[14:50] <mbuf> You can go to a specific date using:
[14:50] <mbuf> => g d
[14:51] <mbuf> It will prompt you first for the year, "Year (>0): 2018"
[14:51] <mbuf> Then it will prompt you with "Month name:", and you can type, say 'Nov' and hit TAB and it will auto-complete
[14:52] <mbuf> You can hit enter, and then, it will prompt you for the day, "Day (1-30):"
[14:52] <mbuf> It is intelligent to know which month has 30 days and which has 31 days.
[14:53] <mbuf> You can scroll backward one month using:
[14:53] <mbuf> => C-x <
[14:54] <mbuf> You can scroll forward one month using:
[14:54] <mbuf> => C-x >
[14:54] <mbuf> You can scroll forward three months using:
[14:54] <mbuf> => C-v
[14:55] <mbuf> You can scroll backward three months using:
[14:55] <mbuf> => M-v
[14:55] <mbuf> next
[14:56] <mbuf> GNU Emacs has lot of built-in help that you can use
[14:56] <mbuf> If you want to describe a key combination, you can use:
[14:57] <mbuf> => C-h k
[14:57] <brute4s99> <eom>
[14:57] <mbuf> At the minibuffer, you will see the message "Describe the following key, mouse click, or menu item:"
[14:58] <mbuf> If you input say "C-p", it will open a window with the description for previous-line
[14:59] <mbuf> Similarly, you can find information on an Emacs Lisp function using:
[14:59] <mbuf> => C-h f
[14:59] <mbuf> It will prompt in the minibuffer with the message: "Describe function"
[14:59] <mbuf> Suppose, you input "kill-line", it will open a window with this function description and usage
[15:00] <mbuf> You can also read man pages inside GNU Emacs. Just use:
[15:00] <mbuf> => M-x man
[15:00] <mbuf> After you hit enter, it will prompt in the minibuffer with the message, "Manual entry:"
[15:01] <mbuf> Let's say, you input "ls", it will open the manual page for the 'ls' command
[15:01] <mbuf> The manual pages in the buffer are well formatted and readable
[15:01] <mbuf> This ends today's session!
[15:01] <mbuf> Any questions?
[15:02] <mbuf> Roll call
[15:02] <shiva> Shiva Saxena
[15:02] <gutsytechster>  Prashant Sharma
[15:02] <priyankasaggu119> Priyanka Saggu
[15:02] <brute4s99> Piyush Aggarwal
[15:02] <storymode7> Mayank Singhal
[15:02] <inquiridortechie> Neeraj Kumar Arya
[15:02] <akshayg96> Akshay Gaikwad
[15:02] <soniya29> Soniya Vyas
[15:02] <bhavin192> Bhavin Gandhi
[15:02] <ann> Anu Kumari Gupta
[15:03] <__rex__> Rakshit Airani
----END CLASS----