2017-11-29 12:45:52 +00:00
|
|
|
|
;;; init --- Summary
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2016-11-01 16:03:01 +00:00
|
|
|
|
(setq custom-file (concat user-emacs-directory "customizations.el"))
|
|
|
|
|
(load custom-file)
|
|
|
|
|
|
2016-10-19 06:05:12 +00:00
|
|
|
|
;; Initialize the package system and use-package
|
2016-10-21 12:44:02 +00:00
|
|
|
|
(setq load-prefer-newer t)
|
2016-10-19 06:05:12 +00:00
|
|
|
|
(require 'package)
|
|
|
|
|
(add-to-list 'package-archives
|
|
|
|
|
'("gnu" . "http://elpa.gnu.org/packages/"))
|
2016-11-07 13:46:53 +00:00
|
|
|
|
(add-to-list 'package-archives
|
|
|
|
|
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
|
2016-10-19 06:05:12 +00:00
|
|
|
|
(add-to-list 'package-archives
|
2016-11-07 13:00:06 +00:00
|
|
|
|
'("melpa" . "https://melpa.org/packages/") t)
|
2016-10-19 06:05:12 +00:00
|
|
|
|
(add-to-list 'package-archives
|
2016-11-07 13:00:06 +00:00
|
|
|
|
'("marmalade" . "http://marmalade-repo.org/packages/") t)
|
2017-01-05 20:41:48 +00:00
|
|
|
|
(add-to-list 'package-archives
|
|
|
|
|
'("org" . "http://orgmode.org/elpa/") t)
|
2016-08-18 20:01:20 +00:00
|
|
|
|
(package-initialize)
|
|
|
|
|
|
2018-07-29 16:38:44 +00:00
|
|
|
|
;; I started moving my configuration to this Org file. It’s easier to document this way.
|
|
|
|
|
(org-babel-load-file (expand-file-name "configuration.org" user-emacs-directory))
|
2016-09-15 14:08:54 +00:00
|
|
|
|
|
2016-11-18 08:45:50 +00:00
|
|
|
|
;; Load my own functions
|
|
|
|
|
(load "gnu-c-header")
|
|
|
|
|
(load "round-number-to-decimals")
|
|
|
|
|
|
2016-12-08 09:27:13 +00:00
|
|
|
|
;; From gmane.emacs.orgmode
|
|
|
|
|
;; (http://article.gmane.org/gmane.emacs.orgmode/75222)
|
|
|
|
|
(defun f-ediff-org-showhide (buf command &rest cmdargs)
|
2017-11-29 12:45:52 +00:00
|
|
|
|
"If buffer BUF exists and in `org-mode', execute COMMAND with CMDARGS."
|
2016-12-08 09:27:13 +00:00
|
|
|
|
(when buf
|
|
|
|
|
(when (eq (buffer-local-value 'major-mode (get-buffer buf)) 'org-mode)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(set-buffer buf)
|
|
|
|
|
(apply command cmdargs)))))
|
|
|
|
|
|
|
|
|
|
(defun f-ediff-org-unfold-tree-element ()
|
|
|
|
|
"Unfold tree at diff location."
|
|
|
|
|
(f-ediff-org-showhide ediff-buffer-A 'org-reveal)
|
|
|
|
|
(f-ediff-org-showhide ediff-buffer-B 'org-reveal)
|
|
|
|
|
(f-ediff-org-showhide ediff-buffer-C 'org-reveal))
|
|
|
|
|
|
|
|
|
|
(defun f-ediff-org-fold-tree ()
|
|
|
|
|
"Fold tree back to top level."
|
|
|
|
|
(f-ediff-org-showhide ediff-buffer-A 'hide-sublevels 1)
|
|
|
|
|
(f-ediff-org-showhide ediff-buffer-B 'hide-sublevels 1)
|
|
|
|
|
(f-ediff-org-showhide ediff-buffer-C 'hide-sublevels 1))
|
|
|
|
|
|
2016-10-10 18:40:40 +00:00
|
|
|
|
;; Waka-waka
|
|
|
|
|
(use-package wakatime-mode
|
|
|
|
|
:init
|
2017-04-11 22:12:58 +00:00
|
|
|
|
(setq-default wakatime-cli-path (executable-find "wakatime"))
|
2016-10-10 18:40:40 +00:00
|
|
|
|
:config
|
|
|
|
|
(global-wakatime-mode t))
|
|
|
|
|
|
2017-04-18 22:31:32 +00:00
|
|
|
|
(use-package gnugo)
|
2016-10-14 13:35:29 +00:00
|
|
|
|
|
2017-04-18 22:31:32 +00:00
|
|
|
|
(use-package gobgen)
|
2016-10-14 13:35:29 +00:00
|
|
|
|
|
2017-04-18 22:31:32 +00:00
|
|
|
|
(use-package xlicense)
|
2016-10-14 13:30:39 +00:00
|
|
|
|
|
2016-10-17 15:43:18 +00:00
|
|
|
|
(use-package plantuml-mode
|
|
|
|
|
:init
|
|
|
|
|
(setq plantuml-jar-path
|
2016-10-24 08:49:02 +00:00
|
|
|
|
(expand-file-name
|
|
|
|
|
;; Make sure we have a download location even if XDG is not
|
|
|
|
|
;; working
|
|
|
|
|
(cond
|
|
|
|
|
((xdg-user-dir "DOWNLOAD")
|
|
|
|
|
(concat (xdg-user-dir "DOWNLOAD") "/plantuml.jar"))
|
|
|
|
|
(t
|
|
|
|
|
"~/Downloads/plantuml.jar"))))
|
2016-10-17 15:43:18 +00:00
|
|
|
|
(defvaralias 'org-plantuml-jar-path 'plantuml-jar-path)
|
|
|
|
|
:config
|
|
|
|
|
(org-babel-do-load-languages
|
|
|
|
|
'org-babel-load-languages
|
|
|
|
|
'((plantuml . t))))
|
2016-10-17 14:24:31 +00:00
|
|
|
|
|
2016-10-20 12:09:15 +00:00
|
|
|
|
(use-package hungarian-holidays
|
|
|
|
|
:config
|
|
|
|
|
(hungarian-holidays-add))
|
|
|
|
|
|
2016-10-20 13:36:33 +00:00
|
|
|
|
(use-package flyspell
|
|
|
|
|
:config
|
|
|
|
|
(add-hook 'prog-mode-hook
|
2016-10-21 07:32:50 +00:00
|
|
|
|
'flyspell-prog-mode)
|
2016-10-20 13:36:33 +00:00
|
|
|
|
(add-hook 'text-mode-hook
|
2016-10-21 07:32:50 +00:00
|
|
|
|
'flyspell-mode))
|
2016-10-20 13:36:33 +00:00
|
|
|
|
|
2016-10-21 08:18:21 +00:00
|
|
|
|
(use-package hungry-delete
|
|
|
|
|
:config
|
|
|
|
|
(global-hungry-delete-mode))
|
|
|
|
|
|
2016-10-21 17:37:08 +00:00
|
|
|
|
(use-package alert
|
|
|
|
|
:config
|
2017-04-12 06:24:19 +00:00
|
|
|
|
(setq alert-default-style
|
|
|
|
|
(if (termux-p)
|
|
|
|
|
(progn
|
|
|
|
|
;; TODO Remove this as soon as my PR gets merged
|
|
|
|
|
;; https://github.com/jwiegley/alert/pull/41
|
|
|
|
|
(unless (fboundp 'alert-termux-notify)
|
|
|
|
|
(defcustom alert-termux-command (executable-find "termux-notification")
|
|
|
|
|
"Path to the termux-notification command.
|
|
|
|
|
This is found in the termux-api package, and it requires the Termux
|
|
|
|
|
API addon app to be installed."
|
|
|
|
|
:type 'file
|
|
|
|
|
:group 'alert)
|
|
|
|
|
|
|
|
|
|
(defun alert-termux-notify (info)
|
|
|
|
|
"Send INFO using termux-notification.
|
|
|
|
|
Handles :TITLE and :MESSAGE keywords from the
|
|
|
|
|
INFO plist."
|
|
|
|
|
(if alert-termux-command
|
|
|
|
|
(let ((args (nconc
|
|
|
|
|
(when (plist-get info :title)
|
|
|
|
|
(list "-t" (alert-encode-string (plist-get info :title))))
|
|
|
|
|
(list "-c" (alert-encode-string (plist-get info :message))))))
|
|
|
|
|
(apply #'call-process alert-termux-command nil
|
|
|
|
|
(list (get-buffer-create " *termux-notification output*") t)
|
|
|
|
|
nil args))
|
|
|
|
|
(alert-message-notify info)))
|
|
|
|
|
|
|
|
|
|
(alert-define-style 'termux :title "Notify using termux"
|
|
|
|
|
:notifier #'alert-termux-notify))
|
|
|
|
|
'termux)
|
2018-07-02 06:55:02 +00:00
|
|
|
|
'libnotify)))
|
2016-10-21 17:37:08 +00:00
|
|
|
|
|
2016-10-24 07:49:07 +00:00
|
|
|
|
(use-package newsticker
|
2016-10-24 12:36:50 +00:00
|
|
|
|
:demand
|
2016-10-24 07:49:07 +00:00
|
|
|
|
:config
|
|
|
|
|
(setq newsticker-url-list '(("(or emacs irrelevant)"
|
|
|
|
|
"http://oremacs.com/atom.xml"
|
|
|
|
|
nil nil nil)
|
|
|
|
|
("think"
|
|
|
|
|
"http://batsov.com/atom.xml"
|
|
|
|
|
nil nil nil)
|
|
|
|
|
("Endless Parentheses"
|
|
|
|
|
"http://endlessparentheses.com/atom.xml"
|
2016-10-24 12:36:50 +00:00
|
|
|
|
nil nil nil)
|
2016-10-24 10:19:37 +00:00
|
|
|
|
("Irreal"
|
|
|
|
|
"http://irreal.org/blog/?feed=rss2"
|
2016-10-25 06:25:29 +00:00
|
|
|
|
nil nil nil)
|
|
|
|
|
;; The followint may supersede previous entries
|
|
|
|
|
("Planet Emacs"
|
|
|
|
|
"http://planet.emacsen.org/atom.xml"
|
2016-10-24 10:19:37 +00:00
|
|
|
|
nil nil nil)))
|
2016-10-24 07:49:07 +00:00
|
|
|
|
:bind
|
|
|
|
|
(:map gpolonkai/pers-map
|
|
|
|
|
("n" . newsticker-show-news)))
|
|
|
|
|
|
2017-04-18 22:31:32 +00:00
|
|
|
|
(use-package cheatsheet)
|
2016-10-24 10:20:04 +00:00
|
|
|
|
|
2016-10-28 05:12:16 +00:00
|
|
|
|
(use-package ace-popup-menu
|
|
|
|
|
:config
|
|
|
|
|
(ace-popup-menu-mode 1))
|
|
|
|
|
|
2016-11-01 12:52:52 +00:00
|
|
|
|
(use-package achievements
|
|
|
|
|
:config
|
|
|
|
|
(achievements-mode 1))
|
|
|
|
|
|
2016-11-07 15:17:30 +00:00
|
|
|
|
(use-package form-feed
|
|
|
|
|
:config
|
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'form-feed-mode))
|
|
|
|
|
|
2016-11-09 07:23:51 +00:00
|
|
|
|
(use-package auto-virtualenv
|
2016-11-15 21:05:58 +00:00
|
|
|
|
:config
|
|
|
|
|
(add-hook 'python-mode-hook 'auto-virtualenv-set-virtualenv)
|
|
|
|
|
(add-hook 'projectile-after-switch-project-hook
|
|
|
|
|
'auto-virtualenv-set-virtualenv))
|
2016-11-09 07:23:51 +00:00
|
|
|
|
|
2017-04-18 22:31:32 +00:00
|
|
|
|
(use-package gitlab)
|
2016-11-10 08:49:26 +00:00
|
|
|
|
|
2017-04-18 22:31:32 +00:00
|
|
|
|
(use-package hl-todo)
|
2016-11-11 22:26:40 +00:00
|
|
|
|
|
2016-11-17 22:30:47 +00:00
|
|
|
|
(use-package anaconda-mode
|
|
|
|
|
:config
|
|
|
|
|
(add-hook 'python-mode-hook 'anaconda-mode)
|
|
|
|
|
(add-hook 'python-mode-hook 'anaconda-eldoc-mode))
|
|
|
|
|
|
2017-04-18 22:31:32 +00:00
|
|
|
|
(use-package enlive)
|
2016-11-21 10:39:39 +00:00
|
|
|
|
|
2018-07-19 10:50:05 +00:00
|
|
|
|
(use-package emmet-mode
|
|
|
|
|
:config
|
|
|
|
|
(setq emmet-self-closing-tag-style "")
|
|
|
|
|
(add-hook 'web-mode 'emmet-mode)
|
|
|
|
|
(add-hook 'css-mode 'emmet-mode))
|
|
|
|
|
|
2017-04-18 22:31:32 +00:00
|
|
|
|
(use-package phi-search)
|
2017-01-26 08:06:29 +00:00
|
|
|
|
|
|
|
|
|
(use-package phi-search-mc
|
|
|
|
|
:config
|
|
|
|
|
(phi-search-mc/setup-keys))
|
2017-04-07 16:23:53 +00:00
|
|
|
|
|
|
|
|
|
(use-package secretaria
|
2017-04-11 22:14:20 +00:00
|
|
|
|
:after
|
|
|
|
|
alert
|
2017-04-07 16:23:53 +00:00
|
|
|
|
:config
|
|
|
|
|
;; use this for getting a reminder every 30 minutes of those tasks
|
|
|
|
|
;; scheduled for today and which have no time of day defined.
|
|
|
|
|
(add-hook 'after-init-hook
|
|
|
|
|
#'secretaria-today-unknown-time-appt-always-remind-me))
|
2017-04-11 22:15:11 +00:00
|
|
|
|
|
|
|
|
|
(when (termux-p)
|
|
|
|
|
(use-package browse-url
|
|
|
|
|
:ensure nil
|
|
|
|
|
:config
|
|
|
|
|
(advice-add 'browse-url-default-browser :override
|
|
|
|
|
(lambda (url &rest args)
|
|
|
|
|
(start-process-shell-command
|
|
|
|
|
"open-url"
|
|
|
|
|
nil
|
|
|
|
|
(concat "am start -a android.intent.action.VIEW --user 0 -d "
|
|
|
|
|
url))))))
|
2017-01-26 08:06:29 +00:00
|
|
|
|
|
2017-08-21 22:13:15 +00:00
|
|
|
|
(use-package feature-mode)
|
|
|
|
|
|
2017-08-07 08:44:10 +00:00
|
|
|
|
(use-package org-ref
|
|
|
|
|
:after
|
|
|
|
|
org
|
|
|
|
|
:config
|
|
|
|
|
(setq org-ref-bibliography-notes (concat user-documents-directory
|
|
|
|
|
(convert-standard-filename
|
|
|
|
|
"/orgmode/bibliography-notes"))
|
|
|
|
|
org-ref-default-bibliography '((concat user-documents-directory
|
|
|
|
|
(convert-standard-filename
|
|
|
|
|
"/orgmode/references.bib")))
|
|
|
|
|
org-ref-pdf-directory (concat user-documents-directory
|
|
|
|
|
(convert-standard-filename
|
|
|
|
|
"/orgmode/bibtex-pdfs"))))
|
|
|
|
|
|
2017-09-22 11:48:32 +00:00
|
|
|
|
(use-package ag
|
|
|
|
|
:after projectile
|
|
|
|
|
:bind
|
|
|
|
|
(:map projectile-mode-map
|
|
|
|
|
("C-c p C-a" . ag-project)))
|
|
|
|
|
|
2017-10-02 11:33:25 +00:00
|
|
|
|
(use-package fancy-narrow
|
|
|
|
|
:config
|
|
|
|
|
(fancy-narrow-mode))
|
|
|
|
|
|
2017-11-08 07:24:22 +00:00
|
|
|
|
(use-package undo-tree)
|
|
|
|
|
|
2018-07-25 05:16:09 +00:00
|
|
|
|
(use-package all-the-icons)
|
|
|
|
|
|
|
|
|
|
(use-package neotree
|
|
|
|
|
:after
|
|
|
|
|
all-the-icons
|
|
|
|
|
:config
|
|
|
|
|
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
|
|
|
|
|
:bind
|
|
|
|
|
(("<f5>" . neotree-toggle)))
|
|
|
|
|
|
2017-08-07 08:44:10 +00:00
|
|
|
|
;; open pdf with system pdf viewer (works on mac)
|
|
|
|
|
(setq bibtex-completion-pdf-open-function
|
|
|
|
|
(lambda (fpath)
|
|
|
|
|
(start-process "open" "*open*" "open" fpath)))
|
|
|
|
|
|
|
|
|
|
;; alternative
|
|
|
|
|
;; (setq bibtex-completion-pdf-open-function 'org-open-file))
|
|
|
|
|
|
2017-01-11 08:10:21 +00:00
|
|
|
|
(add-hook 'python-mode-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(add-to-list 'prettify-symbols-alist
|
|
|
|
|
'("not" . 172))
|
|
|
|
|
(add-to-list 'prettify-symbols-alist
|
2017-08-07 06:30:00 +00:00
|
|
|
|
'("in" . 8712))
|
|
|
|
|
(add-to-list 'prettify-symbols-alist
|
|
|
|
|
'("def" . 402))))
|
2017-01-11 08:10:21 +00:00
|
|
|
|
|
2016-09-29 08:50:50 +00:00
|
|
|
|
;; `c-mode' settings
|
|
|
|
|
(add-hook 'c-mode-common-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(local-set-key (kbd "C-c o") 'ff-find-other-file)
|
|
|
|
|
(c-set-style "PERSONAL")
|
|
|
|
|
(setq tab-width 4
|
|
|
|
|
indent-tabs-mode nil)
|
2016-10-11 17:44:37 +00:00
|
|
|
|
(c-toggle-auto-newline 1)))
|
2016-09-29 08:50:50 +00:00
|
|
|
|
(add-hook 'c-initialization-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(define-key c-mode-base-map (kbd "C-m") 'c-context-line-break)))
|
|
|
|
|
(defvaralias 'c-basic-offset 'tab-width)
|
|
|
|
|
(defvaralias 'cperl-indent-level 'tab-width)
|
2014-10-07 20:17:48 +00:00
|
|
|
|
(defconst my-c-style
|
|
|
|
|
'((c-tab-always-indent . t)
|
|
|
|
|
(c-comment-only-line-offset . 4)
|
|
|
|
|
(c-hanging-braces-alist . ((substatement-open after)
|
|
|
|
|
(brace-list-open)))
|
|
|
|
|
(c-hanging-colons-alist . ((member-init-intro before)
|
|
|
|
|
(inher-intro)
|
|
|
|
|
(case-label after)
|
|
|
|
|
(label after)
|
|
|
|
|
(access-label after)))
|
|
|
|
|
(c-cleanup-list . (scope-operator
|
|
|
|
|
empty-defun-braces
|
|
|
|
|
defun-close-semi))
|
|
|
|
|
(c-offsets-alist . ((arglist-close . +)
|
2018-06-12 13:05:19 +00:00
|
|
|
|
(arglist-intro . +)
|
2014-10-07 20:17:48 +00:00
|
|
|
|
(substatement-open . 0)
|
|
|
|
|
(case-label . 4)
|
|
|
|
|
(block-open . 0)
|
2014-11-16 15:42:08 +00:00
|
|
|
|
(knr-argdecl-intro . -)
|
2018-06-12 13:05:19 +00:00
|
|
|
|
(comment-intro . 0)
|
|
|
|
|
(member-init-intro . ++)))
|
2014-10-07 20:17:48 +00:00
|
|
|
|
(c-echo-syntactic-information-p . t))
|
2017-11-29 12:45:52 +00:00
|
|
|
|
"My C Programming Style.")
|
2014-10-07 20:17:48 +00:00
|
|
|
|
(c-add-style "PERSONAL" my-c-style)
|
2016-02-16 08:12:19 +00:00
|
|
|
|
|
2016-09-29 08:50:50 +00:00
|
|
|
|
;; Custom key bindings
|
2016-10-28 05:32:55 +00:00
|
|
|
|
(bind-keys
|
|
|
|
|
:map global-map
|
|
|
|
|
("M-(" . æ-enclose-region)
|
|
|
|
|
("<C-return>" . open-line-below)
|
|
|
|
|
("<C-S-return>" . open-line-above)
|
2016-11-07 12:22:46 +00:00
|
|
|
|
("M-t" . nil) ;; Remove the old keybinding
|
|
|
|
|
("M-t c" . transpose-chars)
|
|
|
|
|
("M-t w" . transpose-words)
|
|
|
|
|
("M-t l" . transpose-lines)
|
|
|
|
|
("M-t e" . transpose-sexps)
|
|
|
|
|
("M-t s" . transpose-sentences)
|
|
|
|
|
("M-t p" . transpose-paragraphs)
|
2016-11-15 07:55:42 +00:00
|
|
|
|
("M-t W" . transpose-windows)
|
2016-11-15 07:58:45 +00:00
|
|
|
|
("C-a" . gpolonkai/move-to-beginning-of-line)
|
|
|
|
|
("C-e" . gpolonkai/move-to-end-of-line)
|
2016-11-28 04:23:11 +00:00
|
|
|
|
("M-q" . sachachua/fill-or-unfill-paragraph)
|
2017-04-04 20:07:11 +00:00
|
|
|
|
("C-c r" . round-number-at-point-to-decimals)
|
2017-04-17 21:09:51 +00:00
|
|
|
|
("C-s" . isearch-forward-regexp)
|
|
|
|
|
("C-r" . isearch-backward-regexp)
|
|
|
|
|
("C-M-s" . isearch-forward)
|
|
|
|
|
("C-M-r" . isearch-backward)
|
2018-06-11 04:42:06 +00:00
|
|
|
|
("C-~" . toggle-char-case)
|
2016-10-28 05:32:55 +00:00
|
|
|
|
:map ctl-x-map
|
2018-07-29 16:58:11 +00:00
|
|
|
|
("C-y" . gpolonkai/duplicate-line)
|
2016-10-28 05:32:55 +00:00
|
|
|
|
("_" . maximize-window)
|
|
|
|
|
("C-r" . rename-current-buffer-file)
|
|
|
|
|
("C-d" . delete-current-buffer-file)
|
2016-11-17 12:35:33 +00:00
|
|
|
|
("|" . toggle-window-split)
|
2016-11-21 10:40:02 +00:00
|
|
|
|
("k" . gpolonkai/kill-this-buffer)
|
2016-11-25 09:29:12 +00:00
|
|
|
|
("M-c" . gpolonkai/kill-this-buffer-delete-this-window)
|
2016-11-21 10:40:02 +00:00
|
|
|
|
("M-k" . gpolonkai/undo-buffer-kill)
|
2017-08-07 06:44:14 +00:00
|
|
|
|
("C-b" . bury-buffer)
|
2018-06-10 06:22:31 +00:00
|
|
|
|
("/" . repeat)
|
2016-10-28 05:32:55 +00:00
|
|
|
|
:map isearch-mode-map
|
2016-11-03 18:32:28 +00:00
|
|
|
|
("<C-return>" . isearch-exit-other-end)
|
2017-03-22 22:23:38 +00:00
|
|
|
|
("<S-return>" . isearch-exit-mark-match)
|
2016-10-28 05:32:55 +00:00
|
|
|
|
:map gpolonkai/pers-map
|
2016-11-03 18:32:28 +00:00
|
|
|
|
("m" . hidden-mode-line-mode)
|
|
|
|
|
("C-i e" . "gergely@polonkai.eu")
|
2016-11-07 12:23:17 +00:00
|
|
|
|
("C-i w" . "http://gergely.polonkai.eu/")
|
2016-11-14 23:47:14 +00:00
|
|
|
|
("C-p" . package-list-packages)
|
|
|
|
|
("o i" . gpolonkai/visit-init-file)
|
2017-11-21 09:15:41 +00:00
|
|
|
|
("o o" . gpolonkai/visit-org-index)
|
|
|
|
|
("u" . browse-url-at-point)
|
|
|
|
|
("C" . clean-buffer-list))
|
2016-10-19 15:07:41 +00:00
|
|
|
|
|
2017-04-18 09:00:05 +00:00
|
|
|
|
;; TODO: This doesn’t work with use-package and bind-key for some reason.
|
|
|
|
|
;; But why?
|
|
|
|
|
(define-key 'help-command (kbd "C-l") 'find-library)
|
|
|
|
|
(define-key 'help-command (kbd "C-f") 'find-function)
|
|
|
|
|
(define-key 'help-command (kbd "C-k") 'find-function-on-key)
|
|
|
|
|
(define-key 'help-command (kbd "C-v") 'find-variable)
|
|
|
|
|
|
2016-10-20 12:17:30 +00:00
|
|
|
|
;; Kudos goes to
|
|
|
|
|
;; http://endlessparentheses.com/leave-the-cursor-at-start-of-match-after-isearch.html
|
2016-10-19 15:07:41 +00:00
|
|
|
|
(defun isearch-exit-other-end ()
|
2017-11-29 12:45:52 +00:00
|
|
|
|
"Exit isearch, at the opposite end of the string."
|
2016-10-19 15:07:41 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
|
|
|
|
|
(isearch-exit)
|
|
|
|
|
(goto-char isearch-other-end))
|
2016-09-15 15:49:29 +00:00
|
|
|
|
|
2017-03-22 22:23:38 +00:00
|
|
|
|
;; Kudos goes to http://emacs.stackexchange.com/a/31321/507
|
|
|
|
|
(defun isearch-exit-mark-match ()
|
|
|
|
|
"Exit isearch and mark the current match."
|
|
|
|
|
(interactive)
|
|
|
|
|
(isearch-exit)
|
|
|
|
|
(push-mark isearch-other-end)
|
|
|
|
|
(activate-mark))
|
|
|
|
|
|
2016-09-29 08:50:50 +00:00
|
|
|
|
;; Enable some functions
|
|
|
|
|
(put 'downcase-region 'disabled nil)
|
|
|
|
|
(put 'upcase-region 'disabled nil)
|
2016-11-17 07:25:17 +00:00
|
|
|
|
(put 'erase-buffer 'disabled nil)
|
2017-01-11 08:11:29 +00:00
|
|
|
|
(put 'narrow-to-region 'disabled nil)
|
2017-09-18 13:28:34 +00:00
|
|
|
|
(put 'set-goal-column 'disabled nil)
|
2016-09-29 08:50:50 +00:00
|
|
|
|
|
|
|
|
|
;; text-mode settings
|
2016-09-26 08:15:12 +00:00
|
|
|
|
(add-hook 'text-mode-hook (lambda () (visual-line-mode t)))
|
|
|
|
|
|
2016-09-29 08:50:50 +00:00
|
|
|
|
;; Add some symbols to be prettified
|
|
|
|
|
(setq prettify-symbols-alist
|
2017-08-07 06:30:00 +00:00
|
|
|
|
'(("lambda" . 955) ; λ
|
|
|
|
|
("function" . 402) ; ƒ
|
|
|
|
|
("->" . 8594) ; →
|
|
|
|
|
("=>" . 8658) ; ⇒
|
|
|
|
|
("map" . 8614) ; ↦
|
|
|
|
|
("not" . 172)) ; ¬
|
2016-11-10 10:36:48 +00:00
|
|
|
|
|
|
|
|
|
;; …and some pairs to complete
|
|
|
|
|
;; TODO: maybe add-to-list is a better way to do it
|
|
|
|
|
insert-pair-alist '(
|
|
|
|
|
(40 41) ; ()
|
|
|
|
|
(91 93) ; []
|
|
|
|
|
(123 125) ; {}
|
|
|
|
|
(60 62) ; <>
|
|
|
|
|
(34 34) ; ""
|
|
|
|
|
(39 39) ; ''
|
|
|
|
|
(96 39) ; `'
|
|
|
|
|
(8220 8221) ; “”
|
|
|
|
|
(8222 8221) ; „”
|
|
|
|
|
(8216 8217) ; ‘’
|
|
|
|
|
(8249 8250) ; ‹›
|
|
|
|
|
(8250 8249) ; ›‹
|
|
|
|
|
(171 187) ; «»
|
|
|
|
|
(187 171)) ; »«
|
|
|
|
|
|
|
|
|
|
;; Set the frame title to the current file name
|
|
|
|
|
frame-title-format '((:eval (concat system-name
|
|
|
|
|
": "
|
|
|
|
|
(if (buffer-file-name)
|
|
|
|
|
(abbreviate-file-name
|
|
|
|
|
(buffer-file-name))
|
|
|
|
|
"%b")))))
|
2017-04-04 20:08:32 +00:00
|
|
|
|
|
|
|
|
|
(defun gpolonkai/helm-ff-slash-dir-complete ()
|
2017-11-29 12:45:52 +00:00
|
|
|
|
"Make forward slash (/) do completion in helm."
|
2017-04-04 20:08:32 +00:00
|
|
|
|
(interactive)
|
2018-07-25 05:16:37 +00:00
|
|
|
|
(if (and (or
|
|
|
|
|
(equal "magit-status" (assoc-default 'name (helm-get-current-source)))
|
|
|
|
|
(equal "Find Files" (assoc-default 'name (helm-get-current-source))))
|
2017-04-04 20:08:32 +00:00
|
|
|
|
(stringp (helm-get-selection))
|
|
|
|
|
(file-directory-p (helm-get-selection)))
|
|
|
|
|
(helm-execute-persistent-action)
|
|
|
|
|
(insert "/")))
|
2017-01-05 20:43:00 +00:00
|
|
|
|
|
2017-09-25 09:07:02 +00:00
|
|
|
|
;; TODO: 'cursor-color is sometimes nil, but why?
|
|
|
|
|
(setq default-cursor-color (or (frame-parameter nil 'cursor-color) "#ffd85c"))
|
2017-01-05 20:43:00 +00:00
|
|
|
|
(setq yasnippet-can-fire-cursor-color "purple")
|
|
|
|
|
|
|
|
|
|
;; It will test whether it can expand, if yes, cursor color -> purple.
|
|
|
|
|
(defun yasnippet-can-fire-p (&optional field)
|
2017-11-29 12:45:52 +00:00
|
|
|
|
"Check if the word before point can be expanded with yasnippet.
|
|
|
|
|
|
|
|
|
|
TODO: What is FIELD for?"
|
2017-01-05 20:43:00 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(setq yas--condition-cache-timestamp (current-time))
|
|
|
|
|
(let (templates-and-pos)
|
|
|
|
|
(unless (and yas-expand-only-for-last-commands
|
|
|
|
|
(not (member last-command yas-expand-only-for-last-commands)))
|
|
|
|
|
(setq templates-and-pos (if field
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region (yas--field-start field)
|
|
|
|
|
(yas--field-end field))
|
|
|
|
|
(yas--templates-for-key-at-point))
|
|
|
|
|
(yas--templates-for-key-at-point))))
|
|
|
|
|
(and templates-and-pos (first templates-and-pos))))
|
|
|
|
|
|
|
|
|
|
;; Taken from http://pages.sachachua.com/.emacs.d/Sacha.html
|
|
|
|
|
(defun sachachua/change-cursor-color-when-can-expand (&optional field)
|
2017-11-29 12:45:52 +00:00
|
|
|
|
"Change cursor color if the text before point can be expanded with yasnippet.
|
|
|
|
|
|
|
|
|
|
TODO: What is FIELD for?"
|
2017-01-05 20:43:00 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(when (eq last-command 'self-insert-command)
|
|
|
|
|
(set-cursor-color (if (sachachua/can-expand)
|
|
|
|
|
yasnippet-can-fire-cursor-color
|
|
|
|
|
default-cursor-color))))
|
|
|
|
|
|
|
|
|
|
(defun sachachua/can-expand ()
|
2018-07-02 07:46:16 +00:00
|
|
|
|
"Return t if right after an expandable thing."
|
2017-01-05 20:43:00 +00:00
|
|
|
|
(or (abbrev--before-point) (yasnippet-can-fire-p)))
|
|
|
|
|
|
2017-08-07 06:44:49 +00:00
|
|
|
|
;; SysAdmin Day to the calendar
|
|
|
|
|
(add-to-list 'holiday-other-holidays '(holiday-float 7 5 -1 "SysAdmin Day") t)
|
2017-11-29 12:48:15 +00:00
|
|
|
|
(add-to-list 'holiday-other-holidays '(holiday-fixed 10 21 "Reptile Awareness Day") t)
|
|
|
|
|
|
|
|
|
|
;;; init.el ends here
|