(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-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/")))) '(case-fold-search t) '(current-language-environment "English") '(default-input-method "rfc1345") '(flyspell-duplicate-distance 0) '(flyspell-mark-duplications-flag t) '(font-latex-fontify-sectioning (quote color)) '(global-font-lock-mode t nil (font-lock)) '(inhibit-startup-screen t) '(safe-local-variable-values (quote ((TeX-master . notes\.tex) (bookmark-default-file . "./emacs.bmk")))) '(show-paren-mode t) '(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 (:background "DarkSlateGrey" :foreground "Wheat" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 80 :width normal :foundry "xos4" :family "terminus")))) '(bold ((t (:weight semi-bold)))) '(cursor ((t (:background "orchid")))) '(fixed-pitch ((t (:family "Bitstream Vera Sans Mono")))) '(italic ((((supports :underline t)) nil))) '(menu ((t (:inverse-video t)))) '(mouse ((t (:background "orchid")))) '(tooltip ((t (:inherit default :background "lightyellow" :foreground "black" :foundry "xos4" :family "terminus")))) '(variable-pitch ((t (:family "default")))) '(visible-mark-face ((t (:background "goldenrod2" :foreground "darkslategrey"))))) (setq-default display-buffer-reuse-frames t) (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) (require 'mic-paren) ; loading (paren-activate) ; activating (global-set-key (kbd "C-M-") 'backward-kill-sexp) (global-set-key (kbd "") 'TeX-complete-symbol) (setq mouse-autoselect-window nil) (mouse-wheel-mode t) (load "auctex.el" nil t t) (setq TeX-auto-save t TeX-parse-self t TeX-insert-braces nil) (setq-default TeX-master nil) (setq font-latex-fontify-script nil) (setq LaTeX-equation-label "e_") (setq LaTeX-section-label "s_") (load "~/bibsnarf.el" nil t t) (require 'reftex) ;; KDE stuff ;; (add-to-list 'load-path "~/kde-emacs") (load "qml-mode.el" nil t t); (require 'kde-emacs) ;;(setq kde-full-name "Jacopo De Simoi") ;;(setq kde-email "wilderkde@gmail.com") (setq frame-title-format '("emacs %S: " (buffer-file-name "%f" (dired-directory dired-directory "%b")))) ;; 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) ;;(load "skype.el" nil t t) ;; (add-hook 'LaTeX-mode-hook 'turn-on-auto-fill) (add-hook 'text-mode-hook 'flyspell-mode) (require 'linum) (add-hook 'LaTeX-mode-hook 'linum-mode) ;; Let us see how it goes with this. (add-hook 'LaTeX-mode-hook 'subword-mode) (add-hook 'LaTeX-mode-hook (lambda () (modify-syntax-entry ?\\ "w" LaTeX-mode-syntax-table))) (require 'sourcepair) (add-hook 'LaTeX-mode-hook (lambda () (setq sourcepair-source-extensions '(".tex")))) (add-hook 'LaTeX-mode-hook (lambda () (setq sourcepair-header-extensions '(".p.tex")))) (global-set-key (kbd "") 'sourcepair-load) ;; this should really be called in the hook (setq subword-forward-regexp "\\W*\\(\\([\\\\[:upper:]]*\\W?\\)[[:lower:][:digit:]]*\\)") (setq subword-backward-regexp "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([\\\\[:upper:]]+\\W*\\)\\|\\W\\w+\\)") (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) (defun add-delimiter (delim-begin delim-end r-begin r-end) "Add the pair of delimiters given in delim at the ends of the region if it is activated" (interactive "cBegin delimiter: \ncEnd delimiter: \nr") (if (use-region-p) (progn (save-excursion (goto-char r-end) (insert delim-end) (goto-char r-begin) (insert delim-begin))) (insert delim-begin delim-end))) (defun add-curlybrackets-delimiter (r-begin r-end) "Add a pair {} at the boundary of the current region if activated" (interactive "r") (add-delimiter "{" "}" r-begin r-end)) (defun add-dollar-delimiter (r-begin r-end) "Add a pair {} at the boundary of the current region if activated" (interactive "r") (add-delimiter "$" "$" r-begin r-end)) (require 'key-chord) (key-chord-mode 1) (setq key-chord-two-keys-delay 0.05) (key-chord-define-global "{}" 'add-curlybrackets-delimiter) (key-chord-define-global "4r" "$") (key-chord-define-global "$%" 'add-dollar-delimiter) (global-set-key (kbd "M-[") 'previous-buffer) (global-set-key (kbd "M-]") 'next-buffer) (global-set-key (kbd "M-p") 'backward-paragraph) (global-set-key (kbd "M-n") 'forward-paragraph) ;; 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 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 ↓ ;; stop using the arrow keys ;; mark the date 30/1/2014 (global-unset-key [left]) (global-unset-key [up]) (global-unset-key [right]) (global-unset-key [down]) ;; remove mouse-binding. Keyboard is faster (global-unset-key (kbd "")) (global-unset-key (kbd "")) (global-unset-key (kbd "")) ;; Rehab ↑ ;;Remove insanely irritating key-binding (global-unset-key (kbd "C-z")) (global-unset-key (kbd "C-x f")) (require 'visible-mark) (visible-mark-mode t) (global-visible-mark-mode t) (delete 'Git vc-handled-backends) (require 'magit) (require 'iy-go-to-char) (global-set-key (kbd "M-m") 'iy-go-to-char) (global-set-key (kbd "M-M") 'iy-go-to-char-backward) (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) (add-to-list 'load-path "~/tmp/expand-region.el") (require 'expand-region) (global-set-key (kbd "C-M-h") '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))))) (add-to-list 'load-path "~/.emacs.d/multiple-cursors.el") (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-") '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-") 'mc/add-cursor-on-click) (global-set-key (kbd "H-`") 'mc/mark-pop) ;; 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-`") '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-`") 'jump-to-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) (setq server-name (kde-current-activity)) (server-start) (menu-bar-mode -99)