Function: vera-electric-tab

vera-electric-tab is an interactive and byte-compiled function defined in vera-mode.el.gz.

Signature

(vera-electric-tab &optional PREFIX)

Documentation

Do what I mean (indent, expand, tab, change indent, etc..).

If preceding character is part of a word or a paren then hippie-expand, else if right of non whitespace on line then tab-to-tab-stop, else if last command was a tab or return then dedent one step or if a comment toggle between normal indent and inline comment indent, else indent correctly. If vera-intelligent-tab is nil, always indent line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vera-mode.el.gz
(defun vera-electric-tab (&optional prefix)
  "Do what I mean (indent, expand, tab, change indent, etc..).
If preceding character is part of a word or a paren then `hippie-expand',
else if right of non whitespace on line then `tab-to-tab-stop',
else if last command was a tab or return then dedent one step or if a comment
toggle between normal indent and inline comment indent,
else indent `correctly'.
If `vera-intelligent-tab' is nil, always indent line."
  (interactive "*P")
  (if vera-intelligent-tab
      (progn
	(cond ((use-region-p)
	       (vera-indent-region (region-beginning) (region-end) nil))
	      ((memq (char-syntax (preceding-char)) '(?w ?_))
	       (let ((case-fold-search t)
		     (case-replace nil)
		     (hippie-expand-only-buffers
		      (or (and (boundp 'hippie-expand-only-buffers)
			       hippie-expand-only-buffers)
			  '(vera-mode))))
		 (vera-expand-abbrev prefix)))
	      ((> (current-column) (current-indentation))
	       (tab-to-tab-stop))
	      ((and (or (eq last-command 'vera-electric-tab)
			(eq last-command 'vera-electric-return))
		    (/= 0 (current-indentation)))
	       (backward-delete-char-untabify vera-basic-offset nil))
	      (t (indent-according-to-mode)))
	(setq this-command 'vera-electric-tab))
    (indent-according-to-mode)))