From: Saifi Khan <saifixkhan@yahoo.com>
Subject: indentation issues when editing a PHP file
Date: Fri, 26 Mar 2004 09:34:51 -0800 (PST) [thread overview]
Message-ID: <20040326173451.6525.qmail@web13004.mail.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]
Hi:
When editing a PHP file, the '{' curly brace
positions itself as indicated below.
class Log
{
function log( $msg )
...{
...}
}
the dots (.) are for indicating the spaces.
The following indentation style is what I would like to see.
class Log
{
function log( $msg )
{
}
}
I have spent sometime looking at the .emacs file, indentation options
and other mails on the mailing list.
I have been able to setup CCmode for C, C++ and Java,
however this just beats me.
What options should I place in my php-hook-function ?
I will appreciate suggestions to solve this problem.
thanks
Saifi.
Ps. please see the attached .emacs file
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
[-- Attachment #2: emacs-to-list --]
[-- Type: application/octet-stream, Size: 7760 bytes --]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; .emacs file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GLOBAL BEGIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
(setq-default teach-extended-commands-p t)
;; editable screen 72 character wide
(setq-default fill-column 72)
; display line and column number in mode line
(setq-default line-number-mode t)
(setq-default column-number-mode t)
; all indentation should be made from spaces only
(setq-default indent-tabs-mode nil)
; tab stops list
(setq-default tab-stop-list
'(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80))
; tab width should be 4
(setq-default tab-width 4)
;; always end a file with a newline
(setq require-final-newline t)
;; stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)
; automatically insert newline
;(setq-default c-auto-newline t)
;(setq-default c-basic-offset 4)
;; cc-mode style variables are local
(setq-default c-style-variables-are-local-p t)
;; turn on font-lock mode
;;(global-font-lock-mode t)
;;(global-font-lock-mode nil)
;; enable visual feedback on selections
;;(setq-default transient-mark-mode t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GLOBAL END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; backup
(setq make-backup-files t)
(setq backup-by-copying-when-linked t)
;; automatic display of matching parens
(setq blink-matching-paren t)
;;
;; display date and time information
;;
(set-variable (quote display-time-day-and-date) t)
(set-variable (quote display-time-interval) 30)
(set-variable (quote display-time-24hr-format) t)
(display-time )
;;;;;;;;;;;;;;;;;;;;;;;;;; PROGRAMMING STYLES ;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HTML, XML style
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'html-mode-hook
(lambda()
(setq indent-line-function 'indent-relative)
))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; java style mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst reco-java-mode-style
'(
(c-backslash-column . 72)
(c-echo-syntactic-information-p . t)
(c-toggle-auto-hungry-state 1)
(c-electric-pound-behavior . (align-left))
(c-offsets-alist . (
(inher-cont . c-lineup-java-inher)
(inline-open . 0)
(inline-close . c-lineup-close-paren)
(func-decl-cont . c-lineup-java-throws)
(arglist-cont-nonempty . c-lineup-arglist)
(arglist-close . c-lineup-close-paren)
(substatement-open . 0)
(inexpr-class . c-lineup-inexpr-block)
(inexpr-statement . c-lineup-inexpr-block)
))
)
"java style"
)
; define the hook
(defun reco-java-mode-hook()
(c-add-style "java style" reco-java-mode-style t))
; add the hook
(add-hook 'java-mode-hook 'reco-java-mode-hook)
; compile support
(require 'compile)
(add-hook 'java-mode-hook
(lambda()
(set (make-local-variable 'compile-command)
(let ((file (file-name-nondirectory buffer-file-name)))
(concat "javac -d . " file)
))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; C, C++ coding style
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; indentation structure
;;
;; 1: opening and closing braces '{' and '}'
;; 2: opening and closing parens of a function should be
;; in the same column
;; 2: auto single space between '(' and next char, last char and ')'
;; 3: auto single space after typed comma ','
;;
;; reco-c-cpp-mode-common-style
(defconst reco-c-cpp-mode-common-style
'(
(c-basic-offset . 4)
(tab-width . 4)
(c-tab-always-indent . t)
(indent-tabs-mode . nil)
(c-echo-syntactic-information-p . t)
(c-toggle-auto-hungry-state 1)
(c-comment-prefix-regexp *)
(c-hanging-braces-alist . ((substatement-open (after))
(brace-list-open)
))
(c-hanging-colons-alist . ((member-init-intro (before))
(inher-intro)
(case-label (after))
(label (after))
(access-label (after))
))
(c-cleanup-list . ((scope-operator)
(empty-defun-braces)
(defun-close-semi)
(list-close-comma)
))
(c-offsets-alist . (
(c . c-lineup-C-comments)
(func-decl-cont . c-lineup-java-throws)
;(member-init-intro)
(member-init-cont . c-lineup-multi-inher)
;(inher-intro)
(inher-cont . c-lineup-multi-inher)
(case-label . 0)
;(access-label . 0)
;(label . ----)
(do-while-closure . 0)
;(brace-list-open)
;(brace-list-close . c-lineup-arglist-close-under-paren )
;(brace-list-intro . c-lineup-arglist-intro-after-paren)
;(brace-list-entry)
;(brace-entry-open)
;(arglist-intro . c-lineup-arglist-intro-after-paren)
(arglist-intro . +)
;(arglist-cont)
(arglist-cont-nonempty . c-lineup-arglist)
(arglist-close . c-lineup-close-paren)
(stream-op . c-lineup-streamop)
;(inclass)
;(friend)
;(namespace-open)
(namespace-close . 0)
;(extern-lang-open)
(extern-lang-close . 0)
(statement-cont . c-lineup-math)
(substatement-open . 0)
))
)
"C/C++ programming style"
)
;; reco-c-cpp-mode-common-hook
(defun reco-c-cpp-mode-common-hook()
(c-add-style "reco c cpp style" reco-c-cpp-mode-common-style t)
(setq tab-width 4)
)
;; add the hook
(add-hook 'c-mode-common-hook 'reco-c-cpp-mode-common-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; PHP mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun reco-php-mode-hook ()
(setq tab-width 4)
(define-key c-mode-base-map [RET] 'newline-and-indent)
(c-offsets-alist . (
(statement-cont . c-lineup-math)
))
)
(add-hook 'php-mode-hook 'reco-php-mode-hook)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; run clisp from within emacs
;;
(setq inferior-lisp-program "/usr/local/bin/clisp")
;;
;; browser program (links)
;;
(setq browse-url-browser-function 'browse-url-w3)
;;(setq browse-url-generic-program "/usr/bin/links")
;;(setq browse-url-generic-program "/usr/bin/w3m")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Function Key Mappings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[-- Attachment #3: Type: text/plain, Size: 151 bytes --]
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
next reply other threads:[~2004-03-26 17:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-26 17:34 Saifi Khan [this message]
2004-03-26 20:03 ` indentation issues when editing a PHP file Marcelo Toledo
2004-03-27 6:29 ` Emory Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040326173451.6525.qmail@web13004.mail.yahoo.com \
--to=saifixkhan@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.