Commit 07db5857 authored by Simon South's avatar Simon South
Browse files

(delphi-tab): Indent region when Transient Mark mode is enabled and

region is active; otherwise indent or insert TAB as usual.
(delphi-mode): Update description of TAB-key binding.
parent 66d77eda
...@@ -23,6 +23,13 @@ ...@@ -23,6 +23,13 @@
than using advertised-undo. than using advertised-undo.
* tutorial.el (tutorial--default-keys): Adjust accordingly. * tutorial.el (tutorial--default-keys): Adjust accordingly.
2009-09-10 Simon South <ssouth@slowcomputing.org>
* progmodes/delphi.el (delphi-tab): Indent region when Transient
Mark mode is enabled and region is active; otherwise indent or
insert TAB as usual.
(delphi-mode): Update description of TAB-key binding.
2009-09-10 Stefan Monnier <monnier@iro.umontreal.ca> 2009-09-10 Stefan Monnier <monnier@iro.umontreal.ca>
* subr.el (define-key-rebound-commands): Mark obsolete. * subr.el (define-key-rebound-commands): Mark obsolete.
......
...@@ -1652,14 +1652,23 @@ before the indent, the point is moved to the indent." ...@@ -1652,14 +1652,23 @@ before the indent, the point is moved to the indent."
(defun delphi-tab () (defun delphi-tab ()
"Indent the current line or insert a TAB, depending on the value of "Indent the region, when Transient Mark mode is enabled and the region is
`delphi-tab-always-indents' and the current line position." active. Otherwise, indent the current line or insert a TAB, depending on the
value of `delphi-tab-always-indents' and the current line position."
(interactive) (interactive)
(if (or delphi-tab-always-indents ; We are always indenting (cond ((use-region-p)
;; Or we are before the first non-space character on the line. ;; If Transient Mark mode is enabled and the region is active, indent
(save-excursion (skip-chars-backward delphi-space-chars) (bolp))) ;; the entire region.
(delphi-indent-line) (indent-region (region-beginning) (region-end)))
(insert "\t"))) ((or delphi-tab-always-indents
(save-excursion (skip-chars-backward delphi-space-chars) (bolp)))
;; Otherwise, if we are configured always to indent (regardless of the
;; point's position in the line) or we are before the first non-space
;; character on the line, indent the line.
(delphi-indent-line))
(t
;; Otherwise, insert a tab character.
(insert "\t"))))
(defun delphi-is-directory (path) (defun delphi-is-directory (path)
...@@ -1935,7 +1944,8 @@ This is ok since we do our own keyword/comment/string face coloring.") ...@@ -1935,7 +1944,8 @@ This is ok since we do our own keyword/comment/string face coloring.")
;;;###autoload ;;;###autoload
(defun delphi-mode (&optional skip-initial-parsing) (defun delphi-mode (&optional skip-initial-parsing)
"Major mode for editing Delphi code. \\<delphi-mode-map> "Major mode for editing Delphi code. \\<delphi-mode-map>
\\[delphi-tab]\t- Indents the current line for Delphi code. \\[delphi-tab]\t- Indents the current line (or region, if Transient Mark mode
\t is enabled and the region is active) of Delphi code.
\\[delphi-find-unit]\t- Search for a Delphi source file. \\[delphi-find-unit]\t- Search for a Delphi source file.
\\[delphi-fill-comment]\t- Fill the current comment. \\[delphi-fill-comment]\t- Fill the current comment.
\\[delphi-new-comment-line]\t- If in a // comment, do a new comment line. \\[delphi-new-comment-line]\t- If in a // comment, do a new comment line.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment