Re: ident the code
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

gnu.emacs.help Profile…
 Up
Re: ident the code         


Author: filebat Mark
Date: Aug 26, 2008 08:56

I have wrote the following elisp function. I think it works from my side.
Hopes it's useful for someone else.
Show full article (5.33Kb)
1 Comment
Re: ident the code         


Author: Andreas Politz
Date: Aug 26, 2008 09:10

filebat Mark wrote:
> I have wrote the following elisp function. I think it works from my side.
> Hopes it's useful for someone else.
>
>
> (global-set-key [M-f12] 'my_indent_code);;indent code
> (defun my_indent_code()
> (interactive)
> ;;remove blank lines
> (goto-char 0)
> (flush-lines "^$")
> (save-buffer)
> (setq current_filename (buffer-name (current-buffer)))
> ;;indent the code, add or remove some space
> (setq commandline "indent ")
> (setq commandline (concat commandline current_filename))
> (shell-command-to-string commandline)
> ;;convert the line endings of text files from DOS style to unix style
> (setq commandline "dos2unix ")
> (setq commandline (concat commandline current_filename)) ...
Show full article (3.22Kb)
no comments