aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/indent.el17
2 files changed, 18 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 72e2fb27d15..753abd71091 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,4 +1,7 @@
12000-10-06 Stefan Monnier <monnier@cs.yale.edu> 12000-10-07 Stefan Monnier <monnier@cs.yale.edu>
2
3 * indent.el (tab-always-indent): New var.
4 (indent-for-tab-command): Use it.
2 5
3 * files.el (set-auto-mode): Ignore unknown -*- mode -*- rather than 6 * files.el (set-auto-mode): Ignore unknown -*- mode -*- rather than
4 raise an error. This way it can still defaults to a sane value. 7 raise an error. This way it can still defaults to a sane value.
diff --git a/lisp/indent.el b/lisp/indent.el
index 1a7193893c4..648d928a1f3 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -40,19 +40,30 @@
40(defvar indent-line-function 'indent-to-left-margin 40(defvar indent-line-function 'indent-to-left-margin
41 "Function to indent current line.") 41 "Function to indent current line.")
42 42
43(defcustom tab-always-indent t
44 "*Controls the operation of the TAB key.
45If t, hitting TAB always just indents the current line.
46If nil, hitting TAB indents the current line if point is at the left margin
47 or in the line's indentation, otherwise it insert a `real' tab character."
48 :group 'indent
49 :type 'boolean)
50
43(defun indent-according-to-mode () 51(defun indent-according-to-mode ()
44 "Indent line in proper way for current major mode." 52 "Indent line in proper way for current major mode."
45 (interactive) 53 (interactive)
46 (funcall indent-line-function)) 54 (funcall indent-line-function))
47 55
48(defun indent-for-tab-command (&optional prefix-arg) 56(defun indent-for-tab-command (&optional prefix-arg)
49 "Indent line in proper way for current major mode. 57 "Indent line in proper way for current major mode or insert a tab.
58Depending on `tab-always-indent', either insert a tab or indent.
50If initial point was within line's indentation, position after 59If initial point was within line's indentation, position after
51the indentation. Else stay at same point in text. 60the indentation. Else stay at same point in text.
52The function actually called is determined by the value of 61The function actually called to indent is determined by the value of
53`indent-line-function'." 62`indent-line-function'."
54 (interactive "P") 63 (interactive "P")
55 (if (eq indent-line-function 'indent-to-left-margin) 64 (if (or (eq indent-line-function 'indent-to-left-margin)
65 (and (not tab-always-indent)
66 (> (current-column) (current-indentation))))
56 (insert-tab prefix-arg) 67 (insert-tab prefix-arg)
57 (if prefix-arg 68 (if prefix-arg
58 (funcall indent-line-function prefix-arg) 69 (funcall indent-line-function prefix-arg)