emacs-devel
[Top][All Lists]
Advanced

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

Re: TAB when the region is active


From: Dan Nicolaescu
Subject: Re: TAB when the region is active
Date: Mon, 17 Sep 2007 16:28:12 -0700

"Lennart Borgman (gmail)" <address@hidden> writes:

  > Richard Stallman wrote:
  > >       > The idea is logical, but we need to ask users if they find the 
change
  > >       > annoying.
  > >
  > >     Given that we are not close to a release, this would be a good time to
  > >     experiment.  Can you please OK such a change?
  > >
  > > I will ok trying it, if you agree to follow up in a few weeks
  > > by reminding people to try it and say if they don't like it.
  > 
  > 
  > The code below is what I currently use. There are some problems I know
  > about:

Thanks. I don't know much about the code in indent.el, and I don't see
how your code would fit in the existing framework there.  I would
guess that indent-for-tab-command and the functions that it calls
would need changes.

Any help with getting this right would be greatly appreciated.

  > - I do not remember what Drew wanted to add (in another message).
  > 
  > - indent-according-to-mode is not supported everywhere.
  > 
  > BTW, there is another problem with the indentation functions. I
  > believe it would be useful (at least in mumamo.el) if the function
  > that indents a line where split into one that gives the indentation
  > amount and one that does the indentation (for every major mode).
  > 
  > 
  > (defun indent-line-or-region ()
  >   "Indent line or region.
  > Only do this if indentation seems bound to \\t.
  > 
  > Call `indent-region' if region is active, otherwise
  > `indent-according-to-mode'."
  >   (interactive)
  >   ;; Do a wild guess if we should indent or not ...
  >   (let* ((indent-region-mode)
  >          (t-bound (key-binding [?\t])))
  >     (if (not
  >          (save-match-data
  >            (string-match "indent" (symbol-name t-bound))))
  >         (call-interactively t-bound t)
  >       (if (and mark-active ;; there is a visible region selected
  >                transient-mark-mode)
  >           (indent-region (region-beginning) (region-end))
  >         (indent-according-to-mode))))) ;; indent line




reply via email to

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