Skip to content

Instantly share code, notes, and snippets.

@mahyaret
Created December 29, 2019 19:39
Show Gist options
  • Save mahyaret/84bfbf5df2567cbac4ce7d4bc64ccc6a to your computer and use it in GitHub Desktop.
Save mahyaret/84bfbf5df2567cbac4ce7d4bc64ccc6a to your computer and use it in GitHub Desktop.
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
;; Dracula Theme
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'dracula t)
;; Setting lisp system
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(setq slime-contribs '(slime-fancy))
;; Single Window
(setq inhibit-startup-screen t)
;; PYTHON CONFIGURATION
;; --------------------------------------
(elpy-enable)
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize))
;; Undo Tree
(global-undo-tree-mode)
;; Line number
(global-linum-mode t)
;; Font size
(set-face-attribute 'default nil :height 180)
(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
(undo-tree pyenv-mode-auto pyenv-mode anaconda-mode slime projectile jedi exec-path-from-shell elpy dracula-theme))))
(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.
)
(setq elpy-shell-use-project-root nil)
(add-hook 'python-mode-hook 'anaconda-mode)
(setenv "WORKON_HOME" "/anaconda3/envs")
(pyvenv-mode 1)
(defun my-restart-python-console ()
"Restart python console before evaluate buffer or region to avoid various uncanny conflicts, like not reloding modules even when they are changed"
(interactive)
(if (get-buffer "*Python*")
(let ((kill-buffer-query-functions nil)) (kill-buffer "*Python*")))
(elpy-shell-send-region-or-buffer))
;; Restart and run the python script
(global-set-key (kbd "C-c C-x C-c") 'my-restart-python-console)
;; Jumping between panes
(global-set-key (kbd "C-x <left>") 'windmove-left)
(global-set-key (kbd "C-x <right>") 'windmove-right)
(global-set-key (kbd "C-x <up>") 'windmove-up)
(global-set-key (kbd "C-x <down>") 'windmove-down)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment