`

Emacs for PHP setting

阅读更多
Emacs PHP setting
;;打开php模式
(require 'php-mode)
(add-hook 'php-mode-user-hook 'turn-on-font-lock)
;;(setq default-directory "F:/i9fox/I9fox/")

;;根据文件扩展名自动php-mode
(add-to-list 'auto-mode-alist '("\\.php[34]?\\'\\|\\.phtml\\'" . php-mode))
;;开发项目时,php源文件使用其他扩展名
(add-to-list 'auto-mode-alist '("\\.module\\'" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc\\'" . php-mode))
(setq php-completion-file "~/.emacs.d/php/php-completion-file")
(global-set-key (kbd "M-/") 'php-complete-function)

;;php运行函数
(define-key php-mode-map 
[menu-bar php php-run] 
'("Run the PHP Program" . php-run)) 
(defun php-run () 
(interactive) 
(shell-command 
(concat "php -f \"" 
(read-file-name "Input file name: ")
"\""))
)
;;php 运行快捷键
(define-key php-mode-map 
"\C-c\C-r" 
'php-run)

;;Personal information
(setq user-full-name "Jiang Hao")
(setq user-mail-address "jianghao****@gmail.com")



php-completion-file的函数列表和用如下php代码生成
<?php

$extensions = get_loaded_extensions();
foreach($extensions as $each_ext){
  
  $ext_funcs = get_extension_funcs($each_ext);
  
  foreach($ext_funcs as $func){
file_put_contents('./fun',"$func\n",FILE_APPEND);
  }
  
}
?>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics