emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C-u prefix behavior of TAB broken


From: Stefan Monnier
Subject: Re: C-u prefix behavior of TAB broken
Date: Thu, 20 Dec 2007 19:20:28 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>> I'm not sure what you mean... maybe my explanation was poor, but the
>> above is what I'm referring to.

> I thought you had a less rigid version of that.

>> Anyway, that feature is now broken.

> FWIW in lisp-mode it's due to that change:

> 2007-09-19  Stefan Monnier  <address@hidden>

>         ...

>       * emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Use the default TAB
>       binding, so tab-always-indent works right.

It may be the superficial reason for it, but it shouldn't be the root
cause for it: indent-for-tab-command used to pass the C-u prefix to the
indent-line-function.

This said, IMNSHO the feature we're talking about shouldn't be implement
in lisp-mode and c-mode but directly generically in
indent-for-tab-command.

I use the following code in my local version of indent-for-tab-command
for that purpose:

  (cond
   [...]
   (arg
    (let ((old-indent (current-indentation)))
      (if (eq (indent-according-to-mode) 'noindent)
          (funcall (default-value 'indent-line-function)))
      (let ((new-indent (current-indentation))
            (beg (line-beginning-position 2))
            (end (save-excursion (beginning-of-line)
                                 (forward-sexp 1)
                                 (point))))
        (when (and (> end beg) (/= new-indent old-indent))
          (indent-code-rigidly beg end (- new-indent old-indent))))))
   [...])



        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]