0% found this document useful (0 votes)
43 views9 pages

Written Assignment Unit 4

This document provides an overview of the Emacs text editor, including its key features and functions. It describes how Emacs uses buffers to contain content being edited, and keyboard shortcuts for common tasks like opening files, saving, searching/replacing text, and navigating. The overview concludes that Emacs is a powerful editor that requires learning its unique keyboard shortcuts but can significantly increase editing efficiency once mastered.

Uploaded by

Beetle999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views9 pages

Written Assignment Unit 4

This document provides an overview of the Emacs text editor, including its key features and functions. It describes how Emacs uses buffers to contain content being edited, and keyboard shortcuts for common tasks like opening files, saving, searching/replacing text, and navigating. The overview concludes that Emacs is a powerful editor that requires learning its unique keyboard shortcuts but can significantly increase editing efficiency once mastered.

Uploaded by

Beetle999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

Written Assignment Unit 4

University of the People

CS 3307 – Operating Systems 2

Bayo Omoyiola (Instructor)


Binary vs ASCII

Binary code is employed in computers and digital devices to represent and transmit text, symbols,

or processor instructions (Admin, 2012). Since these devices operate based on two voltage values

(High or Low), all data involved in a process must be converted into this binary form. The most

effective way to do this is by using the binary numeral system, which consists of only two digits, 1 and

0. For instance, when you press a key on your keyboard, it generates a sequence of 1s and 0s unique to

each character, sending it as output. This conversion of data into binary code is known as encoding, and

various encoding methods are employed in computing and telecommunications.

ASCII, an abbreviation for the American Standard Code for Information Interchange, is a

standardized encoding for alphanumeric characters utilized in computers and related devices.

Binary Codes

The easiest way to encode data is by assigning a specific value, usually in decimal numbers, to a

character, symbol, or instruction (Admin, 2012). This assigned value is then converted into a binary

number, comprising only 1s and 0s, forming a sequence known as a binary string. The length of this

binary string determines how many different characters or instructions can be encoded. For instance,

with one digit, only two different characters or instructions can be represented, while two digits allow

for four. Various encoding methods use different lengths of binary strings, some with a fixed length

and others with a variable length. ASCII is an example of a fixed-length binary code, and UTF-16 and

UTF-8 are examples of variable-length binary codes.


ASCII

ASCII is an alphanumeric character encoding using a 7-digit binary string in its original form,

allowing it to represent 128 characters (Admin, 2012). A later version known as extended ASCII

utilizes an 8-digit binary string, expanding its capacity to represent 256 different characters. ASCII

consists primarily of two types of characters: control characters (ranging from 0 to 31 and 127 in

decimal) and printable characters (ranging from 32 to 126 in decimal). ASCII is capable of representing

both uppercase and lowercase letters, numbers, symbols, and control keys.

Emacs Text Editor

Emacs is a highly customizable text editor developed in 1976 (Rouse, 2011). It is part of the

GNU project, written in C and Emacs Lisp. Emacs offers content-sensitive modes for different types of

text, including plain text, programming source codes, and HTML. These modes feature syntax

highlighting, using different colors to emphasize various syntax elements such as loops, comments, and

variables. This highlighting enhances code readability and accelerates development.

Emacs is available for free, and runs on most operating systems, including Windows, Mac OS X,

and Linux, and is widely used on Unix and Linux platforms. Beyond text editing, Emacs can execute

shell commands, access the internet, write and test programs, and manage emails.

Automatic indentation in Emacs helps organize code blocks, and it supports Unicode characters

for various languages. Additionally, Emacs features self-documentation, automatically generating and

displaying documentation for commands, variables, and internal functions in a program's source code.

Emacs may be downloaded for all platforms at this link https://emacs.sexy/. This is what the

Emacs startup screen looks like (Windows installation):


As you can see, the startup screen offers helpful links for learning how to use Emacs, including a

tutorial, guided tour, and manuals. The standard menubar at the top with options like "File" and "Edit"

and the toolbar below it are there to perform operations in Emacs (Hamrick, 2012). However, a more

efficient way to use Emacs is by mastering keyboard shortcuts for navigation.

In Emacs, the running instance is referred to as a frame, not a window (Hamrick, 2012). Inside

Emacs, there's a window where you see the "GNU Emacs" welcome buffer. The blinking cursor, called

the point, acts like a standard text editor cursor and serves as the location for running functions. The

grey bar at the bottom is the status bar, providing information about the point and active buffer. The

mini-buffer below it displays occasional status messages and is where you enter Emacs commands.

Emacs has two crucial keys used in keyboard shortcuts: the "meta" key (often the "Alt" key) and

the "Ctrl" key. They're abbreviated as "M" and "C" in key combinations, like M-x and C-f. Be aware

that key combos like C-c | and C-c C-| are different. The essential shortcuts are C-h C-h (help), C-g

(quit), and M-x (run command). Help assists when stuck, quit cancels an operation, and run command

executes an Emacs command.


An Emacs buffer is a fundamental concept in the editor. It's essentially a container that holds the

content you're working on, like text, code, or even images. Imagine it as a blank canvas or document

where you can write, edit, and manipulate your data. In Emacs, you can have multiple buffers open

simultaneously, each displaying file contents, program outputs, or other information. By default, Emacs

starts with a single window showing the GNU Emacs buffer, along with a Messages buffer for Emacs-

related information and an scratch buffer for temporary notes.

To switch between buffers, use the C-x b key combination. Pressing the tab key in the mini-buffer

displays a list of open buffers. You can select a buffer by typing its name and pressing enter.

Additionally, you can cycle through buffers sequentially with C-x right and C-x left. Windows in

Emacs are views into buffers, and you can have multiple windows open in the same frame, allowing

you to work with different buffers simultaneously.

To open and load a file into a buffer in Emacs, press C-x C-f. This will prompt the mini-buffer

with "Find file: ~/path/to/current/directory/." Similar to switching buffers, you can use the tab key to

list files in the specified directory. Type the desired file name (and modify the path if needed), then

press enter to create a new buffer with the specified file.


If you've made changes to the buffer and want to save it back to the file, use C-x C-s. To save the

buffer with a new file name (similar to "Save As"), use C-x C-w, and it will ask you to specify the file

name. If the file already exists, it will confirm whether you intend to overwrite it.

When you're finished with a buffer and want to close/kill it, use C-x k. This prompts you in the

mini-buffer to enter the name of the buffer to kill, similar to when switching buffers. If you don't

specify a buffer, it will default to killing the active buffer, and Emacs will display another open buffer

in the window that previously contained the killed buffer.

The actions of "cut," "copy," and "paste" have different names in Emacs, with "kill" being similar

to "cut" and "yank" being similar to "paste." To perform these actions, you need to first select a

"region." To select a region, move the cursor to one end of the desired area and press C-space. A

message in the mini-buffer will say "Mark set" or “Mark activated”. Move the cursor to the other end

of the region, and the highlighted text will indicate the selected region.

Now that you've selected a region, you can perform operations on it. To delete a selected region,

use C-w. Alternatively, you can implicitly define a region from the cursor to the end of the current line

and delete it using C-k. For pasting, use C-y. If you want to undo the last action, press C-_ several

times, and you'll see an "Undo!" message in the mini-buffer.


To delete a region without permanently removing the text, use M-w. This might seem

counterintuitive—deleting a region without deleting it? The distinction lies in Emacs's ability to store

multiple regions in a "kill ring" when you delete. Yanking retrieves text from the kill ring back into the

buffer. So, when you delete a region without removing it, you're copying its contents to the kill ring

without actually deleting it from the buffer.

To search within a buffer, use C-s for forward search or C-r for backward search. Enter your

search query in the mini-buffer and press C-s or C-r to cycle through the results. When you reach the

end of the search results, Emacs will show a "Failing I-search" message. If you continue the search, it

will wrap back to the beginning, displaying an "Overwrapped I-search" message in the mini-buffer.

To locate and replace a search query, use M-%. Input the text you want to find, press enter, and

then enter the replacement text. Emacs will highlight the text to be replaced, and you can press 'space'

to replace it, 'n' to skip to the next one, or '!' to replace all occurrences.

Navigating with just the arrow keys can be slow, so these key combinations can help. To move

the cursor up or down a whole paragraph, use C-up or C-down. For moving past a whole word, use C-

left or C-right. To go to the beginning of a line, press the home key; for the end of a line, use the end

key. Move up or down a page with the page up and page down keys. To go to the start of the buffer,

use M-.

Conclusion

Emacs is a powerful text editor that can be used to quickly edit files, once you familiarize

yourself with the different keyboard shortcuts. While it takes some adjustment, as the keyboard

shortcuts differ from the more familiar ones (like Ctrl-C for copy and Ctrl-V for paste), it can be be

incredibly useful for quick coding and flexible editing of files.

Binary code is a broad term referring to the encoding of characters or instructions (Admin, 2012).

ASCII, on the other hand, is a specific and widely adopted convention for encoding characters, serving
as the predominant binary encoding scheme for over thirty years. The length of binary code can vary

based on the number of characters, instructions, or the encoding method. In the case of ASCII, it

employs a 7-digit binary string, and for extended ASCII, it uses an 8-digit binary string.
References

Admin. (2012, November 18). Difference between binary and ASCII. Compare the Difference

Between Similar Terms. https://www.differencebetween.com/difference-between-binary-and-vs-

ascii/

Emacs.sexy. (n.d.). https://emacs.sexy/

Hamrick, J. (2012, September 10). Absolute Beginner’s Guide to EMACs.

http://www.jesshamrick.com/2012/09/10/absolute-beginners-guide-to-emacs/

Rouse, M. (2011, October 18). Emacs. Techopedia.

https://www.techopedia.com/definition/24107/emacs

You might also like