Skip to content

Instantly share code, notes, and snippets.

@poqudrof
Created December 7, 2017 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poqudrof/e62c232899efafb768e00e90aaa62c02 to your computer and use it in GitHub Desktop.
Save poqudrof/e62c232899efafb768e00e90aaa62c02 to your computer and use it in GitHub Desktop.
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
(setq tab-width 2)
(require 'ruby-refactor)
(add-hook 'ruby-mode-hook 'ruby-refactor-mode-launch)
;; (add-to-list 'load-path "~/.sonic-pi.el/")
;; (require 'sonic-pi)
;; (setq sonic-pi-path "/home/jiii/repos/sonic-pi/") ; Must end with "/"
;; ;; Optionally define a hook
;; (add-hook 'sonic-pi-mode-hook
;; (lambda ()
;; ;; This setq can go here instead if you wish
;; (setq sonic-pi-path "/home/jiii/repos/sonic-pi/")
;; (define-key ruby-mode-map "\C-c\C-b" 'sonic-pi-stop-all)))
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(require 'projectile-speedbar)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
(markdown-mode+ markdown-mode ruby-refactor osc projectile-speedbar web-mode ruby-electric company projectile-rails coffee-mode))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(prefer-coding-system 'utf-8)
(set-terminal-coding-system 'mule-utf-8) ; pour l'affichage
(set-keyboard-coding-system 'utf-8)
;;To provide the region text to the shell command as input, use `M-|’ (‘shell-command-on-region’). If you want the shell to replace the region text with the output from the shell command, use `C-u M-|’.
;; C-u M-| python replace region by command...
;; Handle more file extensions
(setq auto-mode-alist (cons '("\\.pde$" . java-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.pde\\w?" . java-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.vert\\w?" . c-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.glsl\\w?" . c-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.frag\\w?" . c-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.cu\\w?" . c++-mode) auto-mode-alist))
(add-to-list 'auto-mode-alist
'("\\.\\(?:gemspec\\|irbrc\\|gemrc\\|rake\\|rb\\|ru\\|thor\\)\\'" . ruby-mode))
(add-to-list 'auto-mode-alist
'("\\(Capfile\\|Gemfile\\(?:\\.[a-zA-Z0-9._-]+\\)?\\|[rR]akefile\\)\\'" . ruby-mode))
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
'("marmalade" .
"http://marmalade-repo.org/packages/"))
(package-initialize)
(defun run-current-file ()
"Execute the current with Processing-java
If the file is modified, ask if you want to save first."
(interactive)
(let* (
(suffixMap
`(
("pde" . "processing-java")
)
)
(fName (buffer-file-name))
(fSuffix (file-name-extension fName))
(progName (cdr (assoc fSuffix suffixMap)))
(compileOptions "--force --run")
(folderName (file-name-directory (or load-file-name buffer-file-name)))
(compileStr (concat progName " --sketch=" folderName " --output=" folderName "build " compileOptions))
)
(when (buffer-modified-p)
(when (y-or-n-p "Buffer modified. Do you want to save first?")
(save-buffer) ) )
(if progName
(progn
(message "Running…")
(compile compileStr)
)
(message "No recognized program file suffix for this file.")
) ) )
(defun jruby ()
(interactive)
(inf-ruby "jruby"))
(global-set-key [?\C-c ?c] 'comment-region)
(global-set-key [?\C-c ?u] 'uncomment-region)
(global-set-key [f1] 'start-kbd-macro)
(global-set-key [f2] 'end-kbd-macro)
(global-set-key [f3] 'edit-last-kbd-macro)
(global-set-key [f4] 'name-last-kbd-macro)
(global-set-key [f5] 'insert-kbd-macro)
(global-set-key [f6] 'run-current-file)
;; (global-set-key [f7] 'find-file)
(global-set-key [f7] 'jruby)
(global-set-key [f8] 'other-window)
(global-set-key [f9] 'compile)
;(global-set-key [f10] 'next-error)
(global-set-key [f12] 'projectile-speedbar-open-current-buffer-in-tree)
(setq org-agenda-files (list "~/owncloud/org/todo-main.org"
"~/owncloud/org/todo-code.org"
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment