Tuesday, July 5, 2011

Emacs

Will be updating evil-mode

Installing latest emacs:
sudo port install emacs
sudo port install emacs-app

http://wikemacs.org/wiki/Installing_Emacs_on_OS_X


Using following link to install mac ports
https://guide.macports.org/chunked/installing.macports.html


Start playing tetris:
M-x tetris

Grep with in Emacs:
M-x grep

Emacs can compare two files and highlight their differences (M-x ediff)
Emacs is a file manager (M-x dired)
Emacs can read news, mail, and RSS feeds (M-x gnus)
You can even play tetris in Emacs (M-x tetris)

Emacs with Cscope:
To run Cscope in Emacs you need cscope-indexer and xcscope.el in appropriate folders. They can be found at contrib/xcscope/ in cscope source code.
File cscope-indexer must be executable and placed in some directory in system PATH. File xcscope.el must be copied in some folder in Emacs’s load path. Usually, my .el files are in folder ~/elisp and this folder can be included in Emacs load path by adding this line to ~/.emacs:

(add-to-list 'load-path "~/elisp")

When this is done, we can include cscope in Emacs by adding this line to ~/.emacs :
(require 'xcscope)

Start Emacs, type M-x cscope and type TAB key (one or more times). If you see a list of cscope functions in other buffer, everything is fine. Set the cscope-initial-directory variable by typing M-x cscope-set-initial-directory and ~/projects/foo in the mini buffer (we can check variable values in Emacs by typing M-x describe-variable following the variable name).

Create list of files to index and cscope database with M-x cscope-index-files (this should create files cscope.files and cscope.out)

To move between the Cscope tags: "SPACE BAR"
To know the help commands in cscope file: C-h m

(From file xcscope.el)
;; * Keybindings:
;;
;; All keybindings use the "C-c s" prefix, but are usable only while
;; editing a source file, or in the cscope results buffer:
;;
;;      C-c s s         Find symbol.
;;      C-c s d         Find global definition.
;;      C-c s g         Find global definition (alternate binding).
;;      C-c s G         Find global definition without prompting.
;;      C-c s c         Find functions calling a function.
;;      C-c s C         Find called functions (list functions called
;;                      from a function).
;;      C-c s t         Find text string.
;;      C-c s e         Find egrep pattern.
;;      C-c s f         Find a file.
;;      C-c s i         Find files #including a file.
;;
;; These pertain to navigation through the search results:
;;
;;      C-c s b         Display *cscope* buffer.
;;      C-c s B         Auto display *cscope* buffer toggle.
;;      C-c s n         Next symbol.
;;      C-c s N         Next file.
;;      C-c s p         Previous symbol.
;;      C-c s P         Previous file.
;;      C-c s u         Pop mark.
;;
;; These pertain to setting and unsetting the variable,
;; `cscope-initial-directory', (location searched for the cscope database
;;  directory):
;;
;;      C-c s a         Set initial directory.
;;      C-c s A         Unset initial directory.
;;
;; These pertain to cscope database maintenance:
;;
;;      C-c s L         Create list of files to index.
;;      C-c s I         Create list and index.
;;      C-c s E         Edit list of files to index.
;;      C-c s W         Locate this buffer's cscope directory
;;                      ("W" --> "where").
;;      C-c s S         Locate this buffer's cscope directory.
;;                      (alternate binding: "S" --> "show").
;;      C-c s T         Locate this buffer's cscope directory.
;;                      (alternate binding: "T" --> "tell").
;;      C-c s D         Dired this buffer's directory


References:
http://kliketa.wordpress.com/2010/07/09/using-cscope-source-browsing-tool
http://stackoverflow.com/questions/364495/non-gui-emacs-with-cscope
http://www.stanford.edu/class/cs110/other/emacsrefcard.pdf
http://lists.gnu.org/archive/html/help-gnu-emacs/ -- Emacs mailer list

No comments:

Post a Comment