help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: indent-according-to-mode


From: wenbinye
Subject: Re: indent-according-to-mode
Date: 31 Jul 2006 18:10:41 -0700
User-agent: G2/0.2

You can do like this:
C-x ( M-h C-M-\ C-x )
C-x C-k b my-indent-paragraph
M-x insert-kbd-macro

The code will insert to current buffer:
(fset 'my-indent-paragraph
   (lambda (&optional arg) "Keyboard macro." (interactive "p")
(kmacro-exec-ring-item (quote ("\350\234" 0 "%d")) arg)))

Then you can write this to .emacs:
(defun my-indent-paragraph (&optional arg)
  "Keyboard macro."
  (interactive "p")
  (kmacro-exec-ring-item (quote ("\350\234" 0 "%d")) arg)))
(global-set-key (kbd "<f5>") 'my-indent-region)

or just:
(global-set-key (kbd "<f5>")
   (lambda (&optional arg) "Keyboard macro." (interactive "p")
(kmacro-exec-ring-item (quote ("\350\234" 0 "%d")) arg)))

For documents, see info emacs: Keyboad macros
Gary Wessle wrote:
> Dieter Wilhelm <dieter@duenenhof-wilhelm.de> writes:
>
> > Gary Wessle <phddas@yahoo.com> writes:
> >
> > indent-according-to-mode is only for a line (check it out: C-h f when
> > the cursor is over the function name).
> >
> > > how can I get this function to work on a region?
> >
> > M-C-\ (C-h k M-C-\)
> >
> > > or the whole buffer?
> >
> > C-x h M-C-\
>
> this in my .emacs is causing a problem, could you point it out?
> 
> thanks
> 
> (global-set-key [f5] (kbd "M-h M-C-\"))



reply via email to

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