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

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

Re: Getting an error when working with php files in nXhtml mode


From: Vineet Naik
Subject: Re: Getting an error when working with php files in nXhtml mode
Date: Mon, 18 Jul 2011 11:50:17 +0530

Hi Andreas,

Thank you for replying. Following is my .emacs file. I don't quite know emacs lisp so it mostly contains stuff copy pasted from forums and blogs

;; for php, xhtml, js mixed docs etc.
(load "~/emacs/nxhtml/autostart.el")

;; Sets the basic indentation for C/php source files
;; to four spaces.
(setq c-basic-offset 4)

;; I hate tabs!
(setq-default indent-tabs-mode nil)

;; I hate line-wrapping!
(setq-default truncate-lines t)

;; show line numbers on left
(global-linum-mode t)

;; This .emacs file illustrates the minimul setup
;; required to run the JDE.

;; Set the debug option to enable a backtrace when a
;; problem occurs.
(setq debug-on-error t)

;; Update the Emacs load-path to include the path to
;; the JDE and its require packages. This code assumes
;; that you have installed the packages in the emacs/site
;; subdirectory of your home directory.
(add-to-list 'load-path (expand-file-name "~/emacs/site/jde/lisp"))
(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet-1.0/common"))
(add-to-list 'load-path (expand-file-name "~/usr/share/emacs/site-lisp/elib"))

;; Initialize CEDET.
(load-file (expand-file-name "~/emacs/site/cedet-1.0/common/cedet.el"))


;; If you want Emacs to defer loading the JDE until you open a 
;; Java file, edit the following line
(setq defer-loading-jde nil)
;; to read:
;;
;;  (setq defer-loading-jde t)
;;

(if defer-loading-jde
    (progn
      (autoload 'jde-mode "jde" "JDE mode." t)
      (setq auto-mode-alist
   (append
    '(("\\.java\\'" . jde-mode))
    auto-mode-alist)))
  (require 'jde))


;; Sets the basic indentation for Java source files
;; to four spaces.
(defun my-jde-mode-hook ()
  (setq c-basic-offset 4))

(add-hook 'jde-mode-hook 'my-jde-mode-hook)
(custom-set-variables
  ;; custom-set-variables 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.
 '(espresso-indent-level 2)
 '(jde-compiler (quote (("eclipse java compiler server" "/home/vineet/eclipse/plugins/org.eclipse.jdt.core_3.5.2.v_981_R35x.jar"))))
 '(jde-jdk (quote ("1.6.0_20")))
 '(jde-jdk-registry (quote (("1.6.0_20" . "/usr/lib/jvm/java-6-openjdk"))))
 '(jde-run-working-directory "/home/vineet/java/trial/src/")
 '(nxml-bind-meta-tab-to-complete-flag t)
 '(nxml-child-indent 4)
 '(nxml-outline-child-indent 2))
(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.
 '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "bitstream" :family "Courier 10 Pitch"))))
 '(mumamo-background-chunk-major ((((class color) (min-colors 88) (background light)) nil)))
 '(mumamo-background-chunk-submode1 ((((class color) (min-colors 88) (background light)) nil))))

(add-to-list 'load-path (expand-file-name "~/emacs/site/common"))

;; espresso (_javascript_ mode)
(autoload #'espresso-mode "espresso" "Start espresso-mode" t)
(add-to-list 'auto-mode-alist '("\\.js$" . espresso-mode))
(add-to-list 'auto-mode-alist '("\\.json$" . espresso-mode))

;;;;;;;;;;;;;;;;;;;;;;;;;;; php-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; php, tpl etc
(add-to-list 'auto-mode-alist '("\\.tpl\\'" . php-mode))

;; for better array indentation in php
(add-hook 'php-mode-hook (lambda ()
    (defun ywb-php-lineup-arglist-intro (langelem)
      (save-excursion
        (goto-char (cdr langelem))
        (vector (+ (current-column) c-basic-offset))))
    (defun ywb-php-lineup-arglist-close (langelem)
      (save-excursion
        (goto-char (cdr langelem))
        (vector (current-column))))
    (c-set-offset 'arglist-intro 'ywb-php-lineup-arglist-intro)
    (c-set-offset 'arglist-close 'ywb-php-lineup-arglist-close)))

;;;;;;;;;;;;;;;;;;;;;;;;;;; flymake ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'flymake)

;; flymake for php
(defun flymake-php-init ()
  "Use php to check the syntax of the current file."
  (let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))
(local (file-relative-name temp (file-name-directory buffer-file-name))))
    (list "php" (list "-f" local "-l"))))

(add-to-list 'flymake-err-line-patterns
  '("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))

(add-to-list 'flymake-allowed-file-name-masks '("\\.php$" flymake-php-init))

;; flymake for java
(require 'jde-eclipse-compiler-server)

(add-to-list 'flymake-allowed-file-name-masks '("\\.java$" jde-ecj-server-flymake-init jde-ecj-flymake-cleanup)) 

(add-hook 'find-file-hook 'flymake-mode)

;;;;;;;;;;;;;;;;;;;;;;;;;;; themes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; color themes <http://www.nongnu.org/color-theme/>
(require 'color-theme)

;; solarized theme
(add-to-list 'load-path (expand-file-name "~/emacs/site/common/solarized-theme"))
(require 'color-theme-solarized)
(color-theme-solarized-dark)

;; zenburn theme
;;(require 'color-theme-zenburn)
;;(color-theme-zenburn)


;;;;;;;;;;;;;;;;;;;;;;;;; YasSnippet ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'yasnippet-bundle)

;;;;;;;;;;;;;;;;;;;;;;;;; Markdown mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(autoload 'markdown-mode "markdown-mode.el"
   "Major mode for editing Markdown files" t)
(setq auto-mode-alist
   (cons '("\\.md" . markdown-mode) auto-mode-alist))



On Sun, Jul 17, 2011 at 1:58 PM, Andreas Röhler <andreas.roehler@easy-emacs.de> wrote:
Am 08.07.2011 08:42, schrieb Vineet Naik:

Hi,

I am getting an error while working in .php files that also contain some
html.

I always get an error whenever typing the opening or closing brackets ( () )
inside php code

for eg. if I type

<td><?php echo $person->getName(); ?></td>

it shows me following error after typing ( and ) in getName()

Debugger entered--Lisp error: (wrong-type-argument listp set-from-style)
  c-electric-paren(nil)
  call-interactively(c-electric-paren nil nil)

Please help!

Thanks.

Hi,

not using these modes actively:

seems c-electric-paren installs a global key.
Maybe have a look into your init.

HTH,

Andreas




--
Vineet Naik



reply via email to

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