Thursday, March 15, 2012

Compile lisp file

M-x emacs-lisp-byte-compile       create a .elc from a .el

Etags navigation

Only for declarations and definitions of symbols.

M-.       goes to the symbol definition
M-0 M-.   goes to the next matching definition
M-*       return to your starting point

For invocations (any symbol actually):

M-x tags-search        initiate a search
M-,       go to the next match

Etags: add symbols to TAGS

cd <my directory>
find . -name "*.[chCH]" -print | etags --output=/vob/signalware/Master/TAGS -a -

Etags a full tree

cd /vob/
find . -name "*.[chCH]" -print | etags --output=/vob/signalware/Master/TAGS  -

Or

cd /vob/signalware/Master
find tcap gsm2 -name "*.[chCH]" -print | etags --output=/vob/signalware/Master/TAGS  -

Visit a given TAGS table

M-x visit-tags-table

replace-regexp

In `replace-regexp’, the NEWSTRING need not be constant. It can refer to all or part of what is matched by the REGEXP. `\&’ in NEWSTRING stands for the entire text being replaced. `\D’ in NEWSTRING, where D is a digit, stands for whatever matched the D’th parenthesized grouping in REGEXP. For example,

M-x replace-regexp  c[ad]+r  \&-safe 

would replace (for example) `cadr’ with `cadr-safe’ and `cddr’ with `cddr-safe’.

M-x replace-regexp  \(c[ad]+r\)-safe  \1 

would perform exactly the opposite replacements. To include a `\’ in the text to replace with, you must give `\\’.

M-x -replace-regexp \([0-9]\)1, \1a,

would replace smth like SLK21, into SLK2a,

Set C indent style to 8 characters

;;; --- Add it to C mode Hook
(c-add-style "DAP" 
             '((c-basic-offset  . 8)
               (substatement-open . 0)
               (c-offsets-alist . (
                                   (namespace-open . 0)
                                   (namespace-close . 0)
                                   (innamespace . 0)
                                   ;;; -- brace that opens a substatement block
                                   (substatement-open . 0)
                                   ;;; -- brace that opens an in-class inline me
thod
                                   (inline-open . 0)
                   (case-label . +)
                   (access-label . -2)
                   (class-open . 0)
                                   )
                                )
               ))
(defun dap-hook ()
  (c-set-style "DAP"))
(add-hook 'c-mode-hook 'dap-hook)

ifdef mode

M-x hide-ifdef-mode             Load mode
M-x hide-ifdefs (C-c @ h)       Explicitly hide ifdefs
M-x show-ifdefs (C-c @ s)       Undo hide-ifdefs
M-x hide-ifdef-define (C-c @ d) To define a symbol.
M-x hide-ifdef-undef (C-c @ u)  To undefine a symbol.

Syntactic analysis (c-offsets-alist)

We can use the command

C-c C-s (bound to c-show-syntactic-information)

to simply report what the syntactic analysis is for the current line.

E.g.:

void swap( int& a, int& b )
{
    int tmp = a;
    a = b;
    b = tmp;
}

Running this command on line 4 of this example, we’d see in the echo area:

((statement 35))

Install XEmacs

http://www.xemacs.org/Install/index.html

Recuperer p. ex. xemacs-21.4.22.tar.gz et xemacs-sumo.tar.gz

Creer un repertoire d’install temporaire dont on deplacera le contenu ensuite.

optimal> mkdir ~/install

Installer tout le bordel.

optimal> gzip -dc xemacs-21.4.22.tar.gz | tar xvf -
optimal> cd xemacs-21.4.22
optimal> usegcc346
optimal> ./configure --prefix=/u/gallinar/install
optimal> make
optimal> make install

Ensuite installer les xemacs-packages:

optimal> cd ~/install/lib/xemacs
optimal> gzip -dc ~/xemacs-sumo.tar.gz | tar xvf -

Deplacer ensuite tout le contenu de ~/install vers /u/engineering/...

Copy Paste shit in Virtualbox

VirtualBox host =Windows 7
VirtualBox Guest = Fedora 14 with OpenBox and Eterm
Basically, no selection you make in Eterm can be copied with Ctrl-Ins the expected way into Windows.
Copy Paste Hell Between Windows Host and Linux Guest in VirtualBox gave me part of the solution:
Install xsel with:
> sudo yum -y install xsel
And use the following command to capture selection in Eterm:
> xsel | xsel -b
The problem is now to bind it to a key, let's say Ctrl-Ins ;), in OpenBox.
In ~/.config/openbox/rc.xml, add the following:
    <keybind key="C-Insert">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>xsel</name>
        </startupnotify>
        <command>sh -c '/usr/bin/xsel | /usr/bin/xsel -b'</command>
      </action>
    </keybind>
Do not forget the sh -c or it won't work.