Indenting Text and Removing Whitespace with Emacs

30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

In this lab, you will be adding and removing whitespace from text files. Basic knowledge of opening files, along with familiarity of working with Emacs whitespace, is recommended. Upon completing this lab, you will know how to work with whitespace in Emacs and how to use line and region indentation.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Open the Files
  • Open the file /tmp/remove_whitespace.
  • Open the file /tmp/add_indentation.
Correct Whitespace
  • Remove all the empty lines from the file /tmp/remove_whitespace.
  • Remove leading and trailing whitespace from /tmp/remove_whitespace.
Correct Indentation
  • Follow the instructions in Section 1 of the file /tmp/add_indentation to complete the line indentation.
  • Follow the instructions in Section 2 of the file /tmp/add_indentation to complete the region indentation.

Additional Resources

In this scenario, you have been approached by your company's training team. They are putting on a class regarding Emacs and would like you to help test the whitespace and indentation portion of their lesson. In order to complete their test, you will need to open two files. They are named /tmp/remove_whitespace and /tmp/add_indentation.

For the file /tmp/remove_whitespace, the training team would like you to remove all the blank lines and any leading and trailing whitespace. In the file /tmp/add_indentation, there are two sections with corresponding instructions on how they would like you to some lines and a block of pseudo-code.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?