Introduction to Emacs J. Caldwell, N. McCaw, D. Powell

Slides:



Advertisements
Similar presentations
Microsoft Word Objectives: Word processing using Microsoft Word
Advertisements

Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Introduction to EMACS and XEMACS CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Customizing Word Microsoft Office Word 2007 Illustrated Complete.
Linux+ Guide to Linux Certification, Second Edition
Module 3 Productivity Programs Common Features and Commands Microsoft Office 2007.
CHAPTER 9 Introducing Microsoft Office Learning Objectives Start Office programs and explore common elements Use the Ribbon Work with files Use.
Lesson 6. GCSE Computing – programming languages Candidates should be able to:  describe common tools and facilities available in an integrated development.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Introduction to Unix – CS 21 Lecture 8. Lecture Overview More detail on emacs and vi Regular expression matching in emacs and vi.
Editors And Debugging Systems Other System Software Text Editors Interactive Debugging Systems UNIT 5 S.Sharmili Priyadarsini.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Chapter Three The UNIX Editors.
Jamilah Al-Saidan. Introduction to this Course This course is designed to introduce pharmacy students to data processing and programming with pharmaceutical.
THE C PROGRAMMING ENVIRONMENT. Four parts of C environment  Main menu  Editor status line and edit window  Compiler message window  “Hot Keys” quick.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Key Applications Module Lesson 12 — Word Essentials Computer Literacy BASICS.
PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6.
Chapter 11 Enhancing an Online Form and Using Macros Microsoft Word 2013.
Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)
Fundamentals of Windows Mouse n 4 Basic Operations: –Pointing –Clicking –Double Clicking –Dragging.
Being Productive With Emacs Part 2
Dive Into® Visual Basic 2010 Express
Microsoft Word 2016 Lesson 1.
4.2 Microsoft Word.
Visual Basic.NET Windows Programming
Microsoft Word Objectives: Word processing using Microsoft Word
KARES Demonstration.
Development Environment
5.2 Microsoft Excel.
Chapter 2: The Visual Studio .NET Development Environment
SUSE Linux Enterprise Desktop Administration
Development with Eclipse
Working in the Forms Developer Environment
SQL and SQL*Plus Interaction
Computing Fundamentals
Appendix A Barb Ericson Georgia Institute of Technology May 2006
Microsoft Word 2010.
Chapter Lessons Start Adobe Photoshop CS
Guide To UNIX Using Linux Third Edition
1. Introduction to Visual Basic
Basic operations in Matlab
Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
Word and the Writing Process
An Introduction to Computers and Visual Basic
Introduction to Events
Introduction to Computers
Rachael Sessler Trinkowsky, Ph.D., CRC, CATIS
Introducing Microsoft Office 2010
4.2 Microsoft Word.
5.2 Microsoft Excel.
Assistant lecturer Nisreen A. Jabr
NextGen Trustee General Ledger Accounting
Key Applications Module Lesson 12 — Word Essentials
Technology ICT Core: PowerPoint.
Getting Started: Amazon AWS Account Creation
Introduction Paul Flynn
Productivity Programs Common Features and Commands
Microsoft PowerPoint 2007 – Unit 2
An Introduction to Computers and Visual Basic
Linux Operations and Administration
12th Computer Science – Unit 5
Chapter 1: Programming Basics, Python History and Program Components
1 Word Processing Part I.
The Emacs Editor Read: Forouzan, Appendix C
Key Applications Module Lesson 12 — Word Essentials
HIBBs is a program of the Global Health Informatics Partnership Learning the Basics of Microsoft Word 2019 and Microsoft office support TFN
Microsoft Excel 2007 – Level 2
Selenium IDE Installation and Use.
Presentation transcript:

Introduction to Emacs J. Caldwell, N. McCaw, D. Powell Advanced Computational Methods II 6th March

Introduction to Emacs Virtual Machine: Tutorial Documents: http://www.southampton.ac.uk/~ngcmbits/virtualmachines/Emacs_Intro.ova Tutorial Documents: https://github.com/JimC12/Intro_to_emacs_tasks - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp

Introduction to Emacs Contents Aim: Introduction to the basic usage and familiar terms/concepts used in Emacs. Kill and yank = cut and paste Contents What and why The View The Control Major and Minor Modes Configuration Using EMACS Hands-On: General navigation and use Programming - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp

Back in the day The first state-of-the-art input to a computer was a teletype Line editor The invention of model terminals, users still wanted line editors: Emacs – 1976 Vi – 1976 Focused on using the keyboard as a feature: Open/close/save files Switch buffers Orientate screen layout (split screens) Move letters/words Formatting Spell checking - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp

What is Emacs? Controlled by MACROS to perform large edits Editor MACroS -> Emacs Under the hood is an interpreter for Lisp More than just an Editor Coding/Debugging Email Calendar Control sub processes Indent programs automatically Handle multiple files at once Free under GNU license - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp

What is EMACS Highly Customisable Self-Documenting Extensible Change Emacs to suit your needs and style Content aware editing modes Self-Documenting Built-in documentation for help Extensible Download packages Write you own Lisp functions Load them when required Input it initialization file so that it is always loaded up Make your own key-bindings - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp

Why EMACS? Hardware independent – not locked to any specific format Used on graphical systems (X Window) or terminal Allows remote editing (ssh) without graphical connection Lightweight editor Keyboard controlled ’pointy-click’ too slow! Integrated platform for general purposes Community Share the power - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp

Why EMACS? You can play Tetris - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp Really is more than just a text editor

Fundamentals – The View FRAME: where you view everything WINDOW: Displays buffer content MODE-LINE: Contains important information Buffer State Modified (**) Unmodified (--) Filename Amount of file visible (All) The major mode - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp MINI-BUFFER (ECHO Area): Displays messages and prompts for commands

Fundamentals – The Control Buffer: The text being edited Can be bound to various contents: file, external process Every keystroke is a command Keys (C-n) are mapped to commands (next-line) Each command is a special type of Lisp function Has over 2000 commands Modifier Keys: The Control(Ctrl) key –> c-x (ctrl and x together) The Meta(Alt) key -> m-x (alt and x together) - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp

Fundamentals – The Control Uses sequence of commands: C-f C-x C-f Sequence displayed in the mini-buffer if you are slow Space between characters means release keys Tab auto-complete Prefix Key – Combines with the input which follows the key: c-x c-h of F1 after prefix key lists commands that are used with the prefix key Multiple buffers in same window - Can use help commands to find out what your options are or what the command does Rebinding of keys Change comment manipulation Create new commands – written in Lisp

Configuration On start-up, Emacs looks at the initialization File ~/.emacs.d/init.el Personal Emacs Lisp code that you want to execute when you start Emacs. automatic formatting auto complete Build additional menus

Major Modes Major: Specialised facilities for working on a particular file type (c, shell). Mutually excluse – only one mode To enable mode M-x mode-name Least specialised is ‘fundamental mode’ Generally the default mode Examples: Shell-mode, org-mode, c-mode, compile-mode Org-Mode (organising mode) Note taking Information/task/time organisation

Major Modes Python

Minor Modes Minor: Optional features which can be turned on and off Auto-fill Show line number Scrollbar Status information Buffer can have multiple minor modes active Independent of other modes

Starting Emacs Start: Easiest from terminal - $ emacs Opens in GUI mode Start: In terminal model - $ emacs -nw Open file: $ emacs <file_name> To exit: C-x C-c (save-buffers-kill-terminal)

Basic Navigation and Use Hands On Basic Navigation and Use

Basic Navigation To start Emacs open the terminal (ctrl-alt-t) Type Emacs, press enter Open file named ‘emacs_tutorial’ C-x C-f and find the file

Changing Colours Call Load Theme View Options with tab Select Theme

Use of Calendar M-x calendar: to open calendar mode Adding event to date i d to add day event i w to add weekly event i m to add monthly event i y to add yearly event M-x diary to view todays events while editing a buffer.

Tasks Create new file Import the ‘sample.txt’ file Navigate through it Add something at the end Save Add event to todays date Go back to the file Check what events are on today Close the event buffer

Hands On Programming in C

Task 1 Number 0. Number 1. Number 2. Number 3. Number 4. Number 5. Open file01.c Edit the file in Emacs to correct it so that the desired output is displayed. (Depending on your keyboard, one symbol may be a little tricky…) Compile and run using the terminal The file should compile with all the usual flags (pedantic, ansi and Wall) without any errors or warnings. Output should be the same  Number 0. Number 1. Number 2. Number 3. Number 4. Number 5. Number 6. Number 7. Number 8. Number 9.

Task 2a Save the corrected file01.c as file02.c Change the for loop so that the final printed value is 99. Compile again and pipe the output of the program to “text02.txt”. Open the newly created file in Emacs in a second window. One buffer showing the code in file02.c Another buffer (within the same window) showing the text02.txt contents

Task 2b – illustrating the buffer Change the for loop back to its previous value Recompile the code and pipe the answer to the same file (text02.txt Notice how although the file has changed, Emacs still displays the old contents as you are currently working within a buffer. Finally, open the new output in anther buffer to confirm this.

Summary Emacs is a very versatile and powerful text editor Introduced to basic and fundamental concepts All content is available for use on bitbucket http://computationalmodelling.bitbucket.org/tools/ Helpful Links https://www.emacswiki.org/emacs/InitFile https://www.gnu.org/software/emacs/manual/html_n ode/emacs/index.html#SEC_Contents