Commits

Anonymous committed 99a977e

Removed bunch of files

  • Participants
  • Parent commits d9ab602

Comments (0)

Files changed (35)

File files/advices.el

-(defadvice sgml-delete-tag (after reindent-buffer)
-  (cleanup-buffer))
-
-(defadvice sr-tabs-add (after remove-sunrise-from-name activate)
-  (sr-tabs-rename (replace-regexp-in-string "(Sunrise)" "" (buffer-name))))
-
-(defadvice kill-line (before kill-line-autoreindent activate)
-  (if (member major-mode
-              '(
-                lisp-interaction-mode
-                emacs-lisp-mode
-                scheme-mode
-                lisp-mode
-                c-mode
-                c++-mode
-                latex-mode
-                ))
-      (if (and (eolp) (not (bolp)))
-          (progn (forward-char 1)
-                 (just-one-space 0)
-                 (backward-char 1)))))
-
-(defadvice kill-visual-line (before kill-line-autoreindent activate)
-  (if (member major-mode
-              '(
-                lisp-interaction-mode
-                emacs-lisp-mode
-                scheme-mode
-                lisp-mode
-                c-mode
-                c++-mode
-                latex-mode
-                ))
-      (if (and (eolp) (not (bolp)))
-          (progn (forward-char 1)
-                 (just-one-space 0)
-                 (backward-char 1)))))
-
-(defadvice beginning-of-defun (before fix-org-navig activate)
-  (when (eq major-mode 'org-mode) (previous-line)))
-
-(defadvice 2C-dissociate (after close-window-after-disconnect activate)
-  (delete-window))
-
-(defadvice ispell-word (around fix-golden-ration activate)
-  (golden-ratio-mode -1)
-  ad-do-it
-  (golden-ratio-mode 1))
-
-(defadvice quit-window (around fix-golden-ration activate)
-  ad-do-it
-  (golden-ratio))
-
-(defadvice calendar-exit (around close-window activate)
-  (let* ((wl (window-list))
-         (cb (calendar-buffer-list))
-         (wins-to-kill (mapcar (lambda (w) (cons (member (window-buffer w) cb) w)) wl)))
-    ad-do-it
-    (mapc (lambda (w) (when (car w) (delete-window (cdr w)))) wins-to-kill)))

File files/anki-to-tex.el

-(defun my-dictionary-format ()
-  (interactive)
-  (fix-reset-after-each
-    (replace-regexp "" "")
-    (replace-regexp "" "")
-    (replace-string "E'" "\\`E")
-    (replace-regexp "~" "\\\\mytilde{}")
-    (replace-regexp "intransitive" "$\\\\iota$")
-    (replace-regexp "transitive" "$\\\\tau$")
-    (replace-regexp "reflexive" "$\\\\rho$")
-    (replace-regexp "auxiliary" "$\\\\alpha$")
-    (replace-regexp "impersonal" "$\\\\mu$")
-    (replace-regexp "<div><div>" "<div>")
-    (replace-regexp "</div></div>" "</div>")
-    (replace-regexp "&nbsp;" " ")
-    (replace-regexp "&lt;" "<")
-    (replace-regexp "&gt;" ">")
-    (replace-string "< " "$<$ ")
-    (replace-regexp "^<div>" "")
-    (replace-regexp "\t</div>" "\t")
-    (replace-regexp "<br />" "")
-    (replace-regexp "(<i>" "<i>(")
-    (replace-regexp "</i>)" ")</i>")
-    (replace-regexp "<i>\\(.*?\\)</i>" "\\\\emph{\\1}")
-    (replace-regexp "\\([^{]\\)(syn: \\(.*?\\))" "\\1\\\\emph{(syn: \\2)}")
-    (replace-regexp "(syn: \\(.*?\\))" "{\\\\footnotesize ($\\\\sigma\\\\!\\\\!:\\\\!$ \\1)}")
-    (replace-regexp "\\.\\.\\." "\\\\dots ")
-    ;; remove all the divs in front of first tab
-    (with-lines
-      (goto-char (point-min))
-      (save-excursion
-        (save-restriction
-          (narrow-to-region (point) (save-excursion (re-search-forward "\t" nil t)))
-          (replace-string "<div>" "")
-          (replace-string "</div>" ""))))
-    (while (re-search-forward "\t.*?<div>" nil t)
-      (beginning-of-line)
-      (re-search-forward "\t" nil t)
-      (unless (looking-at "<div>")
-        (insert "<div>")
-        (re-search-forward "<div>" nil t)
-        (backward-char 5)
-        (insert "</div>"))
-      (end-of-line)
-      (unless (looking-back "</div>")
-        (insert "</div>")))
-    (while (re-search-forward "\t<div>" nil t)
-      (backward-delete-char 5)
-      (insert "
-\\begin{enumerate}
-\\item ")
-      (end-of-line)
-      (backward-delete-char 6)
-      (insert "
-\\end{enumerate}"))
-    (replace-regexp "^\\(.*?\\)\t" "{\\\\bfseries \\1} ")
-    (replace-regexp "</div><div>" "
-\\\\item ")
-    ;; what is this??
-    (while (re-search-forward "\\\\item \\[" nil t)
-      (backward-delete-char 7)
-      (when (looking-back "^")
-        (backward-delete-char 1))
-      (insert "[")
-      (save-excursion
-        (save-restriction
-          (narrow-to-region (point) (save-excursion (re-search-forward "\\]" nil t)))
-          (goto-char (point-min))
-          (replace-regexp "
-\\\\item " "; "))))
-    (while (re-search-forward "\\[" nil t)
-      (save-excursion
-        (save-restriction
-          (narrow-to-region (point) (1- (save-excursion (re-search-forward "\\]" nil t))))
-          (goto-char (point-min))
-          (insert "{\\footnotesize ")
-          (if (re-search-forward "= " nil t)
-              (progn
-                (backward-delete-char 2)
-                (insert "\\emph{")
-                (goto-char (point-max))
-                (insert ";}}"))
-            (goto-char (point-max))
-            (insert ";}")))))
-    (replace-regexp "\\[\\(.*?\\)\\]" "\\\\emph{\\1}")
-    (let ((case-fold-search nil)) (replace-string "\\Bf" "\\bf"))
-    (my-dictionary-fix-quotes)
-    (replace-regexp "$" "
-")
-    (my-dictionary-remove-single-item-list)
-    (replace-string "enumerate" "enumerate*")))
-
-(defun my-dictionary-fix-quotes ()
-  (interactive)
-  (let ((single 0)
-        (double 0))
-    (fix-reset-after-each
-      (replace-regexp "\\(\\W\\)'\\(\\w\\)" "\\1`\\2")
-      ;; (while (re-search-forward "[^a-z]'[^a-z]" nil t)
-      ;;   (backward-char 1)
-      ;;   (backward-delete-char 1)
-      ;;   (if (= (mod double 2) 0)
-      ;;       (insert "`")
-      ;;     (insert "'"))
-      ;;   (setq single (1+ single)))
-      (while (re-search-forward "\"" nil t)
-        (backward-delete-char 1)
-        (if (= (mod double 2) 0)
-            (insert "``")
-          (insert "''"))
-        (setq double (1+ double))))))
-
-(defun my-dictionary-remove-single-item-list ()
-  (interactive)
-  (goto-char (point-min))
-  (while (re-search-forward "\\\\begin{enumerate}" nil t)
-    (save-excursion
-      (save-restriction
-        (narrow-to-region (match-beginning 0) (save-excursion (re-search-forward "\\\\end{enumerate}" nil t)))
-        (goto-char (point-min))
-        (when (= 1 (count-matches "^\\\\item"))
-          (kill-line 2)
-          (delete-char 6)
-          (end-of-line)
-          (delete-region (point) (point-max))))
-      (beginning-of-line)
-      (backward-delete-char 2)
-      (insert " "))))
-
-(defun my-format-synonyms ()
-  (interactive)
-  (goto-char (point-min))
-  (re-search-forward "Synonyms" nil t)
-  (my-kill-entire-line)
-  (while (re-search-forward "(\\([0-9]+\\))" nil t)
-    (save-excursion
-      (let ((text (buffer-substring-no-properties (point) (point-at-eol))))
-        (goto-char (point-min))
-        (goto-line (string-to-int (match-string 1)))
-        (end-of-line)
-        (insert " (syn:" text ")")))
-    (my-kill-entire-line))
-  (goto-char (point-min))
-  (replace-regexp "\n\\'" "")
-  (clipboard-kill-region (point-min) (point-max)))

File files/defuns-buffer.el

-(defun create-scratch-buffer (mode)
-  "Create a new scratch buffer to work in. (could be *scratch* - *scratchX*)"
-  (interactive (list (if current-prefix-arg
-                         (intern
-                          (ido-completing-read
-                           "Major mode to set: "
-                           (let (r)
-                             (mapatoms
-                              (lambda (x)
-                                (when (s-suffix? "-mode" (symbol-name x))
-                                  (push x r))))
-                             (mapcar 'symbol-name r))))
-                       'emacs-lisp-mode)))
-  (let ((n 0)
-        bufname)
-    (while (progn
-             (setq bufname (concat "*scratch"
-                                   (if (= n 0) "" (int-to-string n))
-                                   "*"))
-             (setq n (1+ n))
-             (get-buffer bufname)))
-    (switch-to-buffer (get-buffer-create bufname))
-    (call-interactively mode)))
-
-(defun untabify-buffer ()
-  (interactive)
-  (untabify (point-min) (point-max)))
-
-(defun indent-buffer ()
-  (interactive)
-  (indent-region (point-min) (point-max)))
-
-(defun indent-defun ()
-  "Indent the current defun."
-  (interactive)
-  (save-restriction
-    (widen)
-    (narrow-to-defun)
-    (indent-buffer)))
-
-(defun my-kill-this-buffer ()
-  "Kill the current buffer.
-Warn me if I want to kill a scratch buffer."
-  (interactive)
-  (if (or (string-match-p "\\*scratch" (buffer-name (current-buffer)))
-          (string-match-p "\\*Messages\\*" (buffer-name (current-buffer))))
-      (when (y-or-n-p "Do you want really to kill this buffer?")
-        (kill-buffer (current-buffer)))
-    (kill-buffer (current-buffer))))
-
-(defun cleanup-buffer-safe ()
-  "Perform a bunch of safe operations on the whitespace content of a buffer.
-Does not indent buffer, because it is used for a before-save-hook, and that
-might be bad."
-  (interactive)
-  (unless (memq major-mode '(makefile-gmake-mode))
-    (untabify-buffer))
-  (delete-trailing-whitespace)
-  (set-buffer-file-coding-system 'utf-8))
-
-(defun cleanup-buffer ()
-  "Perform a bunch of operations on the whitespace content of a buffer.
-Including indent-buffer, which should not be called automatically on save."
-  (interactive)
-  (cleanup-buffer-safe)
-  (indent-buffer))
-
-(defun my-create-directory-on-save ()
-  (when buffer-file-name
-    (let ((dir (file-name-directory buffer-file-name)))
-      (when (and (not (file-exists-p dir))
-                 (y-or-n-p (format "Directory %s does not exist. Create it?" dir)))
-        (make-directory dir t)))))

File files/defuns-edit.el

-(require 'thingatpt)
-(require 's)
-
-(defun my-kill-whitespace (&optional forward)
-  "Kill all the whitespace characters backwards until hitting
-non-whitespace character.  With prefix argument, kill in the
-forward direction."
-  (interactive "P")
-  (let ((old-point (point)))
-    (if forward
-        (skip-syntax-forward " ")
-      (skip-syntax-backward " "))
-    (delete-region old-point (point))))
-
-(defun my-kill-entire-line ()
-  (interactive)
-  (kill-region (point-at-bol) (min (point-max) (1+ (point-at-eol)))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; opening new lines in various ways
-
-(defun my-newline (&optional arg)
-  "Call `newline' and autoindent according to the active mode."
-  (interactive "p")
-  (newline arg)
-  (indent-according-to-mode))
-
-(defun my-open-line (&optional arg)
-  "If point is before the beginning of \"code\", open new line,
-keep the cursor at the current line and autoindent.
-
-If point is in the middle of the line, create a blank line under
-current line, move cursor to this new line and autoindent.
-
-With raw prefix \\[universal-argument] insert newline at point
-and indent next line according to mode."
-  (interactive "P")
-  (if (or (<= (point) (save-excursion
-                        (my-back-to-indentation)
-                        (point)))
-          (equal arg '(4)))
-      (progn
-        (save-excursion
-          (my-newline (if (equal arg '(4)) 1 arg)))
-        (indent-according-to-mode))
-    (end-of-line)
-    (open-line (prefix-numeric-value arg))
-    (next-line 1)
-    (indent-according-to-mode)))
-
-(defun forward-line-and-indent (arg)
-  "Move point ARG lines forward and autoindent."
-  (interactive "p")
-  (forward-line arg)
-  (indent-according-to-mode))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; navigation functions by "units"
-
-(defun forward-paragraph-select ()
-  "Set the active region from point to end of current paragraph"
-  (interactive)
-  (set-mark (point))
-  (forward-paragraph))
-
-(defun backward-paragraph-select ()
-  "Set the active region from point to beginning of current paragraph"
-  (interactive)
-  (set-mark (point))
-  (backward-paragraph))
-
-(defun beginning-of-region ()
-  "Move cursor to the beginning of active region"
-  (interactive)
-  (goto-char (region-beginning)))
-
-(defun end-of-region ()
-  "Move cursor to the end of active region"
-  (interactive)
-  (goto-char (region-end)))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; moving entire lines up and down
-
-;; from https://github.com/skeeto/.emacs.d/blob/master/my-funcs.el
-(defun move-line (n)
-  "Move the current line up or down by N lines."
-  (interactive "p")
-  (setq col (current-column))
-  (beginning-of-line) (setq start (point))
-  (end-of-line) (forward-char) (setq end (point))
-  (let ((line-text (delete-and-extract-region start end)))
-    (forward-line n)
-    (insert line-text)
-    (forward-line -1)
-    (forward-char col)))
-
-(defun move-line-up (n)
-  "Move the current line up by N lines."
-  (interactive "p")
-  (move-line (if (null n) -1 (- n))))
-
-(defun move-line-down (n)
-  "Move the current line down by N lines."
-  (interactive "p")
-  (move-line (if (null n) 1 n)))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; evaluate sexps/macros
-
-(defun eval-and-replace ()
-  "Replace the preceding sexp with its value."
-  (interactive)
-  (backward-kill-sexp)
-  (condition-case nil
-      (prin1 (eval (read (current-kill 0)))
-             (current-buffer))
-    (error (message "Invalid expression")
-           (insert (current-kill 0)))))
-
-(defun expand-macro-and-replace ()
-  "Replace the preceding sexp with its macroexpand."
-  (interactive)
-  (backward-kill-sexp)
-  (condition-case nil
-      (prin1 (macroexpand (read (current-kill 0)))
-             (current-buffer))
-    (error (message "Invalid expression")
-           (insert (current-kill 0)))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; TODO: rework this
-
-(defun copy-line-with-offset (offset)
-  "Save the line specified by offset (+1 = next, -1 = prev) to the kill ring,
-move the current line down and yank"
-  (kill-ring-save (line-beginning-position (+ offset 1))
-                  (line-end-position (+ offset 1)))
-  (let ((pos (point))
-        (line (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
-    (beginning-of-line)
-    (when (or (and (string-match "[:space:]" line)
-                   (> offset 0))
-              (< offset 0))
-      (newline)
-      (forward-line -1))
-    (beginning-of-line)
-    (insert (car kill-ring))
-    (goto-char pos)))
-
-(defun copy-previous-line ()
-  (interactive)
-  (copy-line-with-offset -1))
-
-(defun copy-next-line ()
-  (interactive)
-  (copy-line-with-offset 1))
-
-(defun kill-line-yank-newline ()
-  (interactive)
-  (let ((beg (line-beginning-position))
-        (end (line-end-position))
-        (name (buffer-name))
-        (col (current-column)))
-    (end-of-line)
-    (newline)
-    (beginning-of-line)
-    (insert-buffer-substring name beg end)
-    (move-to-column col t)
-    (unless (eolp) (kill-sexp))))
-
-(defun my-kill-line-yank-newline ()
-  (interactive)
-  (let ((beg (line-beginning-position))
-        (end (line-end-position))
-        (name (buffer-name))
-        (col (current-column)))
-    (end-of-line)
-    (newline)
-    (beginning-of-line)
-    (insert-buffer-substring name beg end)
-    (move-to-column col t)))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; navigate to beg/end of current line, considering indent and
-;; comments
-
-(defun point-in-comment ()
-  "Determine if the point is inside a comment"
-  (interactive)
-  (let ((face (plist-get (text-properties-at (point)) 'face)))
-    (when (not (listp face)) (setq face (list face)))
-    (or (memq 'font-lock-comment-face face)
-        (memq 'font-lock-comment-delimiter-face face))))
-
-(defun my-back-to-indentation ()
-  (if visual-line-mode
-      (flet ((beginning-of-line (arg) (beginning-of-visual-line arg)))
-        (back-to-indentation))
-    (back-to-indentation)))
-
-(defun my-back-to-indentation-or-beginning (&optional arg)
-  "Jump back to indentation of the current line.  If already
-there, jump to the beginning of current line.  If visual mode is
-enabled, move according to the visual lines."
-  (interactive "p")
-  (cond
-   ((and (functionp'org-table-p)
-         (org-table-p))
-    (let ((eob (save-excursion
-                 (re-search-backward "|")
-                 (forward-char 1)
-                 (skip-chars-forward " ")
-                 (point))))
-      (if (= (point) eob)
-          (org-beginning-of-line)
-        (goto-char eob))))
-   ((eq major-mode 'org-mode)
-    (org-beginning-of-line))
-   (t
-    (if (or (/= arg 1)
-            (= (point) (save-excursion
-                         (my-back-to-indentation)
-                         (point))))
-        (progn
-          (if visual-line-mode
-              (beginning-of-visual-line arg)
-            (move-beginning-of-line arg))
-          (when (/= arg 1)
-            (my-back-to-indentation)))
-      (my-back-to-indentation)))))
-
-(defun my-cua-get-longest-line ()
-  (-max (mapcar 'length
-                (split-string
-                 (buffer-substring-no-properties (cua--rectangle-top) (cua--rectangle-bot))
-                 "\n"))))
-
-(defun my-end-of-code-or-line (&optional arg)
-  "Move to the end of code.  If already there, move to the end of line,
-that is after the possible comment.  If at the end of line, move
-to the end of code.
-
-If the point is in org table, first go to the last non-whitespace
-of the cell, then to the end of line.
-
-If CUA rectangle is active, alternate between end of current
-line, end of code, and end of the longest line in rectangle.
-
-Example:
-  (serious |code here)1 ;; useless commend2
-
-In the example, | is the current point, 1 is the position of
-point after one invocation of this funciton, 2 is position after
-repeated invocation. On subsequent calls the point jumps between
-1 and 2.
-
-Comments are recognized in any mode that sets syntax-ppss
-properly."
-  (interactive "p")
-  (flet ((end-of-line-lov () (if visual-line-mode
-                                 (end-of-visual-line arg)
-                               (move-end-of-line arg)))
-         (beg-of-line-lov () (if visual-line-mode
-                                 (beginning-of-visual-line arg)
-                               (move-beginning-of-line arg))))
-    (cond
-     ((and (functionp'org-table-p)
-           (org-table-p))
-      (let ((eoc (save-excursion
-                   (re-search-forward "|")
-                   (backward-char 1)
-                   (skip-chars-backward " ")
-                   (point))))
-        (if (= (point) eoc)
-            (end-of-line-lov)
-          (goto-char eoc))))
-     ((eq major-mode 'org-mode)
-      (org-end-of-line))
-     (t
-      (let ((eoc (save-excursion
-                   (end-of-line-lov)
-                   (while (and (point-in-comment)
-                               (not (bolp)))
-                     (backward-char))
-                   (skip-syntax-backward " ")
-                   ;; if we skipped all the way to the beginning, that
-                   ;; means there's only comment on this line, so this
-                   ;; should just jump to the end.
-                   (if (= (point) (save-excursion
-                                    (beg-of-line-lov)
-                                    (point)))
-                       (progn (end-of-line-lov)
-                              (point))
-                     (point))))
-            ;; end of rectangle in cua-rect mode
-            (eor (when cua--rectangle (my-cua-get-longest-line))))
-        ;; refactor this: make some "move actions" and call them in
-        ;; order until point changes.
-        (cond
-         ((= (point) eoc)
-          (if (and cua--rectangle
-                   (/= (1+ (aref cua--rectangle 3)) eor))
-              (cua-resize-rectangle-right (- eor (current-column) 1))
-            (end-of-line-lov)))
-         ((= (point) (progn (end-of-line-lov) (point)))
-          (if (and cua--rectangle
-                   (/= (1+ (aref cua--rectangle 3)) eor))
-              (cua-resize-rectangle-right (- eor (current-column) 1))
-            (goto-char eoc)))
-         (t (goto-char eoc))))))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; stuff to do with upcasing and downcasing
-;; used sparingly but when you need it it rocks!
-
-(defun my-upcase-letter (&optional arg)
-  (interactive "p")
-  (upcase-region (point) (+ arg (point))))
-
-(defun my-downcase-letter (&optional arg)
-  (interactive "p")
-  (downcase-region (point) (+ arg (point))))
-
-(defun my-smart-downcase-word (&optional arg)
-  (interactive "P")
-  (cond
-   ((equal arg '(4))
-    (downcase-word 1))
-   (t
-    (setq arg (or (prefix-numeric-value arg) 1))
-    (cond
-     ((region-active-p)
-      (downcase-region (region-beginning) (region-end)))
-     ;; handle camel-case
-     ((save-excursion
-        (when (looking-at "[ \t\n]")
-          (forward-whitespace 1))
-        (let* ((w (thing-at-point 'word))
-               (case-fold-search nil)
-               (st (string-match-p "\\([A-Z]+[a-z]+\\)+" w)))
-          (= (if st st -1) 0)))
-      (my-downcase-letter 1)
-      (forward-word))
-     (t
-      (downcase-word arg))))))
-
-(defun my-smart-upcase-word (&optional arg)
-  (interactive "P")
-  (cond
-   ((equal arg '(4))
-    (upcase-word 1))
-   (t
-    (setq arg (or (prefix-numeric-value arg) 1))
-    (cond
-     ((region-active-p)
-      (upcase-region (region-beginning) (region-end)))
-     ;; handle camel-case
-     ((save-excursion
-        (when (looking-at "[ \t\n]")
-          (forward-whitespace 1))
-        (let* ((w (thing-at-point 'word))
-               (case-fold-search nil)
-               (st (string-match-p "[a-z]+\\([A-Z]+[a-z]+\\)+" w)))
-          (= (if st st -1) 0)))
-      (my-upcase-letter 1)
-      (forward-word))
-     (t
-      (upcase-word arg))))))
-
-(defun my-capitalize-word (&optional arg)
-  "Capitalize the next ARG words and move over.
-With negative ARG capitalize previous ARG words but not move the point.
-
-Additionally, when looking at [ \\t]*$, capitalize backwards."
-  (interactive "p")
-  (when (and (looking-at-p "[ \t]*$") (> arg 0))
-    (setq arg (- arg)))
-  (let ((to-cap (delete-and-extract-region (progn
-                                             (when (sp-point-in-symbol)
-                                               (backward-word (- (cl-signum arg))))
-                                             (point))
-                                           (progn
-                                             (forward-word arg)
-                                             (point)))))
-    (insert (s-titleize to-cap))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; insert the text normally but keep the point fixed
-;; useful to prepend text in e.g. `haskell-mode'
-
-(defvar my-insert-no-move-overlay nil)
-(make-variable-buffer-local 'my-insert-no-move-overlay)
-
-(defvar my-insert-no-move-keymap (make-sparse-keymap))
-(define-key my-insert-no-move-keymap (kbd "<backspace>") 'my-insert-no-move-delete-backward)
-(define-key my-insert-no-move-keymap [remap self-insert-command] 'my-insert-no-move-self-insert-command)
-(define-key my-insert-no-move-keymap (kbd "C-g") 'my-insert-no-move-cancel)
-
-(defun my-insert-no-move ()
-  (interactive)
-  (when my-insert-no-move-overlay
-    (my-insert-no-move-cancel))
-  (setq my-insert-no-move-overlay (make-overlay (point) (point) nil nil t))
-  (overlay-put my-insert-no-move-overlay 'keymap my-insert-no-move-keymap))
-
-(defun my-insert-no-move-delete-backward (&optional arg)
-  (interactive "p")
-  (let ((s (overlay-start my-insert-no-move-overlay))
-        (e (overlay-end my-insert-no-move-overlay)))
-    (if (/= (point) s)
-        (backward-delete-char arg)
-      (goto-char e)
-      (backward-delete-char arg)
-      (goto-char s))))
-
-(defun my-insert-no-move-self-insert-command (&optional arg)
-  (interactive "p")
-  (goto-char (overlay-end my-insert-no-move-overlay))
-  (self-insert-command arg)
-  (goto-char (overlay-start my-insert-no-move-overlay)))
-
-(defun my-insert-no-move-cancel (&optional arg)
-  (interactive "p")
-  (delete-overlay my-insert-no-move-overlay)
-  (setq my-insert-no-move-overlay nil))

File files/defuns-macros.el

-(defmacro save-kill-ring (&rest body)
-  "Save the kill ring and execute the BODY.  After BODY is
-executed, the kill-ring value is restored to the state before
-BODY was executed"
-  (declare (indent 0))
-  ;; initialize new binding for the ,@body.  It starts with the global
-  ;; original value.  After ,@body is executed, the new binding is
-  ;; thrown away!
-  `(let ((kill-ring kill-ring))
-     ,@body))
-
-(defmacro save-buffer-list (&rest forms)
-  "Execute FORMS while preserving the list of opened buffers.
-After the FORMS are executed, close all buffers that were not
-opened before.  This does not re-open closed buffers as that
-might often be impossible."
-  (declare (indent 0))
-  `(let ((old-buffer-list (buffer-list)))
-     ,@forms
-     (mapc (lambda (buffer)
-             (when (member buffer old-buffer-list)
-               (kill-buffer buffer)))
-           (buffer-list))))
-
-;; this is still broken :/
-(defmacro with-files-in-dir (directory &rest forms)
-  (declare (indent 1))
-  `(save-buffer-list
-     (save-excursion
-       (mapc (lambda (file)
-               (find-file (concat ,directory "/" file))
-               ,@forms)
-             (directory-files ,directory)))))
-
-(defmacro with-map-bind-keys (map &rest forms)
-  (declare (indent 1))
-  `(progn
-     ,@(mapcar (lambda (form) (append '(bind-key) form `(,map))) forms)))
-
-(defmacro with-lines (&rest forms)
-  (declare (indent 0))
-  `(while (not (eobp))
-     (let ((beg (point-at-bol))
-           (end (point-at-eol)))
-       (save-excursion
-         (save-restriction
-           (narrow-to-region beg end)
-           ,@forms)))
-     (forward-line)))
-
-(defmacro fix-reset-after-each (&rest forms)
-  (declare (indent 0))
-  `(progn
-     ,@(apply 'append (mapcar (lambda (form) (list '(beginning-of-buffer) form)) forms))))
-
-(defvar my-macro-names
-  '(
-    "save-buffer-list"
-    "save-kill-ring"
-    "with-files-in-dir"
-    "with-map-bind-keys"
-    "with-lines"
-    "fix-reset-after-each"
-    ))
-
-(font-lock-add-keywords 'emacs-lisp-mode `((,(concat "(\\<"
-                                                     (regexp-opt my-macro-names 'paren)
-                                                     "\\>")
-                                            1 font-lock-keyword-face)) 'append)

File files/defuns.el

-;;; Personal functions
-
-;; For loading libraries from the vendor directory
-;; Modified from defunkt's original version to support autoloading.
-;; http://github.com/defunkt/emacs/blob/master/defunkt/defuns.el
-(defun vendor (library &rest autoload-functions)
-  (let* ((file (symbol-name library))
-         (normal (concat "~/.emacs.d/vendor/" file))
-         (suffix (concat normal ".el"))
-         (personal (concat "~/.emacs.d/files/" file))
-         (found nil))
-    (cond
-     ((file-directory-p normal) (add-to-list 'load-path normal) (set 'found t))
-     ((file-directory-p suffix) (add-to-list 'load-path suffix) (set 'found t))
-     ((file-exists-p suffix)  (set 'found t)))
-    (when found
-      (if autoload-functions
-          (progn
-            (dolist (autoload-function autoload-functions)
-              (autoload autoload-function (symbol-name library) nil t))
-            (eval-after-load library
-              `(when (file-exists-p (concat ,personal ".el"))
-                 (load ,personal))))
-        (require library)
-        (when (file-exists-p (concat personal ".el"))
-          (load personal))))))
-
-(defun lorem ()
-  (interactive)
-  (insert "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent libero orci, auctor sed, faucibus vestibulum, gravida vitae, arcu. Nunc posuere. Suspendisse potenti. Praesent in arcu ac nisl ultricies ultricies. Fusce eros. Sed pulvinar vehicula ante. Maecenas urna dolor, egestas vel, tristique et, porta eu, leo. Curabitur vitae sem eget arcu laoreet vulputate. Cras orci neque, faucibus et, rhoncus ac, venenatis ac, magna. Aenean eu lacus. Aliquam luctus facilisis augue. Nullam fringilla consectetuer sapien. Aenean neque augue, bibendum a, feugiat id, lobortis vel, nunc. Suspendisse in nibh quis erat condimentum pretium. Vestibulum tempor odio et leo. Sed sodales vestibulum justo. Cras convallis pellentesque augue. In eu magna. In pede turpis, feugiat pulvinar, sodales eget, bibendum consectetuer, magna. Pellentesque vitae augue."))
-
-;; some functions to ease the work with mark and mark-ring
-(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"))
-
-(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))
-
-(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))
-
-(defun my-mini-calc (expr &optional arg)
-  "Calculate expression.
-
-If ARG is given, then insert the result to current-buffer"
-  (interactive
-   (list (read-from-minibuffer "Enter expression: ")
-         current-prefix-arg))
-  (let ((result (calc-eval expr)))
-    (if arg
-        (insert result)
-      (message (format "Result: [%s] = %s" expr result)))))
-
-(defsubst buffer-narrowed-p ()
-  "Return non-nil if the current buffer is narrowed."
-  (/= (- (point-max) (point-min)) (buffer-size)))
-
-;;; function overloads
-(eval-after-load "hi-lock"
-  '(progn
-     (defun hi-lock-read-face-name ()
-       "Read face name from minibuffer with completion and history."
-       (intern (completing-read
-                "Highlight using face: "
-                (mapcar 'symbol-name (face-list))
-                nil
-                nil
-                "hi-"
-                'face-name-history
-                (car hi-lock-face-defaults))))))
-
-;; By Stefan Monnier <foo at acm.org>.
-(defun unfill-paragraph ()
-  "Take a multi-line paragrap and make it into a single line of text.
-This is the opposite of fill-paragraph."
-  (interactive)
-  (let ((fill-column (point-max)))
-    (fill-paragraph nil)))
-
-(defun* my-list-interactive (&optional (file-name (buffer-file-name)))
-  "Return a list of all interactive functions in file FILE-NAME."
-  (loop for i in (cdr (assoc-string file-name load-history))
-           if (and (consp i) (eq (car i) 'defun) (commandp (cdr i)))
-           collect (cdr i)))
-
-(defun remove-dos-eol ()
-  "Do not show ^M in files containing mixed UNIX and DOS line endings."
-  (interactive)
-  (setq buffer-display-table (make-display-table))
-  (aset buffer-display-table ?\^M []))
-
-(defun my-gather-hippie ()
-  (let (re)
-    (flet ((he-substitute-string
-            (str &optional trans-case)
-            (when (not (member str re)) (!cons str re)))
-           (message (&rest args) t))
-      (setq he-num -1)
-      (hippie-expand nil)
-      (let ((this-command 'a)
-            (last-command 'a))
-        (while (hippie-expand nil))))
-    re))
-
-(defun my-possible-expand ()
-  (let* ((p (point))
-         (sap (bounds-of-thing-at-point 'sexp))
-         (start (car sap))
-         (end (cdr sap))
-         (orig (buffer-substring-no-properties start end)))
-    (save-excursion (insert " "))
-    (let ((expands (my-gather-hippie))
-          (suffix (buffer-substring-no-properties (1+ p) (1+ end))))
-      (delete-char 1)
-      (delete-region start end)
-      (let ((kill-ring (append (list orig) (--filter (s-ends-with? suffix it) expands))))
-        (browse-kill-ring)))))
-
-(defun my-assimil--format-line (fill)
-  (let ((fill-column 38)
-        (fill-prefix fill))
-    (fill-region (line-beginning-position) (line-end-position))))
-
-(defun my-assimil-format (arg)
-  (interactive "p")
-  (dotimes (i arg)
-    (my-assimil--format-line "     ")
-    (forward-line -1)))
-
-(defun my-assimil-format-ubung (arg)
-  (interactive "p")
-  (dotimes (i arg)
-    (my-assimil--format-line "   ")
-    (forward-line -1)))
-
-(defun my-assimil-insert-dialog-template (arg)
-  (interactive "p")
-  (dotimes (i arg)
-    (insert (format "%2d - \n" (1+ i)))))
-
-(defun my-assimil-insert-ubung-template (arg)
-  (interactive "p")
-  (dotimes (i arg)
-    (insert (format "%d. \n" (1+ i)))))

File files/desktop.el

-;; desktop settings for session management
-;; currently, we only save sunrise tabs
-(require 'desktop)
-(defun my-desktop-filter (buffer)
-  (let ((mode (with-current-buffer buffer major-mode)))
-    (eq mode 'sr-mode)))
-
-(setq desktop-dirname "~/.emacs.d/desktop/")
-(setq desktop-path (list desktop-dirname))
-(desktop-save-mode 1)
-(setq history-length 250)
-
-;; Autosave
-(defun my-desktop-save ()
-  (interactive)
-  ;; Don't call desktop-save-in-desktop-dir, as it prints a message.
-  (if (eq (desktop-owner) (emacs-pid))
-      (desktop-save desktop-dirname)))
-(add-hook 'auto-save-hook 'my-desktop-save)
-
-(defcustom desktop-buffer-filter nil
-  "If not nil, run the specified function on each buffer to determine
-if it should be saved or not. The function should have type buffer -> bool.
-This is a more general way to filter buffers that are to be saved than simple
-blacklist."
-  :type 'symbol
-  :group 'desktop
-  :version "24.1")
-
-;; Modification of desktop-save to include buffer-filtering.
-;; If `desktop-buffer-filter' is not nil, run it on each buffer in
-;; (buffer-list) to determine if it should be saved
-(defun desktop-save (dirname &optional release)
-  "Save the desktop in a desktop file.
-Parameter DIRNAME specifies where to save the desktop file.
-Optional parameter RELEASE says whether we're done with this desktop.
-See also `desktop-base-file-name'."
-  (interactive "DDirectory to save desktop file in: ")
-  (setq desktop-dirname (file-name-as-directory (expand-file-name dirname)))
-  (save-excursion
-    (let ((eager desktop-restore-eager)
-          (new-modtime (nth 5 (file-attributes (desktop-full-file-name)))))
-      (when
-          (or (not new-modtime)      ; nothing to overwrite
-              (equal desktop-file-modtime new-modtime)
-              (yes-or-no-p (if desktop-file-modtime
-                               (if (> (float-time new-modtime) (float-time desktop-file-modtime))
-                                   "Desktop file is more recent than the one loaded.  Save anyway? "
-                                 "Desktop file isn't the one loaded.  Overwrite it? ")
-                             "Current desktop was not loaded from a file.  Overwrite this desktop file? "))
-              (unless release (error "Desktop file conflict")))
-
-        ;; If we're done with it, release the lock.
-        ;; Otherwise, claim it if it's unclaimed or if we created it.
-        (if release
-            (desktop-release-lock)
-          (unless (and new-modtime (desktop-owner)) (desktop-claim-lock)))
-
-        (with-temp-buffer
-          (insert
-           ";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\n"
-           desktop-header
-           ";; Created " (current-time-string) "\n"
-           ";; Desktop file format version " desktop-file-version "\n"
-           ";; Emacs version " emacs-version "\n")
-          (save-excursion (run-hooks 'desktop-save-hook))
-          (goto-char (point-max))
-          (insert "\n;; Global section:\n")
-          (mapc (function desktop-outvar) desktop-globals-to-save)
-          (when (memq 'kill-ring desktop-globals-to-save)
-            (insert
-             "(setq kill-ring-yank-pointer (nthcdr "
-             (int-to-string (- (length kill-ring) (length kill-ring-yank-pointer)))
-             " kill-ring))\n"))
-
-          (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n")
-          (dolist (l (mapcar 'desktop-buffer-info (buffer-list)))
-            (let ((base (pop l)))
-              (when (and (apply 'desktop-save-buffer-p l)
-                         (if desktop-buffer-filter (funcall desktop-buffer-filter
-                                                            (get-buffer (cadr l))) t))
-                (insert "("
-                        (if (or (not (integerp eager))
-                                (if (zerop eager)
-                                    nil
-                                  (setq eager (1- eager))))
-                            "desktop-create-buffer"
-                          "desktop-append-buffer-args")
-                        " "
-                        desktop-file-version)
-                ;; If there's a non-empty base name, we save it instead of the buffer name
-                (when (and base (not (string= base "")))
-                  (setcar (nthcdr 1 l) base))
-                (dolist (e l)
-                  (insert "\n  " (desktop-value-to-string e)))
-                (insert ")\n\n"))))
-
-          (setq default-directory desktop-dirname)
-          (let ((coding-system-for-write 'emacs-mule))
-            (write-region (point-min) (point-max) (desktop-full-file-name) nil 'nomessage))
-          ;; We remember when it was modified (which is presumably just now).
-          (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))))))))

File files/emacs-lisp-mode.el

-(require 'thingatpt)
-
-(setq my-emacs-lisp-open-line-list '(
-                                    if
-                                    when
-                                    unless
-                                    defun
-                                    defmacro
-                                    defvar
-                                    defcustom
-                                    let
-                                    let*
-                                    progn
-                                    ))
-
-(defun my-emacs-lisp-open-line ()
-  "Opens a new line if the point is at the closing parens of
-function on `my-emacs-lisp-open-line-list'."
-  (interactive)
-  (ignore-errors
-    (my-newline)
-    (when (and (save-excursion
-                 (forward-char)
-                 (backward-sexp)
-                 (when (listp (sexp-at-point))
-                   (memq (car (sexp-at-point)) my-emacs-lisp-open-line-list)))
-               (thing-at-point 'sexp)
-               (eq (following-char) ?\)))
-      (newline)
-      (indent-according-to-mode)
-      (previous-line))))
-
-(defun my-describe-thing-in-buffer ()
-  "Display the full documentation of FUNCTION (a symbol) in the help buffer."
-  (interactive)
-  (let ((function (function-called-at-point))
-        (variable (variable-at-point)))
-    (cond
-     ((/= variable 0) (describe-variable variable))
-     (function (describe-function function)))))
-
-;; global elisp settings
-(eldoc-in-minibuffer-mode 1)
-
-(defun my-emacs-lisp-init ()
-  (with-map-bind-keys emacs-lisp-mode-map
-    ("RET" 'my-emacs-lisp-open-line)
-    ("C-M-;" 'clippy-describe-function)
-    ("C-. ." 'my-describe-thing-in-buffer))
-
-  (set-input-method "english-prog")
-  (eldoc-mode 1)
-  (letcheck-mode t))
-
-(defun my-wrap-region (beg end)
-  (goto-char end)
-  (insert ")")
-  (goto-char beg)
-  (insert "("))
-
-(defun my-goto-dominating-let ()
-  "Find dominating let form"
-  (while (and (> (car (syntax-ppss)) 0)
-              (not (ignore-errors
-                     (backward-up-list)
-                     (save-excursion
-                       (down-list)
-                       (memq (symbol-at-point) '(let let*))))))))
-
-(defun my-extract-to-let (name &optional arg)
-  "Extract the form at point into a variable called NAME placed
-in a let form ARG levels up.
-
-If ARG is \\[universal-argument] place the variable into the most
-inner let form point is inside of."
-  (interactive "sName of variable: \nP")
-  (let ((new-vform (sp-get (sp--next-thing-selection) (delete-and-extract-region :beg-prf :end)))
-        (raw (sp--raw-argument-p arg))
-        (arg (prefix-numeric-value arg)))
-    (save-excursion
-      (cond
-       (raw
-        (my-goto-dominating-let)
-        (progn
-          (down-list)
-          (forward-sexp 2)
-          (backward-down-list)
-          (insert "\n(" name " " new-vform ")")
-          (indent-according-to-mode)))
-       (t
-        (backward-up-list arg)
-        (if (> arg 0)
-            (sp-get (sp--next-thing-selection) (my-wrap-region :beg-prf :end))
-          (insert "()")
-          (backward-char))
-        (insert "let ((" name " " new-vform "))\n")
-        (backward-up-list)
-        (indent-sexp))))
-    (if (> arg 0)
-        (insert name)
-      (forward-sexp)
-      (backward-down-list)
-      (save-excursion
-        (insert "\n")
-        (backward-up-list)
-        (indent-sexp)))))
-
-(defun my-merge-let-forms ()
-  "Merge the most inner let form into the next outer one."
-  (interactive)
-  (save-excursion
-    (my-goto-dominating-let)
-    (down-list)
-    (forward-sexp 2)
-    (backward-sexp)
-    (let ((var-list (sp-get (sp--next-thing-selection) (delete-and-extract-region :beg-prf :end))))
-      (sp-splice-sexp-killing-backward 1)
-      (my-goto-dominating-let)
-      (down-list)
-      (forward-sexp 2)
-      (backward-down-list)
-      (insert "\n" var-list)
-      (backward-down-list)
-      (sp-unwrap-sexp)
-      (backward-up-list 2)
-      (indent-sexp))))
-
-(add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-init)

File files/evil.el

-(define-key evil-normal-state-map [?\e] 'evil-force-normal-state)
-(define-key evil-visual-state-map [?\e] 'evil-exit-visual-state)
-(define-key evil-insert-state-map [?\e] 'evil-normal-state)
-(define-key evil-replace-state-map [?\e] 'evil-normal-state)
-(define-key evil-ex-completion-map [?\e] 'abort-recursive-edit)
-
-(setq evil-normal-state-tag   (propertize "N" 'face '((:background "#73d216" :foreground "black")))
-      evil-emacs-state-tag    (propertize "E" 'face '((:background "#f57900" :foreground "black")))
-      evil-insert-state-tag   (propertize "I" 'face '((:background "#cc0000")))
-      evil-motion-state-tag   (propertize "M" 'face '((:background "blue")))
-      evil-visual-state-tag   (propertize "V" 'face '((:background "#eeeeec" :foreground "black")))
-      evil-operator-state-tag (propertize "O" 'face '((:background "purple"))))
-
-(setq evil-normal-state-cursor '("#73d216" t)
-      evil-visual-state-cursor '("#eeeeec" t))
-
-(evil-define-operator sp-evil-move-end (beg end type)
-  "Move to the end of the next motion or text object."
-  (interactive "<R>")
-  (message "beg: %s end: %s type: %s" beg end type)
-  (goto-char end))
-
-(evil-define-operator sp-evil-move-beginning (beg end type)
-  "Move to the beginning of the next motion or text object."
-  (interactive "<R>")
-  (goto-char beg))
-
-(evil-define-text-object sp-evil-a-sexp (count &optional beg end type)
-  "Smartparens sexp object."
-  (save-excursion
-    (let ((obj (sp--next-thing-selection count)))
-      (sp-get obj
-        (message "a-sexp %s %s" :beg-prf :end)
-        (list :beg-prf :end)))))
-
-(evil-define-text-object sp-evil-a-paren (count &optional beg end type)
-  "Smartparens paren object.  This is the enclosing sexp."
-  (let ((obj (sp-get-enclosing-sexp count)))
-    (sp-get obj (list :beg-prf :end))))
-
-(defvar sp-prefix-beg-of-obj nil)
-
-(evil-define-text-object sp-evil-inner-paren (count &optional beg end type)
-  "Smartparens inner paren object.  This is insides of the
-enclosing sexp."
-  (let ((obj (if sp-prefix-beg-of-obj
-                 (progn (message "inner, foo") (sp--next-thing-selection '(4)))
-               (message "inner, bar")
-               (sp-get-enclosing-sexp count))))
-    (sp-get obj (message "inner paren, %s %s" :beg-in :end-in))
-    (sp-get obj (list :beg-in :end-in))))
-
-(define-key evil-inner-text-objects-map "[" 'sp-evil-inner-paren)
-(define-key evil-inner-text-objects-map "]" 'sp-evil-inner-paren)
-
-(evil-define-text-object sp-evil-end-of-obj (count beg end)
-  "Modify the next object to be an end movement."
-  (interactive "<c><r>")
-  (message "count: %s beg: %s end: %s" count beg end)
-  (list (point) end))
-
-(evil-define-text-object sp-evil-beg-of-obj (count beg end)
-  "Modify the next object to be a beg movement."
-  (interactive "<c>" (let ((sp-prefix-beg-of-obj t)) (evil-operator-range)))
-  (message "beg obj, count: %s beg: %s end: %s" count beg end)
-  (list beg end))
-
-(evil-define-text-object sp-evil-pair-obj (count beg end)
-  "Modify the next object to be a pair movement."
-  (interactive "<c>" (let ((sp-prefix-pair-object t)) (evil-operator-range)))
-  (message "pair obj, count: %s beg: %s end: %s" count beg end)
-  (list beg end))
-
-(evil-define-text-object sp-evil-tag-obj (count beg end)
-  "Modify the next object to be a tag movement."
-  (interactive "<c>" (let ((sp-prefix-tag-object t)) (evil-operator-range)))
-  (message "tag obj, count: %s beg: %s end: %s" count beg end)
-  (list beg end))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; evil bindings, smartparens related
-
-(define-key evil-outer-text-objects-map "e" 'sp-evil-a-sexp)
-(define-key evil-outer-text-objects-map "[" 'sp-evil-a-paren)
-(define-key evil-outer-text-objects-map "]" 'sp-evil-a-paren)
-
-;; [[ etc. navigated defuns, [( etc. navigated (backward)-up-list
-(define-key evil-motion-state-map "[" 'sp-evil-beg-of-obj)
-(define-key evil-motion-state-map "]" 'sp-evil-end-of-obj)
-(define-key evil-motion-state-map "/" 'sp-evil-pair-obj)
-(define-key evil-motion-state-map "?" 'sp-evil-tag-obj)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; custom evil bindings
-
-(define-key evil-normal-state-map "M" 'evil-set-marker)
-
-;; my own evil movements. Some default bindings were moved here.
-(defvar my-evil-move-map (make-sparse-keymap))
-(define-prefix-command 'my-evil-move-map)
-(define-key evil-normal-state-map "m" my-evil-move-map)
-(define-key my-evil-move-map "]]" 'evil-forward-section-begin)
-(define-key my-evil-move-map "][" 'evil-forward-section-end)
-(define-key my-evil-move-map "[[" 'evil-backward-section-begin)
-(define-key my-evil-move-map "[]" 'evil-backward-section-end)
-(define-key my-evil-move-map "d" 'sp-down-sexp)
-(define-key my-evil-move-map "a" 'sp-backward-down-sexp)
-
-(define-key evil-normal-state-map (kbd "C-.") nil)

File files/expand-region.el

-(bind-key "s-'" 'er/expand-region)

File files/golden-ratio.el

-;;; Automatic resizing of Emacs windows to the golden ratio
-
-(golden-ratio-enable)
-
-(defadvice ispell-word (around golden-ratio-temp-disable activate)
-  (golden-ratio-disable)
-  ad-do-it
-  (golden-ratio-enable))
-
-(defadvice ediff-quit (after golden-ratio-enable activate)
-  (golden-ratio-enable))
-
-(defadvice ediff-buffers (after golden-ratio-disable activate)
-  (golden-ratio-disable)
-  (balance-windows)
-  (enlarge-window -10)
-  (balance-windows)
-  (execute-kbd-macro "?")
-  (execute-kbd-macro "|"))

File files/ibuffer.el

-(require 'ibuffer)
-;; filter groups
-(setq ibuffer-saved-filter-groups
-      (quote (("default"
-               ("Org" ;; all org-related buffers
-                (mode . org-mode))
-               ("emacs-elpa"
-                (or (predicate
-                     .
-                     (let ((bfn (buffer-file-name (current-buffer))))
-                       (when bfn
-                         (and (string-match-p "\\.emacs\\.d/elpa" bfn)
-                              (eq major-mode 'emacs-lisp-mode)))))))
-               ("emacs-config"
-                (or (predicate
-                     .
-                     (let ((bfn (buffer-file-name (current-buffer))))
-                       (when bfn
-                         (and (string-match-p "\\.emacs\\.d" bfn)
-                              (eq major-mode 'emacs-lisp-mode)))))))
-               ("emacs"
-                (or (mode . emacs-lisp-mode)
-                    (mode . lisp-interaction-mode)
-                    (mode . inferior-emacs-lisp-mode)))
-               ("TeX"
-                (or (mode . tex-mode)
-                    (mode . plain-tex-mode)
-                    (mode . latex-mode)))
-               ("Markdown" (or (mode . markdown-mode)
-                               (mode . gfm-mode)))
-               ("Web"
-                (or (mode . html-mode)
-                    (mode . css-mode)
-                    (mode . php-mode)
-                    (mode . js-mode)))
-               ("Dired"
-                (mode . dired-mode))
-               ("Langs"
-                (or (predicate
-                     .
-                     (let ((bfn (buffer-file-name (current-buffer))))
-                       (when bfn
-                         (string-match-p "d:/languages" bfn))))))
-               ("Images"
-                (or (mode . image-dired-display-image-mode)
-                    (mode . image-dired-thumbnail-mode)
-                    (mode . image-mode)))
-               ("Tramp"
-                (or (name . "tramp")))
-               ("Programming" ;; prog stuff not already in MyProjectX
-                (or
-                 (mode . c-mode)
-                 (mode . perl-mode)
-                 (mode . python-mode)
-                 (mode . cc-mode)
-                 ;; etc
-                 ))
-               ("IRC"
-                (or (mode . erc-mode)))
-               ))))
-
-;; (define-ibuffer-filter in-directory
-;;   "Toggle current view to buffers whose default-directory is in QUALIFIER."
-;;   (:description "in-directory"
-;;    :reader (read-directory-name "Directory: "))
-;;   (with-current-buffer buf (file-in-directory-p default-directory qualifier)))
-
-(define-ibuffer-column size-h
-  (:name "Size"
-   :inline t
-   :summarizer
-   (lambda (column-strings)
-     (let ((total 0))
-       (dolist (string column-strings)
-         (setq total
-               ;; like, ewww ...
-               (+
-                (let ((number (float (string-to-number string))))
-                  (cond
-                   ((string-match-p "K" string)
-                    (* number 1000))
-                   ((string-match-p "M" string)
-                    (* number 1000000))
-                   (t number)))
-                total)))
-       (file-size-human-readable total 'si))))
-  (file-size-human-readable (buffer-size) 'si))
-
-;; Modify the default ibuffer-formats
-(setq ibuffer-formats
-      '((mark modified vc-status-mini read-only
-              " " (name 25 25 :left :elide)
-              " " (size-h 9 -1 :right)
-              " " (mode 16 16 :left :elide)
-
-              " " filename-and-process)
-        (mark " " (name 16 -1)
-              " " filename)))
-
-;; startup function
-(defun customize-ibuffer-mode ()
-  "Startup function."
-  (ibuffer-switch-to-saved-filter-groups "default")
-  (add-to-list 'ibuffer-hidden-filter-groups "Tramp")
-  (add-to-list 'ibuffer-hidden-filter-groups "emacs-elpa")
-  (visual-line-mode -1)
-  (toggle-truncate-lines 1))
-(add-hook 'ibuffer-mode-hook 'customize-ibuffer-mode)
-
-;; Switching to ibuffer puts the cursor on the most recent buffer
-(defadvice ibuffer (around ibuffer-point-to-most-recent activate) ()
-  "Open ibuffer with cursor pointed to most recent buffer name"
-  (let ((recent-buffer-name (buffer-name)))
-    ad-do-it
-    (ibuffer-jump-to-buffer recent-buffer-name)))

File files/irc.el

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; ERC
-
-(setq global-mode-string '("" erc-modified-channels-object))
-
-;; special colors for some people
-(setq erc-nick-color-alist '(;; ##latin
-                             ("theseb" . "dodger blue")
-                             ("godmy" . "indian red")
-                             ("fuco" . "SkyBlue1") ;;#8cc4ff
-                             ("rhemaxx0s" . "medium sea green")
-                             ("tonitrus" . "forest green")
-                             ;; #emasc
-                             ("wgreenhouse" . "green")
-                             ("nicferrier" . "indian red")
-                             ("ijp" . "cornflower blue")
-                             ("forcer" . "forest green")
-                             ("fsbot" . "gray35")
-                             ("fsbot`" . "gray35")
-                             ("jlf" . "NavajoWhite4")
-                             ("taylanub" . "DeepSkyBlue1")
-                             ("jordigh" . "orchid1")
-                             ))
-
-(defun erc-get-color-for-nick (nick)
-  "Gets a color for NICK. If NICK is in erc-nick-color-alist, use
-that color, else hash the nick and use a random color from the
-pool"
-  (or (cdr (assoc (downcase nick) erc-nick-color-alist))
-      "#edd400"))
-
-(defun erc-put-color-on-nick ()
-  "Modifies the color of nicks according to erc-get-color-for-nick"
-  (let (word bounds)
-    (save-excursion
-      (let ((inhibit-read-only t)) (put-text-property (point-min) (point-max) 'read-only nil))
-      (goto-char (point-min))
-      (while (or (forward-word 1) (not (eobp)))
-        (setq bounds (bounds-of-thing-at-point 'word))
-        (when bounds
-          (setq word (buffer-substring-no-properties
-                      (car bounds) (cdr bounds)))
-          (when (or (and (erc-server-buffer-p) (erc-get-server-user word))
-                    (and erc-channel-users (erc-get-channel-user word)))
-            (put-text-property (car bounds) (cdr bounds)
-                               'face (cons 'foreground-color
-                                           (erc-get-color-for-nick word)))
-            ))))))
-
-(add-hook 'erc-insert-post-hook 'erc-put-color-on-nick)
-
-(defun my-erc-init ()
-  (modify-syntax-entry ?\_ "w" nil)
-  (modify-syntax-entry ?\- "w" nil)
-  (modify-syntax-entry ?` "w" nil))
-(add-hook 'erc-mode-hook 'my-erc-init)
-
-(defun my-erc-join-channel ()
-  (smartparens-mode -1)
-  (show-smartparens-mode -1)
-  (visual-line-mode 1)
-  (erc-fill-mode -1))
-(add-hook 'erc-join-hook 'my-erc-join-channel)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; RCIRC
-
-(eval-after-load 'rcirc
-  '(defun-rcirc-command reconnect (arg)
-     "Reconnect the server process."
-     (interactive "i")
-     (unless process
-       (error "There's no process for this target"))
-     (let* ((server (car (process-contact process)))
-            (port (process-contact process :service))
-            (nick (rcirc-nick process))
-            channels query-buffers)
-       (dolist (buf (buffer-list))
-         (with-current-buffer buf
-           (when (eq process (rcirc-buffer-process))
-             (remove-hook 'change-major-mode-hook
-                          'rcirc-change-major-mode-hook)
-             (if (rcirc-channel-p rcirc-target)
-                 (setq channels (cons rcirc-target channels))
-               (setq query-buffers (cons buf query-buffers))))))
-       (delete-process process)
-       (rcirc-connect server port nick
-                      rcirc-default-user-name
-                      rcirc-default-full-name
-                      channels))))

File files/latex-mode.el

-(use-package tex-site
-  :load-path "site-lisp/auctex/"
-  :mode ("\\.tex\\'" . TeX-latex-mode)
-  :commands TeX-latex-mode
-  :config
-  (progn
-    (use-package latex
-      :defer t
-      :config
-      (progn
-        (require 'smartparens-latex)
-        (sp-local-pair 'latex-mode "\\begin" "\\end")
-        (sp-local-tag 'latex-mode "\\ba" "\\begin{align*}" "\\end{align*}")
-
-        (use-package preview)
-        (use-package font-latex)
-        (fset 'tex-font-lock-suscript 'ignore)
-
-        (sp-with-modes '(tex-mode plain-tex-mode latex-mode)
-          (sp-local-pair "\\[" nil :post-handlers '(my-latex-math-block-indent)))
-
-        (defun my-latex-math-block-indent (a action c)
-          (when (eq action 'insert)
-            (newline-and-indent)
-            (save-excursion (newline))))
-
-        (defun my-latex-compile ()
-          (interactive)
-          (save-buffer)
-          (TeX-command "LaTeX" 'TeX-master-file nil))
-        (bind-key "C-M-x" 'my-latex-compile LaTeX-mode-map)
-
-        (defvar my-latex-wrap-choices '("emph"
-                                        "textsc"))
-        (defvar my-latex-wrap-history nil)
-
-        (defun my-latex-wrap (macro-name)
-          (interactive (list (ido-completing-read
-                              "Macro> "
-                              my-latex-wrap-choices
-                              nil 'confirm nil my-latex-wrap-history)))
-          (when (use-region-p)
-            (let ((b (region-beginning))
-                  (e (region-end)))
-              (goto-char e)
-              (insert "}")
-              (goto-char b)
-              (insert "\\" macro-name "{"))))
-        (bind-key "C-c w" 'my-latex-wrap LaTeX-mode-map)
-
-        (defun my-end-of-environment ()
-          (interactive)
-          (LaTeX-mark-environment)
-          (end-of-region))
-
-        (defun my-beginning-of-environment ()
-          (interactive)
-          (LaTeX-mark-environment)
-          (beginning-of-region)
-          (deactivate-mark))
-
-        (bind-key "M-n" 'my-end-of-environment LaTeX-mode-map)
-        (bind-key "M-p" 'my-beginning-of-environment LaTeX-mode-map)
-
-        ;; fix italian quote highlight
-        (push '("\"<" "\">") font-latex-quote-list)
-
-        (defun my-latex-remove-command ()
-          "Unwrap the expression that point is in or before, also
-removing the command name.  By command we understand a symbol
-starting with \\ and followed by a block of text enclosed in {}."
-          (interactive)
-          (let ((ok (sp-get-enclosing-sexp)))
-            (cond
-             ;; we're inside the { } block
-             (ok
-              (progn
-                (save-excursion
-                  (goto-char (sp-get ok :beg))
-                  (zap-to-char -1 ?\\ ))
-                (sp-splice-sexp)))
-             ;; test if we are in looking at the command fromt he front
-             ((looking-at "\\\\")
-              (zap-up-to-char 1 ?{)
-              (sp-unwrap-sexp))
-             ;; otherwise we're inside the command name
-             (t
-              (zap-to-char -1 ?\\ )
-              (zap-up-to-char 1 ?{)
-              (sp-unwrap-sexp)))))
-        (bind-key "C-c d" 'my-latex-remove-command LaTeX-mode-map)
-        (bind-key "M-RET" 'LaTeX-insert-item LaTeX-mode-map)
-
-        (defun my-LaTeX-preview-math ()
-          (interactive)
-          (let ((b (save-excursion (while (texmathp) (backward-char 1)) (1- (point))))
-                (e (save-excursion (while (texmathp) (forward-char 1)) (point))))
-            (preview-region b e)))
-        (bind-key "C-<m-key>" 'my-LaTeX-preview-math preview-map)
-
-        (defun my-LaTeX-mode-init ()
-          (setq TeX-auto-save t)
-          (setq TeX-parse-self t)
-          (TeX-PDF-mode t)
-          (setq reftex-plug-into-AUCTeX t)
-          (setq TeX-source-correlate-mode t)
-          (setq TeX-source-correlate-method 'synctex)
-          (reftex-mode t)
-          (TeX-fold-mode t)
-
-          (keyadvice-mode t)
-
-          (LaTeX-add-environments
-           '("derivation" LaTeX-env-label))
-          (TeX-add-symbols '("emph" 1))
-
-          (setq fill-column 100000)
-
-          (message "LaTeX mode init complete."))
-        ;; ACUTeX replaces latex-mode-hook with LaTeX-mode-hook
-        (add-hook 'LaTeX-mode-hook 'my-LaTeX-mode-init)
-
-        (keyadvice-add-advice (kbd "`")
-          (if (and (eq major-mode 'latex-mode) (texmathp))
-              (let* ((events (let ((overriding-local-map LaTeX-math-keymap))
-                               (read-key-sequence "math: ")))
-                     (binding (lookup-key LaTeX-math-keymap events)))
-                (call-interactively binding))
-            keyadvice-do-it))))))

File files/latextohtml.el

-;; list of enviroments:
-;; simpleScreenplay - tt, center, 0.5in margin (signs on buildings, landmarks...)
-;; letter           - it, 0.3in margin (letters, recordings, broadcasts, thoughts of another person...)
-;; diary            - it (long portions of text by another person, diary, memories...)
-;; radio            - it (radio)
-;; terminal         - tt, 0.3in margin (terminal notes or notes on paper, portions of books etc.)
-;; song             - it, 0.3in margin, note symbol - #9834 (songs)
-;; center           - make text centered
-;;
-;; commands
-;;
-;; vspace          - adds a bit of a vspace (about one empty par)
-;; emph            - emphatic text. Should be enviroment-sensitive
-;; bf              - bold face.
-;; Scene           - scene separator
-;; "<              - opening quote - &laquo;
-;; ">              - closing quote - &raquo;
-;; dots            - ellipsis - &hellip;
-;; ---             - &mdash;
-;; \%              - %
-;; footnote        - footnotes, this will need some special treatment
-;; levelup         - level up notification. needs to add some text:
-;;                   Nota: Nuovo livello.
-;;
-;;                   Nuovo vantaggio: #1
-;; normalchapter   - subtext, name of the chapter
-
-;; <SUP><A HREF="#note_to_$N" NAME="#note_from_$N">$N</A></SUP>
-;; e segnati il contenuto della nota. A fine capitolo cicla le note e metti
-;; <P><SUP><A HREF="#note_from_$N" NAME="#note_to_$N">$N</A></SUP> Testo della nota</P>
-
-(defun gen-footnotes-internal (n)
-  "n - currently processed footnote"
-  (when (search-forward "\\footnote" nil t)
-    (let* ((x (point)) (fn (number-to-string n)))
-      (forward-sexp)
-      (let* ((y (point)) (str (buffer-substring-no-properties (+ x 1) (- y 1))))
-        (progn (message str)
-               (delete-region (- x 9) y)
-               (insert (concat
-                        "<sup><a href=\"#note_to_"
-                        fn
-                        "\" name=\"note_from_"
-                        fn
-                        "\" >["
-                        fn
-                        "]</a></sup>"))
-               (end-of-buffer)
-               (insert (concat "
-
-<p><sup><a href=\"#note_from_"
-                               fn
-                               "\" name=\"note_to_"
-                               fn
-                               "\" >["
-                               fn
-                               "]</a></sup> "
-                               str
-                               "</p>"))
-               ;(pop-global-mark)
-               (beginning-of-buffer)
-               (gen-footnotes-internal (+ n 1))
-               ))))
-)
-
-(defun gen-footnotes ()
-  (interactive)
-  (beginning-of-buffer)
-  (gen-footnotes-internal 1)
-)
-
-(defun print-frontmatter ()
-  (beginning-of-buffer)
-  (insert "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
-<html xmlns=\"http://www.w3.org/1999/xhtml\" dir=\"ltr\" lang=\"it\" xml:lang=\"it\">
-<head>
-<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />
-<meta http-equiv=\"content-style-type\" content=\"text/css\" />
-<meta http-equiv=\"content-language\" content=\"it\" />
-
-<link rel=\"stylesheet\" href=\"style.css\" />
-</head>
-<body>")
-)
-
-(defun print-backmatter ()
-  (end-of-buffer)
-  (insert "
-
-</body>
-</html>")
-)
-
-
-(defun gen-html ()
-  (interactive)
-  (let* ((bn (buffer-name)) (bfn (buffer-file-name)) (nbfn (when (string-match ".tex" bfn)
-                                        (message (replace-match ".html" nil nil bfn)))))
-   (progn (find-file nbfn)
-          (erase-buffer)
-          (insert-buffer-substring bn))
-)
-  (end-of-buffer)
-  (insert "<hr>
-")
-  (beginning-of-buffer)
-  (gen-footnotes)
-  (beginning-of-buffer)
-  (replace-regexp "\"<" "&laquo;")
-  (beginning-of-buffer)
-  (replace-regexp "\">" "&raquo;")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\dk{``A}" "&ldquo;A")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\dk{\"<A}" "&ldquo;A")
-  (beginning-of-buffer)
-  (replace-regexp "``" "&ldquo;")
-  (beginning-of-buffer)
-  (replace-regexp "''" "&rdquo;")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\textasciitilde{}" "~")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\textgreater{}" "&gt;")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\-" "")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\fussy " "")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\sloppy " "")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\newline" "<br>")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\vspace{\\(.*?\\)}" "<div style=\"height: \\1\" ></div>")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\emph{\\(.*?\\)}" "<em>\\1</em>")
-  (beginning-of-buffer)
-  (replace-regexp "{\\\\bf \\(.*?\\)}" "<strong>\\1</strong>")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\Scene" "<div class=\"scene\" ></div>")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\dots" "&hellip;")
-  (beginning-of-buffer)
-  (replace-regexp "---" " &mdash; ")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\%" "%")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\#" "#")
-  (beginning-of-buffer) ; add newlines around begin
-  (replace-regexp "\\(\\\\begin{.*?}\\)" "
-\\1
-")
-  (beginning-of-buffer) ; add newlines around end
-  (replace-regexp "\\(\\\\end{.*?}\\)" "
-\\1
-")
-  (beginning-of-buffer) ; remove excessive newlines
-  (replace-regexp "
-
-
-+" "
-
-")
-  (beginning-of-buffer) ; add <p> tags
-  (replace-regexp "\\(^[^<\\
-].*?\\)
-
-" "<p>\\1</p>
-
-")
-  (beginning-of-buffer) ; change begin .letter and .terminal and .song into <blockquote>
-  (replace-regexp "\\\\begin{\\(\\(letter\\|terminal\\|song\\)\\)}" "<blockquote class=\"\\1\" >")
-  (beginning-of-buffer) ; change end .letter and .terminal .song into </blockquote>
-  (replace-regexp "\\\\end{\\(\\(letter\\|terminal\\|song\\)\\)}" "</blockquote>")
-  (beginning-of-buffer) ; memoryOrb style
-  (replace-regexp "\\\\begin{memoryOrb}" "<div class=\"memoryOrb\" >
-<div class=\"memoryOrbOpen\" >(* * *)</div>")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\end{memoryOrb}" "<div class=\"memoryOrbClose\" >(* * *)</div>
-</div>")
-  (beginning-of-buffer)
-  (replace-regexp "<blockquote class=\"song\" >" "<blockquote class=\"song\" >
-<div class=\"songnote\" >&#9834;</div>")
-  (beginning-of-buffer) ; change begin to <div> element
-  (replace-regexp "\\\\begin{\\(.*?\\)}" "<div class=\"\\1\" >")
-  (beginning-of-buffer) ; change end to </div> element
-  (replace-regexp "\\\\end{\\(.*?\\)}" "</div>")
-  (beginning-of-buffer) ; fix special case where line starts with <strong|em> and doesn\t have <p>
-  (replace-regexp "^\\(<\\(strong\\|em\\)>.*?\\)
-
-" "<p>\\1</p>
-
-")
-  (beginning-of-buffer) ; fix <p>&gt; ... </p>
-  (replace-regexp "<p>\\(&gt;.*?\\)</p>" "\\1")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\normalchapter\\[\\(.*?\\)\\]{\\(.*?\\)}" "<h1>\\2</h1>
-
-<p style=\"text-align:center;\" ><em>\\1</em></p>")
-  (beginning-of-buffer)
-  (replace-regexp "\\\\normalchapters\\[\\(.*?\\)\\]{\\(.*?\\)}{.*?}" "<h1>\\2</h1>
-
-<p style=\"text-align:center;\" ><em>\\1</em></p>")
-  (replace-regexp "\\\\levelup{\\(.*?\\)}" "<div class=\"levelup\" >
-<p>Nota: nuovo livello.</p>
-
-<p>Nuovo vantaggio: \\1</p>
-</div>
-
-")
-  (print-frontmatter)
-  (print-backmatter)
-  (save-buffer)
-)
-
-;; (loop for i in (make-list 12)
-;;       do
-;;       (find-file (concat "d:/download/fic/foeitalian/chapter" (number-to-string i) ".tex")))
-
-;; (loop for i in (make-list 12)
-;;       do
-;;       (progn (switch-to-buffer (concat "chapter" (number-to-string i) ".tex"))
-;;              (gen-html)
-;;              ))
-
-; &bdquo; -- open quote „
-; &ldquo; -- "close quote" “
-; &#39; -- '
-; &nbsp; -- " " < space
-; &hellip; -- …
-
-(defun fix-basic ()
-  (interactive)
-  (fix-reset-after-each
-    (replace-regexp "…" "\\\\dots ")
-    (replace-regexp "\\.\\.\\." "\\\\dots ")
-    (replace-regexp "\\\\dots[[:space:]]+)" "\\\\dots)")
-    (replace-regexp "[[:space:]][[:space:]]+" " ")
-    (replace-regexp "[[:space:]]+--[[:space:]]+" "---")
-    (replace-regexp "[[:space:]]+–[[:space:]]+" "---")
-    (replace-regexp "[[:space:]]+-[[:space:]]+" "---")
-    (replace-regexp "“" "``")
-    (replace-regexp "„" "``")
-    (replace-regexp "”" "''")
-    (replace-regexp "‘" "`")
-    (replace-regexp "‚" "`")
-    (replace-regexp "’" "'")
-    (replace-regexp "~" "\\\\textasciitilde{}")
-    (replace-regexp "\\\\dots[[:space:]]+''" "\\\\dots''")
-    (replace-regexp "\\([^\\]\\)%" "\\1\\\\%")
-    (replace-regexp "^[[:space:]]" "")
-    (replace-string "}\\emph{" "")
-    (replace-string "\\emph{}" "")
-    (query-replace-regexp "\\\\emph{ }" "")
-    (replace-string "'' ``" "''\n\n``")
-    (replace-regexp "
-
-
-+" "
-
-")
-    (replace-regexp "``-\\([^-]\\)" "``---\\1")
-    (replace-regexp "``---\\([^}]\\)" "\\\\dk{``---}\\1")
-    (replace-regexp "\\([^-]\\)-''" "\\1---''") ; fix the hyphen at the end of quotation
-    (query-replace-regexp "---''\\([^}]\\)" "\\\\dk{---''}\\1")
-    (replace-regexp "\\([^-]\\)-}" "\\1---}") ; fix the hyphen before emph end
-    (query-replace-regexp "- " "---")
-    (replace-regexp "!!+" "!")
-    (replace-regexp "\\?\\?+" "?")
-    (replace-regexp "\\([^-]\\)-
-" "\\1---
-")
-    (replace-regexp "``A\\([^}]\\)" "\\\\dk{``A}\\1")
-    (query-replace-regexp " }\\(\\w\\)" "} \\1")
-    (query-replace "\\emph{ " " \\emph{")
-    ))
-
-
-(defun fix-quotes () ; and some less trivial quotation stuff
-  (interactive)
-  ;; replace 'em with $$EM$$, it's too common to skip all the time,
-  ;; then we replace it back
-  (fix-reset-after-each
-    (replace-string "'em" "$$EM$$")
-    (query-replace-regexp "[[:space:]]'\\([[:word:]]\\)" " `\\1")
-    (query-replace-regexp "``'\\([[:word:]]\\)" "```\\1")
-    (query-replace-regexp "^'" "`")
-    (replace-regexp ":[ ]``" ", ``")
-    (query-replace-regexp "\\([[:word:]]\\)-[ ]" "\\1\\\\dots ")
-    (replace-regexp "\\([[:word:]]\\)[ ]\\\\dots" "\\1\\\\dots")
-    (replace-string "$$EM$$" "'em")
-    (query-replace-regexp "}\\." ".}")
-    (query-replace-regexp "}," ",}")
-    (query-replace-regexp "}!" "!}")
-    (query-replace-regexp "}\\?" "?}")
-    (query-replace-regexp "!," "!")
-    (query-replace-regexp "\\?," "?")
-    (query-replace-regexp "\\.," ",")
-    ))
-
-(defun fix-quotes-italian (arg)
-  (interactive "P")
-  (fix-reset-after-each
-    (unless arg
-      (replace-regexp "``" "\"<")
-      (replace-regexp "''" "\">"))
-    (replace-regexp "“" "\"<")
-    (replace-regexp "”" "\">")
-    (replace-regexp "«" "\"<")
-    (replace-regexp "»" "\">")
-    ))
-
-(defun fix-italian ()
-  (interactive)
-  (fix-reset-after-each
-    (replace-string "E'" "È")
-    (replace-string "un pò" "un po'")
-    (replace-string "perchè" "perché"))
-  )
-
-(defun fix-quot-to-quotes (beg end)
-  (interactive "r")
-  (goto-char beg)
-  (delete-region beg (+ beg 6))
-  (insert "``")
-  (goto-char (- end 4 6))
-  (delete-region (- end 4 6) (- end 4))
-  (insert "''")
-  (goto-char (- end 8)))
-
-;; (beginning-of-buffer)
-;; (replace-regexp "\\*\\*\\* \\*\\*\\* \\*\\*\\*" "\\\\Scene")
-
-(defun fix-html (italic-class bold-class)
-  (interactive (list (read-from-minibuffer "Italics class name: ")
-                     (when current-prefix-arg
-                       (read-from-minibuffer "Bold class name: "))))
-  (fix-reset-after-each
-    (replace-regexp "<p.*?>" "")
-    (replace-regexp "</p>" "
-
-")
-    (replace-regexp
-     (concat "<span class=\"\\(?:c[0-9]+ \\)*?" italic-class "\\(?: c[0-9]+\\)*?\">\\(.*?\\)</span>")
-     "\\\\emph{\\1}")
-    (replace-regexp
-     (concat "<span class=\"\\(?:c[0-9]+ \\)*?" bold-class "\\(?: c[0-9]+\\)*?\">\\(.*?\\)</span>")
-     "\\\\strong{\\1}")
-    (replace-regexp " " " ")
-    (replace-regexp "<span.*?>" "")
-    (replace-regexp "</span>" "")
-    (replace-regexp "&ndash;" "–")
-    (replace-regexp "&bdquo;" "„")
-    (replace-regexp "&ldquo;" "“")
-    (replace-regexp "&rdquo;" "”")
-    (replace-regexp "&rsquo;" "’")
-    (replace-regexp "&laquo;" "«")
-    (replace-regexp "&raquo;" "»")
-    (replace-regexp "&#39;" "'")
-    (replace-regexp "&nbsp;" " ")
-    (replace-regexp "&hellip;" "…")
-    (replace-regexp "&egrave;" "è")
-    (replace-regexp "&agrave;" "à")
-    (replace-regexp "&ugrave;" "ù")
-    (replace-regexp "&ograve;" "ò")
-    (replace-regexp "&igrave;" "ì")
-    (replace-regexp "&eacute;" "é")
-    (replace-regexp "&Aacute;" "Á")
-    (replace-regexp "&uuml;" "̇ü")
-    (replace-regexp "&ouml;" "ö")
-    (replace-regexp "&auml;" "ä")
-    (replace-regexp "&deg;" "$^\\circ$")
-    (replace-regexp "<.*?>" "")
-    ))
-
-(defun fix-html-fimfic ()
-  (interactive)
-  (fix-reset-after-each
-    (replace-regexp "</i><i>" "")
-    (replace-regexp "<i>\\(.*?\\)</i>" "\\\\emph{\\1}")
-    (replace-regexp "<br />" "
-")
-    (replace-regexp "<hr />" "\\\\Scene")
-    (replace-regexp " " " ")
-    (replace-regexp "\\\\emph{ }" " ")
-    (replace-regexp "\\\\emph{}" "")
-    ))
-
-
-(defun fix-prepare-diff ()
-  (interactive)
-  (fix-reset-after-each
-    (replace-regexp "“" "\"")
-    (replace-regexp "„" "\"")
-    (replace-regexp "”" "\"")
-    (replace-regexp "‘" "'")
-    (replace-regexp "‚" "'")
-    (replace-regexp "’" "'")
-    (replace-regexp "«" "\"")
-    (replace-regexp "»" "\"")
-    (replace-regexp "…" "...")
-    (replace-regexp "—" "--")
-    (replace-string "* * *" "")
-    (replace-string "*** *** ***" "")
-    (replace-regexp "  +" " ")
-    (replace-regexp " +$" "")
-    (replace-string "... " "...")
-    (replace-regexp "^ +$" "")
-    (replace-regexp "
-
-
-+" "
-
-")
-    )
-  )

File files/macros.el

-;; insert a footnote to the text. The footnote is in a format
-;; [i] Text of the footnote...
-;; It will search for the first [i] in the text body and place \footnote{...} there
-(setq last-kbd-macro
-   [?\C-\M-f ?\C-f ?\C-  ?\M-e ?\M-w ?\M-` ?\C-a ?\C-s ?\C-w ?\C-w ?\C-r ?\C-r ?\C-\] delete ?\M-x ?f ?n ?o ?t ?e ?\] return])
-
-(defun fnote ()
-  (interactive)
-  (insert "\\footnote{")
-  (yank)
-  (insert "}"))
-
-(setq last-kbd-macro
-   [?\C-\M-f ?\C-f ?\C-  ?\M-e ?\M-w ?\M-` ?\C-a ?\C-s ?\C-\M-w ?\C-\M-w ?\C-r ?\C-r return ?\C-\] delete ?\M-x ?f ?n ?o ?t ?e return])
-
-;; swap between two last used buffers
-(fset 'swap-buffer-to-last-used
-   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([24 98 return] 0 "%d")) arg)))
-(bind-key "C-x C-a" nil emacs-lisp-mode-map)
-(bind-key "C-x C-a" 'swap-buffer-to-last-used)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; ALIASES
-
-(defalias 'qrr 'query-replace-regexp)
-(defalias 'rs 'replace-string)

File files/multi-web-mode.el

-(require 'multi-web-mode)
-(setq mweb-default-major-mode 'html-mode)
-(setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")