Skip to content

Commit

Permalink
Matlab and BUGS oh my
Browse files Browse the repository at this point in the history
  • Loading branch information
llasram committed Feb 3, 2016
1 parent b23c3dd commit 8afed15
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 4 deletions.
6 changes: 6 additions & 0 deletions basic/emacs.d/.mc-lists.el
Expand Up @@ -7,9 +7,15 @@
autopair-skip-close-maybe
beginning-of-buffer
downcase-region
ess-smart-comma
generic-hungry-backspace
generic-hungry-delete
kill-region
org-beginning-of-line
org-end-of-line
org-force-self-insert
org-self-insert-command
org-yank
))

(setq mc/cmds-to-run-once
Expand Down
7 changes: 6 additions & 1 deletion basic/emacs.d/custom.el
Expand Up @@ -65,6 +65,9 @@
'(magit-diff-options (quote ("--patience")))
'(magit-push-always-verify nil)
'(mail-user-agent (quote gnus-user-agent))
'(matlab-functions-have-end t)
'(matlab-shell-command "/opt/mathworks/matlab/bin/matlab")
'(matlab-shell-command-switches (quote ("-nodesktop" "-nosplash")))
'(max-specpdl-size 2600)
'(menu-bar-mode nil)
'(message-send-mail-function (quote message-smtpmail-send-it))
Expand Down Expand Up @@ -154,7 +157,9 @@
'(ruby-electric-expand-delimiters-list (quote (124)))
'(safe-local-variable-values
(quote
((whitespace-mode)
((whitespace-style face tabs spaces trailing lines space-before-tab::space newline indentation::space empty space-after-tab::space space-mark tab-mark newline-mark)
(ess-bugs-chains . 1)
(whitespace-mode)
(whitespace-line-column . 99)
(eval put-clojure-indent
(quote c-for)
Expand Down
46 changes: 44 additions & 2 deletions basic/emacs.d/init.el
Expand Up @@ -119,7 +119,6 @@
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.R$" . ess-mode))
(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode))
(add-to-list 'auto-mode-alist '("\\.edn$" . clojure-mode))

;;
Expand Down Expand Up @@ -308,6 +307,8 @@ ARGS are as per the arguments to the advised functions."
'(progn
(require 'ess-inf)
(require 'ess-mode)
(require 'ess-bugs-d)
(require 'ess-jags-d)
(require 'llasram-ess)))
(eval-after-load 'llasram-ess
'(progn
Expand All @@ -317,9 +318,11 @@ ARGS are as per the arguments to the advised functions."
(define-key ess-mode-map (kbd "C-c C-d") 'ess-help)
(define-key ess-mode-map (kbd "C-c C-k") 'ess-load-file)
(define-key ess-mode-map (kbd "M-TAB") 'ess-complete-object-name)
(define-key ess-mode-map (kbd "_") 'self-insert-command)))
(define-key ess-mode-map (kbd "_") 'self-insert-command)
(define-key ess-bugs-mode-map (kbd "_") 'self-insert-command)))
(add-hook 'ess-mode-hook 'my/coding-on)
(advice-add 'ess-load-file :around #'my/preserve-selected-window)
(require 'ess-site) ;; hacky, but easy

(eval-after-load 'org
'(progn
Expand All @@ -329,6 +332,37 @@ ARGS are as per the arguments to the advised functions."
(global-set-key (kbd "C-c a") 'org-agenda)
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)

(defun my/matlab-electric ()
"Setup electric rules for MATLAB code."
(setq-local electric-indent-chars (cons ?\; electric-indent-chars))
(setq-local electric-layout-rules '((?\; . after)))
(setq-local electric-pair-pairs '((?\; . after))))

(eval-after-load 'matlab-mode
'(progn
(define-key matlab-mode-map (kbd "C-h") nil)
(define-key matlab-mode-map (kbd "C-c h") nil)
(define-key matlab-mode-map
(kbd "C-c C-d") 'matlab-view-current-word-doc-in-another-buffer)
(define-key matlab-mode-map
(kbd "M-.") 'matlab-jump-to-definition-of-word-at-cursor)
(define-key matlab-shell-mode-map (kbd "C-h") nil)
(define-key matlab-shell-mode-map (kbd "C-c h") nil)
(define-key matlab-shell-mode-map (kbd "TAB") 'company-complete)
(define-key matlab-shell-mode-map
(kbd "C-c M-o") 'my/comint-empty-buffer)
(define-key matlab-shell-mode-map
(kbd "C-c C-d") 'matlab-view-current-word-doc-in-another-buffer)
(define-key matlab-shell-mode-map
(kbd "M-.") 'matlab-jump-to-definition-of-word-at-cursor)
(defun matlab-do-functions-have-end-p () t)))
(add-hook 'matlab-mode-hook 'my/coding-on)
(add-hook 'matlab-mode-hook 'my/eldoc-mode-on)
(add-hook 'matlab-mode-hook 'my/matlab-electric)
(add-hook 'matlab-shell-mode-hook 'my/eldoc-mode-on)
(advice-add 'matlab-view-current-word-doc-in-another-buffer
:around #'my/preserve-selected-window)

(eval-after-load 'octave
'(progn
(define-key octave-mode-map (kbd "RET") 'newline-and-indent)
Expand All @@ -341,6 +375,14 @@ ARGS are as per the arguments to the advised functions."
(add-hook 'octave-mode-hook 'my/coding-on)
(add-hook 'octave-mode-hook 'my/eldoc-mode-on)

(if (file-accessible-directory-p "~/ws/matlab-mode")
(progn
(add-to-list 'load-path "~/ws/matlab-mode")
(add-to-list 'auto-mode-alist '("\\.m$" . matlab-mode))
(autoload 'matlab-mode "matlab-mode" "" t)
(autoload 'matlab-shell "matlab-mode" "" t))
(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode)))

(eval-after-load 'rust-mode
'(progn
(require 'flycheck-rust)
Expand Down
2 changes: 1 addition & 1 deletion basic/lein/profiles.clj
@@ -1,6 +1,6 @@
{:user
{:plugins [[lein-pprint "1.1.1"]
[lein-ancient "0.6.8"]
[cider/cider-nrepl "0.9.1"]]
[cider/cider-nrepl "0.10.1"]]
:dependencies [[alembic "0.3.2"]
[criterium "0.4.3"]]}}

0 comments on commit 8afed15

Please sign in to comment.