[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C-u prefix behavior of TAB broken
From: |
Miles Bader |
Subject: |
Re: C-u prefix behavior of TAB broken |
Date: |
Sun, 23 Dec 2007 07:59:08 +0900 |
martin rudalics <address@hidden> writes:
>> + (let ((indentation-change (- (current-indentation) old-indent)))
>
> `lisp-indent-line' quits here when `indentation-change' equals zero.
Good point (fixed below).
-Miles
--- orig/lisp/indent.el
+++ mod/lisp/indent.el
@@ -86,10 +86,10 @@
indent the region.
The function actually called to indent the line is determined by the value of
`indent-line-function'."
- (interactive "p")
+ (interactive "P")
(cond
;; The region is active, indent it.
- ((and arg transient-mark-mode mark-active
+ ((and transient-mark-mode mark-active
(not (eq (region-beginning) (region-end))))
(indent-region (region-beginning) (region-end)))
((or ;; indent-to-left-margin is only meant for indenting,
@@ -99,13 +99,27 @@
(or (> (current-column) (current-indentation))
(eq this-command last-command))))
(insert-tab arg))
- ;; Those functions are meant specifically for tabbing and not for
- ;; indenting, so we can't pass them to indent-according-to-mode.
- ((memq indent-line-function '(indent-relative indent-relative-maybe))
- (funcall indent-line-function))
- ;; Indent the line.
(t
- (indent-according-to-mode))))
+ (let ((end-marker
+ (and arg
+ (save-excursion
+ (forward-line 0) (forward-sexp) (point-marker))))
+ (old-indent
+ (current-indentation)))
+
+ ;; Indent the line.
+ (funcall indent-line-function)
+
+ ;; If a prefix argument was given, rigidly indent the following
+ ;; sexp to match the change in the current line's indentation.
+ ;;
+ (when arg
+ (let ((indentation-change (- (current-indentation) old-indent)))
+ (unless (zerop indentation-change)
+ (save-excursion
+ (forward-line 1)
+ (when (< (point) end-marker)
+ (indent-rigidly (point) end-marker indentation-change))))))))))
(defun insert-tab (&optional arg)
(let ((count (prefix-numeric-value arg)))
--
The car has become... an article of dress without which we feel uncertain,
unclad, and incomplete. [Marshall McLuhan, Understanding Media, 1964]
- Re: C-u prefix behavior of TAB broken, (continued)
- Re: C-u prefix behavior of TAB broken, Miles Bader, 2007/12/17
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/17
- Re: C-u prefix behavior of TAB broken, Stefan Monnier, 2007/12/20
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/21
- Re: C-u prefix behavior of TAB broken, Miles Bader, 2007/12/21
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Miles Bader, 2007/12/22
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Miles Bader, 2007/12/22
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/22
- Re: C-u prefix behavior of TAB broken,
Miles Bader <=
- Re: C-u prefix behavior of TAB broken, Stefan Monnier, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Miles Bader, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Stefan Monnier, 2007/12/23
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/22
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/22
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/23
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/23
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/24
- Re: C-u prefix behavior of TAB broken, martin rudalics, 2007/12/24
- Re: C-u prefix behavior of TAB broken, Richard Stallman, 2007/12/26