smart-home.el 794 B

1234567891011121314151617181920212223
  1. ;; --- Home-key configuration file ---
  2. ;; Configure home to go to the start of the
  3. ;; code (ignores comment headers).
  4. ;; If pressed twice, goes to start of the line.
  5. ;; Requires:
  6. (defun smart-beginning-of-line ()
  7. "Move point to first non-whitespace character or beginning-of-line.
  8. Move point to the first non-whitespace character on this line.
  9. If point was already at that position, move point to beginning of line."
  10. (interactive "^")
  11. ;(if (version< "22" emacs-version) (interactive "^") (interactive))
  12. (let ((oldpos (point)))
  13. (beginning-of-line-text); goes to first significant character
  14. ;(back-to-indentation); goes to first non-whitespace
  15. (and (= oldpos (point))
  16. (beginning-of-line))))
  17. (global-set-key [home] 'smart-beginning-of-line)
  18. (provide 'smart-home)