Skip to content

Instantly share code, notes, and snippets.

@viraltux
Created August 22, 2017 14:39
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 viraltux/82cd48539a95a504797ae818227aa1af to your computer and use it in GitHub Desktop.
Save viraltux/82cd48539a95a504797ae818227aa1af to your computer and use it in GitHub Desktop.
;; https://stable.melpa.org/#/getting-started
(require 'package) ;; You might already have this line
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(url (concat (if no-ssl "http" "https") "://melpa.org/packages/")))
(add-to-list 'package-archives (cons "melpa" url) t))
(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
(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.
'(custom-enabled-themes (quote (tango-dark)))
'(org-agenda-files (quote ("~/workspace/org/agenda.org")))
'(org-directory "~/workspace/org")
'(package-selected-packages
(quote
(helm-swoop helm ctable dash f julia-mode popup pythonic s anaconda-mode ess company company-anaconda auto-complete org ess-view ess-smart-underscore ess-smart-equals ess-R-object-popup ess-R-data-view))))
(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.
)
;;;;; Auto Complete ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; uses auto-complete-mode-maybe, which turn AC on only those listed in ac-modes
(global-auto-complete-mode t)
;; You can add them manually just like this
;; (add-to-list 'ac-modes 'sql-mode)
;; You can make your own list if you wish AC be active only for few modes
;; (setq ac-modes '(c++-mode sql-mode))
;; Or rewrite it to have AC everywhere.
;; Autocomplete in minibuffer is bad. I think this will be better.
;; (defun auto-complete-mode-maybe ()
;; "No maybe for you. Only AC!"
;; (unless (minibufferp (current-buffer))
;; (auto-complete-mode 1)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; org Customization ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (setq org-icalendar-timezone "Europe/Prague")
;; C-h v org-icalendar-use-UTC-date-time for details
;; Using UTC format is globally is advice since many calendar apps can
;; update its value easily. It works in Google & Yahoo web calendars.
;; warning: Google calendar updates daily and does not allow for manual refresh.
;; (org-babel-do-load-languages
;; 'org-babel-load-languages
;; '((R . t)
;; (perl . t)
;; (ruby . t)
;; (shell . t)
;; (python . t)
;; ))
;; http://orgmode.org/manual/Installation.html
;; http://orgmode.org/guide/Activation.html#Activation
;; The following lines are always needed. Choose your own keys.
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
(setq org-icalendar-date-time-format ":%Y%m%dT%H%M%SZ")
(setq org-agenda-default-appointment-duration 30)
(setq org-icalendar-alarm-time 120)
;; Check http://orgmode.org/manual/Template-expansion.html#Template-expansion
(setq org-capture-templates
'(
("t" "Todo" entry (file+headline "~/workspace/org/agenda.org" "Tasks")
"* TODO %?\n %i\n %a")
("c" "Calendar" entry (file+headline "~/workspace/org/agenda.org" "Calendar")
"* %?\n %T\n %i\n")
("i" "Ideas" entry (file "~/workspace/org/ideas.org.gpg")
"* %?\n %U\n %i\n %a")
("j" "Journal" entry (file+datetree "~/workspace/org/journal.org")
"* %?\nEntered on %U\n %i\n %a")
)
)
;; Check more settings described in Blog
;; https://blog.aaronbieber.com/2016/01/30/dig-into-org-mode.html
(setq org-blank-before-new-entry (quote ((heading) (plain-list-item))))
(setq org-enforce-todo-dependencies t)
(setq org-log-done (quote time))
;; (defun fran-update-agenda ()
;; (interactive)
;; (shell-command "cd ~/workspace/org/sync; mv ../agenda.ics .; git commit -a -m 'update'; git push"))
;; (global-set-key (kbd "C-c f") 'fran-update-agenda)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Auto Complete ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; https://www.emacswiki.org/emacs/ESSAuto-complete
(require 'auto-complete)
(package-initialize)
;; Movement keys
(define-key ac-completing-map (kbd "M-h") 'ac-quick-help)
(define-key ac-completing-map "\M-n" nil) ;; was ac-next
(define-key ac-completing-map "\M-p" nil) ;; was ac-previous
(define-key ac-completing-map "\M-," 'ac-next)
(define-key ac-completing-map "\M-k" 'ac-previous)
;; Completion keys
(define-key ac-completing-map "\r" nil)
(define-key ac-completing-map "\t" 'ac-complete)
(define-key ac-completing-map [tab] 'ac-complete)
(define-key ac-completing-map [return] nil)
;; Colors
(set-face-attribute 'ac-candidate-face nil :background "#00222c" :foreground "light gray")
(set-face-attribute 'ac-selection-face nil :background "SteelBlue4" :foreground "white")
(set-face-attribute 'popup-tip-face nil :background "#003A4E" :foreground "light gray")
;; Misc
(setq
;; ac-auto-show-menu 1
;; ac-candidate-limit nil
;; ac-delay 0.1
;; ac-disable-faces (quote (font-lock-comment-face font-lock-doc-face))
;; ac-ignore-case 'smart
;; ac-menu-height 10
;; ac-quick-help-delay 1.5
;; ac-quick-help-prefer-pos-tip t
;; ac-use-quick-help nil
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Emacs Customization ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Store all backup *~ and autosave #*# files in the tmp dir
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; Warnings
(setq visible-bell 1)
;; Helm
(require 'helm-config)
;; (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ;; seems to replace <r> with <t> andd C-j does the same.
(global-set-key (kbd "M-i") 'helm-swoop) ;; C-x C-e to evaluate
(global-set-key (kbd "C-x b") 'helm-buffers-list)
(global-set-key (kbd "C-x r b") 'helm-bookmarks) ;; set bookmark C-x r m
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
;; Input Mode
(add-hook 'text-mode-hook
(lambda () (set-input-method "spanish-prefix")))
;; Visual Settings
(global-visual-line-mode t)
;; To force wrap text lines at a set width
;; (add-hook 'text-mode-hook
;; '(lambda() (turn-on-auto-fill) (set-fill-column 80)))
;; Set background color
(set-background-color "black")
;; Set transparency of emacs
(set-frame-parameter (selected-frame) 'alpha '(85 . 50))
(add-to-list 'default-frame-alist '(alpha . (85 . 50)))
(defun transparency (value)
"Sets the transparency of the frame window. 0=transparent/100=opaque"
(interactive "nTransparency Value 0 - 100 opaque:")
(set-frame-parameter (selected-frame) 'alpha value))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment