conf-auto-indent.el 785 B

12345678910111213141516171819202122
  1. ;; Move to the beginning of the text
  2. (defun smart-beginning-of-line ()
  3. "Move point to first non-whitespace character or beginning-of-line.
  4. Move point to the first non-whitespace character on this line.
  5. If point was already at that position, move point to beginning of line."
  6. (interactive) ; Use (interactive "^") in Emacs 23 to make shift-select work
  7. (let ((oldpos (point)))
  8. (back-to-indentation)
  9. (and (= oldpos (point))
  10. (beginning-of-line))))
  11. (global-set-key [home] 'smart-beginning-of-line)
  12. (global-set-key (kbd "C-a") 'smart-beginning-of-line)
  13. ;; Return and indent on prog-mode variants
  14. (defun my/set-newline-and-indent ()
  15. (local-set-key [(return)] 'newline-and-indent))
  16. (add-hook 'prog-mode-hook 'my/set-newline-and-indent)
  17. (provide 'conf-auto-indent)