Wednesday, July 13, 2011

Emacs on Cygwin

Install Cygwin/X
1. Install Cygwin/X, X Windows on Windows , remember to select packages, like, emacs
2. Add below script to C:\cygwin\home\user\.bashrc
export DISPLAY=:0.0

2. Start XWin Server
3. Type command on shell to start Emacs
$ emacs


Install color-theme for emacs
1. Download , file: color-theme-6.6.0.zip
2. Extract color-theme-6.6.0.zip to C:\cygwin\home\user\.emacs.d
3. Create file, C:\cygwin\home\user\.emacs
4. Add below script to file, .emacs

(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0/")


Change Emacs theme
1. Open Emacs on Cygwin (Turn on X Server and type: emacs)
2. Type: 'M-x load-library'; then type: 'color-theme'
3. Type: 'M-x color-theme-select'


Set user's default theme
Put below scripts to file .emacs
 (require 'color-theme)  (color-theme-initialize)  (color-theme-robin-hood)
Last script 'robin-hood' is the name of theme


Check load-path
'C-h v load-path RET'

Reference

Monday, April 18, 2011

menuconfig

Add an entry to kernel config menu
** make sure library has been installed, "ncurses-devel"

/kernel source$ make clean
/kernel source$ make menuconfig

Friday, April 15, 2011

Change emacs theme

M-x load-library
color-theme
M-x color-theme-select

After you've selected a theme on the list then press ENTER

P.S. Place color-theme folder to ~/.emacs.d

Sunday, April 3, 2011

Tags with Emacs

For emacs you can't use the file, which is generated by ctags. You should use etags.

$ find -E . -iregex '.*\.(cpp|[ch])$' | etags -

Inside Emacs

M-x visit-tags-table <RET> FILE <RET>
M-. Find the first definition of TAG
M-* Pop back
C-u M-. Find the next definition



Reference:

Synopsis:

Saturday, March 5, 2011

Search string in multiple files

$ find -E ./ -iregex '.*\.(cpp|h)$' | xargs grep -Ei 'string'

Replace string in multiple files

$ find -E ./ -iregex '.*menu_.*\.(cpp|h)$' | xargs sed -E -i~ 's/ORG/NEW/g'

Multiple file name change

$ find -E ./ -iregex '.*menu_.*\.(cpp|h)$' > file.list
$ perl -w rename.pl file.list

-----------------------------------------
while($line = <>) {
if($line =~ m/.*(\bMenu_Setting.*)/i) {
# print "$1\n";
$old = $line;
$old =~ s/^\./\/home\/max\/src\/csu502 can\/acu-stm32-lcd/;
$old =~ s/\n//;
print "$old\n";
$newname = $old;
# replace file name
$newname =~ s/Menu_Setting_//;
print "$newname\n\n";
# use shell command: mv
system("mv", "$old", "$newname");
}
}