Showing posts with label Emacs. Show all posts
Showing posts with label Emacs. Show all posts

Font & old emacs

Jul 11, 2011
Tested on: CentOS release 5.6 (Final)

The newer version of emacs (23.x) has a nice option in menu to change the default font. But the older emacs (21.4.1) does not have these options. The older (& stable) versions of emacs are generally shipped with centos. Here are steps for changing the default fonts in emacs 21.4.1

Option 1 (for current sessions only)
  1. Open emacs.
  2. Left-click on mouse while holding 'Shift' key on keyboard. A Font-menu will pop-up.
  3. Play around with the menu & set required font.

Option 2 (for all future sessions)
We have to find the available system fonts and apply them to ~/.emacs file.
  1. Open terminal & execute following command: xfontsel
  2. Left-click on 'fmly' & others to select a value. You will be able to see how the font looks like in the same window. When you are satisfied with the font selected press 'Select' button. It will copy the font name with details to clipboard. Following are some of the examples of the fonts: -*-courier-medium-r-*-*-17-*-*-*-*-*-iso8859-* -*-lucidatypewriter-medium-*-*-*-14-*-*-*-*-90-iso8859-* -*-luxi mono-medium-r-*-*-17-*-*-*-*-*-ascii-*
  3. Open ~/.emacs file in any text editor and add following at the end of the file: (set-default-font "-*-*-*-*-*-*-*-*-*-*-*-*-*-*") Replace -*-*-*-*-*-*-*-*-*-*-*-*-*-* by your selected font name (like one of the examples shown above) Save ~/.emacs & re-launch emacs. You should be able to see the difference.
  4. There might be some delay before text is displayed in emacs. Add following to top of the ~/.emacs file for a workaround: (modify-frame-parameters nil '((wait-for-wm . nil)))
Read more ...

AUCTeX on windows

May 13, 2011
It’s a little tricky to get AUCTeX working on windows, specially the preview feature working. Following steps helped me.
  1. Install MikTeX.
  2. Install Ghostscript & GSview.
  3. Install Emacs & AUCTeX from here.
  4. Add to system PATH the location of gsview32c.exe. (Required for LaTeX-preview). Restart the system (Did not work without restart for me)
  5. Add following lines to .emacs file (load "auctex.el" nil t t) (load "preview-latex.el" nil t t) .emacs file can be found in C:/users/username/appdata/roaming/ or in the home directory. 
  6. Change variable (see next section) preview-image-type to pnm. To use other types install correct dll files in bin directory of emacs.
Other customizations:
To customize/change a variables in Emacs use M-x customize-variable
  • Change default viewer: <to-find-out>
  • Change preview size: Customize variable display-mm-dimensions-alist. Experiment with width height. My setting: Width-250, height-180
Read more ...

Emacs Cheat Sheet

Sep 11, 2009
C-x is same as Ctrl-x
M-x is same as Alt-x
<#> represents a numeric value

FILE
   Open    C-x C-f
   Save    C-x C-s
   Save As    C-x C-w
   Save All    C-x s
   Close Buffer    C-x k
   Quit    C-x C-c
EDIT
   Undo    C-_
   Begin Selection    C-space
   Cancel Selection    C-g
   Cut Selection    C-w
   Cut Line (text on right side of the cursor)    C-k
   Paste / Yank    C-y
   Copy Selection to Numbered Clipboard    C-x r s <#>
   Paste from Numbered Clipboard    C-x r i <#>
   Forward Delete    Delete
   C-d
   Forward Delete Word    M-d
   Backward Delete    Backspace
   Backward Delete Word    C-Backspace
   M-Backspace
   M-Delete
   Complete word (based on words in open buffers)    M-/
Rectangle Edits
   Copy rectangle    C-x r r
   Cut / kill rectangle    C-x r k
   Paste / Yank rectangle    C-x r y
   Create blank rectangle    C-x r o
SEARCH
   Search / Move to next search hit    C-s
   Search / Move to previous search hit    C-r
   Regexp Search / Move to next hit    M-C-s
   Regexp Search / Move to previous hit    M-C-r
   Search and Replace    M-% then y for each replacement
                    ! to replace all
   Goto Line Number    M-x goto-line <#>
   M-g g <#>
   Move to previous matching bracket    M-C-b
   Move to next matching bracket    M-C-f
WINDOW
   Move to & fro in buffers    C-x right-arrow-key
   C-x left-arrow-key
   Choose Window    C-x, C-b
   Move to top of page    C-Home-key
   Move to bottom of page    C-End-key
   Move to beginning of current line    C-a
   Home-key
   Move to end of current line    C-e
   End-key
   Maximize / Display only one buffer    C-x 1
   Split Horizontal    C-x 2
   Split Vertical    C-x 3
   Switch Focus Between Windows    C-x o
   Activate Menu Bar     M-`
FORMATTING
   Indent Selection    M-C-\
   Convert to uppercase (till end of current word)    M-u
   Convert to lowercase (till end of current word)    M-l
   Capitalize Word
   (Convert 1st letter of word to uppercase)
   M-c
   Uppercase Selection    C-x, C-u
   Lowercase Selection    C-x, C-l


Other useful cheat sheets:

Emacs configuration files:
Read more ...