Wednesday, 15 August 2012

Emacs web-mode tabs not working -



Emacs web-mode tabs not working -

i using emacs web-mode edit php files , have noticed tab key doesn't work way expect in couple of different situations. illustration if have string spans multiple lines this...

<?php homecoming " <nav> <a href='index.php?page=skills'>my skills , background</a> <a href='index.php?page=projects'>some projects</a> </nav> "; ?>

and go origin of lines anchor tags , press tab nil happens. have utilize space bar indent lines way want.

the other situation occurs within of php block example

<?php error_reporting( e_all ); ini_set( "display_errors", 1); $pagedata = new stdclass(); $pagedata->title = "jordan: portfolio site"; $pagedata->content = include_once "views/navigation.php"; $navigationisclicked = isset($_get['page']); if($navigationisclicked) { $filetoload = $_get['page']; $pagedata->content .= "<p>will load $filetoload.php</p>"; } $page = include_once "templates/page.php"; echo $page; ?>

if go 1 of variable assignment lines , force tab nil happens, 1 time again spaces work fine, within if block 1 tab allowed. there way alter how mode uses tabs in .emacs file. have in .emacs

(defun my-setup-php () ;; enable web mode (web-mode) ;; create these variables local (make-local-variable 'web-mode-code-indent-offset) (make-local-variable 'web-mode-markup-indent-offset) (make-local-variable 'web-mode-css-indent-offset) ;; set indentation, can set different indentation level different code type (setq web-mode-code-indent-offset 4) (setq web-mode-css-indent-offset 2) (setq web-mode-markup-indent-offset 2)) (add-to-list 'auto-mode-alist '("\\.php$" . my-setup-php))

as turns out question unrelated web-mode. function emacs binds tab key default called indent-for-tab-command function looking called tab-to-tab-stop default bound m - i. website has detailed explanation of how tab key works in emacs , how customize it.

emacs

No comments:

Post a Comment