| Emacs Guide |
Emacs Help Guide
1. Introduction
Emacs is perhaps world's most powerful text editor.you can do lot's of stuff using emacs in a very powerful way.I will just try to list out few tasks that you can accomplish with help of emacs:
When you start emacs(using command emacs &)..you can see a menu bar on the top of the emacs window,a tool bar just below the menu bar.And then most of the remaining space is occupied by the editing buffer(where actual editing is performed).You can see a scroll bar in the left side of window. Another thing that you will observe that at the end of editing buffer there exists some sort of seperator..and below it exists another small area.
Well this area is very important.. All of the emacs commands are basically in the form of some special key bindings.These key bindings may initially appear a bit daunting but are very convenient. Usually all of the emacs commands start with either with control or alt key.Rest of the printable characters are sent to the editing buffer and are not considered as command. For Example: Here i will try to give all the essential commands with help of which you can easily work with emacs. One thing you should keep in mind is that you need not to remember all the commands. You can work with emacs very easily using a limited list of commands. The method to enter the command has been explained in the earlier section.
ctrl-x,ctrl-s: Now many of the commands has been described below and a description of how to bind keys with these commands is also given below. You can check spelling of a buffer using the command `alt-x-ispell-buffer`. You can use 'r' to enter a mis-spelled word for yourself. Can be also used for spelling checking..thus in this mode the spelling of the word will be checked on the fly and highlighted if there is an error. So either you can edit the word yourself or else left click on the word and let emacs suggest options. Completing The Text From Another Part of the BufferLet's say you are editing a text file and you are typing several words lot's of times then you can use this thing. We can use keystroke "alt-/" to auto complete a word that you have typed before. Some Very Important Keystrokes for Moving Around
alt-e: to end of the paragraph. Emacs can be very easily customized this is one of the reasons it is such a powerful editor.If you try command "alt-set-background-color" then you will find that you can change the background color of the current face. But the settings won't be saved thus next time you will start emacs your changes will be lost. Emacs reads a file called $HOME_DIR/.emacs(~/.emacs) on startup. By editing this file you can customize emacs very easily and your changes will saved. Here i am giving contents of my .emacs file. By looking at the comments itself you can guess what is the function of that line. Even of you don't, relax and simply use it for the time being. Just simply copy following lines and paste it to a file called .emacs(if something is already there in that file then you make sure it should be deleted). Sample .emacs File
;; Set up the keyboard so the delete key on both the regular keyboard
;; and the keypad delete the character under the cursor and to the right
;; under X, instead of the default, backspace behavior.
(global-set-key [delete] 'delete-char)
(global-set-key [kp-delete] 'delete-char)
;; turn on font-lock mode
(global-font-lock-mode t)
;; enable visual feedback on selections
(setq-default transient-mark-mode t)
;; always end a file with a newline
(setq require-final-newline t)
;; stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)
;;to display time
(display-time)
;;to set the cursor color
(set-cursor-color "red")
;;to set the font
(set-frame-font "-*-fixedsysttf-*-*-*-*-15-*-*-*-*-*-*-*")
;;to set foreground color to white
(set-foreground-color "white")
;;to set background color to black
(set-background-color "black")
;;to manage the geometric size of initial window.
(setq initial-frame-alist '((width . 87) (height . 42)))
;;set the keybinding so that you can use f4 for goto line
(global-set-key [f4] 'goto-line)
;;set the keybinding so that f3 will start the shell
(global-set-key [f3] 'shell)
;;set the keybinding so that f5 will start query replace
(global-set-key [f5] 'query-replace)
(global-set-key [f6] 'switch-to-buffer)
(global-set-key [f7] 'hippie-expand)
(global-set-key [f8] 'ispell)
(setq load-path (cons "/home/hemant/elisp" load-path))
(when window-system
;; enable wheelmouse support by default
(mwheel-install)
;; use extended compound-text coding for X clipboard
(set-selection-coding-system 'compound-text-with-extensions))
(autoload 'mpg123 "mpg123" "A Front-end to mpg123" t)
(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(auto-save-default nil)
'(backup-directory-alist (quote (("." . "/home/hemant/backup"))))
'(default-frame-alist (quote ((tool-bar-lines . 1) (menu-bar-lines . 1) (width . 87) (height . 42)))))
(custom-set-faces
;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(font-lock-comment-face ((((class color) (background dark)) (:foreground "chocolate1" :slant italic :family "-*-lucida-medium-r-*-*-14-*-*-*-*-*-*-*"))))
'(fringe ((((class color) (background dark)) (:background "grey10" :width ultra-condensed))))
'(scroll-bar ((t (:background "Dark slate gray")))))
Miscellaneous Commands
Some keystrokes set by me:
Customizing key bindings in emacs:
(global-set-key [f4] 'goto-line)
1.to jump to newline automatically after termination of an statement: My .emacs file assumes you have fixedsys and lucida fonts installed.(though lucida comes with any standard installation of GNU/Linux..fixedsys won't be installed on your system.Also i have created a directory called ~/elisp where additional elisp packages are stored ,so you must have a directory of that name.Now if you don't have fixedsys and any packages that has to be stored in ~/elisp better remove those lines).Another important thing..by default emacs creates backup of files while editing and saves it in current directory with prefix ~.But i have customized emacs so that all the backup files will redirected to ~/backup directory.So you should also create a directory called ~/backup. CopyrightThis documentation is covered by GFDL.you can freely modify and redistribute the copies of this documenation under terms of GFDL. Having trouble? Got questions? Require further assistance? If so please feel free to visit our Help Forums and ask the experts! |
|
Copyright © 1997 - 2010 Private World Domination Inc. All rights reserved. |
|