diff options
| author | Stefan Monnier | 2000-10-07 04:13:09 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-10-07 04:13:09 +0000 |
| commit | 20b1d07968d9e99693ea14efb32cd65bbb176bfe (patch) | |
| tree | e1e38295fe32bc8623a7646443c0f0b8f48c69d2 | |
| parent | 9ee45b2cc114ab555e45d9f030747b9c7e5a7a89 (diff) | |
| download | emacs-20b1d07968d9e99693ea14efb32cd65bbb176bfe.tar.gz emacs-20b1d07968d9e99693ea14efb32cd65bbb176bfe.zip | |
(tab-always-indent): New var.
(indent-for-tab-command): Use it.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/indent.el | 17 |
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 @@ | |||
| 1 | 2000-10-06 Stefan Monnier <monnier@cs.yale.edu> | 1 | 2000-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. | ||
| 45 | If t, hitting TAB always just indents the current line. | ||
| 46 | If 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. |
| 58 | Depending on `tab-always-indent', either insert a tab or indent. | ||
| 50 | If initial point was within line's indentation, position after | 59 | If initial point was within line's indentation, position after |
| 51 | the indentation. Else stay at same point in text. | 60 | the indentation. Else stay at same point in text. |
| 52 | The function actually called is determined by the value of | 61 | The 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) |