help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem: can't indent correct!


From: DongJazz
Subject: Problem: can't indent correct!
Date: Thu, 22 Nov 2012 02:33:17 +0000

Hello!

when i use GNU Emacs to edit with php file, the indent style like the screentshot emacs1.png.

I want to the source formated as the sceenshot emacs2.png or emacs3.png.

Can u help me?

Thanks!

attach: The content of .emacs:


(require 'erc)


;;设置tab宽度为4 
(setq-default indent-tabs-mode  nil) 
(setq tab-width 4 c-basic-offset 4) 
;;关闭启动画面
(setq inhibit-startup-message t)


;;php-mode安装
;;(add-to-list 'load-path "~/elisp")
(require 'php-mode)
 
;;autocoplete安装
(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete-config)

(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)(require 'auto-complete)
(require 'auto-complete-config)
(global-auto-complete-mode t)
(setq ac-auto-start 2)
(setq ac-auto-show-menu nil)
(setq ac-dwim nil) ; To get pop-ups with docs even if a word is uniquely completed
;; (setq ac-ignores '("." "=" "@" "[" "]" "(" ")"))

(define-key ac-completing-map (kbd "C-n") 'ac-next)
(define-key ac-completing-map (kbd "C-p") 'ac-previous)

;;----------------------------------------------------------------------------
;; Use Emacs' built-in TAB completion hooks to trigger AC (Emacs >= 23.2)
;;----------------------------------------------------------------------------
(setq tab-always-indent 'complete) ;; use 'complete when auto-complete is disabled
(add-to-list 'completion-styles 'initials t)

;; hook AC into completion-at-point
(defun set-auto-complete-as-completion-at-point-function ()
  (setq completion-at-point-functions '(auto-complete)))
(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)


(set-default 'ac-sources
             '(ac-source-dictionary
               ac-source-words-in-buffer
               ac-source-words-in-same-mode-buffers
               ac-source-words-in-all-buffer))

(dolist (mode '(magit-log-edit-mode log-edit-mode org-mode text-mode haml-mode
                sass-mode yaml-mode csv-mode espresso-mode haskell-mode
                html-mode nxml-mode sh-mode smarty-mode clojure-mode
                lisp-mode textile-mode markdown-mode tuareg-mode
                js3-mode css-mode less-css-mode))
  (add-to-list 'ac-modes mode))


;; Exclude very large buffers from dabbrev
(defun sanityinc/dabbrev-friend-buffer (other-buffer)
  (< (buffer-size other-buffer) (* 1 1024 1024)))

(setq dabbrev-friend-buffer-function 'sanityinc/dabbrev-friend-buffer)
;;autocomplete安装



Attachment: emacs1.png
Description: PNG image

Attachment: emacs2.png
Description: PNG image

Attachment: emacs3.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]