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.
 
 
 

370 lines
12 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-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)
'(compilation-auto-jump-to-first-error 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 (:inherit nil :stipple nil :background "#223939" :foreground "Wheat" :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 semi-bold))))
'(cursor ((t (:background "orchid"))))
'(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"))))
'(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 "goldenrod" :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-<backspace>") 'backward-kill-sexp)
(global-set-key (kbd "<backtab>") '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"))
(setq sourcepair-header-extensions '(".p.tex"))
;; (define-key LaTeX-mode-map (kbd "\\") (lambda () (interactive) (insert ";")))
;; (define-key LaTeX-mode-map (kbd ";") (lambda () (interactive) (insert "\\")))
(define-key LaTeX-mode-map (kbd "C-c }") 'TeX-back-insert-braces)
))
(setq subword-forward-regexp "\\W*\\(\\([\\\\[:upper:]]*\\W?\\)[[:lower:][:digit:]]*\\)")
(setq subword-backward-regexp "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([\\\\[:upper:]]+\\W*\\)\\|\\W\\w+\\)")
(global-set-key (kbd "<f6>") 'sourcepair-load)
;; this should really be called in the hook
(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)
;; 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 ↓
;; mark the date 30/1/2014
(add-to-list 'load-path "~/.emacs.d/emacs-no-easy-keys")
(require 'no-easy-keys)
(no-easy-keys 1)
;;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"))
(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-up-to-char)
(global-set-key (kbd "M-M") 'iy-go-up-to-char-backward)
;;
;; ace jump mode major function
;;
(add-to-list 'load-path "~/.emacs.d/ace-jump-mode/")
(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)
(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-<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-`") '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)
(add-to-list 'load-path "~/.emacs.d")
;; (require 'wordnik)
;; (setq wordnik-api-key "fa815fa92045b7fa23699014d0a01c081b3d9c3c761292bf3")(kbd "H-=") synonym-at-point)
(require 'wordnik-synonym)
(global-set-key (kbd "H-=") 'wn/synonym-at-point)
;; this reimplements TeX-insert-braces to work with negative argument
(defun TeX-insert-braces (arg)
"Make a pair of braces around next ARG sexps and leave point inside.
No argument is equivalent to zero: just insert braces and leave point
between.
If there is an active region, ARG will be ignored, braces will be
inserted around the region, and point will be left after the
closing brace."
(interactive "P")
(if (TeX-active-mark)
(progn
(if (< (point) (mark))
(exchange-point-and-mark))
(insert TeX-grcl)
(save-excursion
(goto-char (mark))
(insert TeX-grop)))
(if (and arg (< arg 0))
(progn
(save-excursion
(backward-sexp (prefix-numeric-value (- 0 arg)))
(insert TeX-grop))
(insert TeX-grcl))
(insert TeX-grop)
(save-excursion
(if arg (forward-sexp (prefix-numeric-value arg)))
(insert TeX-grcl)))))
(defun TeX-back-insert-braces (arg)
(interactive "P")
(if arg (TeX-insert-braces (- 0 arg))
(insert TeX-grcl)))
(setq server-name (kde-current-activity))
(server-start)
(menu-bar-mode -99)