[M-x replace-string] : unconditional replace
[M-%] : find and replace [space/y (yes) | DEL/n (no)]]


emacs -l .emacs-ede.el tree.c

================= Etc ===============
[M-x replace-string] : unconditional replace
[M-%] : find and replace [space/y (yes) | DEL/n (no)]]

emacs -l .emacs-ede.el tree.c

=================  Hightlight ===============
C-x w r : unhighlight-regexp
C-x w h : highlight-regexp

=================  Diff Mode (M-x diff) ===============
M-n
Move to the next hunk-start (diff-hunk-next).
This command has a side effect: it refines the hunk you move to, highlighting its changes with better granularity. To disable this feature, type M-x diff-auto-refine-mode to toggle off the minor mode Diff Auto-Refine mode. To disable Diff Auto Refine mode by default, add this to your init file (see Hooks):

          (add-hook 'diff-mode-hook
                    (lambda () (diff-auto-refine-mode -1)))

M-p
Move to the previous hunk-start (diff-hunk-prev). Like M-n, this has the side-effect of refining the hunk you move to, unless you disable Diff Auto-Refine mode.

M-}
Move to the next file-start, in a multi-file patch (diff-file-next).

M-{
Move to the previous file-start, in a multi-file patch (diff-file-prev).

M-k
Kill the hunk at point (diff-hunk-kill).

M-K
In a multi-file patch, kill the current file part. (diff-file-kill).

C-c C-a
Apply this hunk to its target file (diff-apply-hunk). With a prefix argument of C-u, revert this hunk.

C-c C-b
Highlight the changes of the hunk at point with a finer granularity (diff-refine-hunk). This allows you to see exactly which parts of each changed line were actually changed.

C-c C-c
Go to the source file and line corresponding to this hunk (diff-goto-source).

C-c C-e
Start an Ediff session with the patch (diff-ediff-patch). See Ediff.

C-c C-n
Restrict the view to the current hunk (diff-restrict-view). See Narrowing. With a prefix argument of C-u, restrict the view to the current file of a multiple-file patch. To widen again, use C-x n w (widen).

C-c C-r
Reverse the direction of comparison for the entire buffer (diff-reverse-direction).

C-c C-s
Split the hunk at point (diff-split-hunk). This is for manually editing patches, and only works with the unified diff format produced by the -u or --unified options to the diff program. If you need to split a hunk in the context diff format produced by the -c or --context options to diff, first convert the buffer to the unified diff format with C-c C-u.

C-c C-d
Convert the entire buffer to the context diff format (diff-unified->context). With a prefix argument, convert only the text within the region.

C-c C-u
Convert the entire buffer to unified diff format (diff-context->unified). With a prefix argument, convert unified format to context format. When the mark is active, convert only the text within the region.

C-c C-w
Refine the current hunk so that it disregards changes in whitespace (diff-refine-hunk).

C-x 4 A
Generate a ChangeLog entry, like C-x 4 a does (see Change Log), for each one of the hunks (diff-add-change-log-entries-other-window). This creates a skeleton of the log of changes that you can later fill with the actual descriptions of the changes. C-x 4 a itself in Diff mode operates on behalf of the current hunk's file, but gets the function name from the patch itself. This is useful for making log entries for functions that are deleted by the patch.

================= ECB ===============
C-c . g 1
C-c . g d
C-c . g s
C-c . g h
C-c . g m

================= Modes ===============
M-x hexl-mode : hex edit mode
M-x calculator :
M-x calendar

================= CC Mode ===============
C-c C-s : To know which syntatic symbols affect the offset calculations for the line.
C-c C-o : To change offset of syntatic symbol interactively.
M-h C-c C-c : comment region
M-h C-u C-c C-c" : uncomment region
M-C-f    : To the end of block - ex parenthesis, bracket, brace
M-C-b    : To the beginning of block
========================================================
EDE :
+ To add files easily : DirEd mode -> Mark files ("m") -> ". a" to add to target
+ use "M-x customize-target RET" while inside some source file in a target to customize things like compiler flags.

C-x r [SPC] [CHR]
C-x r j [CHR]

================= Key code =============
C : control
M : meta (alt)
S : shift
C-S : control + shift
<f8> : F8 key
<left> <right> <down> <up>
\e : escape key (usually same with meta key)
[(control return)] : control + return key.

(global-set-key [f9] 'alexott-compile)

================= Keyboard macro =============
'C-x (' : start defining a keyboard macro
'C-x )' : stop defining the keyboard macro
'C-x e' : execute the keyboard macro
'C-u 37 C-x e' : execute the macro 37 times.
'C-u 0 C-x e' : execute the macro an infinite number of times until the end of file is reached.
'M-x name-last-kbd-macro' : Name the last-defined keyboard macro
'M-x my-macro' : execute macro by name.

================= Search =============
M-s w : If incremental search is active, toggle word search mode (isearch-toggle-word); otherwise, begin an incremental forward word search (isearch-forward-word).
M-s w <RET> words <RET> : Search for words, using a forward nonincremental word search.
M-s w C-r <RET> words <RET> : Search backward for words, using a nonincremental word search.
M-c to toggle search case-sensitivity
(setq case-fold-search t)   ; make searches case insensitive

================== Online-Help ==================
C-h c which command does this keystroke invoke
C-h k which command does this keystroke invoke and what does it do?
C-h l what were my last 100 typed keys
C-h w what key-combo does this command have?
C-h f what does this function do
C-h v what's this variable and what is it's value
C-h b show all keycommands for this buffer
C-h t start the emacs tutorial
C-h i start the info reader
C-h C-k start up info reader and go to a certain key-combo point
C-h F show the emacs FAQ
C-h p show infos about the Elisp package on this machine

================= Basics ===============
C-x 4 f find file in other window
C-x 4 o change to other window
C-x 4 0 kill buffer and window
C-x 5 2 make new frame
C-x 5 f find file in other frame
C-x 5 o change to other frame
C-x 5 0 close this frame

C-x r m : bookmark-set
C-x r b : bookmark-jump
C-x r l : bookmark-menu-list (list all your bookmarks)

M-C-f / M-C-b : find matching brace in forward/backward direction.

C-M-v : (scroll-other-window) scroll other window down
C-M-S-v : scroll other window up.

==================== misc =====================
tabify : change spaces to tab in selected region <-> untabify

================= functions ===================
load-library : load files whose extension is .elc, .el and no-ext(specified name alone)  in the directories.
eval-current-buffer : evaluate all the Lisp expressions in the buffer.


==================== elisp ==============
C-x C-e : eval-last-sexp : evaluate lisp expresstion to the left of the cursor
eval-region : select lisp code and evaluate it.
ielm : turns the buffer into a interactive elisp command line interface.
C-h f : describe-function : finds inline documentation of a function
elisp-index-search : finds the documentation of a function in the official GNU Emacs Lisp Reference Manual.

====================================================
C-x r <SPC> r :    Record the position of point and the current buffer in register r (point-to-register).
C-x r j r :    Jump to the position and buffer saved in register r (jump-to-register).

==================== Semantic =====================
C-x B : semantic-mrub-switch-tag :
C-c , j : semantic-complete-jump-local
C-c , n : senator-next-tag
C-c , p : senator-previous-tag
C-c , u : senator-go-to-up-reference : move cursor to the "parent" tag.

==================== gtags =====================
\e* : gtags-pop-stack
\e. : gtags-find-tag
\C-x4. : gtags-find-tag-other-window


==================== gud gdb ======================
gdb-many-windows : t (M-x gdb-many-windows)

C-x <SPC>    Set a breakpoint on the source line that point is on.
C-c C-l
C-x C-a C-l
    Display in another window the last line referred to in the GUD buffer (that is, the line indicated in the last location message). This runs the command gud-refresh.
C-c C-s
C-x C-a C-s
    Execute a single line of code (gud-step). If the line contains a function call, execution stops after entering the called function.
C-c C-n
C-x C-a C-n
    Execute a single line of code, stepping across entire function calls at full speed (gud-next).
C-c C-i
C-x C-a C-i
    Execute a single machine instruction (gud-stepi).
C-c C-p
C-x C-a C-p
    Evaluate the expression at point (gud-print). If Emacs does not print the exact expression that you want, mark it as a region first.
C-c C-r
C-x C-a C-r
    Continue execution without specifying any stopping point. The program will run until it hits a breakpoint, terminates, or gets a signal that the debugger is checking for (gud-cont).
C-c C-d
C-x C-a C-d
    Delete the breakpoint(s) on the current source line, if any (gud-remove). If you use this command in the GUD interaction buffer, it applies to the line where the program last stopped.
C-c C-t
C-x C-a C-t
    Set a temporary breakpoint on the current source line, if any (gud-tbreak). If you use this command in the GUD interaction buffer, it applies to the line where the program last stopped.
C-c <
C-x C-a <
    Select the next enclosing stack frame (gud-up). This is equivalent to the GDB command ‘up’.
C-c >
C-x C-a >
    Select the next inner stack frame (gud-down). This is equivalent to the GDB command ‘down’.
C-c C-u
C-x C-a C-u
    Continue execution to the current line (gud-until). The program will run until it hits a breakpoint, terminates, gets a signal that the debugger is checking for, or reaches the line on which the cursor currently sits.
C-c C-f
C-x C-a C-f
    Run the program until the selected stack frame returns or stops for some other reason (gud-finish).

If you are using GDB, these additional key bindings are available:

C-x C-a C-j
    Only useful in a source buffer, gud-jump transfers the program's execution point to the current line. In other words, the next line that the program executes will be the one where you gave the command. If the new execution line is in a different function from the previously one, GDB prompts for confirmation since the results may be bizarre. See the GDB manual entry regarding jump for details.
<TAB>
    With GDB, complete a symbol name (gud-gdb-complete-command). This key is available only in the GUD interaction buffer.



==================== Version control ======================
C-x v v     vc-next-action
    perform the next logical control operation on file
(C-x C-q     by default, C-x C-q is no longer bound, so it's better to use the above binding)

C-u C-x v v
    To switch between branches, type and specify the revision ID you want to select

C-x v i     vc-register
    add a new file to version control
 
C-x v I        vc-log-incoming
    Display the changes that will be received with a pull operation.

C-x v O     vc-log-outgoing
    Display the changes that will be sent by the next push operation.

C-x v ~     vc-version-other-window
    Prompt for a revision of the current file, and visit it in a buffer of its own

C-x v =     vc-diff
    Compare the files in the current fileset with the working revision(s) you started from. With a prefix argument, prompt for two revisions of the current fileset and compare them. You can call this command from a Dired buffer (Dired)

C-x v D     vc-root-diff
    Compare the entire tree corresponding to the current fileset with the tree you started from. With a prefix argument, prompt for two revisions and compare their trees.

C-x v g     vc-annotate
    Display an annotated version of the file: for each line, show the latest revision in which it was modified (vc-annotate).    
   
C-x v d     vc-directory
    View VC-Directory-Mode.
   
C-x v s     vc-create-snapshot
    tag all the files with a symbolic name
   
C-x v r     vc-retrieve-snapshot
    undo checkouts and return to a snapshot with a symbolic name

C-x v l     vc-print-log
    show log for current file (not in ChangeLog format)
   
C-x v L     vc-print-root-log
    Display the change history for the current repository
   
C-x v a     vc-update-change-log
    Visit the current directory's change log file and, for registered files in that directory, create new entries for versions checked in since the most recent entry in the change log file. ().
    This command works with RCS or CVS only, not with any of the other back ends.

C-u C-x v a
    As above, but only find entries for the current buffer's file.

M-1 C-x v a
    As above, but find entries for all the currently visited files that are maintained with version control. This works only with RCS, and it puts all entries in the log for the default directory, which may not be appropriate.

C-x v m     vc-merge
    Merge changes into the work file.

C-x v h     vc-insert-headers
    Insert headers in a file for use with your version-control system.

C-x v u     vc-revert-buffer
    Revert the buffer and the file to the working revision from which you started editing the file.
   
C-x v c     vc-rollback
    Remove the last-entered change from the master for the visited file. This undoes your last check-in.

M-x vc-find-conflicted-file

M-x vc-resolve-conflicts
    pop up an ediff-merge session on a file with conflict markers



[ VC Directory Commands ]
-------------------------

Up- and down-arrow keys
    move in the buffer;
   
n and p
    also move vertically as in other list-browsing modes.

<SPC> and <TAB>
    behave like down-arrow

<BackTab>
    behaves like up-arrow.

o    visits that file in another window.

q    dismisses the directory buffer.

f    visit the file on the current line.

C-m    Same with above

x    hides up-to-date files.

m    marks the file or directory on the current line. If the region is active, m marks all the files in the region. There are some restrictions when marking: a file cannot be marked if any of its parent directories are marked, and a directory cannot be marked if any files in it or in its child directories are marked.

M    marks all the files with the same VC state as the current file if the cursor is on a file. If the cursor is on a directory, it marks all child files. With a prefix argument: marks all files and directories.

u    unmarks the file or directory on the current line. If the region is active, it unmarks all the files in the region.

U    marks all the files with the same VC state as the current file if the cursor is on a file. If the cursor is on a directory, it unmarks all child files. With a prefix argument: unmarks all marked files and directories.


* It is possible to do search, search and replace, incremental search, and incremental regexp search on multiple files. These commands will work on all the marked files or the current file if nothing is marked. If a directory is marked, the files in that directory shown in the VC directory buffer will be used.

S    searches the marked files.

Q    does a query replace on the marked files.

M-s a C-s
    does an incremental search on the marked files.

M-s a C-M-s
    does an incremental regular expression search on the marked files.

* Commands are also accessible from the VC-dir menu. Note that some VC backends use the VC-dir menu to make available extra, backend-specific, commands. For example, Git and Bazaar allow you to manipulate stashes and shelves. (These provide a mechanism to temporarily store uncommitted changes somewhere out of the way, and bring them back at a later time.)

* Normal VC commands with the C-x v prefix work in VC directory buffers. Some single-key shortcuts are available as well; =, +, l, i, and v behave as through prefixed with C-x v.

The command C-x v v (vc-next-action) operates on all the marked files.

When C-x v v (vc-next-action) operates on multiple files, all of those files must be either in the same state or in compatible states (added, modified and removed states are considered compatible). Otherwise it signals an error. This differs from the behavior of older versions of VC, which did not have fileset operations and simply did vc-next-action on each file individually.

If any files are in a state that calls for commit, C-x v v reads a single log entry and uses it for the changeset as a whole. If the underling VCS is file- rather than changeset-oriented, the log entry will be replicated into the history of each file.



[ In '*vc-change-log* ]
-----------------------

p    Move to the previous revision-item in the buffer. (Revision entries in the log buffer are usually in reverse-chronological order, so the previous revision-item usually corresponds to a newer revision.) A numeric prefix argument is a repeat count.

n    Move to the next revision-item (which most often corresponds to the previous revision of the file). A numeric prefix argument is a repeat count.

P    Move to the log of the previous file, when the logs of multiple files are in the log buffer (see VC Directory Mode). Otherwise, just move to the beginning of the log. A numeric prefix argument is a repeat count, so C-u 10 P would move backward 10 files.

N    Move to the log of the next file, when the logs of multiple files are in the log buffer (see VC Directory Mode). It also takes a numeric prefix argument as a repeat count.

a    Annotate the revision indicated by the current line.

e    Modify the change comment displayed at point. Note that not all VC systems support modifying change comments.

f    Visit the revision indicated at the current line, like typing C-x v ~ and specifying this revision's ID (see Old Revisions).

d    Display the diff (see Comparing Files) between the revision indicated at the current line and the next earlier revision. This is useful to see what actually changed in the file when the revision indicated on the current line was committed.

D    Display the changeset diff (see Comparing Files) between the revision indicated at the current line and the next earlier revision. This is useful to see all the changes to all files that the revision indicated on the current line did when it was committed.


   
[ VC-Annotate menu ]
--------------------

From the annotate buffer, these and other color scaling options are available from the ‘VC-Annotate’ menu. In this buffer, you can also use the following keys to browse the annotations of past revisions, view diffs, or view log entries:

p    Annotate the previous revision, that is to say, the revision before the one currently annotated. A numeric prefix argument is a repeat count, so C-u 10 p would take you back 10 revisions.

n    Annotate the next revision—the one after the revision currently annotated. A numeric prefix argument is a repeat count.

j    Annotate the revision indicated by the current line.

a    Annotate the revision before the one indicated by the current line. This is useful to see the state the file was in before the change on the current line was made.

f    Show in a buffer the file revision indicated by the current line.

d    Display the diff between the current line's revision and the previous revision. This is useful to see what the current line's revision actually changed in the file.

D    Display the diff between the current line's revision and the previous revision for all files in the changeset (for VC systems that support changesets). This is useful to see what the current line's revision actually changed in the tree.

l    Show the log of the current line's revision. This is useful to see the author's description of the changes in the revision on the current line.

w    Annotate the working revision–the one you are editing. If you used p and n to browse to other revisions, use this key to return to your working revision.

v    Toggle the annotation visibility. This is useful for looking just at the file contents without distraction from the annotations.    


======================================================================


Emacs Commands List

C = Control
M = Meta = Alt|Esc

[Basics]
C-x C-f "find" file i.e. open/create a file in buffer
C-x C-s save the file
C-x C-w write the text to an alternate name
C-x C-v find alternate file
C-x i insert file at cursor position
C-x b create/switch buffers
C-x C-b show buffer list
C-x k kill buffer
C-z suspend emacs
C-X C-c close down emacs

[Basic movement]
C-f forward char
C-b backward char
C-p previous line
C-n next line
M-f forward one word
M-b backward one word
C-a beginning of line
C-e end of line
C-v one page up
M-v scroll down one page
M-< beginning of text
M-> end of text

[Editing]
M-n repeat the following command n times
C-u repeat the following command 4 times
C-u n repeat n times
C-d delete a char
M-d delete word
M-Del delete word backwards
C-k kill line

C-Space Set beginning mark (for region marking for example)
C-W "kill" (delete) the marked region region
M-W copy the marked region
C-y "yank" (paste) the copied/killed region/line
M-y yank earlier text (cycle through kill buffer)
C-x C-x exchange cursor and mark

C-t transpose two chars
M-t transpose two words
C-x C-t transpose lines
M-u make letters uppercase in word from cursor position to end
M-c simply make first letter in word uppercase
M-l opposite to M-u

[Important]
C-g quit the running/entered command
C-x u undo previous action
M-x revert-buffer RETURN (insert like this) undo all changes since last save
M-x recover-file RETURN Recover text from an autosave-file
M-x recover-session RETURN if you edited several files

[Online-Help]
C-h c which command does this keystroke invoke
C-h k which command does this keystroke invoke and what does it do?
C-h l what were my last 100 typed keys
C-h w what key-combo does this command have?
C-h f what does this function do
C-h v what's this variable and what is it's value
C-h b show all keycommands for this buffer
C-h t start the emacs tutorial
C-h i start the info reader
C-h C-k start up info reader and go to a certain key-combo point
C-h F show the emacs FAQ
C-h p show infos about the Elisp package on this machine

[Search/Replace]
C-s Search forward
C-r search backward
C-g return to where search started (if you are still in search mode)
M-% query replace

    Space or y replace this occurence
    Del or n don't replace
    . only replace this and exit (replace)
    , replace and pause (resume with Space or y)
    ! replace all following occurences
    ^ back to previous match
    RETURN or q quit replace


Search/Replace with regular expressions
Characters to use in regular expressions:
^ beginning of line
$ end of line
. single char
.* group or null of chars
\< beginning of a word
\> end of a word
[] every char inside the backets (for example [a-z] means every small letter)

M C-s RETURN search for regular expression forward
M C-r RETURN search for regular expression backward
M C-s incremental search
C-s repeat incremental search
M C-r incremental search backwards
C-r repeat backwards
M-x query-replace-regexp search and replace

[Window-Commands]
C-x 2 split window vertically
C-x o change to other window
C-x 0 delete window
C-x 1 close all windows except the one the cursors in
C-x ^ enlarge window
M-x shrink-window command says it ;-)
M C-v scroll other window
C-x 4 f find file in other window
C-x 4 o change to other window
C-x 4 0 kill buffer and window
C-x 5 2 make new frame
C-x 5 f find file in other frame
C-x 5 o change to other frame
C-x 5 0 close this frame

[Bookmark commands]
C-x r m set a bookmark at current cursor pos
C-x r b jump to bookmark
M-x bookmark-rename says it
M-x bookmark-delete "
M-x bookmark-save "
C-x r l list bookmarks

    d mark bookmark for deletion
    r rename bookmark
    s save all listed bookmarks
    f show bookmark the cursor is over
    m mark bookmarks to be shown in multiple window
    v show marked bookmarks (or the one the cursor is over)
    t toggle listing of the corresponding paths
    w " path to this file
    x delete marked bookmarks
    Del ?
    q quit bookmark list


M-x bookmark-write write all bookmarks in given file
M-x bookmark-load load bookmark from given file

[Shell]
M-x shell starts shell modus
C-c C-c same as C-c under unix (stop running job)
C-d delete char forward
C-c C-d Send EOF
C-c C-z suspend job (C-z under unix)
M-p show previous commands

[DIRectory EDitor (dired)]
C-x d start up dired
C (large C) copy
d mark for erase
D delete right away
e or f open file or directory
g reread directory structure from file
G change group permissions (chgrp)
k delete line from listing on screen (don't actually delete)
m mark with *
n move to next line
o open file in other window and go there
C-o open file in other window but don't change there
P print file
q quit dired
Q do query-replace in marked files
R rename file
u remove mark
v view file content
x delete files marked with D
z compress file
M-Del remove all marks (whatever kind)
~ mark backup files (name~ files) for deletion
# mark auto-save files (#name#) for deletion
*/ mark directory with * (C-u * removes that mark again)
= compare this file with marked file
M-= compare this file with it's backup file
! apply shell command to this file
M-} change to the next file marked with * od D
M-{ " previous "
% d mark files described through regular expression for deletion
% m " (with *)
+ create directory
> changed to next dir
< change to previous dir
s toggle between sorting by name or date

Maybe into this category also fits this command:
M-x speedbar starts up a separate window with a directory view

[Telnet]
M-x telnet starts up telnet-modus
C-d either delete char or send EOF
C-c C-c stop running job (similar to C-c under unix)
C-c C-d send EOF
C-c C-o clear output of last command
C-c C-z suspend execution of command
C-c C-u kill line backwards
M-p recall previous command

[Text]
Works only in text mode
M-s center line
M-S center paragraph
M-x center-region name says

[Macro-commands]
C-x ( start macro definition
C-x ) end of macro definition
C-x e execute last definied macro
M-n C-x e execute last defined macro n times
M-x name-last-kbd-macro give name to macro (for saving)
M-x insert-keyboard-macro save named macro into file
M-x load-file load macro
M-x macroname execute macroname

[Programming]
M C-\ indent region between cursor and mark
M-m move to first (non-space) char in this line
M-^ attach this line to previous
M-; formatize and indent comment

[C, C++ and Java Modes]
M-a beginning of statement
M-e end of statement
M C-a beginning of function
M C-e end of function
C-c RETURN Set cursor to beginning of function and mark at the end
C-c C-q indent the whole function according to indention style
C-c C-a toggle modus in which after electric signs (like {}:';./*) emacs does the indention
C-c C-d toggle auto hungry mode in which emacs deletes groups of spaces with one del-press
C-c C-u go to beginning of this preprocessor statement
C-c C-c comment out marked area

More general (I guess)
M-x outline-minor-mode collapses function definitions in a file to a mere {...}
M-x show-subtree If you are in one of the collapsed functions, this un-collapses it

In order to achive some of the feats coming up now you have to run etags *.c *.h *.cpp (or what ever ending you source files have) in the source directory
M-. (Thats Meta dot) If you are in a function call, this will take you to it's definition
M-x tags-search ENTER Searches through all you etaged
M-, (Meta comma) jumps to the next occurence for tags-search
M-x tags-query-replace yum. This lets you replace some text in all the tagged files

[GDB (Debugger)]
M-x gdb starts up gdm in an extra window

[Version Control]
C-x v d show all registered files in this dir
C-x v = show diff between versions
C-x v u remove all changes since last checkin
C-x v ~ show certain version in different window
C-x v l print log
C-x v i mark file for version control add
C-x v h insert version control header into file
C-x v r check out named snapshot
C-x v s create named snapshot
C-x v a create changelog file in gnu-style


In this case order is very important. Because Semantic uses Global, GNU Global should be loaded before loading Semantic.
The problems is, Semantic doesn't shows any warning or error even if order is wrong.
So, your .emacs should be like follows,

    ...
    [loading Global]
    ...
    [loading Semantic and setting for using Global]
    ...

+ Recent posts