From 151d7c2676a7d09729344ee27a74b7475e1c6d5b Mon Sep 17 00:00:00 2001 From: mattkae Date: Mon, 20 Jun 2022 06:41:03 -0400 Subject: Ignore tilda files --- .gitignore | 3 +- init.el~ | 68 ----- lisp/cpp.el~ | 55 ---- lisp/general.el~ | 59 ----- lisp/js-mode-custom.el~ | 20 -- lisp/latex-custom.el~ | 6 - lisp/latex.el~ | 5 - lisp/minimap.el~ | 652 ------------------------------------------------ lisp/org-custom.el~ | 73 ------ lisp/org.el~ | 0 lisp/ts-custom.el~ | 36 --- 11 files changed, 2 insertions(+), 975 deletions(-) delete mode 100644 init.el~ delete mode 100644 lisp/cpp.el~ delete mode 100644 lisp/general.el~ delete mode 100644 lisp/js-mode-custom.el~ delete mode 100644 lisp/latex-custom.el~ delete mode 100644 lisp/latex.el~ delete mode 100644 lisp/minimap.el~ delete mode 100644 lisp/org-custom.el~ delete mode 100644 lisp/org.el~ delete mode 100644 lisp/ts-custom.el~ diff --git a/.gitignore b/.gitignore index 025037d..f7b39c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ elpa projectile-bookmarks.eld -auto-save-list \ No newline at end of file +auto-save-list +*.~ \ No newline at end of file diff --git a/init.el~ b/init.el~ deleted file mode 100644 index 84c7b29..0000000 --- a/init.el~ +++ /dev/null @@ -1,68 +0,0 @@ -;; Load path -(add-to-list 'load-path "~/.emacs.d/lisp/") -(add-to-list 'custom-theme-load-path "~/.emacs.d/themes") - -;; Melpa support -(require 'package) -(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) -;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities` -;; and `package-pinned-packages`. Most users will not need or want to do this. -;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) -(package-initialize) - -;; The default is 800 kilobytes. Measured in bytes. -(setq gc-cons-threshold (* 50 1000 1000)) - -;; Profile emacs startup -(add-hook 'emacs-startup-hook - (lambda () - (message "*** Emacs loaded in %s seconds with %d garbage collections." - (emacs-init-time "%.2f") - gcs-done))) - -;; Theme -(load-theme 'vs-light t) -(set-face-attribute 'region nil :background "#ffffcd") -(setq debug-on-error t) - -(require 'evil) -(evil-mode 1) - -(require 'general) -(setup-general) - -(require 'cpp) -(add-hook 'c-mode-common-hook 'setup-c) - -(require 'text) -(add-hook 'text-mode-hook 'setup-text-mode) - -(require 'org-custom) -(add-hook 'org-mode-hook 'org-custom-hook) - -(require 'js-mode-custom) -(setup-js) - -(require 'ts-custom) -(setup-ts) - -(require 'latex-custom) -(setup-latex) - -(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. - '(custom-safe-themes - '("5859f61b502aa335b502b231c86a051210cb5974f74966e620c31be3a966659f" "32a9fa0f3722e679ed77a28aed3ae99161ef54dc27c35fd19e68e0410633960b" default)) - '(org-agenda-files (list org-directory)) - '(org-directory "~/Documents/org") - '(package-selected-packages - '(auctex evil js2-highlight-vars ac-js2 js2-refactor js2-mode flycheck-irony company-irony all-the-icons req-package projectile irony org))) -(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. -) diff --git a/lisp/cpp.el~ b/lisp/cpp.el~ deleted file mode 100644 index a81e1ff..0000000 --- a/lisp/cpp.el~ +++ /dev/null @@ -1,55 +0,0 @@ -(defun setup-c() - (setq c++-tab-always-indent 0) - (setq c-basic-offset 4) ;; Default is 2 - (setq c-indent-level 4) ;; Default is 2 - (c-set-offset 'brace-list-open 0) - - - (setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60)) - (setq tab-width 4) - (electric-indent-mode 0) - - ;; == irony-mode == - (use-package irony - :ensure t - :defer t - :init - (add-hook 'c++-mode-hook 'irony-mode) - (add-hook 'c-mode-hook 'irony-mode) - (add-hook 'objc-mode-hook 'irony-mode) - :config - ;; replace the `completion-at-point' and `complete-symbol' bindings in - ;; irony-mode's buffers by irony-mode's function - (defun my-irony-mode-hook () - (define-key irony-mode-map [remap completion-at-point] - 'irony-completion-at-point-async) - (define-key irony-mode-map [remap complete-symbol] - 'irony-completion-at-point-async)) - (add-hook 'irony-mode-hook 'my-irony-mode-hook) - (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options) - ) - - ;; == company-mode == - (use-package company - :ensure t - :defer t - :init (add-hook 'after-init-hook 'global-company-mode) - :config - (use-package company-irony :ensure t :defer t) - (setq company-idle-delay nil - company-minimum-prefix-length 2 - company-show-numbers t - company-tooltip-limit 20 - company-dabbrev-downcase nil - company-backends '((company-irony company-gtags)) - ) - :bind ("C-;" . company-complete-common) - ) - - ;; Flycheck - (eval-after-load 'flycheck - '(add-hook 'flycheck-mode-hook #'flycheck-irony-setup)) - -) - -(provide 'cpp) diff --git a/lisp/general.el~ b/lisp/general.el~ deleted file mode 100644 index b06836a..0000000 --- a/lisp/general.el~ +++ /dev/null @@ -1,59 +0,0 @@ -(defun setup-general() - ;; menu bars - (menu-bar-mode -1) - (toggle-scroll-bar -1) - (tool-bar-mode -1) - (setq mac-shift-modifier 'meta) - - ;; Default Values - ;(setq-default indent-tabs-mode t) ; use spaces only if nil - (setq-default tab-width 4) ; Assuming you want your tabs to be four spaces wide - (set-face-attribute 'default nil :font "Droid Sans Mono-12") - (set-fontset-font t nil "Courier New" nil 'append) - (set-fontset-font t '(?😊 . ?😎) "Segoe UI Emoji") - - ;;(set-face-attribute 'default nil :height 110 :family "Consolas") - (set-language-environment "UTF-8") - (set-default-coding-systems 'utf-8) - - ;; Cursor - (setq-default cursor-type 'bar) - (blink-cursor-mode 1) - - ;; Margin - (global-linum-mode 1) - ;; (require 'minimap) - ;; (minimap-mode 1) - (require 'perfect-margin) - (perfect-margin-mode 1) - - ;; Highlight line - (require 'hl-line) - (global-hl-line-mode 1) - (set-face-background hl-line-face "#EFEFEF") - - ;; Initialization screen - (setq inhibit-splash-screen t) - (setq initial-scratch-message "") - (setq initial-major-mode 'text-mode) - (org-agenda-list) - (delete-other-windows) - - ;; Projectile for projects - (require 'projectile) - (projectile-mode +1) - (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) - - ;; Tree - (require 'neotree) - (global-set-key [f8] 'neotree-toggle) - (setq neo-smart-open t) - (setq projectile-switch-project-action 'neotree-projectile-action) - (setq neo-theme (if (display-graphic-p) 'icons 'arrow)) - - ;; Smooth scroll - (require 'smooth-scrolling) - (smooth-scrolling-mode 1) -) - -(provide 'general) diff --git a/lisp/js-mode-custom.el~ b/lisp/js-mode-custom.el~ deleted file mode 100644 index b188761..0000000 --- a/lisp/js-mode-custom.el~ +++ /dev/null @@ -1,20 +0,0 @@ -(defun setup-js() - (setq js-indent-level 2) - ) - -(require 'js2-mode) -(require 'js2-refactor) -(require 'js2-highlight-vars) -(require 'company) -(add-hook 'js-mode-hook 'js2-minor-mode) -;(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) -(add-hook 'js2-mode-hook #'js2-imenu-extras-mode) -(add-hook 'js2-mode-hook 'ac-js2-mode) -(add-hook 'js2-mode-hook 'js2-refactor-mode) -(add-hook 'js2-mode-hook 'js2-highlight-vars-mode) -(add-hook 'js2-mode-hook 'setup-js) -(js2r-add-keybindings-with-prefix "C-c C-r") -(add-to-list 'company-backends 'ac-js2-company) - - -(provide 'js-mode-custom) diff --git a/lisp/latex-custom.el~ b/lisp/latex-custom.el~ deleted file mode 100644 index 9523783..0000000 --- a/lisp/latex-custom.el~ +++ /dev/null @@ -1,6 +0,0 @@ - -(defun setup-latex() - (setq TeX-PDF-mode t) -) - -(provide 'latex-custom) diff --git a/lisp/latex.el~ b/lisp/latex.el~ deleted file mode 100644 index 9f98a3c..0000000 --- a/lisp/latex.el~ +++ /dev/null @@ -1,5 +0,0 @@ - - -(setq TeX-PDF-mode t) - -(provide 'latex) diff --git a/lisp/minimap.el~ b/lisp/minimap.el~ deleted file mode 100644 index 3ef6268..0000000 --- a/lisp/minimap.el~ +++ /dev/null @@ -1,652 +0,0 @@ -;;; minimap.el --- Minimap sidebar for Emacs - -;; Copyright (C) 2011 Dustin Lacewell - -;; Authors: Dustin Lacewell -;; David Engster -;; Keywords: minimap -;; Version: 0.1 - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License -;; as published by the Free Software Foundation; either version 2 -;; of the License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Heavily based off minimap.el by David Engster however I -;; have refactored it a bit to support only a single global -;; minimap window. Usually this should be opened on startup -;; when there is a single window. Some defaults have also -;; been changed. - -;; This file is an implementation of a minimap sidebar, i.e., a -;; smaller display of the current buffer on the left side. It -;; highlights the currently shown region and updates its position -;; automatically. You can navigate in the minibar by dragging the -;; active region with the mouse, which will scroll the corresponding -;; edit buffer. - -;; Usage: -;; * Put minimap.el in your load path. -;; * (require 'minimap) -;; * Use 'M-x minimap-toggle' to toggle the minimap. -;; * Use 'M-x minimap-kill' to create the minimap. -;; * Use 'M-x minimap-kill' to kill the minimap. -;; * Use 'M-x customize-group RET minimap RET' to adapt minimap to your needs. - -;;; Customizable variables; - -(defgroup minimap nil - "A minimaap sidebar for Emacs." - :group 'convenience) - -(defface minimap-font-face - '((default :family "DejaVu Sans Mono" :height 30)) - "Face used for text in minimap buffer, notably the font family and height. -This height should be really small. You probably want to use a -TrueType font for this. After changing this, you should -recreate the minimap to avoid problems with recentering." - :group 'minimap) - -(defface minimap-active-region-background - '((((background dark)) (:background "#4517305D0000")) - (t (:background "#C847D8FEFFFF"))) - "Face for the active region in the minimap. -By default, this is only a different background color." - :group 'minimap) - -(defface minimap-semantic-function-face - '((((background dark)) - (:box (:line-width 1 :color "white") - :inherit (font-lock-function-name-face minimap-font-face) - :height 1.9 :background "gray10")) - (t (:box (:line-width 1 :color "black") - :inherit (font-lock-function-name-face minimap-font-face) - :height 1.9 :background "gray90"))) - "Face used for functions in the semantic overlay.") - -(defface minimap-semantic-variable-face - '((((background dark)) - (:box (:line-width 1 :color "white") - :inherit (font-lock-variable-name-face minimap-font-face) - :height 1.9 :background "gray10")) - (t (:box (:line-width 1 :color "black") - :inherit (font-lock-function-name-face minimap-font-face) - :height 1.9 :background "gray90"))) - "Face used for variables in the semantic overlay.") - -(defface minimap-semantic-type-face - '((((background dark)) - (:box (:line-width 1 :color "white") - :inherit (font-lock-type-face minimap-font-face) - :height 1.9 :background "gray10")) - (t (:box (:line-width 1 :color "black") - :inherit (font-lock-function-name-face minimap-font-face) - :height 1.9 :background "gray90"))) - "Face used for types in the semantic overlay.") - -(defcustom minimap-dedicated-window t - "Whether the minimap should create a dedicated window." - :type 'boolean - :group 'minimap) - -(defcustom minimap-width-fraction 0.1 - "Fraction of width which should be used for minimap sidebar." - :type 'number - :group 'minimap) - -(defcustom minimap-buffer-name-prefix "*MINIMAP*" - "Prefix for buffer names of minimap sidebar." - :type 'string - :group 'minimap) - -(defcustom minimap-update-delay 0.8 - "Delay in seconds after which sidebar gets updated. -Setting this to 0 will let the minimap react immediately, but -this will slow down scrolling." - :type 'number - :set (lambda (sym value) - (set sym value) - (when (and (boundp 'minimap-timer-object) - minimap-timer-object) - (cancel-timer minimap-timer-object) - (setq minimap-timer-object - (run-with-idle-timer - minimap-update-delay t 'minimap-update)))) - :group 'minimap) - -(defcustom minimap-always-recenter nil - "Whether minimap sidebar should be recentered after every point movement." - :type 'boolean - :group 'minimap) - -(defcustom minimap-recenter-type 'middle - "Specifies the type of recentering the minimap should use. -The minimap can use different types of recentering, i.e., how the -minimap should behave when you scroll in the main window or when -you drag the active region with the mouse. The following -explanations will probably not help much, so simply try them and -choose the one which suits you best. - -`middle' -- The active region will stay fixed in the middle of -the minimap. This the default. - -`free' -- The position will be more or less free. When dragging -the active region, the minimap will scroll when you reach the -bottom or top. - -`relative' -- The position of the active region in the minimap -corresponds with the relative position of this region in the -buffer." - - :type '(choice (const :tag "Relative" relative) - (const :tag "Middle" middle) - (const :tag "Free" free)) - :group 'minimap) - -(defcustom minimap-hide-scroll-bar t - "Whether the minimap should hide the vertical scrollbar." - :type 'boolean - :group 'minimap) - -(defcustom minimap-hide-fringes t - "Whether the minimap should hide the fringes." - :type 'boolean - :group 'minimap) - -(defcustom minimap-display-semantic-overlays t - "Display overlays from CEDET's semantic analyzer. -If you use CEDET and the buffer's major-mode is supported, the -minimap can display overlays generated by the semantic analyzer. -By default, it will apply the faces `minimap-semantic--face', -with being \"function\", \"variable\" and \"type\". Also, it -will display the name of the tag in the middle of the overlay in -the corresponding font-lock face. - -See also `minimap-enlarge-certain-faces', which can be used as -fallback." - :type 'boolean - :group 'minimap) - -(defcustom minimap-enlarge-certain-faces 'as-fallback - "Whether certain faces should be enlarged in the minimap. -All faces listed in `minimap-normal-height-faces' will be -displayed using the default font height, allowing you to still -read text using those faces. By default, this should enlarge all -function names in the minimap, given you have font locking -enabled. This variable can have the following values: - -'as-fallback (the default) -- The feature will only be activated - if information from CEDET's semantic analyzer isn't available - (see: `minimap-display-semantic-overlays'). -'always -- Always active. -nil -- Inactive." - :type '(choice (const :tag "Fallback if CEDET unavailable." 'as-fallback) - (const :tag "Always active." 'always) - (const :tag "Inactive." nil)) - :group 'minimap) - -(defcustom minimap-normal-height-faces '(font-lock-function-name-face) - "List of faces which should be displayed with normal height. -When `minimap-enlarge-certain-faces' is non-nil, all faces in -this list will be displayed using the default font height. By -default, this list contains `font-lock-function-name-face', so -you can still read function names in the minimap." - :type '(repeat face) - :group 'minimap) - -(defcustom minimap-sync-overlay-properties '(face invisible) - "Specifies which overlay properties should be synced. -Unlike text properties, overlays are not applied automatically to -the minimap and must be explicitly synced. This variable -specifies which overlay properties should be synced by -`minimap-sync-overlays'. Most importantly, this variable should -include 'invisible', so that hidden text does not appear in the -minimap buffer." - :type '(repeat symbol) - :group 'minimap) - -;;; Internal variables - -(defvar minimap-start nil) -(defvar minimap-end nil) -(defvar minimap-active-overlay nil) -(defvar minimap-window nil) -(defvar minimap-timer-object nil) -(defvar minimap-base-overlay nil) -(defvar minimap-numlines nil) -(defvar minimap-pointmin-overlay nil) - -(make-variable-buffer-local 'minimap-start) -(make-variable-buffer-local 'minimap-end) -(make-variable-buffer-local 'minimap-active-overlay) -(make-variable-buffer-local 'minimap-base-overlay) -(make-variable-buffer-local 'minimap-numlines) -(make-variable-buffer-local 'minimap-pointmin-overlay) - -(defun minimap-toggle () - "Toggle the minimap." - (interactive) - (if (and minimap-window - (window-live-p minimap-window)) - (minimap-kill) - (minimap-create))) - -(defun minimap-buffer-name() - "Get minimap buffer name for current buffer" - (concat minimap-buffer-name-prefix " " (buffer-name (current-buffer)))) - -;;;###autoload -(defun minimap-create() - "Create the minimap sidebar" - (interactive) - (let ((was_created) - (current_buffer (current-buffer)) - (raw_buffer_name (buffer-name (current-buffer))) - (buffer_name (minimap-buffer-name)) - (original_window (selected-window))) - ;; let progn - - ;;; WINDOW CREATION - ;; don't operate on minimap windows - (unless (string-match minimap-buffer-name-prefix raw_buffer_name) - ;; if minimap window is open - (if (and minimap-window - (window-live-p minimap-window)) - (progn - ;; switch to it - (select-window minimap-window) - ;; kill existing buffer if there is one - (when (string-match minimap-buffer-name-prefix - (buffer-name (current-buffer))) - - (when minimap-dedicated-window - (set-window-dedicated-p minimap-window nil)) - (kill-buffer))) - ;; otherwise split current window - (unless (split-window-horizontally - (round (* (window-width) minimap-width-fraction))) - (message "Failed to create window. Try `delete-other-windows' (C-x 1) first.") - (return nil)) - ;; save new window to variable - (setq minimap-window (selected-window)) - (setq was_created t)) - - ;;; BUFFER CREATION - (select-window minimap-window) - (when minimap-dedicated-window - (set-window-dedicated-p minimap-window nil)) - ;; if minimap buffer exists - (if (get-buffer buffer_name) - ;; show it - (switch-to-buffer buffer_name t) - ;; otherwise create new minimap buffer - (minimap-new-minimap buffer_name current_buffer) - ;; initialize timer - (unless minimap-timer-object - (setq minimap-timer-object - (run-with-idle-timer minimap-update-delay t 'minimap-update)))) - (if was_created - (other-window 1) - (select-window original_window)) - (minimap-sync-overlays) - (when minimap-dedicated-window - (set-window-dedicated-p minimap-window 1))))) - -(defun minimap-new-minimap (buffer_name target_buffer) - "Create new minimap indirect-buffer pointing to target" - (unless (or (string-match minimap-buffer-name-prefix (buffer-name target_buffer)) - (string-match "minibuf" (buffer-name target_buffer))) - (let ((indirect_buffer (make-indirect-buffer target_buffer buffer_name t)) - (edges (window-pixel-edges))) - ;; let progn - (set-buffer indirect_buffer) - ;; hide scrollbars? - (when minimap-hide-scroll-bar - (setq vertical-scroll-bar nil)) - ;; show buffer - (switch-to-buffer indirect_buffer) - (setq minimap-base-overlay (make-overlay (point-min) (point-max) nil t t)) - (overlay-put minimap-base-overlay 'face 'minimap-font-face) - (setq minimap-pointmin-overlay (make-overlay (point-min) (1+ (point-min)))) - (setq minimap-start (window-start) - minimap-end (window-end) - minimap-active-overlay (make-overlay minimap-start minimap-end) - line-spacing 0) - (overlay-put minimap-active-overlay 'face - 'minimap-active-region-background) - (overlay-put minimap-active-overlay 'priority 5) - (minimap-mode 1) - (when (and (boundp 'linum-mode) - linum-mode) - (linum-mode 0)) - (when minimap-hide-fringes - (set-window-fringes nil 0 0)) - ;; Calculate the actual number of lines displayable with the minimap face. - - (setq minimap-numlines - (floor - (/ - (- (nth 3 edges) (nth 1 edges)) - (car (progn (redisplay) (window-line-height))))))))) - -;;;###autoload -(defun minimap-kill () - "Kill minimap for current buffer. -Cancel the idle timer if no more minimaps are active." - (interactive) - (if (null minimap-window) - (message "No minimap window found.") - ;; kill all minimap buffers - (set-window-dedicated-p minimap-window nil) - (dolist (ele (buffer-list)) - (when (string-match minimap-buffer-name-prefix (buffer-name ele)) - (kill-buffer ele))) - (delete-window minimap-window) - (setq minimap-window nil) - (when minimap-timer-object - (cancel-timer minimap-timer-object) - (setq minimap-timer-object nil)) - (message "Minimap killed."))) - - -(defun minimap-valid-target() - "Return t if valid minimap target" - (interactive) - (not (or (string-match minimap-buffer-name-prefix (buffer-name (current-buffer))) - (string-match "minibuf" (buffer-name (current-buffer)))))) - - -(defun minimap-update (&optional force) - "Update the minimap sidebar." - (interactive) - (when (and minimap-window - (window-live-p minimap-window) - (minimap-valid-target)) - (set-window-dedicated-p minimap-window nil) - (let (start end pt ov) - (unless (get-buffer (minimap-buffer-name)) - (minimap-create)) - (set-window-buffer minimap-window (minimap-buffer-name)) - (setq start (window-start) - end (window-end) - pt (point) - ov) - (with-selected-window minimap-window - (unless (and (not force) - (= minimap-start start) - (= minimap-end end)) - (move-overlay minimap-active-overlay start end) - (setq minimap-start start - minimap-end end) - (minimap-recenter (line-number-at-pos (/ (+ end start) 2)) - (/ (- (line-number-at-pos end) - (line-number-at-pos start)) - 2))) - (goto-char pt) - (when minimap-always-recenter - (recenter (round (/ (window-height) 2)))) - (when minimap-dedicated-window - (set-window-dedicated-p minimap-window 1)))))) - -;;; Overlay movement -(defun minimap-move-overlay-mouse (start-event) - "Move overlay by tracking mouse movement." - (interactive "e") - (mouse-set-point start-event) - (when (get-buffer-window (buffer-base-buffer (current-buffer))) - (let* ((echo-keystrokes 0) - (end-posn (event-end start-event)) - (start-point (posn-point end-posn)) - (make-cursor-line-fully-visible nil) - (cursor-type nil) - (pcselmode (when (boundp 'pc-selection-mode) - pc-selection-mode)) - pt ev) - (when (and pcselmode (fboundp 'pc-selection-mode)) - (pc-selection-mode -1)) - (move-overlay minimap-active-overlay start-point minimap-end) - (track-mouse - (minimap-set-overlay start-point) - (while (and - (consp (setq ev (read-event))) - (eq (car ev) 'mouse-movement)) - (setq pt (posn-point (event-start ev))) - (when (numberp pt) - (minimap-set-overlay pt)))) - (select-window (get-buffer-window (buffer-base-buffer))) - (minimap-update) - (when (and pcselmode (fboundp 'pc-selection-mode)) - (pc-selection-mode 1))))) - -(defun minimap-set-overlay (pt) - "Set overlay position, with PT being the middle." - (goto-char pt) - (let* ((ovstartline (line-number-at-pos minimap-start)) - (ovendline (line-number-at-pos minimap-end)) - (ovheight (round (/ (- ovendline ovstartline) 2))) - (line (line-number-at-pos)) - (winstart (window-start)) - (winend (window-end)) - newstart newend) - (setq pt (point-at-bol)) - (setq newstart (minimap-line-to-pos (- line ovheight))) - ;; Perform recentering - (minimap-recenter line ovheight) - ;; Set new position in main buffer and redisplay - (with-selected-window (get-buffer-window (buffer-base-buffer)) - (goto-char pt) - (set-window-start nil newstart) - (redisplay t) - (setq newend (window-end))) - (when (eq minimap-recenter-type 'free) - (while (> newend winend) - (scroll-up 5) - (redisplay t) - (setq winend (window-end)))) - (move-overlay minimap-active-overlay newstart newend))) - -(defun minimap-line-to-pos (line) - "Return point position of line number LINE." - (save-excursion - (goto-char 1) - (if (eq selective-display t) - (re-search-forward "[\n\C-m]" nil 'end (1- line)) - (forward-line (1- line))) - (point))) - -(defun minimap-recenter (middle height) - "Recenter the minimap according to `minimap-recenter-type'. -MIDDLE is the line number in the middle of the active region. -HEIGHT is the number of lines from MIDDLE to begin/end of the -active region." - (cond - ;; Relative recentering - ((eq minimap-recenter-type 'relative) - (let* ((maxlines (line-number-at-pos (point-max))) - percentage relpos newline start numlines) - (setq numlines (count-lines (window-start) (window-end))) - (setq percentage (/ (float middle) (float maxlines))) - (setq newline (ceiling (* percentage numlines))) - (setq start (minimap-line-to-pos - (- middle height - (floor (* percentage - (- numlines height height)))))) - (or (> start (point-min)) - (setq start (point-min))) - ;; If (point-max) already visible, don't go further - (if (and (> start (window-start)) - (with-selected-window (get-buffer-window (buffer-base-buffer)) - (= (point-max) (window-end)))) - (save-excursion - (goto-char (point-max)) - (recenter -1)) - (unless (and (> start (window-start)) - (= (point-max) (window-end))) - (set-window-start nil start))))) - ;; Middle recentering - ((eq minimap-recenter-type 'middle) - (let ((start (- middle height - (floor (* 0.5 - (- minimap-numlines height height)))))) - (if (< start 1) - (progn - ;; Hack: Emacs cannot scroll down any further, so we fake - ;; it using an overlay. Otherwise, the active region - ;; would move to the top. - (overlay-put minimap-pointmin-overlay - 'display (concat - (make-string (abs start) 10) - (buffer-substring (point-min) (1+ (point-min))))) - (overlay-put minimap-pointmin-overlay - 'face `(:background ,(face-background 'default))) - (overlay-put minimap-pointmin-overlay - 'priority 10) - (setq start 1)) - (overlay-put minimap-pointmin-overlay 'display "") - (overlay-put minimap-pointmin-overlay 'face nil)) - (set-window-start nil (minimap-line-to-pos start)))) - ;; Free recentering - ((eq minimap-recenter-type 'free) - (let ((newstart (minimap-line-to-pos (- middle height))) - (winstart (window-start))) - (while (< newstart winstart) - (scroll-down 5) - (redisplay t) - (setq winstart (window-start))))))) - -;;; satellite minor mode - -(defvar minimap-mode-map (make-sparse-keymap) - "Keymap used by `minimap-mode'.") - -(define-key minimap-mode-map [down-mouse-1] 'minimap-move-overlay-mouse) -(define-key minimap-mode-map [down-mouse-2] 'minimap-move-overlay-mouse) -(define-key minimap-mode-map [down-mouse-3] 'minimap-move-overlay-mouse) - -(define-minor-mode minimap-mode - "Minor mode for minimap sidebar." - nil "minimap" minimap-mode-map) - -;;; Sync minimap with modes which create/delete overlays. - -(defun minimap-sync-overlays () - "Synchronize overlays between base and minimap buffer. -Apply semantic overlays or face enlargement if necessary." - (interactive) - (let ((baseov (overlays-in (point-min) (point-max))) - (semantic (and (boundp 'semantic-version) - (semantic-active-p))) - ov props p) - (set-window-dedicated-p minimap-window nil) - (with-current-buffer (minimap-buffer-name) - (remove-overlays) - (while baseov - (when (setq props (minimap-get-sync-properties (car baseov))) - (setq ov (make-overlay (overlay-start (car baseov)) - (overlay-end (car baseov)))) - (while (setq p (car props)) - (overlay-put ov (car p) (cadr p)) - (setq props (cdr props)))) - (setq baseov (cdr baseov))) - (move-overlay minimap-pointmin-overlay (point-min) (1+ (point-min))) - ;; Re-apply font overlay - (move-overlay minimap-base-overlay (point-min) (point-max))) - ;; Face enlargement - (when (and font-lock-mode - (or (eq minimap-enlarge-certain-faces 'always) - (and (eq minimap-enlarge-certain-faces 'as-fallback) - (or (not minimap-display-semantic-overlays) - (not semantic))))) - (when (eq font-lock-support-mode 'jit-lock-mode) - (jit-lock-fontify-now)) - (with-current-buffer (minimap-buffer-name) - (minimap-enlarge-faces))) - ;; Semantic overlays - (when (and semantic - minimap-display-semantic-overlays) - (minimap-apply-semantic-overlays))) - (minimap-update t)) - -(defun minimap-get-sync-properties (ov) - "Get properties from overlay OV which should be synced. -You can specify those properties with -`minimap-sync-overlay-properties'." - (delq nil - (mapcar - (lambda (p) - (let ((val (overlay-get ov p))) - (if val - (list p val) - nil))) - minimap-sync-overlay-properties))) - -(defun minimap-enlarge-faces () - "Apply default font to all faces in `minimap-normal-height-faces'. -This has to be called in the minimap buffer." - (let ((pos (next-single-property-change (point-min) 'face)) - next ov face) - (while pos - (setq face (get-text-property pos 'face)) - (when (delq nil (mapcar (lambda (x) (equal x face)) - minimap-normal-height-faces)) - (setq ov - (make-overlay pos - (setq pos (next-single-property-change pos 'face)))) - (overlay-put ov 'face `(:family ,(face-font 'default))) - (overlay-put ov 'priority 5)) - (setq pos (next-single-property-change pos 'face))))) - -(defun minimap-apply-semantic-overlays () - "Apply semantic overlays to the minimap. -This has to be called from the base buffer." - (let ((tags (semantic-fetch-tags)) - tag class ov ovnew) - (while tags - (setq tag (car tags)) - (setq class (semantic-tag-class tag)) - (setq ov (semantic-tag-overlay tag)) - (when (and (overlayp ov) - (or (eq class 'function) - (eq class 'type) - (eq class 'variable))) - (message (minimap-buffer-name)) - (with-current-buffer (minimap-buffer-name) - (let ((start (overlay-start ov)) - (end (overlay-end ov)) - (name (semantic-tag-name tag))) - (overlay-put - (setq ovnew (make-overlay start end)) - 'face `(:background ,(face-background - (intern (format "minimap-semantic-%s-face" - (symbol-name class)))))) - (overlay-put ovnew 'priority 1) - (setq start - (minimap-line-to-pos (/ (+ (line-number-at-pos start) - (line-number-at-pos end)) 2))) - (setq end (progn (goto-char start) (point-at-eol))) - (setq ovnew (make-overlay start end)) - (overlay-put ovnew 'face (format "minimap-semantic-%s-face" - (symbol-name class))) - (overlay-put ovnew 'display (concat " " name " ")) - (overlay-put ovnew 'priority 6)))) - (setq tags (cdr tags))))) - -;; outline-(minor-)mode -(add-hook 'outline-view-change-hook 'minimap-sync-overlays) - -;; hideshow -(add-hook 'hs-hide-hook 'minimap-sync-overlays) -(add-hook 'hs-show-hook 'minimap-sync-overlays) - -(provide 'minimap) -;;; minimap.el ends here diff --git a/lisp/org-custom.el~ b/lisp/org-custom.el~ deleted file mode 100644 index 94b38aa..0000000 --- a/lisp/org-custom.el~ +++ /dev/null @@ -1,73 +0,0 @@ -;; https://zzamboni.org/post/beautifying-org-mode-in-emacs/ - -(defun org-custom-hook() - (setq org-hide-emphasis-markers t) - (font-lock-add-keywords 'org-mode - '(("^ *\\([-]\\) " - (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) - - (let* ((variable-tuple - (cond ((x-list-fonts "ETBembo") '(:font "ETBembo")) - ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro")) - ((x-list-fonts "Lucida Grande") '(:font "Lucida Grande")) - ((x-list-fonts "Verdana") '(:font "Verdana")) - ((x-family-fonts "Sans Serif") '(:family "Sans Serif")) - (nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro.")))) - (base-font-color (face-foreground 'default nil 'default)) - (headline `(:inherit default :weight normal :foreground ,base-font-color))) - - (custom-theme-set-faces - 'user - `(org-level-8 ((t (,@headline ,@variable-tuple)))) - `(org-level-7 ((t (,@headline ,@variable-tuple)))) - `(org-level-6 ((t (,@headline ,@variable-tuple)))) - `(org-level-5 ((t (,@headline ,@variable-tuple)))) - `(org-level-4 ((t (,@headline ,@variable-tuple :height 0.8)))) - `(org-level-3 ((t (,@headline ,@variable-tuple :height 0.9)))) - `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.0)))) - `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.1 :weight bold)))) - `(org-document-title ((t (,@headline ,@variable-tuple :height 1.5 :underline t :weight:bold)))))) - - (custom-theme-set-faces - 'user - '(org-block ((t (:inherit fixed-pitch)))) - '(org-code ((t (:inherit (shadow fixed-pitch))))) - '(org-document-info ((t (:foreground "dark orange")))) - '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) - '(org-indent ((t (:inherit (org-hide fixed-pitch))))) - '(org-link ((t (:foreground "royal blue" :underline t)))) - '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch))))) - '(org-property-value ((t (:inherit fixed-pitch))) t) - '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch))))) - '(org-table ((t (:inherit fixed-pitch :foreground "#83a598")))) - '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8)))) - '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))) - - (variable-pitch-mode) - (visual-line-mode) - - (require 'org-bullets) - (org-bullets-mode 1) - - (setq org-blank-before-new-entry (quote ((heading . nil) - (plain-list-item . nil)))) -) - -(custom-set-variables - '(org-directory "~/Documents/org") - '(org-agenda-files (list org-directory))) - -(setq org-todo-keywords - '((sequence "TODO" "PROGRESS" "VERIFY" "|" "DONE" "ABANDONED"))) - -(setq org-todo-keyword-faces - '(("TODO" . "RED") ("PROGRESS" . "royal blue") ("VERIFY" . "#E0A526") ("ABANDONED" . "light gray") ("DONE" . "dark green")) - ) - -(global-set-key "\C-cl" 'org-store-link) -(global-set-key "\C-ca" 'org-agenda) -(global-set-key "\C-cc" 'org-capture) -(global-set-key "\C-cb" 'org-iswitchb) - - -(provide 'org-custom) diff --git a/lisp/org.el~ b/lisp/org.el~ deleted file mode 100644 index e69de29..0000000 diff --git a/lisp/ts-custom.el~ b/lisp/ts-custom.el~ deleted file mode 100644 index df9510f..0000000 --- a/lisp/ts-custom.el~ +++ /dev/null @@ -1,36 +0,0 @@ -(defun setup-ts() - - (use-package tide :ensure t) - (use-package company :ensure t) - (use-package flycheck :ensure t) - (defun setup-tide-mode() - (interactive) - (tide-setup) - (flycheck-mode +1) - (setq web-mode-enable-auto-quoting nil) - (setq web-mode-markup-indent-offset 2) - (setq web-mode-code-indent-offset 2) - (setq web-mode-attr-indent-offset 2) - (setq web-mode-attr-value-indent-offset 2) - (setq flycheck-check-syntax-automatically '(save-mode-enabled)) - (eldoc-mode +1) - (tide-hl-identifier-mode +1) - (company-mode +1) - (setq flycheck-check-syntax-automatically '(mode-enabled save))) - - (add-hook 'typescript-mode-hook #'setup-tide-mode) - (add-hook 'before-save-hook 'tide-format-before-save) - (require 'web-mode) - - (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)) - (add-hook 'web-mode-hook - (lambda () - (when (string-equal "tsx" (file-name-extension buffer-file-name)) - (setup-tide-mode)))) - - ;; enable typescript - tslint checker - (flycheck-add-mode 'typescript-tslint 'web-mode) - (global-flycheck-mode) - (add-hook 'after-init-hook #'global-flycheck-mode)) - -(provide 'ts-custom) -- cgit v1.2.1