ખીલો ખોદતા ખાણ જો મળે ઝવેરાતની, તો નિરાંતે તારી ભક્તિ કરું શામળા | ભલું થયું ભાંગી જંજાળ, નવી નક્કોર દેશે શ્રીગોપાળ | જે તુજથી ના થઈ શકે એ જ કરાવ પ્રભુ પાસે, પાણિયારું પ્રભુ ભરશે નહિ ભરશે નદી તળાવ

Kiran Chauhan

Cogito, ergo sum // I think, therefore I am.

Showing posts with label emacs. Show all posts

Emacs Minipost Pt. 6

—

Do you remember that in last Minipost we did some modifications in main.c file and saved it again for the sake of practice? I wants you to open that directory/folder location in file manager.

Notice we're seeing two files - main.c file and another file that has same name but ends with ~ e.g. main.c~. This is how Emacs save the backup of your file in case something goes wrong.

If you want, we can disable this backup saving by configuring this option in Emacs config file. Open the Emacs config file and add following:

(setq make-backup-files nil)

Follow these steps:

  1. Press ctrl-x ctrl-f and open the Emacs config file (write the relative or absolute path).
  2. Do the modification as suggested above. e.g. add (setq make-backup-files nil) in config file.
  3. Press ctrl-x ctrl-s to save the config changes.
  4. Go to file manager and delete main.c~ file.
  5. Press ctrl-x ctrl-f and open the main.c file.
  6. Remove that extra printf() that we added previously.
  7. Press ctrl-x ctrl-s to save the changes in main.c file.
  8. Go to the file manager and see if we now have main.c~ file or not?
  9. Confirm that we don't have. If that is the case, yay! If not then try closing and then re-opening the Emacs.

Summary: We disabled the backup saving functionalities and practice the whole save, open, save flow.


Emacs Minipost Pt. 5

—

Do you remember that in previous Minipost, we created a main.c file? In this Minipost, we're going to open it.

Open the Emacs and press ctrl-x ctrl-f. It asks you the path/file name that you want to open.

P.S. It supports auto-complete. So, just write few characters and press Tab. Emacs will auto-complete path/file name for you!

Type a path/file name and press Enter. Emacs will open the file!

Let's modifies the code and add one more printf().

#include <stdio.h>

int main(int argc, char** argv) {
  printf("hello, world\n");
  printf("how are you?\n");

  return 0;
}

We know how to save, right? ctrl-x ctrl-s. Press.

We now know how to create, open, and save the file in Emacs! Yay!

Summary: Now, you know how to open an existing file and save it with modified content.


Emacs Minipost Pt. 4

—

Open the Emacs. You should see the following screen.

Remove these two lines (or comments) from the scratch pad and type the following code.

P.S. You might face difficulty while adding the indentation. For now, stay with me and type spaces literally instead of tabs.

#include <stdio.h>

int main(int argc, char** argv) {
  printf("hello, world\n");

  return 0;
}

We know how to save the file, right? Yes, ctrl-x ctrl-s. Press. But, we haven't created the file yet. So, Emacs first ask to create the file and then will save the content of it.

Here, instead of typing the name of the file, you can type the full path if you don't want to save at the default location that Emacs is suggesting and then press Enter.

Congratulation on creating and saving the files using Emacs!

Summary: Now you know how to create and save the file from Emacs only!


Emacs Minipost Pt. 3

—

Go ahead and create a new file with name main.c. Right-click the file and open with Emacs. It should looks like this:

Now, type the following code.

#include <stdio.h>

int main(int argc, char** argv) {
  printf("hello, world\n");

  return 0;
}

After you typed this code, it should look like this.

We need to save the file with this code. To do so, we need to type ctrl+x and then ctrl+s meaning that pressing ctrl and then x and then s while keep pressing ctrl. After successful save, you should see a message at the end of the editor in single line as follows:

Congratulation on modifying and saving the file using Emacs. Go ahead practice now!

Summary: Now you know how to save the file in Emacs - ctrl+x ctrl+s.


Emacs Minipost Pt. 2

—

This is a startup screen. When you open Emacs without any file, you'll probably see this startup screen all the time at the start of Emacs. You can customize the startup screen by clicking on "Customize Startup" link from this startup screen and within "To start..." section or you can write following line in .emacs.d file. .emacs.d is a config file and based on the instructions you write in this file, Emacs behave accordingly.

Following are the possible locations of the .emacs.d file.

# GNU/Linux
~/.config/emacs/init.el

# macOS
~/.emacs.d/init.el

# Windows
%USERPROFILE%\.emacs.d\init.el

Navigate and open based on your OS and add following line. This will hide/disable the startup screen permanently.

(setq inhibit-startup-screen t)

Restart the Emacs and you won't see that startup screen on next time!

Summary: With this step, now you know that there is Emacs config file where you can write configuration for the Emacs!

Click here for next Minipost.


Emacs Minipost Pt. 1

—

Emacs is a wonderful editor. It is one of those software that you should try and learn before you die! I'm not die hard fan of Emacs. Hell! I'm using other editors based and on work (i.e. Code for web development, Sublime for text writing, Notepad++ for copy-paste, nano for config edit, and few more). But, I still have soft corner for the Emacs and I use it whenever possible.

This is the first in the series of miniposts where I'm going to teach (and learning as I'm explaining to you) Emacs. Each post will be a paragraph or two long with one point. Read it, remember it, try it, and practice it!

Go ahead and install the latest version of Emacs from the official website - https://www.gnu.org/software/emacs (as of writing it is v30.2). It is available for all popular OSes. Once the installation is done, launch it, stare it, and then close it. It is standalone software. So, use it in that way - no need to open in terminal. Open it from applications launcher and you're good to go!

Summary: With this step, we've installed the Emacs!

Click here for next Minipost.


Subscribe to: Posts (Atom)

સાહિત્યિક કાર્યક્રમો

  • તા. ૦૨-૧૮ ઓક્ટોબર ૨૦૨૬ - ગાંધી પુસ્તક મહોત્સવ, ગુજરાત વિદ્યાપીઠ, અમદાવાદ
  • તા. ૨૧-૨૫ ઓક્ટોબર ૨૦૨૬ - સંસ્કૃત વાગ્માધુરી 2026, રા. વિ. પાઠક સભાગૃહ, ગુજરાતી સાહિત્ય પરિસદ, આશ્રમ રોડ, અમદાવાદ.
  • તા. ૨૪–૨૫ ઓક્ટોબર ૨૦૨૬ - અમદાવાદ ઇન્ટરનેશનલ લિટરેચર ફેસ્ટિવલ
  • વધુ માહિતી માટે...

વર્ગીકૃત

કડીઓ

સૂચિત લેખો

ચોપડીઓ

જોયેલ