 
 ;; yascroll
 (global-yascroll-bar-mode 1)
+
+;; move to beginning of text on line
+(defun smart-beginning-of-line ()
+    "Move point to first non-whitespace character or beginning-of-line.
+
+Move point to the first non-whitespace character on this line. If point was
+already at that position, move point to beginning of line.
+
+If visual-line-mode is on, then also jump to beginning of real line."
+    (interactive) ; Use (interactive "^") in Emacs 23 to make shift-select work
+    (let ((oldpos (point))
+          (vispos (point)))
+
+      (beginning-of-visual-line)
+      (setq vispos (point))
+      (beginning-of-line-text)
+
+      (if (and (> vispos (point))
+               (not (= oldpos vispos)))
+          (goto-char vispos)
+        (when (= oldpos (point))
+          (beginning-of-line)))))
+(global-set-key "\C-a" 'smart-beginning-of-line)
+
+(defun smart-end-of-line ()
+  "Move point to end of visual line or, if already there, to end of logical line."
+  (interactive) ; Use (interactive "^") in Emacs 23 to make shift-select work
+  (let ((oldpos (point)))
+
+    (end-of-visual-line)
+    (when (= oldpos (point))
+      (end-of-line))))
+(global-set-key "\C-e" 'smart-end-of-line)
+
+

;;       (cons '("\\.m$" . octave-mode) auto-mode-alist))

(load-library "matlab-load")
(custom-set-variables
 '(matlab-shell-command-switches '("-nodesktop -nosplash")))
(add-hook 'matlab-mode
          (lambda ()
            (auto-complete-mode 1)


;; ;; python ;;
;; ;; ipython as shell
;; (setq
;;  python-shell-interpreter "ipython"
;;  python-shell-interpreter-args ""
;;  python-shell-prompt-regexp "In \\[[0-9]+\\]: "
;;  python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
;;  python-shell-completion-setup-code
;;  "from IPython.core.completerlib import module_completion"
;;  python-shell-completion-module-string-code
;;  "';'.join(module_completion('''%s'''))\n"
;;  python-shell-completion-string-code
;;  "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")

(elpy-enable)
(elpy-use-ipython)
(elpy-clean-modeline)

;; python-mode
;; (require 'python-mode)
(autoload 'python-mode "python-mode" "Python editing mode." t)
;; jedi completion
(add-hook 'python-mode-hook 'auto-complete-mode)
(add-hook 'python-mode-hook 'jedi:setup)
(add-hook 'python-mode-hook 'linum-mode)

;; Sometimes you have to
(require 'php-mode)

