You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

443 lines
14 KiB

(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.
'(TeX-complete-word (quote dabbrev-expand-helper))
'(TeX-fold-preserve-comments t)
'(TeX-fold-type-list (quote (env)))
'(TeX-newline-function (quote reindent-then-newline-and-indent))
'(auto-save-file-name-transforms (quote ((".*" "~/.emacs.d/autosaves/\\1" t))))
'(backup-directory-alist (quote ((".*" . "~/.emacs.d/backup/"))))
'(blink-cursor-delay 3)
'(blink-cursor-mode t)
'(bsn-backends (quote (msn)))
'(case-fold-search t)
'(compilation-auto-jump-to-first-error t)
'(compilation-skip-threshold 2)
'(current-language-environment "English")
'(default-input-method "rfc1345")
'(delete-active-region nil)
'(flyspell-duplicate-distance 0)
'(flyspell-mark-duplications-flag t)
'(font-latex-fontify-sectioning (quote color))
'(global-font-lock-mode t nil (font-lock))
'(hl-sexp-background-colors (quote ("#395959")))
'(ibuffer-use-other-window t)
'(inhibit-startup-screen t)
'(org-agenda-files (quote ("~/org/notes.org")))
'(org-capture-templates
(quote
(("t" "Todo" entry
(file+headline "~/org/notes.org" "Tasks")
"* TODO %?
%u
%a")
("i" "Idea" entry
(file+headline "~/org/notes.org" "Ideas")
"* IDEA %?
%u")
("e" "MailTo" entry
(file+headline "~/org/notes.org" "E-mails")
"* TODO mailto:%?")
("s" "Item to buy" item
(file+headline "~/org/spesa.org" "Food")
"- %? "))) t)
'(org-catch-invisible-edits (quote smart))
'(org-icalendar-include-todo t)
'(org-indent-mode-turns-on-hiding-stars nil)
'(org-pomodoro-play-sounds nil)
'(parens-require-spaces nil)
'(safe-local-variable-values
(quote
((eval add-hook
(quote before-save-hook)
(quote org-icalendar-export-to-ics)
nil t)
(eval add-hook
(quote before-save-hook)
(quote org-export-icalendar-this-file)
nil t)
(TeX-master . notes\.tex)
(bookmark-default-file . "./emacs.bmk"))))
'(show-paren-mode t)
'(smart-tab-completion-functions-alist
(quote
((emacs-lisp-mode . lisp-complete-symbol)
(text-mode . dabbrev-completion)
(latex-mode . TeX-complete-symbol))))
'(transient-mark-mode t)
'(truncate-partial-width-windows nil)
'(visible-mark-inhibit-trailing-overlay t))
(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.
'(default ((t (:inherit nil :stipple nil :background "#182828" :foreground "cornsilk1" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 90 :width normal :foundry "xos4" :family "terminus"))))
'(bold ((t (:weight normal))))
'(cursor ((t (:background "orchid3" :foreground "#182828"))))
'(fixed-pitch ((t (:family "Bitstream Vera Sans Mono"))))
'(font-latex-italic-face ((t (:inherit italic :foreground "SpringGreen"))))
'(font-lock-comment-delimiter-face ((t (:foreground "lightslategray"))))
'(font-lock-comment-face ((t (:foreground "SlateGray"))))
'(highlight ((t (:background "Darkslategray"))))
'(hl-sexp-face ((t (:underline t))) t)
'(italic ((((supports :underline t)) nil)))
'(linum-highlight-face ((t (:inherit (highlight default)))))
'(menu ((t (:inverse-video t))))
'(mouse ((t (:background "orchid"))))
'(org-pomodoro-mode-line ((t (:foreground "tomato3"))))
'(paren-face-match ((t (:background "turquoise" :foreground "black"))))
'(region ((t (:background "DodgerBlue4"))))
'(shadow ((t (:foreground "grey60"))))
'(tooltip ((t (:inherit default :background "lightyellow" :foreground "black" :foundry "xos4" :family "terminus"))))
'(variable-pitch ((t (:family "default"))))
'(visible-mark-face ((t (:background "goldenrod" :foreground "#182828")))))
;; This kinda overrides the customize business, but it works
(setq-default display-buffer-reuse-frames t)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setq c-basic-offset 4)
(setq indent-tabs-mode nil)
(setq-default abbrev-mode t)
(read-abbrev-file "~/.abbrev_defs")
(setq save-abbrevs t)
;; fix compilation window eating up my work window
(setq compilation-scroll-output t
compilation-window-height 12)
(tool-bar-mode 0)
(scroll-bar-mode -1)
(setq-default show-trailing-whitespace t)
(setq search-whitespace-regexp "[ \t\r\n]+")
(setq flyspell-use-meta-tab nil)
(setq redisplay-dont-pause t
scroll-margin 1
scroll-step 1
scroll-conservatively 10000
scroll-preserve-screen-position 1)
;; add .emacs.d and subdirs to load path
;; (add-to-list 'load-path "~/.emacs.d")
(let ((default-directory "~/.emacs.d/"))
(normal-top-level-add-subdirs-to-load-path)
(normal-top-level-add-to-load-path '("fringe-helper.el" "multiple-cursors.el" "dash.el")))
(require 'mic-paren) ; loading
(paren-activate) ; activating
(global-set-key (kbd "C-M-<backspace>") 'backward-kill-sexp)
(setq mouse-autoselect-window nil)
(mouse-wheel-mode t)
(load "init-latex.el")
(load "init-org.el")
(load "init-c++.el")
;; KDE stuff
;;
(add-to-list 'load-path "~/kde-emacs")
(load "qml-mode.el" nil t t)
(add-to-list 'auto-mode-alist '("\\.qml\\'" . qml-mode))
(require 'kde-emacs)
;;(setq kde-full-name "Jacopo De Simoi")
;;(setq kde-email "wilderkde@gmail.com")
(setq frame-title-format
'((buffer-file-name "%f"
(dired-directory dired-directory "%b")) " · emacs " kde-current-activity-name "%S"))
;; Put autosave files (ie #foo#) and backup files (ie foo~) in ~/.emacs.d/.
;; create the autosave dir if necessary, since emacs won't.
(make-directory "~/.emacs.d/autosaves/" t)
(make-directory "~/.emacs.d/backup/" t)
(require 'linum)
(add-hook 'text-mode-hook 'flyspell-mode)
(add-hook 'text-mode-hook 'linum-mode)
(add-hook 'qml-mode-hook 'linum-mode)
(require 'sourcepair)
(global-set-key (kbd "<f6>") 'sourcepair-load)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(setq default-fill-column 120)
(add-to-list 'load-path "~/tmp")
(setq mouse-yank-at-point t)
(blink-cursor-mode 0)
(global-hl-line-mode t)
(setq focus-follows-mouse nil)
(require 'pomodoro)
(global-set-key (kbd "M-[") 'previous-buffer)
(global-set-key (kbd "M-]") 'next-buffer)
;; kde activity stuff -- move to other file when stabilized
(defun kde-current-activity ()
"Returns the current KDE activity"
(substring (shell-command-to-string "qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.CurrentActivity") 0 -1)
)
(defun kde-current-activity-name ()
"Returns the name of the current KDE activity"
(substring (shell-command-to-string (concat "qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.ActivityName " (kde-current-activity))) 0 -1))
(defun X-window-id-belongs-to-activity (window-id activity)
(= (shell-command (concat "xprop -id " window-id " | grep _KDE_NET_WM_ACTIVITIES | grep " activity ">/dev/null")) 0)
)
(defun select-frame-on-activity (activity)
(setq framelist (frame-list))
(setq done nil)
(while (and framelist (not done))
(setq cur (car framelist))
(setq cur-id (cdr (assq 'window-id (frame-parameters cur))))
(if cur-id (if (X-window-id-belongs-to-activity cur-id activity) (progn;
(setq done 't) (select-frame cur)) ))
(setq framelist (cdr framelist)))
done
)
(defun select-X-frame ()
(setq framelist (frame-list))
(setq done nil)
(while (and framelist (not done))
(setq cur (car framelist))
(setq cur-id (cdr (assq 'window-id (frame-parameters cur))))
(if cur-id (progn;
(setq done 't) (raise-frame cur)))
(setq framelist (cdr framelist)))
done
)
(defun select-frame-on-current-activity ()
(select-frame-on-activity (kde-current-activity))
)
;; Rehab ↓
;; mark the date 30/1/2014
;; (require 'no-easy-keys)
;; (no-easy-keys 1)
;; conflicts a bit with org-mode
;;Keyboard is faster than mouse
(global-unset-key (kbd "<mouse-1>"))
(global-unset-key (kbd "<down-mouse-1>"))
(global-unset-key (kbd "<drag-mouse-1>"))
;; Rehab ↑
;;Remove insanely irritating key-binding
(global-unset-key (kbd "C-z"))
(global-unset-key (kbd "C-x f"))
(global-unset-key (kbd "<M-f4>")) ; rly?
;; Change some global bindings:
(global-set-key (kbd "C-M-d") 'kill-sexp)
(global-set-key (kbd "C-M-i") 'down-list) ;; -i stands for /in/
(global-set-key (kbd "C-M-o") 'up-list) ;; -o stands for /out/
(global-unset-key (kbd "C-M-u"))
;; experimental: try to force myself to use the buffer commands
(global-unset-key (kbd "M-["))
(global-unset-key (kbd "M-]"))
(require 'visible-mark)
(visible-mark-mode t)
(global-visible-mark-mode t)
;(delete 'Git vc-handled-backends)
(require 'magit)
(global-set-key (kbd "C-x C-g") 'magit-status) ;; relates to C-x C-f and C-x C-s
;; Comment out since it does not work reliably
(require 'iy-go-to-char)
(global-set-key (kbd "M-m") 'iy-go-up-to-char)
(global-set-key (kbd "M-M") 'iy-go-up-to-char-backward)
(require 'smart-tab)
(global-smart-tab-mode 1)
;;
;; ace jump mode major function
;;
(autoload
'ace-jump-mode
"ace-jump-mode"
"Emacs quick move minor mode"
t)
;; you can select the key you prefer to
(define-key global-map (kbd "C-c SPC") 'ace-jump-mode)
;;
;; enable a more powerful jump back function from ace jump mode
;;
(autoload
'ace-jump-mode-pop-mark
"ace-jump-mode"
"Ace jump back:-)"
t)
(eval-after-load "ace-jump-mode"
'(ace-jump-mode-enable-mark-sync))
(define-key global-map (kbd "C-x SPC") 'ace-jump-mode-pop-mark)
(defun smart-line-beginning ()
"Move point to the beginning of text on the current line; if that is already
the current position of point, then move it to the beginning of the line."
(interactive)
(let ((pt (point)))
(beginning-of-line-text)
(when (eq pt (point))
(beginning-of-line))))
(global-set-key (kbd "C-a") 'smart-line-beginning)
;; (defun smart-delete-backward-char ()
;; "try to be smart to delete indentation"
;; (interactive)
;; (let ((pt (point)))
;; (beginning-of-line-text)
;; (if (eq pt (point))
;; (delete-indentation)
;; (progn
;; (goto-char pt)
;; (call-interactively 'delete-backward-char)))))
;; (global-set-key "\d" 'smart-delete-backward-char)
(add-to-list 'load-path "~/tmp/expand-region.el")
(require 'expand-region)
(global-set-key (kbd "H-SPC") 'er/expand-region)
(defun emacs-session-filename (session-id)
"Construct a filename to save the session in based on SESSION-ID.
If the directory ~/.emacs.d exists, we make a filename in there, otherwise
a file in the home directory."
(let ((basename (concat "sessions/session." session-id))
(emacs-dir user-emacs-directory))
(expand-file-name (if (file-directory-p emacs-dir)
(concat emacs-dir basename)
(concat "~/.emacs-" basename)))))
(require 'multiple-cursors)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
(global-set-key (kbd "C-S-<mouse-1>") 'mc/add-cursor-on-click)
(global-set-key (kbd "H-.") 'mc/mark-next-like-this)
(global-set-key (kbd "H-,") 'mc/mark-previous-like-this)
(global-set-key (kbd "H-<mouse-1>") 'mc/add-cursor-on-click)
(global-set-key (kbd "<H-f13>") 'mc/mark-pop)
(global-set-key (kbd "H-#") 'mc/insert-numbers)
(global-set-key (kbd "<f13>") 'set-mark-command)
;; clever mark stuff
(defun push-mark-no-activate ()
"Pushes `point' to `mark-ring' and does not activate the region
Equivalent to \\[set-mark-command] when \\[transient-mark-mode] is disabled"
(interactive)
(push-mark (point) t nil)
(message "Pushed mark to ring"))
(global-set-key (kbd "<C-f13>") 'push-mark-no-activate)
(defun jump-to-mark ()
"Jumps to the local mark, respecting the `mark-ring' order.
This is the same as using \\[set-mark-command] with the prefix argument."
(interactive)
(set-mark-command 1))
(global-set-key (kbd "<M-f13>") 'jump-to-mark)
(defun just-activate-mark ()
(interactive)
(exchange-point-and-mark)
(exchange-point-and-mark))
(global-set-key (kbd "<S-f13>") 'just-activate-mark)
;; (defun exchange-point-and-mark-no-activate ()
;; "Identical to \\[exchange-point-and-mark] but will not activate the region."
;; (interactive)
;; (exchange-point-and-mark)
;; (deactivate-mark nil))
;; (define-key global-map [remap exchange-point-and-mark] 'exchange-point-and-mark-no-activate)
(byte-recompile-directory "~/.emacs.d/bibretrieve" 0)
(load "bibretrieve")
(require 'wordnik-synonym)
(global-set-key (kbd "H-=") 'wn/synonym-at-point)
(add-hook 'minibuffer-exit-hook
'(lambda ()
(let ((buffer "*Completions*"))
(and (get-buffer buffer)
(kill-buffer buffer)))
))
;; Open gpg encrypted files on the fly
(require 'epa-file)
(epa-file-enable)
;; Time stamps
;; write
;; Time-stamp: <>
;; in your file and save it to see time stamps at work.
;; Other time stamp format: "%a %b %e, %Y %l:%M %p"
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-active t)
(setq time-stamp-format "%:a %02d %:b %:y, %02H:%02M:%02S, %u")
(setq european-calendar-style 't)
;; first day of the week is monday instead of sunday:
(setq calendar--week--start--day 1)
(require 'highlight-sexps)
(setq echo-keystrokes 0.10)
(set-default 'cursor-type 'box)
(require 'fringe-current-line)
(global-fringe-current-line-mode 1)
(require 'hlinum)
(hlinum-activate)
;; (require 'completion-ui) ;
(setq ibuffer-saved-filter-groups
(quote (("default"
("LaTeχ" (mode . latex-mode))
("Magit" (name . "^\\*magit.*$"))
("elisp" (mode . emacs-lisp-mode))
("org" (mode . org-mode))
("emacs" (or
(name . "^\\*scratch\\*$")
(name . "^\\*Messages\\*$")
(name . "^\\*compilation\\*$")))))))
(add-hook 'ibuffer-mode-hook
'(lambda ()
(ibuffer-switch-to-saved-filter-groups "default")))
;; Try again with ido
(require 'ido)
(ido-mode t)
(set-face-font 'default "-xos4-TerminusPlus-Medium-R-Normal--12-120-72-72-C-60-ISO10646-1")
(mapc
(lambda (face)
(set-face-attribute face nil :weight 'normal))
(face-list))
(setq server-name (kde-current-activity))
(server-start)
(menu-bar-mode -99)