emacs window systems

在配置emacs的时候,一直想区别对待x-window和terminal两种环境。上周五配的nxhtml时,因为mumamo会给同一个buffer中的不同模式加上背景色,而我一般以终端方式使用emacs,所以当然希望背景全是黑的。


(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won’t work right.

‘(mumamo-background-chunk-major ((((class color) (min-colors 8)) (:background “black”))))
‘(mumamo-background-chunk-submode1 ((((class color) (min-colors 8)) (:background “black”))))
‘(mumamo-background-chunk-submode2 ((((class color) (min-colors 8)) (:background “black”))))
‘(mumamo-background-chunk-submode3 ((((class color) (min-colors 8)) (:background “black”))))
‘(mumamo-background-chunk-submode4 ((((class color) (min-colors 8)) (:background “black”)))))

这时候,情况出现了。使用GUI方式时同一buffer的不同模式的背景是黑色,但和GUI默认的代码高亮方案冲突了,所以代码基本没法看。而terminal下面又表现的近乎完美,所以才有想区别对待x-window和terminal两种情况。翻遍emacs lisp才找到原来有个系统变量window-system,那么接下来的事情就好办了,为x-window装一个配色解决方案:color-theme:


;; color theme
(if (eq window-system ‘x)
(progn
(setq default-font “DejaVu Sans Mono”)
(add-to-list ‘load-path “/share/.emacs.d/color-theme-6.6.0″)
(require ‘color-theme)
(eval-after-load “color-theme”
‘(progn
(color-theme-initialize)
(color-theme-hober)))))

下面是emacs lisp手册中的原文描述:


Window Systems
Emacs works with several window systems, most notably the X Window System. Both Emacs and X use the term “window”, but use it differently. An Emacs frame is a single window as far as X is concerned; the individual Emacs windows are not known to X at all.

topVariable: window-system
This variable tells Lisp programs what window system Emacs is running under. The possible values are

x
Emacs is displaying using X.
pc
Emacs is displaying using MSDOS.
w32
Emacs is displaying using Windows NT or Windows 95.
nil
Emacs is using a character-based terminal.

这下就完美了!!!

上班前两天-编译环境

上班第一天,鸟哥让我编译环境,说实话这个还真不会,以前虽然折腾过VPS或虚拟机,但从来不曾下足勇气去编译。。。一直都是yum或apt-get的选手。。。因为组中大家共用一个开发机,所以每个人分了个帐号,没有root权限。。。

A. 先编译apache吧

./configure –prefix=/home/guweigang/local/httpd …
配置选项在这里(中文):http://apache.jz123.cn/programs/configure.html#configurationoptions
(英文):http://httpd.apache.org/docs/2.2/zh-cn/programs/configure.html

在配置rewrite的时候,发现apache没有mod_rewrite,可能是当初编译apache的时候没有带上 –enable-rewrite选项。

重新编译mod_rewrite.so:
在apache的源码安装目录中寻找mod_rewrite.c文件
find / -name mod_rewrite.c
/home/springshine/LAMP/httpd-2.2.3/modules/mappers/mod_rewrite.c

编译:
cd /home/springshine/LAMP/httpd-2.2.3/modules/mappers/
/usr/local/apache2/bin/apxs -c mod_rewrite.c
/usr/local/apache2/bin/apxs -i -a -n mod_rewrite mod_rewrite.la
如果没出错,在/usr/local/apache2/modules/ 中就会有mod_rewrite.so了

B. MySQL

C. PHP
1.获取源码
2.解压
tar -jxvf php-5.x.x.tar.bz2
cd php-5.x.x
3.配置编译选项
./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/path/to/mysql –with-xml –with-dom –with-openssl –enable-ftp
其中–with-apxs2=/usr/local/apache2/bin/apxs 选项和作用是:在安装里会修改APACHE配置文件,加入PHP模块,同时交将模块复制到apache的模块目录下。
4.编译并安装
make && make insatll
5.测试
1).查看/usr/local/apache2/conf/httpd.conf中是否存在并且启用下面的行
LoadModule php5_moudle moudles/libphp5.so
2).在配置文件添加下面的行,使以php为扩展名的文件会使用PHP程序来解析
AddType application/x-httpd-php .php
注:在.php前必须有空格
3).在/usr/local/apache2/htdocs下,创建一个测试文件index.php,内容如下
phpinfo();
?>
4).检测并启动服务
/usr/local/apache2/bin/httpd -S
/usr/local/apache2/bin/httpd -k start
5).测试
在浏览器中输入http://10.1.1.199/index.php
如果成功返回php的相关信息,说明安装成功.

原来编译php的时候,没有把pdo_ mysql 相关的参数带上,安装完后才发现。再重新编译有点费时间,所以决定单独来安装。

$cd $HOME/php-5.x.x/ext/pdo_mysql
$ ~/local/php/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
$ ./configure –with-php-config=PATH –with-pdo-mysq=DIR
$ make && make install

D. SVN
最新的SVN源代码包依赖sqlite和neon。。。
分别到其官网下载源代码,解压并并分别重命名文件夹为:sqlite-amalgamation和neon
然后编译安装,即可。

E. 最后在配置emacs的时候,怎么样都无法显示中文,我靠,设置语言环境也不行,最后在网上找到一个简单的方法,在~/bashrc中加入以下环境变量:
LC_CTYPE=zh_CN.UTF-8

OK,全部搞定,你也可以在直接输入$ LC_CTYPE=zh_CN.UTF-8 emacs启动emacs。

个人用户的环境配置文件是~/.bashrc,全局的环境配置文件是在./etc/profile

Debug php in emacs with geben

While PHP-developing it sometimes is just too tedious to do those ‘add a echo here and there, then reload and search the echoed strings on the screen’-loops. So I searched for a debugger for my favourite editor emacs. After a lengthy install procedure I finally got it running: With geben on emacs you can debug PHP (step through and evaluate expressions)
Continue reading