diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index f4b1d1cb40ad..25592296a038 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -40,8 +40,8 @@ (expand-file-name (concat spacemacs-core-directory "templates/")) "Configuration layer templates directory.") -(defconst configuration-layer-contrib-directory - (expand-file-name (concat user-emacs-directory "contrib/")) +(defconst configuration-layer-directory + (expand-file-name (concat user-emacs-directory "layers/")) "Spacemacs contribution layers base directory.") (defconst configuration-layer-private-directory @@ -392,7 +392,7 @@ Possible return values: (if (string-match "^!" (file-name-nondirectory (directory-file-name - (concat configuration-layer-contrib-directory path)))) + (concat configuration-layer-directory path)))) 'category (let ((files (directory-files path))) ;; most frequent files encoutered in a layer are tested first @@ -410,7 +410,7 @@ Returns nil if the directory is not a category." (when (file-directory-p dirpath) (let ((dirname (file-name-nondirectory (directory-file-name - (concat configuration-layer-contrib-directory + (concat configuration-layer-directory dirpath))))) (when (string-match "^!" dirname) (intern (substring dirname 1)))))) @@ -421,7 +421,7 @@ path." ;; load private layers at the end on purpose we asume that the user layers ;; must have the final word on configuration choices. Let ;; `dotspacemacs-directory' override the private directory if it exists. - (let ((search-paths (append (list configuration-layer-contrib-directory) + (let ((search-paths (append (list configuration-layer-directory) dotspacemacs-configuration-layer-path (list configuration-layer-private-layer-directory) (when dotspacemacs-directory @@ -455,8 +455,6 @@ path." (t ;; layer not found, add it to search path (setq search-paths (cons sub search-paths))))))))) - ;; add the spacemacs layer - (puthash 'spacemacs (expand-file-name user-emacs-directory) result) ;; add discovered layers to hash table (mapc (lambda (l) (if (ht-contains? result (car l)) @@ -472,19 +470,22 @@ path." result)) (defun configuration-layer//declare-layers () - "Add default layers and user layers declared in the dotfile." + "Declare default layers and user layers declared in the dotfile." (setq configuration-layer--layers nil) (setq configuration-layer-paths (configuration-layer//discover-layers)) - (if (eq 'all dotspacemacs-configuration-layers) - (setq dotspacemacs-configuration-layers - ;; spacemacs is contained in configuration-layer-paths - (ht-keys configuration-layer-paths)) - (setq configuration-layer--layers - (list (configuration-layer/make-layer 'spacemacs)))) - (setq configuration-layer--layers - (reverse (append (configuration-layer//make-layers - dotspacemacs-configuration-layers) - configuration-layer--layers)))) + (when (eq 'all dotspacemacs-configuration-layers) + (setq dotspacemacs-configuration-layers + (ht-keys configuration-layer-paths))) + (dolist (layer dotspacemacs-configuration-layers) + (let ((layer-name (if (listp layer) (car layer) layer))) + (unless (string-match-p "!distribution" + (ht-get configuration-layer-paths layer-name)) + (push (configuration-layer/make-layer layer) + configuration-layer--layers)))) + (setq configuration-layer--layers (reverse configuration-layer--layers)) + ;; distribution layer is always first + (push (configuration-layer/make-layer dotspacemacs-distribution) + configuration-layer--layers)) (defun configuration-layer/declare-layers (layer-names) "Add layer with LAYER-NAMES to used layers." diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index fe392ca3bd3f..68c198de16fb 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -52,6 +52,11 @@ exists. Otherwise, fallback to ~/.spacemacs") (defvar dotspacemacs-verbose-loading nil "If non nil output loading progess in `*Messages*' buffer.") +(defvar dotspacemacs-distribution 'spacemacs + "Base distribution to use. This is a layer contained in the directory +`!distribution'. For now available distributions are `spacemacs-core' +or `spacemacs'.") + (defvar dotspacemacs-configuration-layer-path '() "List of additional paths where to look for configuration layers. Paths must have a trailing slash (ie. `~/.mycontribs/')") diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index bb57e53c8ce1..0b946ecaa298 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -7,6 +7,10 @@ You should not put any user code in this function besides modifying the variable values." (setq-default + ;; Base distribution to use. This is a layer contained in the directory + ;; `!distribution'. For now available distributions are `spacemacs-core' + ;; or `spacemacs'. (default 'spacemacs) + dotspacemacs-distribution 'spacemacs ;; List of additional paths where to look for configuration layers. ;; Paths must have a trailing slash (i.e. `~/.mycontribs/') dotspacemacs-configuration-layer-path '() diff --git a/contrib/!config/ansible/README.org b/layers/!config-files/ansible/README.org similarity index 100% rename from contrib/!config/ansible/README.org rename to layers/!config-files/ansible/README.org diff --git a/contrib/!config/ansible/config.el b/layers/!config-files/ansible/config.el similarity index 100% rename from contrib/!config/ansible/config.el rename to layers/!config-files/ansible/config.el diff --git a/contrib/!config/ansible/funcs.el b/layers/!config-files/ansible/funcs.el similarity index 100% rename from contrib/!config/ansible/funcs.el rename to layers/!config-files/ansible/funcs.el diff --git a/contrib/!config/ansible/img/ansible.png b/layers/!config-files/ansible/img/ansible.png similarity index 100% rename from contrib/!config/ansible/img/ansible.png rename to layers/!config-files/ansible/img/ansible.png diff --git a/contrib/!config/ansible/packages.el b/layers/!config-files/ansible/packages.el similarity index 100% rename from contrib/!config/ansible/packages.el rename to layers/!config-files/ansible/packages.el diff --git a/contrib/!config/dockerfile/README.org b/layers/!config-files/dockerfile/README.org similarity index 100% rename from contrib/!config/dockerfile/README.org rename to layers/!config-files/dockerfile/README.org diff --git a/contrib/!config/dockerfile/img/docker.png b/layers/!config-files/dockerfile/img/docker.png similarity index 100% rename from contrib/!config/dockerfile/img/docker.png rename to layers/!config-files/dockerfile/img/docker.png diff --git a/contrib/!config/dockerfile/packages.el b/layers/!config-files/dockerfile/packages.el similarity index 100% rename from contrib/!config/dockerfile/packages.el rename to layers/!config-files/dockerfile/packages.el diff --git a/contrib/!config/puppet/README.org b/layers/!config-files/puppet/README.org similarity index 100% rename from contrib/!config/puppet/README.org rename to layers/!config-files/puppet/README.org diff --git a/contrib/!config/puppet/config.el b/layers/!config-files/puppet/config.el similarity index 100% rename from contrib/!config/puppet/config.el rename to layers/!config-files/puppet/config.el diff --git a/contrib/!config/puppet/img/puppet.png b/layers/!config-files/puppet/img/puppet.png similarity index 100% rename from contrib/!config/puppet/img/puppet.png rename to layers/!config-files/puppet/img/puppet.png diff --git a/contrib/!config/puppet/packages.el b/layers/!config-files/puppet/packages.el similarity index 100% rename from contrib/!config/puppet/packages.el rename to layers/!config-files/puppet/packages.el diff --git a/contrib/!config/salt/README.org b/layers/!config-files/salt/README.org similarity index 100% rename from contrib/!config/salt/README.org rename to layers/!config-files/salt/README.org diff --git a/contrib/!config/salt/img/saltstack.png b/layers/!config-files/salt/img/saltstack.png similarity index 100% rename from contrib/!config/salt/img/saltstack.png rename to layers/!config-files/salt/img/saltstack.png diff --git a/contrib/!config/salt/packages.el b/layers/!config-files/salt/packages.el similarity index 100% rename from contrib/!config/salt/packages.el rename to layers/!config-files/salt/packages.el diff --git a/contrib/!config/terraform/README.org b/layers/!config-files/terraform/README.org similarity index 100% rename from contrib/!config/terraform/README.org rename to layers/!config-files/terraform/README.org diff --git a/contrib/!config/terraform/img/terraform.png b/layers/!config-files/terraform/img/terraform.png similarity index 100% rename from contrib/!config/terraform/img/terraform.png rename to layers/!config-files/terraform/img/terraform.png diff --git a/contrib/!config/terraform/packages.el b/layers/!config-files/terraform/packages.el similarity index 100% rename from contrib/!config/terraform/packages.el rename to layers/!config-files/terraform/packages.el diff --git a/spacemacs/config.el b/layers/!distribution/spacemacs-core/config.el similarity index 63% rename from spacemacs/config.el rename to layers/!distribution/spacemacs-core/config.el index 63d1aa55369d..c255eccdef14 100644 --- a/spacemacs/config.el +++ b/layers/!distribution/spacemacs-core/config.el @@ -1,4 +1,4 @@ -;;; config.el --- Spacemacs Layer configuration File +;;; config.el --- Spacemacs Core Layer configuration File ;; ;; Copyright (c) 2012-2014 Sylvain Benner ;; Copyright (c) 2014-2015 Sylvain Benner & Contributors @@ -70,15 +70,12 @@ ;; Navigation ;; --------------------------------------------------------------------------- -(ido-mode t) -(setq ido-save-directory-list-file (concat spacemacs-cache-directory "ido.last") - ;; enable fuzzy matching - ido-enable-flex-matching t) -;; Auto refresh buffers +;; Auto refresh (global-auto-revert-mode 1) ;; Also auto refresh dired, but be quiet about it (setq global-auto-revert-non-file-buffers t auto-revert-verbose nil) + ;; Regexp for useful and useless buffers for smarter buffer switching (defvar spacemacs-useless-buffers-regexp '("*\.\+") "Regexp used to determine if a buffer is not useful.") @@ -86,18 +83,9 @@ "Regexp used to define buffers that are useful despite matching `spacemacs-useless-buffers-regexp'.") -;; activate winner mode use to undo and redo windows layout -(winner-mode t) ;; no beep pleeeeeease ! (and no visual blinking too please) (setq ring-bell-function 'ignore visible-bell nil) -;; required for evil folding -(defun spacemacs//enable-hs-minor-mode () - "Enable hs-minor-mode for code folding." - (ignore-errors - (hs-minor-mode) - (spacemacs|hide-lighter hs-minor-mode))) -(add-hook 'prog-mode-hook 'spacemacs//enable-hs-minor-mode) ;; Hack to fix a bug with tabulated-list.el ;; see: http://redd.it/2dgy52 @@ -126,25 +114,11 @@ It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'." ;; start scratch in text mode (usefull to get a faster Emacs load time ;; because it avoids autoloads of elisp modes) (setq initial-major-mode 'text-mode) -;; whitespace-mode -(defcustom spacemacs-show-trailing-whitespace t - "If t, show trailing whitespace." - :type 'boolean - :group 'spacemacs) - -(add-hook 'prog-mode-hook (lambda () - (when spacemacs-show-trailing-whitespace - (set-face-attribute 'trailing-whitespace nil - :background (face-attribute 'font-lock-comment-face - :foreground)) - (setq show-trailing-whitespace 1)))) - ;; use only spaces and no tabs (setq-default indent-tabs-mode nil default-tab-width 2) -;; turn on electric-indent-mode for both 24.3 and 24.4 -(electric-indent-mode) + ;; Text (setq longlines-show-hard-newlines t) @@ -193,23 +167,16 @@ It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'." (fset 'yes-or-no-p 'y-or-n-p) ;; draw underline lower (setq x-underline-at-descent-line t) -;; setup right and left margins -;; (add-hook 'window-configuration-change-hook -;; (lambda () -;; (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 0 0))) - ;; don't let the cursor go into minibuffer prompt ;; Tip taken from Xah Lee: http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html (setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) - ;; Emacs 24.4 new features (unless (version< emacs-version "24.4") (if dotspacemacs-fullscreen-at-startup (spacemacs/toggle-frame-fullscreen) (if dotspacemacs-maximized-at-startup (add-hook 'window-setup-hook 'toggle-frame-maximized)))) - (defvar spacemacs--global-mode-line-excludes nil "List of elements to exclude from the global modeline string. These should have their own segments in the modeline.") @@ -249,12 +216,6 @@ These should have their own segments in the modeline.") (_ (setq auto-save-default nil auto-save-list-file-prefix nil))) -(require 'uniquify) -;; When having windows with repeated filenames, uniquify them -;; by the folder they are in rather those annoying <2>,<3>,.. etc -(setq uniquify-buffer-name-style 'post-forward-angle-brackets - ;; don't screw special buffers - uniquify-ignore-buffers-re "^\\*") ;; remove annoying ellipsis when printing sexp in message buffer (setq eval-expression-print-length nil eval-expression-print-level nil) @@ -278,94 +239,3 @@ These should have their own segments in the modeline.") (defun server-remove-kill-buffer-hook () (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)) (add-hook 'server-visit-hook 'server-remove-kill-buffer-hook) - -;; The following code is kept as reference ----------------------------------- - -;; ;; save a bunch of variables to the desktop file -;; ;; for lists specify the len of the maximal saved data also -;; (setq desktop-globals-to-save -;; (append '((extended-command-history . 30) -;; (file-name-history . 100) -;; (grep-history . 30) -;; (compile-history . 30) -;; (minibuffer-history . 50) -;; (query-replace-history . 60) -;; (read-expression-history . 60) -;; (regexp-history . 60) -;; (regexp-search-ring . 20) -;; (search-ring . 20) -;; (shell-command-history . 50) -;; (evil-ex .100) -;; tags-file-name -;; register-alist))) - -;; ;; Make emacs open all files in last emacs session (taken from ergoemacs). - -;; ;; This functionality is provided by desktop-save-mode -;; ;; (“feature” name: “desktop”). -;; ;; -;; ;; The mode is not on by default in emacs 23.1, and has a lot options. -;; ;; The following is init settings for the mode for ErgoEmacs. -;; ;; Goal: have emacs always auto open the set of opened files in last session, -;; ;; even if emacs crashed in last session or the OS crashed in last session. -;; ;; Also, don't bother users by asking questions like “do you want to save -;; ;; desktop?” or “do you want to override last session file?”, because these are -;; ;; annoying and terms like “session” or “desktop” are confusing to most users -;; ;; because it can have many meanings. -;; ;; -;; ;; Some tech detail: set the desktop session file 〔.emacs.desktop〕 -;; ;; at the variable “user-emacs-directory” (default value is “~/.emacs.d/”). -;; ;; This file is our desktop file. It will be auto created and or over-written. -;; ;; If a emacs expert has other desktop session files elsewhere, he can still use -;; ;; or manage those. - -;; (require 'desktop) - -;; (defun desktop-settings-setup () -;; "Some settings setup for desktop-save-mode." -;; (interactive) - -;; ;; At this point the desktop.el hook in after-init-hook was -;; ;; executed, so (desktop-read) is avoided. -;; (when (not (eq (emacs-pid) (desktop-owner))) ; Check that emacs did not load a desktop yet -;; ;; Here we activate the desktop mode -;; (desktop-save-mode 1) -;; ;; The default desktop is saved always -;; (setq desktop-save t) -;; ;; The default desktop is loaded anyway if it is locked -;; (setq desktop-load-locked-desktop t) -;; ;; Set the location to save/load default desktop -;; (setq desktop-dirname user-emacs-directory) -;; ;; Make sure that even if emacs or OS crashed, emacs -;; ;; still have last opened files. -;; (add-hook 'find-file-hook -;; (lambda () -;; (run-with-timer 5 nil -;; (lambda () -;; ;; Reset desktop modification time so the user is not bothered -;; (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))) -;; (desktop-save user-emacs-directory))))) -;; ;; Read default desktop -;; (if (file-exists-p (concat desktop-dirname desktop-base-file-name)) -;; (desktop-read desktop-dirname)) -;; ;; Add a hook when emacs is closed to we reset the desktop -;; ;; modification time (in this way the user does not get a warning -;; ;; message about desktop modifications) -;; (add-hook 'kill-emacs-hook -;; (lambda () -;; ;; Reset desktop modification time so the user is not bothered -;; (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))))) -;; ) -;; ) - -;; (add-hook 'after-init-hook -;; ;; 'desktop-settings-setup -;; (lambda () -;; ;; No splash screen -;; (setq inhibit-startup-screen t) -;; ;; ;; If the *scratch* buffer is the current one, then create a new -;; ;; ;; empty untitled buffer to hide *scratch* -;; ;; (if (string= (buffer-name) "*scratch*") -;; ;; (spacemacs/new-empty-buffer)) -;; ) -;; t) ;; append this hook to the tail diff --git a/spacemacs/funcs.el b/layers/!distribution/spacemacs-core/funcs.el similarity index 84% rename from spacemacs/funcs.el rename to layers/!distribution/spacemacs-core/funcs.el index 227d2c9766d4..67cbcad6d1fb 100644 --- a/spacemacs/funcs.el +++ b/layers/!distribution/spacemacs-core/funcs.el @@ -1,4 +1,4 @@ -;;; funcs.el --- Spacemacs Layer functions File +;;; funcs.el --- Spacemacs Core Layer functions File ;; ;; Copyright (c) 2012-2014 Sylvain Benner ;; Copyright (c) 2014-2015 Sylvain Benner & Contributors @@ -192,7 +192,6 @@ the current state and point position." :type 'number :group 'spacemacs) - (defun spacemacs/indent-region-or-buffer () "Indent a region if selected, otherwise the whole buffer." (interactive) @@ -207,58 +206,6 @@ the current state and point position." (message "Indented buffer."))) (whitespace-cleanup)))) -;; linum gutter helpers -(defvar spacemacs-linum-mdown-line nil - "Define persistent variable for linum selection") - -(defun spacemacs/line-at-click () - "Determine the visual line at click" - (save-excursion - (let ((click-y (cddr (mouse-position))) - (debug-on-error t) - (line-move-visual t)) - (goto-char (window-start)) - (next-line (1- click-y)) - (1+ (line-number-at-pos)) - ))) - -(defun spacemacs/md-select-linum (event) - "Set point as spacemacs-linum-mdown-line" - (interactive "e") - (mouse-select-window event) - (goto-line (spacemacs/line-at-click)) - (set-mark (point)) - (setq spacemacs-linum-mdown-line - (line-number-at-pos))) - -(defun spacemacs/mu-select-linum () - "Select code block between point and spacemacs-linum-mdown-line" - (interactive) - (when spacemacs-linum-mdown-line - (let (mu-line) - (setq mu-line (spacemacs/line-at-click)) - (goto-line (max spacemacs-linum-mdown-line mu-line)) - (set-mark (line-end-position)) - (goto-line (min spacemacs-linum-mdown-line mu-line)) - (setq spacemacs-linum-mdown-line nil)))) - -(defun spacemacs/select-current-block () - "Select the current block of text between blank lines." - (interactive) - (let (p1 p2) - (progn - (if (re-search-backward "\n[ \t]*\n" nil "move") - (progn (re-search-forward "\n[ \t]*\n") - (setq p1 (point))) - (setq p1 (point))) - (if (re-search-forward "\n[ \t]*\n" nil "move") - (progn (re-search-backward "\n[ \t]*\n") - (setq p2 (point))) - (setq p2 (point)))) - (set-mark p1))) - -;; eval lisp helpers - ;; idea from http://www.reddit.com/r/emacs/comments/312ge1/i_created_this_function_because_i_was_tired_of/ (defun spacemacs/eval-current-form () "Looks for the current def* or set* command then evaluates, unlike `eval-defun', does not go to topmost function" @@ -290,6 +237,22 @@ the current state and point position." (window-configuration-to-register '_) (delete-other-windows)))) +;; A small minor mode to use a big fringe +;; from http://bzg.fr/emacs-strip-tease.html +(defvar bzg-big-fringe-mode nil) +(define-minor-mode bzg-big-fringe-mode + "Minor mode to use big fringe in the current buffer." + :init-value nil + :global t + :variable bzg-big-fringe-mode + :group 'editing-basics + (if (not bzg-big-fringe-mode) + (set-fringe-style nil) + (set-fringe-mode + (/ (- (frame-pixel-width) + (* 100 (frame-char-width))) + 2)))) + (defun spacemacs/toggle-maximize-centered-buffer () "Maximize buffer and center it on the screen" (interactive) @@ -301,35 +264,21 @@ the current state and point position." (delete-other-windows) (bzg-big-fringe-mode 1)))) -(defun spacemacs/toggle-triple-double-column-mode () - "Toggle between triple columns and double columns mode quickly." - (interactive) - (if (= 3 (length (window-list))) - (progn (delete-window (window-next-sibling)) - (golden-ratio-mode 1)) - (let ((num-windows (length (window-list)))) - (progn - (golden-ratio-mode 0) - (dotimes (i (max 0 (- num-windows 3))) - (delete-window (window-next-sibling))) - (dotimes (i (- 3 (length (window-list)))) - (progn (split-window-right) - (balance-windows))))))) - -(defun spacemacs/layout-triple-columns () - "Set the layout to triple columns." - (interactive) - (golden-ratio-mode 0) - (delete-other-windows) - (dotimes (i 2) (split-window-right)) - (balance-windows)) - -(defun spacemacs/layout-double-columns () - "Set the layout to double columns." - (interactive) - (golden-ratio-mode 1) - (delete-other-windows) - (split-window-right)) +(defun spacemacs/useless-buffer-p (buffer) + "Determines if a buffer is useful." + (let ((buf-paren-major-mode (get (with-current-buffer buffer + major-mode) + 'derived-mode-parent)) + (buf-name (buffer-name buffer))) + ;; first find if useful buffer exists, if so returns nil and don't check for + ;; useless buffers. If no useful buffer is found, check for useless buffers. + (unless (cl-loop for regexp in spacemacs-useful-buffers-regexp do + (when (or (eq buf-paren-major-mode 'comint-mode) + (string-match regexp buf-name)) + (return t))) + (cl-loop for regexp in spacemacs-useless-buffers-regexp do + (when (string-match regexp buf-name) + (return t)))))) ;; from magnars modified by ffevotte for dedicated windows support (defun spacemacs/rotate-windows (count) @@ -366,22 +315,6 @@ argument takes the kindows rotate backwards." (interactive "p") (spacemacs/rotate-windows (* -1 count))) -(defun spacemacs/useless-buffer-p (buffer) - "Determines if a buffer is useful." - (let ((buf-paren-major-mode (get (with-current-buffer buffer - major-mode) - 'derived-mode-parent)) - (buf-name (buffer-name buffer))) - ;; first find if useful buffer exists, if so returns nil and don't check for - ;; useless buffers. If no useful buffer is found, check for useless buffers. - (unless (cl-loop for regexp in spacemacs-useful-buffers-regexp do - (when (or (eq buf-paren-major-mode 'comint-mode) - (string-match regexp buf-name)) - (return t))) - (cl-loop for regexp in spacemacs-useless-buffers-regexp do - (when (string-match regexp buf-name) - (return t)))))) - (defun spacemacs/next-useful-buffer () "Switch to the next buffer and avoid special buffers." (interactive) @@ -435,39 +368,6 @@ argument takes the kindows rotate backwards." (kill-buffer buffer) (message "File '%s' successfully removed" filename))))) -;; from magnars -(defun spacemacs/find-or-create-file-at-point () - "Guesses what parts of the buffer under point is a file name and opens it." - (interactive) - (find-spacemacs/file (file-name-at-point))) - -;; from magnars -(defun spacemacs/find-or-create-file-at-point-other-window () - "Guesses what parts of the buffer under point is a file name and opens it." - (interactive) - (find-spacemacs/file-other-window (file-name-at-point))) - -;; from magnars -(defun spacemacs/file-name-at-point () - (save-excursion - (let* ((file-name-regexp "[./a-zA-Z0-9\-_~]") - (start (progn - (while (looking-back file-name-regexp) - (forward-char -1)) - (point))) - (end (progn - (while (looking-at file-name-regexp) - (forward-char 1)) - (point)))) - (buffer-substring start end)))) - -;; from magnars -(defun spacemacs/touch-buffer-file () - (interactive) - (insert " ") - (backward-delete-char 1) - (save-buffer)) - ;; from magnars (defun spacemacs/sudo-edit (&optional arg) (interactive "p") @@ -484,19 +384,6 @@ argument takes the kindows rotate backwards." (mapc 'kill-buffer (delq (current-buffer) (buffer-list))) (message "Buffers deleted!")))) -;; evenly split windows horizontally -(defun spacemacs/evenly-split-window-right () - "Evenly split frame horizontally." - (interactive) - (split-window-right) - (balance-windows)) -;; evenly split windows vertically -(defun spacemacs/evenly-split-window-below () - "Evenly split frame vertically." - (interactive) - (split-window-below) - (balance-windows)) - ;; from http://dfan.org/blog/2009/02/19/emacs-dedicated-windows/ (defun spacemacs/toggle-current-window-dedication () "Toggle dedication state of a window." @@ -545,127 +432,7 @@ argument takes the kindows rotate backwards." (defun spacemacs/find-contrib-file () (interactive) "Edit the `file' in the spacemacs base directory, in the current window." - (ido-find-file-in-dir configuration-layer-contrib-directory)) - -;; byte compile elisp files -(defun byte-compile-current-buffer () - "`byte-compile' current buffer if it's emacs-lisp-mode and compiled file exists." - (interactive) - (when (and (eq major-mode 'emacs-lisp-mode) - (file-exists-p (byte-compile-dest-file buffer-file-name))) - (byte-compile-file buffer-file-name))) - -(add-hook 'after-save-hook 'byte-compile-current-buffer) - -;; From http://xugx2007.blogspot.ca/2007/06/benjamin-rutts-emacs-c-development-tips.html -(setq compilation-finish-function - (lambda (buf str) - - (if (or (string-match "exited abnormally" str) - (string-match "FAILED" (buffer-string))) - - ;; there were errors - (message "There were errors. SPC-e-n to visit.") - (unless (or (string-match "Grep finished" (buffer-string)) - (string-match "Ag finished" (buffer-string)) - (string-match "nosetests" (buffer-name))) - - ;; no errors - (message "compilation ok."))))) - -;; from https://gist.github.com/timcharper/493269 -(defun spacemacs/split-window-vertically-and-switch () - (interactive) - (split-window-vertically) - (other-window 1)) - -(defun spacemacs/split-window-horizontally-and-switch () - (interactive) - (split-window-horizontally) - (other-window 1)) - -(defun spacemacs/ido-invoke-in-other-window () - "signals ido mode to switch to (or create) another window after exiting" - (interactive) - (setq ido-exit-minibuffer-target-window 'other) - (ido-exit-minibuffer)) - -(defun spacemacs/ido-invoke-in-horizontal-split () - "signals ido mode to split horizontally and switch after exiting" - (interactive) - (setq ido-exit-minibuffer-target-window 'horizontal) - (ido-exit-minibuffer)) - -(defun spacemacs/ido-invoke-in-vertical-split () - "signals ido mode to split vertically and switch after exiting" - (interactive) - (setq ido-exit-minibuffer-target-window 'vertical) - (ido-exit-minibuffer)) - -(defun spacemacs/ido-invoke-in-new-frame () - "signals ido mode to create a new frame after exiting" - (interactive) - (setq ido-exit-minibuffer-target-window 'frame) - (ido-exit-minibuffer)) - -(defadvice ido-read-internal (around ido-read-internal-with-minibuffer-other-window activate) - (let* (ido-exit-minibuffer-target-window - (this-buffer (current-buffer)) - (result ad-do-it)) - (cond - ((equal ido-exit-minibuffer-target-window 'other) - (if (= 1 (count-windows)) - (spacemacs/split-window-horizontally-and-switch) - (other-window 1))) - ((equal ido-exit-minibuffer-target-window 'horizontal) - (spacemacs/split-window-horizontally-and-switch)) - - ((equal ido-exit-minibuffer-target-window 'vertical) - (spacemacs/split-window-vertically-and-switch)) - ((equal ido-exit-minibuffer-target-window 'frame) - (make-frame))) - (switch-to-buffer this-buffer) ;; why? Some ido commands, such as textmate.el's textmate-goto-symbol don't switch the current buffer - result)) - -(defun spacemacs/set-google-translate-languages (source target) - "Set source language for google translate. -For instance pass En as source for english." - (interactive "sEnter source language (ie. En): \nsEnter target language (ie. En): " - source target) - (message (format "Set google translate source language to %s and target to %s" - source target)) - (setq google-translate-default-source-language source) - (setq google-translate-default-target-language target)) - -;; from http://www.emacswiki.org/emacs/WordCount -(defun spacemacs/count-words-analysis (start end) - "Count how many times each word is used in the region. - Punctuation is ignored." - (interactive "r") - (let (words) - (save-excursion - (goto-char start) - (while (re-search-forward "\\w+" end t) - (let* ((word (intern (match-string 0))) - (cell (assq word words))) - (if cell - (setcdr cell (1+ (cdr cell))) - (setq words (cons (cons word 1) words)))))) - (when (interactive-p) - (message "%S" words)) - words)) - -(defun spacemacs/set-attributes-from-alist (face attr) - "Apply an alist of attributes in the form ((:PROP . VALUE)) to face." - (while (car attr) - (set-face-attribute face nil (caar attr) (cdar attr)) - (setq attr (cdr attr)))) - -(defun spacemacs/new-empty-buffer () - "Create a new buffer called untitled()" - (interactive) - (let ((newbuf (generate-new-buffer-name "untitled"))) - (switch-to-buffer newbuf))) + (ido-find-file-in-dir configuration-layer-directory)) (defun spacemacs/home () "Go to home Spacemacs buffer" @@ -759,27 +526,6 @@ dotspacemacs-persistent-server to be t" (server-kill-buffer) (make-frame-invisible nil 1)) -;; A small minor mode to use a big fringe -;; from http://bzg.fr/emacs-strip-tease.html -(defvar bzg-big-fringe-mode nil) -(define-minor-mode bzg-big-fringe-mode - "Minor mode to use big fringe in the current buffer." - :init-value nil - :global t - :variable bzg-big-fringe-mode - :group 'editing-basics - (if (not bzg-big-fringe-mode) - (set-fringe-style nil) - (set-fringe-mode - (/ (- (frame-pixel-width) - (* 100 (frame-char-width))) - 2)))) - -(defun spacemacs/fill-char-to-column (char column) - " Fill the line with CHAR up to the given COLUMN" - (interactive "cFill with char: \nnUp to column: " - char column)) - (defun spacemacs/toggle-frame-fullscreen () "Respect the `dotspacemacs-fullscreen-use-non-native' variable when toggling fullscreen." @@ -828,14 +574,6 @@ The body of the advice is in BODY." ,@body)) commands))) -(defun spacemacs/disable-electric-indent-mode () - (if (fboundp 'electric-indent-local-mode) - ;; for 24.4 - (electric-indent-local-mode -1) - ;; for 24.3 - (add-hook 'electric-indent-functions - (lambda () 'no-indent) nil 'local))) - (defun spacemacs/safe-revert-buffer () "Prompt before reverting the file." (interactive) @@ -927,13 +665,6 @@ current window." (clipboard-yank) (deactivate-mark)) -;; indent on paste -;; from Prelude: https://github.com/bbatsov/prelude -(defun spacemacs/yank-advised-indent-function (beg end) - "Do indentation, as long as the region isn't too large." - (if (<= (- end beg) spacemacs-yank-indent-threshold) - (indent-region beg end nil))) - ;; hide mode line ;; from http://bzg.fr/emacs-hide-mode-line.html (defvar-local hidden-mode-line-mode nil) @@ -959,17 +690,6 @@ current window." (concat "Hidden Mode Line Mode enabled. " "Use M-x hidden-mode-line-mode to make the mode-line appear.")))) -(spacemacs|advise-commands - "indent" (yank yank-pop evil-paste-before evil-paste-after) after - "If current mode is not one of spacemacs-indent-sensitive-modes - indent yanked text (with universal arg don't indent)." - (if (and (not (equal '(4) (ad-get-arg 0))) - (not (member major-mode spacemacs-indent-sensitive-modes)) - (or (derived-mode-p 'prog-mode) - (member major-mode spacemacs-indent-sensitive-modes))) - (let ((transient-mark-mode nil)) - (spacemacs/yank-advised-indent-function (region-beginning) (region-end))))) - ;; BEGIN align functions ;; modified function from http://emacswiki.org/emacs/AlignCommands @@ -1048,23 +768,6 @@ first element is the symbol `image')." object (eq 'image (car object)))) -(defun spacemacs//intersperse (seq separator) - "Returns a list with `SEPARATOR' added between each element -of the list `SEQ'." - (cond - ((not seq) nil) - ((not (cdr seq)) seq) - (t (append (list (car seq) separator) - (spacemacs//intersperse (cdr seq) separator))))) - -(defun spacemacs//mode-line-nonempty (seg) - "Checks whether a modeline segment (classical Emacs style) -is nonempty." - (let ((val (format-mode-line seg))) - (cond ((listp val) val) - ((stringp val) (< 0 (length val))) - (t)))) - (defun spacemacs/uniquify-lines () "Remove duplicate adjacent lines in region or current buffer" (interactive) @@ -1082,3 +785,135 @@ is nonempty." (let ((beg (if (region-active-p) (region-beginning) (point-min))) (end (if (region-active-p) (region-end) (point-max)))) (sort-lines nil beg end))) + +;; BEGIN linum mouse helpers + +(defvar spacemacs-linum-mdown-line nil + "Define persistent variable for linum selection") + +(defun spacemacs/line-at-click () + "Determine the visual line at click" + (save-excursion + (let ((click-y (cddr (mouse-position))) + (debug-on-error t) + (line-move-visual t)) + (goto-char (window-start)) + (next-line (1- click-y)) + (1+ (line-number-at-pos)) + ))) + +(defun spacemacs/md-select-linum (event) + "Set point as spacemacs-linum-mdown-line" + (interactive "e") + (mouse-select-window event) + (goto-line (spacemacs/line-at-click)) + (set-mark (point)) + (setq spacemacs-linum-mdown-line + (line-number-at-pos))) + +(defun spacemacs/mu-select-linum () + "Select code block between point and spacemacs-linum-mdown-line" + (interactive) + (when spacemacs-linum-mdown-line + (let (mu-line) + (setq mu-line (spacemacs/line-at-click)) + (goto-line (max spacemacs-linum-mdown-line mu-line)) + (set-mark (line-end-position)) + (goto-line (min spacemacs-linum-mdown-line mu-line)) + (setq spacemacs-linum-mdown-line nil)))) + +(defun spacemacs/select-current-block () + "Select the current block of text between blank lines." + (interactive) + (let (p1 p2) + (progn + (if (re-search-backward "\n[ \t]*\n" nil "move") + (progn (re-search-forward "\n[ \t]*\n") + (setq p1 (point))) + (setq p1 (point))) + (if (re-search-forward "\n[ \t]*\n" nil "move") + (progn (re-search-backward "\n[ \t]*\n") + (setq p2 (point))) + (setq p2 (point)))) + (set-mark p1))) + +;; END linum mouse helpers + +;; From http://xugx2007.blogspot.ca/2007/06/benjamin-rutts-emacs-c-development-tips.html +(setq compilation-finish-function + (lambda (buf str) + + (if (or (string-match "exited abnormally" str) + (string-match "FAILED" (buffer-string))) + + ;; there were errors + (message "There were errors. SPC-e-n to visit.") + (unless (or (string-match "Grep finished" (buffer-string)) + (string-match "Ag finished" (buffer-string)) + (string-match "nosetests" (buffer-name))) + + ;; no errors + (message "compilation ok."))))) + +;; from http://www.emacswiki.org/emacs/WordCount +(defun spacemacs/count-words-analysis (start end) + "Count how many times each word is used in the region. + Punctuation is ignored." + (interactive "r") + (let (words) + (save-excursion + (goto-char start) + (while (re-search-forward "\\w+" end t) + (let* ((word (intern (match-string 0))) + (cell (assq word words))) + (if cell + (setcdr cell (1+ (cdr cell))) + (setq words (cons (cons word 1) words)))))) + (when (interactive-p) + (message "%S" words)) + words)) + +;; byte compile elisp files +(defun byte-compile-current-buffer () + "`byte-compile' current buffer if it's emacs-lisp-mode and compiled file exists." + (interactive) + (when (and (eq major-mode 'emacs-lisp-mode) + (file-exists-p (byte-compile-dest-file buffer-file-name))) + (byte-compile-file buffer-file-name))) + +(add-hook 'after-save-hook 'byte-compile-current-buffer) + +;; indent on paste +;; from Prelude: https://github.com/bbatsov/prelude +(defun spacemacs/yank-advised-indent-function (beg end) + "Do indentation, as long as the region isn't too large." + (if (<= (- end beg) spacemacs-yank-indent-threshold) + (indent-region beg end nil))) + +(spacemacs|advise-commands + "indent" (yank yank-pop evil-paste-before evil-paste-after) after + "If current mode is not one of spacemacs-indent-sensitive-modes + indent yanked text (with universal arg don't indent)." + (if (and (not (equal '(4) (ad-get-arg 0))) + (not (member major-mode spacemacs-indent-sensitive-modes)) + (or (derived-mode-p 'prog-mode) + (member major-mode spacemacs-indent-sensitive-modes))) + (let ((transient-mark-mode nil)) + (spacemacs/yank-advised-indent-function (region-beginning) (region-end))))) + +(defun spacemacs//intersperse (seq separator) + "Returns a list with `SEPARATOR' added between each element +of the list `SEQ'." + (cond + ((not seq) nil) + ((not (cdr seq)) seq) + (t (append (list (car seq) separator) + (spacemacs//intersperse (cdr seq) separator))))) + +(defun spacemacs//mode-line-nonempty (seg) + "Checks whether a modeline segment (classical Emacs style) +is nonempty." + (let ((val (format-mode-line seg))) + (cond ((listp val) val) + ((stringp val) (< 0 (length val))) + (t)))) diff --git a/spacemacs/keybindings.el b/layers/!distribution/spacemacs-core/keybindings.el similarity index 98% rename from spacemacs/keybindings.el rename to layers/!distribution/spacemacs-core/keybindings.el index 77e34baa3265..d25d26c5c8c3 100644 --- a/spacemacs/keybindings.el +++ b/layers/!distribution/spacemacs-core/keybindings.el @@ -1,4 +1,4 @@ -;;; keybindings.el --- Spacemacs Layer key-bindings File +;;; keybindings.el --- Spacemacs Core Layer key-bindings File ;; ;; Copyright (c) 2012-2014 Sylvain Benner ;; Copyright (c) 2014-2015 Sylvain Benner & Contributors @@ -151,7 +151,6 @@ Ensure that helm is required before calling FUNC." "jh" 'spacemacs/push-mark-and-goto-beginning-of-line "jl" 'spacemacs/push-mark-and-goto-end-of-line) ;; Compilation ---------------------------------------------------------------- -(evil-leader/set-key "cc" 'helm-make-projectile) (evil-leader/set-key "cC" 'compile) (evil-leader/set-key "cr" 'recompile) ;; narrow & widen ------------------------------------------------------------- @@ -160,10 +159,6 @@ Ensure that helm is required before calling FUNC." "np" 'narrow-to-page "nf" 'narrow-to-defun "nw" 'widen) -;; spell check --------------------------------------------------------------- -(evil-leader/set-key - "Sd" 'ispell-change-dictionary - "Sn" 'flyspell-goto-next-error) ;; toggle --------------------------------------------------------------------- (spacemacs|add-toggle highlight-current-line-globally :status global-hl-line-mode diff --git a/spacemacs/local/centered-cursor/centered-cursor-mode.el b/layers/!distribution/spacemacs-core/local/centered-cursor/centered-cursor-mode.el similarity index 100% rename from spacemacs/local/centered-cursor/centered-cursor-mode.el rename to layers/!distribution/spacemacs-core/local/centered-cursor/centered-cursor-mode.el diff --git a/layers/!distribution/spacemacs-core/local/experimental-iedit/experimental-iedit.el b/layers/!distribution/spacemacs-core/local/experimental-iedit/experimental-iedit.el new file mode 100644 index 000000000000..952504b4239d --- /dev/null +++ b/layers/!distribution/spacemacs-core/local/experimental-iedit/experimental-iedit.el @@ -0,0 +1,128 @@ +;;; experimental-iedit.el --- iedit experimentations. + +;; Author: Sylvain Benner +;; Keywords: helm, spacemacs +;; Version: 0.1 +;; Package-Requires: ((helm "1.5")) + +;; This file 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 3, or (at your option) +;; any later version. + +;; This file 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 GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; This package adds a convenient way to discover Spacemacs configuration +;; layers thanks to helm. + +;;; Code: + +(require 'iedit) +(require 'evil-iedit-state) + +(define-key evil-iedit-state-map (kbd "H") 'ex-iedit-move-overlays-backward) +(define-key evil-iedit-state-map (kbd "J") 'ex-iedit-move-overlays-next-line) +(define-key evil-iedit-state-map (kbd "K") 'ex-iedit-move-overlays-previous-line) +(define-key evil-iedit-state-map (kbd "L") 'ex-iedit-move-overlays-forward) +(define-key evil-iedit-state-map (kbd "C-S-h") '(lambda () (interactive) (ex-iedit-expand-overlays -1))) +(define-key evil-iedit-state-map (kbd "C-S-l") '(lambda () (interactive) (ex-iedit-expand-overlays 1))) +(define-key evil-iedit-state-map (kbd "w") '(lambda () (interactive) (ex-iedit-expand-overlays 'evil-forward-word-begin t))) +(define-key evil-iedit-state-map (kbd "gj") 'ex-iedit-toggle-point-overlay-next-line) +(define-key evil-iedit-state-map (kbd "gk") 'ex-iedit-toggle-point-overlay-previous-line) + +(defun iedit-toggle-selection () + "Override default iedit function to be able to add arbitrary overlays. + +It will toggle the overlay under point or create an overlay of one character." + (interactive) + (iedit-barf-if-buffering) + (let ((ov (iedit-find-current-occurrence-overlay))) + (if ov + (iedit-restrict-region (overlay-start ov) (overlay-end ov) t) + (save-excursion + (push (iedit-make-occurrence-overlay (point) (1+ (point))) + iedit-occurrences-overlays)) + (setq iedit-mode + (propertize + (concat " Iedit:" (number-to-string + (length iedit-occurrences-overlays))) + 'face 'font-lock-warning-face)) + (force-mode-line-update)))) + +(defun ex-iedit-move-overlays (func) + (dolist (o iedit-occurrences-overlays) + (let* ((start (overlay-start o)) + (end (overlay-end o)) + (len (- end start))) + (save-excursion + (goto-char (overlay-start o)) + (ignore-errors (call-interactively func)) + (move-overlay o (point) (+ (point) len)))))) + +(defun ex-iedit-expand-overlays (arg &optional from-end) + (when (iedit-find-current-occurrence-overlay) + (dolist (o iedit-occurrences-overlays) + (let ((start (overlay-start o)) + (end (overlay-end o))) + (save-excursion + (if from-end + (goto-char end) + (goto-char start)) + (cond + ((numberp arg) + (when (> (+ (- end start) arg) 0) + (move-overlay o start (+ arg end)))) + ((functionp arg) + (ignore-errors (call-interactively arg)) + (move-overlay o start (point))))))))) + +(defun ex-iedit-move-overlays-forward () + (interactive) + (ex-iedit-move-overlays 'evil-forward-char)) + +(defun ex-iedit-move-overlays-backward () + (interactive) + (ex-iedit-move-overlays 'evil-backward-char)) + +(defun ex-iedit-move-overlays-next-line () + (interactive) + (ex-iedit-move-overlays 'evil-next-line)) + +(defun ex-iedit-move-overlays-previous-line () + (interactive) + (ex-iedit-move-overlays 'evil-previous-line)) + +(defun ex-iedit-toggle-point-overlay-next-line (count) + (interactive "p") + (unless (iedit-find-current-occurrence-overlay) + (iedit-toggle-selection)) + (let ((i (when count count 1))) + (save-excursion + (evil-next-line) + (while (and (> i 0) + (iedit-find-current-occurrence-overlay)) + (1- i) + (evil-next-line)) + (message "i %s" i) + (when (not (iedit-find-current-occurrence-overlay)) + (dotimes (j (1+(- count i))) + (iedit-toggle-selection) + (evil-next-line)))))) + +(defun ex-iedit-toggle-point-overlay-previous-line (count) + (interactive "p") + (save-excursion + (dotimes (i count) + (evil-previous-line) + (iedit-toggle-selection)))) + + (provide 'experimental-iedit) diff --git a/spacemacs/local/helm-spacemacs/helm-spacemacs.el b/layers/!distribution/spacemacs-core/local/helm-spacemacs/helm-spacemacs.el similarity index 100% rename from spacemacs/local/helm-spacemacs/helm-spacemacs.el rename to layers/!distribution/spacemacs-core/local/helm-spacemacs/helm-spacemacs.el diff --git a/spacemacs/local/holy-mode/holy-mode.el b/layers/!distribution/spacemacs-core/local/holy-mode/holy-mode.el similarity index 100% rename from spacemacs/local/holy-mode/holy-mode.el rename to layers/!distribution/spacemacs-core/local/holy-mode/holy-mode.el diff --git a/spacemacs/local/hybrid-mode/hybrid-mode.el b/layers/!distribution/spacemacs-core/local/hybrid-mode/hybrid-mode.el similarity index 100% rename from spacemacs/local/hybrid-mode/hybrid-mode.el rename to layers/!distribution/spacemacs-core/local/hybrid-mode/hybrid-mode.el diff --git a/spacemacs/local/paradox/README.md b/layers/!distribution/spacemacs-core/local/paradox/README.md similarity index 100% rename from spacemacs/local/paradox/README.md rename to layers/!distribution/spacemacs-core/local/paradox/README.md diff --git a/spacemacs/local/paradox/paradox-compat.el b/layers/!distribution/spacemacs-core/local/paradox/paradox-compat.el similarity index 100% rename from spacemacs/local/paradox/paradox-compat.el rename to layers/!distribution/spacemacs-core/local/paradox/paradox-compat.el diff --git a/spacemacs/local/paradox/paradox.el b/layers/!distribution/spacemacs-core/local/paradox/paradox.el similarity index 100% rename from spacemacs/local/paradox/paradox.el rename to layers/!distribution/spacemacs-core/local/paradox/paradox.el diff --git a/spacemacs/local/solarized-theme/README.md b/layers/!distribution/spacemacs-core/local/solarized-theme/README.md similarity index 100% rename from spacemacs/local/solarized-theme/README.md rename to layers/!distribution/spacemacs-core/local/solarized-theme/README.md diff --git a/spacemacs/local/solarized-theme/solarized-dark-theme.el b/layers/!distribution/spacemacs-core/local/solarized-theme/solarized-dark-theme.el similarity index 100% rename from spacemacs/local/solarized-theme/solarized-dark-theme.el rename to layers/!distribution/spacemacs-core/local/solarized-theme/solarized-dark-theme.el diff --git a/spacemacs/local/solarized-theme/solarized-light-theme.el b/layers/!distribution/spacemacs-core/local/solarized-theme/solarized-light-theme.el similarity index 100% rename from spacemacs/local/solarized-theme/solarized-light-theme.el rename to layers/!distribution/spacemacs-core/local/solarized-theme/solarized-light-theme.el diff --git a/spacemacs/local/solarized-theme/solarized-theme-pkg.el b/layers/!distribution/spacemacs-core/local/solarized-theme/solarized-theme-pkg.el similarity index 100% rename from spacemacs/local/solarized-theme/solarized-theme-pkg.el rename to layers/!distribution/spacemacs-core/local/solarized-theme/solarized-theme-pkg.el diff --git a/spacemacs/local/solarized-theme/solarized-theme-utils.el b/layers/!distribution/spacemacs-core/local/solarized-theme/solarized-theme-utils.el similarity index 100% rename from spacemacs/local/solarized-theme/solarized-theme-utils.el rename to layers/!distribution/spacemacs-core/local/solarized-theme/solarized-theme-utils.el diff --git a/spacemacs/local/solarized-theme/solarized-theme.el b/layers/!distribution/spacemacs-core/local/solarized-theme/solarized-theme.el similarity index 100% rename from spacemacs/local/solarized-theme/solarized-theme.el rename to layers/!distribution/spacemacs-core/local/solarized-theme/solarized-theme.el diff --git a/spacemacs/local/solarized-theme/solarized.el b/layers/!distribution/spacemacs-core/local/solarized-theme/solarized.el similarity index 100% rename from spacemacs/local/solarized-theme/solarized.el rename to layers/!distribution/spacemacs-core/local/solarized-theme/solarized.el diff --git a/spacemacs/local/zoom-frm/frame-cmds.el b/layers/!distribution/spacemacs-core/local/zoom-frm/frame-cmds.el similarity index 100% rename from spacemacs/local/zoom-frm/frame-cmds.el rename to layers/!distribution/spacemacs-core/local/zoom-frm/frame-cmds.el diff --git a/spacemacs/local/zoom-frm/frame-fns.el b/layers/!distribution/spacemacs-core/local/zoom-frm/frame-fns.el similarity index 100% rename from spacemacs/local/zoom-frm/frame-fns.el rename to layers/!distribution/spacemacs-core/local/zoom-frm/frame-fns.el diff --git a/spacemacs/local/zoom-frm/zoom-frm.el b/layers/!distribution/spacemacs-core/local/zoom-frm/zoom-frm.el similarity index 100% rename from spacemacs/local/zoom-frm/zoom-frm.el rename to layers/!distribution/spacemacs-core/local/zoom-frm/zoom-frm.el diff --git a/layers/!distribution/spacemacs-core/packages.el b/layers/!distribution/spacemacs-core/packages.el new file mode 100644 index 000000000000..476b51bffe42 --- /dev/null +++ b/layers/!distribution/spacemacs-core/packages.el @@ -0,0 +1,1399 @@ +;;; packages.el --- Spacemacs Core Layer packages File +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2014-2015 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(setq spacemacs-core-packages + '( + bind-key + bookmark + diminish + ;; hack to be able to wrap built-in emacs modes in an init function + (builtin-process-menu :location local) + (builtin-ido :location local) + (builtin-hs-minor-mode :location local) + (builtin-electric-indent-mode :location local) + (builtin-uniquify :location local) + ediff + eldoc + evil + evil-escape + evil-leader + evil-surround + evil-visualstar + exec-path-from-shell + fill-column-indicator + helm + helm-descbinds + helm-projectile + (helm-spacemacs :location local) + (holy-mode :location local :step pre) + (hybrid-mode :location local) + page-break-lines + popup + popwin + projectile + quelpa + recentf + savehist + saveplace + spacemacs-theme + subword + undo-tree + use-package + which-key + whitespace + winner)) + +;; Initialization of packages + +(defun spacemacs-core/init-bind-key ()) + +(defun spacemacs-core/init-bookmark () + (use-package bookmark + :defer t + :init + (setq bookmark-default-file (concat spacemacs-cache-directory "bookmarks") + ;; autosave each change + bookmark-save-flag 1))) + +(defun spacemacs-core/init-diminish () + (use-package diminish + :init + (progn + ;; Minor modes abbrev -------------------------------------------------------- + (when (display-graphic-p) + (eval-after-load "eproject" + '(diminish 'eproject-mode " eⓅ")) + (eval-after-load "flymake" + '(diminish 'flymake-mode " Ⓕ2"))) + ;; Minor Mode (hidden) ------------------------------------------------------ + (eval-after-load 'elisp-slime-nav + '(diminish 'elisp-slime-nav-mode)) + (eval-after-load "hi-lock" + '(diminish 'hi-lock-mode)) + (eval-after-load "abbrev" + '(diminish 'abbrev-mode)) + (eval-after-load "subword" + '(when (eval-when-compile (version< "24.3.1" emacs-version)) + (diminish 'subword-mode)))))) + +(defun spacemacs-core/init-eldoc () + (use-package eldoc + :defer t + :config + (progn + ;; enable eldoc in `eval-expression' + (add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode) + ;; enable eldoc in IELM + (add-hook 'ielm-mode-hook #'eldoc-mode) + ;; don't display eldoc on modeline + (spacemacs|hide-lighter eldoc-mode)))) + +(defun spacemacs-core/init-builtin-process-menu () + (evilify process-menu-mode process-menu-mode-map)) + +(defun spacemacs-core/init-builtin-ido () + (ido-mode t) + (setq ido-save-directory-list-file (concat spacemacs-cache-directory + "ido.last") + ;; enable fuzzy matching + ido-enable-flex-matching t)) + +(defun spacemacs-core/init-builtin-hs-minor-mode () + ;; required for evil folding + (defun spacemacs//enable-hs-minor-mode () + "Enable hs-minor-mode for code folding." + (ignore-errors + (hs-minor-mode) + (spacemacs|hide-lighter hs-minor-mode))) + (add-hook 'prog-mode-hook 'spacemacs//enable-hs-minor-mode)) + +(defun spacemacs-core/init-builtin-electric-indent-mode () + (electric-indent-mode)) + +(defun spacemacs-core/init-builtin-uniquify () + (require 'uniquify) + ;; When having windows with repeated filenames, uniquify them + ;; by the folder they are in rather those annoying <2>,<3>,.. etc + (setq uniquify-buffer-name-style 'post-forward-angle-brackets + ;; don't screw special buffers + uniquify-ignore-buffers-re "^\\*")) + +;; notes from mijoharas +;; We currently just set a few variables to make it look nicer. +;; Here is my first attempt at evilifying the buffer, does not work correctly, help is very much welcome. + +;; ``` +;; (defun ediff/setup-ediff-keymaps () +;; "setup the evil ediff keymap" +;; (progn +;; (add-to-list 'evil-emacs-state-modes 'Ediff) +;; (spacemacs|evilify ediff-mode-map) +;; (spacemacs/activate-evil-leader-for-map 'ediff-mode-map) +;; ) +;; ) + +;; ;; inside the use-package function +;; (add-hook 'ediff-keymap-setup-hook 'ediff/setup-ediff-keymaps) +;; ``` +(defun spacemacs-core/init-ediff () + (use-package ediff + :defer t + :init + (progn + ;; first we set some sane defaults + (setq-default + ediff-window-setup-function 'ediff-setup-windows-plain + ;; emacs is evil and decrees that vertical shall henceforth be horizontal + ediff-split-window-function 'split-window-horizontally + ediff-merge-split-window-function 'split-window-horizontally)))) + +(defun spacemacs-core/init-eldoc () + (use-package eldoc + :defer t + :config + (progn + ;; enable eldoc in `eval-expression' + (add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode) + ;; enable eldoc in IELM + (add-hook 'ielm-mode-hook #'eldoc-mode) + ;; don't display eldoc on modeline + (spacemacs|hide-lighter eldoc-mode)))) + +(defun spacemacs-core/init-evil () + (use-package evil + :init + (progn + (defvar spacemacs-evil-cursor-colors '((normal . "DarkGoldenrod2") + (insert . "chartreuse3") + (emacs . "SkyBlue2") + (replace . "chocolate") + (evilified . "LightGoldenrod3") + (visual . "gray") + (motion . "plum3") + (lisp . "HotPink1") + (iedit . "firebrick1") + (iedit-insert . "firebrick1")) + "Colors assigned to evil states.") + + ;; put back refresh of the cursor on post-command-hook see status of: + ;; https://bitbucket.org/lyro/evil/issue/502/cursor-is-not-refreshed-in-some-cases + (add-hook 'post-command-hook 'evil-refresh-cursor) + + ;; allow the point to go past the end of line so we can + ;; consisently evaluate expression with eval-last-sexp in + ;; all modes + (setq evil-move-beyond-eol t) + + (defun spacemacs/state-color-face (state) + "Return the symbol of the face for the given STATE." + (intern (format "spacemacs-%s-face" (symbol-name state)))) + + (defun spacemacs/defface-state-color (state color) + "Define a face for the given STATE and background COLOR." + (eval `(defface ,(spacemacs/state-color-face state) '((t ())) + ,(format "%s state face." (symbol-name state)) + :group 'spacemacs)) + (set-face-attribute (spacemacs/state-color-face state) nil + :background color + :foreground (face-background 'mode-line) + :box (face-attribute 'mode-line :box) + :inherit 'mode-line)) + + (defun spacemacs/state-color (state) + "Return the color string associated to STATE." + (face-background (spacemacs/state-color-face state))) + + (defun spacemacs/current-state-color () + "Return the color string associated to the current state." + (face-background (spacemacs/state-color-face evil-state))) + + (defun spacemacs/state-face (state) + "Return the face associated to the STATE." + (spacemacs/state-color-face state)) + + (defun spacemacs/current-state-face () + "Return the face associated to the current state." + (let ((state (if (eq evil-state 'operator) + evil-previous-state + evil-state))) + (spacemacs/state-color-face state))) + + (defun spacemacs/set-state-faces () + "Define or set the state faces." + (mapcar (lambda (x) (spacemacs/defface-state-color (car x) (cdr x))) + spacemacs-evil-cursor-colors)) + (spacemacs/set-state-faces) + + (defun set-default-evil-emacs-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'emacs)))) + (setq evil-emacs-state-cursor `(,c box)))) + (defun set-default-evil-evilified-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'evilified)))) + (setq evil-evilified-state-cursor `(,c box)))) + (defun set-default-evil-normal-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'normal)))) + (setq evil-normal-state-cursor `(,c box)))) + (defun set-default-evil-insert-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'insert)))) + (setq evil-insert-state-cursor `(,c (bar . 2))))) + (defun set-default-evil-visual-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'visual)))) + (setq evil-visual-state-cursor `(,c (hbar . 2))))) + (defun set-default-evil-motion-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'motion)))) + (setq evil-motion-state-cursor `(,c box)))) + (defun set-default-evil-lisp-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'lisp)))) + (setq evil-lisp-state-cursor `(,c box)))) + (defun set-default-evil-iedit-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'iedit)))) + (setq evil-iedit-state-cursor `(,c box)))) + (defun set-default-evil-iedit-insert-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'iedit-insert)))) + (setq evil-iedit-insert-state-cursor `(,c (bar . 2))))) + (defun set-default-evil-replace-state-cursor () + (let ((c (when dotspacemacs-colorize-cursor-according-to-state + (spacemacs/state-color 'replace)))) + (setq evil-replace-state-cursor `(,c (hbar . 2))))) + (defun evil-insert-state-cursor-hide () + (setq evil-insert-state-cursor '((hbar . 0)))) + (set-default-evil-emacs-state-cursor) + (set-default-evil-evilified-state-cursor) + (set-default-evil-normal-state-cursor) + (set-default-evil-insert-state-cursor) + (set-default-evil-visual-state-cursor) + (set-default-evil-motion-state-cursor) + (set-default-evil-lisp-state-cursor) + (set-default-evil-iedit-state-cursor) + (set-default-evil-iedit-insert-state-cursor) + (set-default-evil-replace-state-cursor) + + (evil-mode 1)) + :config + (progn + ;; evil ex-command key + (define-key evil-normal-state-map (kbd dotspacemacs-command-key) 'evil-ex) + (define-key evil-visual-state-map (kbd dotspacemacs-command-key) 'evil-ex) + (define-key evil-motion-state-map (kbd dotspacemacs-command-key) 'evil-ex) + ;; Make the current definition and/or comment visible. + (define-key evil-normal-state-map "zf" 'reposition-window) + ;; toggle maximize buffer + (define-key evil-window-map (kbd "o") 'spacemacs/toggle-maximize-buffer) + (define-key evil-window-map (kbd "C-o") 'spacemacs/toggle-maximize-buffer) + ;; make cursor keys work + (define-key evil-window-map (kbd "") 'evil-window-left) + (define-key evil-window-map (kbd "") 'evil-window-right) + (define-key evil-window-map (kbd "") 'evil-window-up) + (define-key evil-window-map (kbd "") 'evil-window-down) + ;; Make Y equivalent to y$ + (defun spacemacs/evil-yank-to-end-of-line () + "Yank from point to end of line." + (interactive) + (evil-yank (point) (point-at-eol))) + (define-key evil-normal-state-map (kbd "Y") 'spacemacs/evil-yank-to-end-of-line) + (define-key evil-motion-state-map (kbd "Y") 'spacemacs/evil-yank-to-end-of-line) + + (evil-leader/set-key "re" 'evil-show-registers) + + (defmacro evil-map (state key seq) + "Map for a given STATE a KEY to a sequence SEQ of keys. + +Can handle recursive definition only if KEY is the first key of SEQ. +Example: (evil-map visual \"<\" \"" ">gv") + + (defun spacemacs/evil-smart-doc-lookup () + "Version of `evil-lookup' that attempts to use + the mode specific goto-definition binding, + i.e. `SPC m h h`, to lookup the source of the definition, + while falling back to `evil-lookup'" + (interactive) + (condition-case nil + (execute-kbd-macro (kbd (concat dotspacemacs-leader-key " mhh"))) + (error (evil-lookup)))) + (define-key evil-normal-state-map (kbd "K") 'spacemacs/evil-smart-doc-lookup) + + (defun spacemacs/evil-smart-goto-definition () + "Version of `evil-goto-definition' that attempts to use + the mode specific goto-definition binding, + i.e. `SPC m g g`, to lookup the source of the definition, + while falling back to `evil-goto-definition'" + (interactive) + (condition-case nil + (execute-kbd-macro (kbd (concat dotspacemacs-leader-key " mgg"))) + (error (evil-goto-definition)))) + (define-key evil-normal-state-map + (kbd "gd") 'spacemacs/evil-smart-goto-definition) + + ;; scrolling micro state + (defun spacemacs/scroll-half-page-up () + "Scroll half a page up while keeping cursor in middle of page." + (interactive) + (evil-window-top) + (let ((recenter-redisplay nil)) + (recenter nil))) + (defun spacemacs/scroll-half-page-down () + "Scroll half a page down while keeping cursor in middle of page." + (interactive) + (evil-window-bottom) + ;; required to make repeated presses idempotent + (evil-next-visual-line) + (let ((recenter-redisplay nil)) + (recenter nil))) + (spacemacs|define-micro-state scroll + :doc "[,] page up [.] page down [<] half page up [>] half page down" + :execute-binding-on-enter t + :evil-leader "n." "n," "n<" "n>" + :bindings + ;; page + ("," evil-scroll-page-up) + ("." evil-scroll-page-down) + ;; half page + ("<" spacemacs/scroll-half-page-up) + (">" spacemacs/scroll-half-page-down)) + + ;; support for auto-indentation inhibition on universal argument + (spacemacs|advise-commands + "handle-indent" (evil-paste-before evil-paste-after) around + "Handle the universal prefix argument for auto-indentation." + (let ((prefix (ad-get-arg 0))) + (ad-set-arg 0 (unless (equal '(4) prefix) prefix)) + ad-do-it + (ad-set-arg 0 prefix))) + + ;; pasting micro-state + (spacemacs|advise-commands + "paste-micro-state" + (evil-paste-before evil-paste-after evil-visual-paste) after + "Initate the paste micro-state." + (unless (or (evil-ex-p) + (eq 'evil-paste-from-register this-command)) + (spacemacs/paste-micro-state))) + (defun spacemacs//paste-ms-doc () + "The documentation for the paste micro-state." + (format (concat "[%s/%s] Type [p] or [P] to paste the previous or " + "next copied text, [.] to paste the same text") + (length kill-ring-yank-pointer) (length kill-ring))) + (spacemacs|define-micro-state paste + :doc (spacemacs//paste-ms-doc) + :use-minibuffer t + :bindings + ("p" evil-paste-pop) + ("P" evil-paste-pop-next)) + (unless dotspacemacs-enable-paste-micro-state + (ad-disable-advice 'evil-paste-before 'after + 'evil-paste-before-paste-micro-state) + (ad-activate 'evil-paste-before) + (ad-disable-advice 'evil-paste-after 'after + 'evil-paste-after-paste-micro-state) + (ad-activate 'evil-paste-after) + (ad-disable-advice 'evil-visual-paste 'after + 'evil-visual-paste-paste-micro-state) + (ad-activate 'evil-visual-paste)) + + ;; define text objects + (defmacro spacemacs|define-text-object (key name start end) + (let ((inner-name (make-symbol (concat "evil-inner-" name))) + (outer-name (make-symbol (concat "evil-outer-" name))) + (start-regex (regexp-opt (list start))) + (end-regex (regexp-opt (list end)))) + `(progn + (evil-define-text-object ,inner-name (count &optional beg end type) + (evil-select-paren ,start-regex ,end-regex beg end type count nil)) + (evil-define-text-object ,outer-name (count &optional beg end type) + (evil-select-paren ,start-regex ,end-regex beg end type count t)) + (define-key evil-inner-text-objects-map ,key (quote ,inner-name)) + (define-key evil-outer-text-objects-map ,key (quote ,outer-name)) + (when (configuration-layer/package-usedp 'evil-surround) + (push (cons (string-to-char ,key) + (if ,end + (cons ,start ,end) + ,start)) + evil-surround-pairs-alist))))) + + (defun spacemacs//standard-text-objects () + ;; between dollars sign: + (spacemacs|define-text-object "$" "dollar" "$" "$") + ;; define stars + (spacemacs|define-text-object "*" "star" "*" "*") + ;; define block star text object + (spacemacs|define-text-object "8" "block-star" "/*" "*/") + ;; between pipe characters: + (spacemacs|define-text-object "|" "bar" "|" "|") + ;; between percent signs: + (spacemacs|define-text-object "%" "percent" "%" "%")) + + (spacemacs/add-to-hook 'prog-mode-hook '(spacemacs//standard-text-objects)) + + ;; define text-object for entire buffer + (evil-define-text-object evil-inner-buffer (count &optional beg end type) + (evil-select-paren "\\`" "\\'" beg end type count nil)) + (define-key evil-inner-text-objects-map "g" 'evil-inner-buffer) + + ;; support smart 1parens-strict-mode + (when (configuration-layer/package-usedp 'smartparens) + (defadvice evil-delete-backward-char-and-join + (around spacemacs/evil-delete-backward-char-and-join activate) + (defvar smartparens-strict-mode) + ;; defadvice compiles this sexp generating a compiler warning for a + ;; free variable reference. The line above fixes this + (if smartparens-strict-mode + (call-interactively 'sp-backward-delete-char) + ad-do-it)))))) + +(defun spacemacs-core/init-evil-escape () + (use-package evil-escape + :init + (evil-escape-mode) + :config + (spacemacs|hide-lighter evil-escape-mode))) + +(defun spacemacs-core/init-evil-leader () + (use-package evil-leader + :init + (progn + (setq evil-leader/leader dotspacemacs-leader-key) + (global-evil-leader-mode)) + :config + (progn + ;; Unset shortcuts which shadow evil leader + (eval-after-load "compile" + '(progn + ;; (define-key compilation-mode-map (kbd dotspacemacs-leader-key) nil) + (define-key compilation-mode-map (kbd "h") nil))) + ;; (eval-after-load "dired" + ;; '(define-key dired-mode-map (kbd dotspacemacs-leader-key) nil)) + ;; make leader available in visual and motion states + (mapc (lambda (s) + (eval `(define-key + ,(intern (format "evil-%S-state-map" s)) + ,(kbd dotspacemacs-leader-key) + evil-leader--default-map))) + '(motion visual)) + ;; emacs and insert states (make it also available in other states + ;; for consistency and POLA.) + (mapc (lambda (s) + (eval `(define-key + ,(intern (format "evil-%S-state-map" s)) + ,(kbd dotspacemacs-emacs-leader-key) + evil-leader--default-map))) + '(emacs insert normal visual motion)) + ;; experimental: map SPC m to , + (when dotspacemacs-major-mode-leader-key + (add-hook 'after-change-major-mode-hook + 'spacemacs/activate-major-mode-leader))))) + +(defun spacemacs-core/init-evil-surround () + (use-package evil-surround + :init + (progn + (global-evil-surround-mode 1) + ;; `s' for surround instead of `substitute' + ;; see motivation for this change in the documentation + (evil-define-key 'visual evil-surround-mode-map "s" 'evil-surround-region) + (evil-define-key 'visual evil-surround-mode-map "S" 'evil-substitute)))) + +(defun spacemacs-core/init-evil-visualstar () + (use-package evil-visualstar + :commands (evil-visualstar/begin-search-forward + evil-visualstar/begin-search-backward) + :init + (progn + (define-key evil-visual-state-map (kbd "*") + 'evil-visualstar/begin-search-forward) + (define-key evil-visual-state-map (kbd "#") + 'evil-visualstar/begin-search-backward)))) + +(defun spacemacs-core/init-exec-path-from-shell () + (use-package exec-path-from-shell + :init (when (memq window-system '(mac ns x)) + (exec-path-from-shell-initialize)))) + +(defun spacemacs-core/init-fill-column-indicator () + (use-package fill-column-indicator + :defer t + :init + (progn + (setq fci-rule-width 1) + (setq fci-rule-color "#D0BF8F") + ;; manually register the minor mode since it does not define any + ;; lighter + (push '(fci-mode "") minor-mode-alist) + (spacemacs|add-toggle fill-column-indicator + :status fci-mode + :on (turn-on-fci-mode) + :off (turn-off-fci-mode) + :documentation "Display the fill column indicator." + :evil-leader "tf")) + :config + (spacemacs|hide-lighter fci-mode))) + +(defun spacemacs-core/init-helm () + (use-package helm + :defer 1 + :commands (spacemacs/helm-find-files + spacemacs/helm-find-spacemacs-file + spacemacs/helm-find-contrib-file) + :config + (progn + (when dotspacemacs-helm-resize + (setq helm-autoresize-min-height 1) + (helm-autoresize-mode 1)) + + ;; from https://www.reddit.com/r/emacs/comments/2z7nbv/lean_helm_window/ + (defvar helm-source-header-default-background (face-attribute 'helm-source-header :background)) + (defvar helm-source-header-default-foreground (face-attribute 'helm-source-header :foreground)) + (defvar helm-source-header-default-box (face-attribute 'helm-source-header :box)) + (defvar helm-source-header-default-height (face-attribute 'helm-source-header :height) ) + + (defun helm-toggle-header-line () + "Hide the `helm' header is there is only one source." + (when dotspacemacs-helm-no-header + (if (> (length helm-sources) 1) + (set-face-attribute 'helm-source-header + nil + :foreground helm-source-header-default-foreground + :background helm-source-header-default-background + :box helm-source-header-default-box + :height helm-source-header-default-height) + (set-face-attribute 'helm-source-header + nil + :foreground (face-attribute 'helm-selection :background) + :background (face-attribute 'helm-selection :background) + :box nil + :height 0.1)))) + (add-hook 'helm-before-initialize-hook 'helm-toggle-header-line) + + (defun spacemacs/helm-find-files (arg) + "Custom spacemacs implementation for calling helm-find-files-1. + +Removes the automatic guessing of the initial value based on thing at point. " + (interactive "P") + (let* ((hist (and arg helm-ff-history (helm-find-files-history))) + (default-input hist ) + (input (cond ((and (eq major-mode 'dired-mode) default-input) + (file-name-directory default-input)) + ((and (not (string= default-input "")) + default-input)) + (t (expand-file-name (helm-current-directory)))))) + (set-text-properties 0 (length input) nil input) + (helm-find-files-1 input ))) + ) + :init + (progn + (setq helm-prevent-escaping-from-minibuffer t + helm-bookmark-show-location t + helm-display-header-line nil + helm-split-window-in-side-p t + helm-always-two-windows t + helm-echo-input-in-header-line t + helm-imenu-execute-action-at-once-if-one nil) + + ;; hide minibuffer in Helm session, since we use the header line already + (defun helm-hide-minibuffer-maybe () + (when (with-helm-buffer helm-echo-input-in-header-line) + (let ((ov (make-overlay (point-min) (point-max) nil nil t))) + (overlay-put ov 'window (selected-window)) + (overlay-put ov 'face (let ((bg-color (face-background 'default nil))) + `(:background ,bg-color :foreground ,bg-color))) + (setq-local cursor-type nil)))) + (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe) + + ;; fuzzy matching setting + (setq helm-M-x-fuzzy-match t + helm-apropos-fuzzy-match t + helm-file-cache-fuzzy-match t + helm-imenu-fuzzy-match t + helm-lisp-fuzzy-completion t + helm-recentf-fuzzy-match t + helm-semantic-fuzzy-match t + helm-buffers-fuzzy-matching t) + + ;; helm-locate uses es (from everything on windows, which doesnt like fuzzy) + (setq helm-locate-fuzzy-match (executable-find "locate")) + + (defun spacemacs/helm-find-files-navigate-back (orig-fun &rest args) + ) + (defadvice helm-ff-delete-char-backward + (around spacemacs/helm-find-files-navigate-back activate) + (if (= (length helm-pattern) (length (helm-find-files-initial-input))) + (helm-find-files-up-one-level 1) + ad-do-it)) + + (defun spacemacs//helm-do-grep-region-or-symbol (&optional targs use-region-or-symbol-p) + "Version of `helm-do-grep' with a default input." + (interactive) + (require 'helm) + (cl-letf* + (((symbol-function 'this-fn) (symbol-function 'helm-do-grep-1)) + ((symbol-function 'helm-do-grep-1) + (lambda (targets &optional recurse zgrep exts default-input region-or-symbol-p) + (let* ((new-input (when region-or-symbol-p + (if (region-active-p) + (buffer-substring-no-properties + (region-beginning) (region-end)) + (thing-at-point 'symbol t)))) + (quoted-input (when new-input (rxt-quote-pcre new-input)))) + (this-fn targets recurse zgrep exts default-input quoted-input)))) + (preselection (or (dired-get-filename nil t) + (buffer-file-name (current-buffer)))) + (targets (if targs + targs + (helm-read-file-name + "Search in file(s): " + :marked-candidates t + :preselect (and helm-do-grep-preselect-candidate + (if helm-ff-transformer-show-only-basename + (helm-basename preselection) + preselection)))))) + (helm-do-grep-1 targets nil nil nil nil use-region-or-symbol-p))) + + (defun spacemacs/helm-find-contrib-file () + "Runs helm find files on spacemacs contrib folder" + (interactive) + (require 'helm-files) + (helm-find-files-1 + (expand-file-name (concat user-emacs-directory "contrib/")))) + + (defun spacemacs/helm-find-spacemacs-file () + "Runs helm find files on spacemacs directory" + (interactive) + (require 'helm-files) + (helm-find-files-1 + (expand-file-name (concat user-emacs-directory "spacemacs/")))) + + (defun spacemacs/helm-file-do-grep () + "Search in current file with `grep' using a default input." + (interactive) + (spacemacs//helm-do-grep-region-or-symbol + (list (buffer-file-name (current-buffer))) nil)) + + (defun spacemacs/helm-file-do-grep-region-or-symbol () + "Search in current file with `grep' using a default input." + (interactive) + (spacemacs//helm-do-grep-region-or-symbol + (list (buffer-file-name (current-buffer))) t)) + + (defun spacemacs/helm-files-do-grep () + "Search in files with `grep'." + (interactive) + (spacemacs//helm-do-grep-region-or-symbol nil nil)) + + (defun spacemacs/helm-files-do-grep-region-or-symbol () + "Search in files with `grep' using a default input." + (interactive) + (spacemacs//helm-do-grep-region-or-symbol nil t)) + + (defun spacemacs/helm-buffers-do-grep () + "Search in opened buffers with `grep'." + (interactive) + (let ((buffers (cl-loop for buffer in (buffer-list) + when (buffer-file-name buffer) + collect (buffer-file-name buffer)))) + (spacemacs//helm-do-grep-region-or-symbol buffers nil))) + + (defun spacemacs/helm-buffers-do-grep-region-or-symbol () + "Search in opened buffers with `grep' with a default input." + (interactive) + (let ((buffers (cl-loop for buffer in (buffer-list) + when (buffer-file-name buffer) + collect (buffer-file-name buffer)))) + (spacemacs//helm-do-grep-region-or-symbol buffers t))) + + (defun spacemacs/last-search-buffer () + "open last helm-ag or hgrep buffer." + (interactive) + (if (get-buffer "*helm ag results*") + (switch-to-buffer-other-window "*helm ag results*") + (if (get-buffer "*hgrep*") + (switch-to-buffer-other-window "*hgrep*") + (message "No previous search buffer found")))) + + ;; use helm by default for contrib and spacemacs layers + (unless dotspacemacs-use-ido + (evil-leader/set-key + "fes" 'spacemacs/helm-find-spacemacs-file + "fec" 'spacemacs/helm-find-contrib-file)) + + ;; use helm by default for M-x + (unless (configuration-layer/package-usedp 'smex) + (global-set-key (kbd "M-x") 'helm-M-x)) + + (evil-leader/set-key + "" 'helm-apropos + "bb" 'helm-mini + "Cl" 'helm-colors + "ff" 'spacemacs/helm-find-files + "fF" 'helm-find-files + "fL" 'helm-locate + "fr" 'helm-recentf + "hb" 'helm-filtered-bookmarks + "hi" 'helm-info-at-point + "hl" 'helm-resume + "hm" 'helm-man-woman + "iu" 'helm-ucs + "ry" 'helm-show-kill-ring + "rr" 'helm-register + "rm" 'helm-all-mark-rings + "sL" 'spacemacs/last-search-buffer + "sl" 'spacemacs/jump-in-buffer) + + ;; search with grep + (evil-leader/set-key + "sgb" 'spacemacs/helm-buffers-do-grep + "sgB" 'spacemacs/helm-buffers-do-grep-region-or-symbol + "sgf" 'spacemacs/helm-files-do-grep + "sgF" 'spacemacs/helm-files-do-grep-region-or-symbol + "sgg" 'spacemacs/helm-file-do-grep + "sgG" 'spacemacs/helm-file-do-grep-region-or-symbol) + + ;; define the key binding at the very end in order to allow the user + ;; to overwrite any key binding + (add-hook 'emacs-startup-hook + (lambda () + (unless (configuration-layer/package-usedp 'smex) + (evil-leader/set-key dotspacemacs-command-key 'helm-M-x)))) + + (defvar spacemacs-helm-display-help-buffer-regexp '("*.*Helm.*Help.**")) + (defvar spacemacs-helm-display-buffer-regexp `("*.*helm.**" + (display-buffer-in-side-window) + (inhibit-same-window . t) + (side . ,dotspacemacs-helm-position) + (window-height . 0.4))) + (defvar spacemacs-display-buffer-alist nil) + (defun spacemacs//helm-prepare-display () + "Prepare necessary settings to make Helm display properly." + ;; avoid Helm buffer being diplaye twice when user + ;; sets this variable to some function that pop buffer to + ;; a window. See https://github.com/syl20bnr/spacemacs/issues/1396 + (let ((display-buffer-base-action '(nil))) + (setq spacemacs-display-buffer-alist display-buffer-alist) + ;; the only buffer to display is Helm, nothing else we must set this + ;; otherwise Helm cannot reuse its own windows for copyinng/deleting + ;; etc... because of existing popwin buffers in the alist + (setq display-buffer-alist nil) + (popwin-mode -1))) + + (defun spacemacs//display-helm-window (buffer) + (let ((display-buffer-alist (list spacemacs-helm-display-help-buffer-regexp + ;; this or any specialized case of Helm buffer must be added AFTER + ;; `spacemacs-helm-display-buffer-regexp'. Otherwise, + ;; `spacemacs-helm-display-buffer-regexp' will be used before + ;; `spacemacs-helm-display-help-buffer-regexp' and display + ;; configuration for normal Helm buffer is applied for helm help + ;; buffer, making the help buffer unable to be displayed. + spacemacs-helm-display-buffer-regexp))) + (helm-default-display-buffer buffer))) + + (setq helm-display-function 'spacemacs//display-helm-window) + + (defun spacemacs//restore-previous-display-config () + (popwin-mode 1) + ;; we must enable popwin-mode first then restore `display-buffer-alist' + ;; Otherwise, popwin keeps adding up its own buffers to `display-buffer-alist' + ;; and could slow down Emacs as the list grows + (setq display-buffer-alist spacemacs-display-buffer-alist)) + + (add-hook 'helm-after-initialize-hook 'spacemacs//helm-prepare-display) + ;; Restore popwin-mode after a Helm session finishes. + (add-hook 'helm-cleanup-hook 'spacemacs//restore-previous-display-config) + + ;; Add minibuffer history with `helm-minibuffer-history' + (define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history) + + (defun spacemacs//helm-cleanup () + "Cleanup some helm related states when quitting." + ;; deactivate any running transient map (micro-state) + (setq overriding-terminal-local-map nil)) + (add-hook 'helm-cleanup-hook 'spacemacs//helm-cleanup) + + (defface spacemacs-helm-navigation-ms-face + `((t :background ,(face-attribute 'error :foreground) :foreground "black")) + "Face for helm heder when helm micro-state is activated." + :group 'spacemacs)) + + :config + (progn + (helm-mode +1) + (defun spacemacs//set-dotted-directory () + "Set the face of diretories for `.' and `..'" + (set-face-attribute 'helm-ff-dotted-directory + nil + :foreground nil + :background nil + :inherit 'helm-ff-directory)) + (add-hook 'helm-find-files-before-init-hook 'spacemacs//set-dotted-directory) + + ;; alter helm-bookmark key bindings to be simpler + (defun simpler-helm-bookmark-keybindings () + (define-key helm-bookmark-map (kbd "C-d") 'helm-bookmark-run-delete) + (define-key helm-bookmark-map (kbd "C-e") 'helm-bookmark-run-edit) + (define-key helm-bookmark-map (kbd "C-f") 'helm-bookmark-toggle-filename) + (define-key helm-bookmark-map (kbd "C-o") 'helm-bookmark-run-jump-other-window) + (define-key helm-bookmark-map (kbd "C-/") 'helm-bookmark-help)) + (add-hook 'helm-mode-hook 'simpler-helm-bookmark-keybindings) + + ;; helm navigation on hjkl + (defun spacemacs//helm-hjkl-navigation (&optional arg) + "Set navigation in helm on `jklh'. +ARG non nil means that the editing style is `vim'." + (cond + (arg + (define-key helm-map (kbd "C-j") 'helm-next-line) + (define-key helm-map (kbd "C-k") 'helm-previous-line) + (define-key helm-map (kbd "C-h") 'helm-next-source) + (define-key helm-map (kbd "C-l") 'helm-previous-source)) + (t + (define-key helm-map (kbd "C-j") 'helm-execute-persistent-action) + (define-key helm-map (kbd "C-k") 'helm-delete-minibuffer-contents) + (define-key helm-map (kbd "C-h") nil) + (define-key helm-map (kbd "C-l") 'helm-recenter-top-bottom-other-window)))) + (spacemacs//helm-hjkl-navigation (member dotspacemacs-editing-style '(vim hybrid))) + + (defun spacemacs/helm-edit () + "Switch in edit mode depending on the current helm buffer." + (interactive) + (cond + ((string-equal "*helm-ag*" helm-buffer) + (helm-ag-edit)))) + + (defun spacemacs//helm-navigation-ms-on-enter () + "Initialization of helm micro-state." + ;; faces + (spacemacs//helm-navigation-ms-set-face) + (setq spacemacs--helm-navigation-ms-face-cookie-minibuffer + (face-remap-add-relative + 'minibuffer-prompt + 'spacemacs-helm-navigation-ms-face)) + ;; bind actions on numbers starting from 1 which executes action 0 + (dotimes (n 10) + (define-key helm-map (number-to-string n) + `(lambda () (interactive) (helm-select-nth-action + ,(% (+ n 9) 10)))))) + + (defun spacemacs//helm-navigation-ms-set-face () + "Set the face for helm header in helm navigation micro-state" + (with-helm-window + (setq spacemacs--helm-navigation-ms-face-cookie-header + (face-remap-add-relative + 'helm-header + 'spacemacs-helm-navigation-ms-face)))) + + (defun spacemacs//helm-navigation-ms-on-exit () + "Action to perform when exiting helm micro-state." + ;; restore helm key map + (dotimes (n 10) (define-key helm-map (number-to-string n) nil)) + ;; restore faces + (with-helm-window + (face-remap-remove-relative + spacemacs--helm-navigation-ms-face-cookie-header)) + (face-remap-remove-relative + spacemacs--helm-navigation-ms-face-cookie-minibuffer)) + + (defun spacemacs//helm-navigation-ms-full-doc () + "Full documentation for helm navigation micro-state." + " + [?] display this help + [a] toggle action selection page + [e] edit occurrences if supported + [j] [k] next/previous candidate + [h] [l] previous/next source + [t] toggle visible mark + [T] toggle all mark + [v] persistent action + [q] quit") + + (spacemacs|define-micro-state helm-navigation + :persistent t + :disable-evil-leader t + :define-key (helm-map . "M-SPC") (helm-map . "s-M-SPC") + :on-enter (spacemacs//helm-navigation-ms-on-enter) + :on-exit (spacemacs//helm-navigation-ms-on-exit) + :bindings + ("" helm-select-action :exit t) + ("C-i" helm-select-action :exit t) + ("" helm-maybe-exit-minibuffer :exit t) + ("?" nil :doc (spacemacs//helm-navigation-ms-full-doc)) + ("a" helm-select-action :post (spacemacs//helm-navigation-ms-set-face)) + ("e" spacemacs/helm-edit) + ("h" helm-previous-source) + ("j" helm-next-line) + ("k" helm-previous-line) + ("l" helm-next-source) + ("q" nil :exit t) + ("t" helm-toggle-visible-mark) + ("T" helm-toggle-all-marks) + ("v" helm-execute-persistent-action)) + + ;; Swap default TAB and C-z commands. + ;; For GUI. + (define-key helm-map (kbd "") 'helm-execute-persistent-action) + ;; For terminal. + (define-key helm-map (kbd "TAB") 'helm-execute-persistent-action) + (define-key helm-map (kbd "C-z") 'helm-select-action) + + (eval-after-load "helm-mode" ; required + '(spacemacs|hide-lighter helm-mode))))) + +(defun spacemacs-core/init-helm-descbinds () + (use-package helm-descbinds + :defer t + :init + (progn + (setq helm-descbinds-window-style 'split) + (add-hook 'helm-mode-hook 'helm-descbinds-mode) + (evil-leader/set-key "?" 'helm-descbinds)))) + +(defun spacemacs-core/init-helm-projectile () + (use-package helm-projectile + :commands (helm-projectile-switch-to-buffer + helm-projectile-find-dir + helm-projectile-dired-find-dir + helm-projectile-recentf + helm-projectile-find-file + helm-projectile-grep + helm-projectile + helm-projectile-switch-project) + :init + (progn + (setq projectile-switch-project-action 'helm-projectile) + + (defconst spacemacs-use-helm-projectile t + "This variable is only defined if helm-projectile is used.") + + ;; needed for smart search if user's default tool is grep + (defalias 'spacemacs/helm-project-do-grep 'helm-projectile-grep) + (defalias + 'spacemacs/helm-project-do-grep-region-or-symbol 'helm-projectile-grep) + + (evil-leader/set-key + "pb" 'helm-projectile-switch-to-buffer + "pd" 'helm-projectile-find-dir + "pf" 'helm-projectile-find-file + "ph" 'helm-projectile + "pp" 'helm-projectile-switch-project + "pr" 'helm-projectile-recentf + "pv" 'projectile-vc + "sgp" 'helm-projectile-grep)))) + +(defun spacemacs-core/init-helm-spacemacs () + (use-package helm-spacemacs + :commands helm-spacemacs + :init + (evil-leader/set-key "feh" 'helm-spacemacs))) + +(defun spacemacs-core/init-holy-mode () + (use-package holy-mode + :commands holy-mode + :init + (progn + (when (eq 'emacs dotspacemacs-editing-style) + (holy-mode)) + (spacemacs|add-toggle holy-mode + :status holy-mode + :on (holy-mode) + :off (holy-mode -1) + :documentation "Globally toggle holy mode." + :evil-leader "E H")))) + +(defun spacemacs-core/init-hybrid-mode () + (use-package hybrid-mode + :commands hybrid-mode + :init + (progn + (add-to-list 'spacemacs-evil-cursor-colors + `(hybrid . ,(spacemacs/state-color 'emacs))) + (spacemacs/set-state-faces) + (setq hybrid-mode-insert-state-cursor + (if (and (display-graphic-p) + dotspacemacs-colorize-cursor-according-to-state) + `(,(spacemacs/state-color 'hybrid) (bar . 2)) + 'bar)) + (copy-face 'spacemacs-insert-face 'spacemacs-insert-face-backup) + (add-hook 'hybrid-mode-hook + (lambda () + (copy-face (if hybrid-mode + 'spacemacs-emacs-face + 'spacemacs-insert-face-backup) + 'spacemacs-insert-face))) + (when (eq 'hybrid dotspacemacs-editing-style) + (hybrid-mode)) + (spacemacs|add-toggle hybrid-mode + :status hybrid-mode + :on (hybrid-mode) + :off (hybrid-mode -1) + :documentation "Globally toggle hybrid mode." + :evil-leader "E Y")))) + +(defun spacemacs-core/init-page-break-lines () + (use-package page-break-lines + :init + (global-page-break-lines-mode t) + (spacemacs|hide-lighter page-break-lines-mode))) + +(defun spacemacs-core/init-popup () + (use-package popup + :defer t)) + +(defun spacemacs-core/init-popwin () + (use-package popwin + :config + (progn + (popwin-mode 1) + (evil-leader/set-key "wpm" 'popwin:messages) + (evil-leader/set-key "wpp" 'popwin:close-popup-window) + + ;; don't use default value but manage it ourselves + (setq popwin:special-display-config nil) + + ;; buffers that we manage + (push '("*Help*" :dedicated t :position bottom :stick t :noselect nil :height 0.4) popwin:special-display-config) + (push '("*compilation*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config) + (push '("*Shell Command Output*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '("*Async Shell Command*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '(" *undo-tree*" :dedicated t :position bottom :stick t :noselect nil :height 0.4) popwin:special-display-config) + (push '("*ert*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '("*grep*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '("*nosetests*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) + (push '("^\*WoMan.+\*$" :regexp t :position bottom ) popwin:special-display-config) + + (defun spacemacs/remove-popwin-display-config (str) + "Removes the popwin display configurations that matches the passed STR" + (setq popwin:special-display-config + (-remove (lambda (x) (if (and (listp x) (stringp (car x))) + (string-match str (car x)))) + popwin:special-display-config)))))) + +(defun spacemacs-core/init-projectile () + (use-package projectile + :commands (projectile-ack + projectile-ag + projectile-compile-project + projectile-dired + projectile-grep + projectile-find-dir + projectile-find-file + projectile-find-tag + projectile-find-test-file + projectile-invalidate-cache + projectile-kill-buffers + projectile-multi-occur + projectile-project-root + projectile-recentf + projectile-regenerate-tags + projectile-replace + projectile-run-async-shell-command-in-root + projectile-run-shell-command-in-root + projectile-switch-project + projectile-switch-to-buffer + projectile-vc) + :init + (progn + ;; note for Windows: GNU find or Cygwin find must be in path + ;; default parameters are not supported on Windows, we default + ;; to simplest call to find. + (when (spacemacs/system-is-mswindows) + (setq projectile-generic-command "find . -type f")) + (setq projectile-enable-caching t + projectile-indexing-method 'alien + projectile-sort-order 'recentf + projectile-cache-file (concat spacemacs-cache-directory + "projectile.cache") + projectile-known-projects-file (concat spacemacs-cache-directory + "projectile-bookmarks.eld")) + (unless (configuration-layer/package-usedp 'helm-projectile) + (evil-leader/set-key + "pb" 'projectile-switch-to-buffer + "pd" 'projectile-find-dir + "pf" 'projectile-find-file + "ph" 'helm-projectile + "pr" 'projectile-recentf + "ps" 'projectile-switch-project)) + (evil-leader/set-key + "p!" 'projectile-run-shell-command-in-root + "p&" 'projectile-run-async-shell-command-in-root + "pa" 'projectile-toggle-between-implementation-and-test + "pc" 'projectile-compile-project + "pD" 'projectile-dired + "pG" 'projectile-regenerate-tags + "pI" 'projectile-invalidate-cache + "pk" 'projectile-kill-buffers + "po" 'projectile-multi-occur + "pR" 'projectile-replace + "pT" 'projectile-find-test-file + "py" 'projectile-find-tag)) + :config + (progn + (projectile-global-mode) + (spacemacs|hide-lighter projectile-mode)))) + +(defun spacemacs-core/init-quelpa ()) + +(defun spacemacs-core/init-recentf () + (use-package recentf + :defer t + :init + ;; lazy load recentf + (add-hook 'find-file-hook (lambda () (unless recentf-mode + (recentf-mode) + (recentf-track-opened-file)))) + :config + (add-to-list 'recentf-exclude (expand-file-name spacemacs-cache-directory)) + (add-to-list 'recentf-exclude (expand-file-name package-user-dir)) + (add-to-list 'recentf-exclude "COMMIT_EDITMSG\\'") + (setq recentf-save-file (concat spacemacs-cache-directory "recentf")) + (setq recentf-max-saved-items 100) + (setq recentf-auto-cleanup 'never) + (setq recentf-auto-save-timer (run-with-idle-timer 600 t 'recentf-save-list)))) + +(defun spacemacs-core/init-savehist () + (use-package savehist + :init + (progn + ;; Minibuffer history + (setq savehist-file (concat spacemacs-cache-directory "savehist") + enable-recursive-minibuffers t ; Allow commands in minibuffers + history-length 1000 + savehist-additional-variables '(mark-ring + global-mark-ring + search-ring + regexp-search-ring + extended-command-history) + savehist-autosave-interval 60) + (savehist-mode t)))) + +(defun spacemacs-core/init-saveplace () + (use-package saveplace + :init + (progn + ;; Save point position between sessions + (setq save-place t + save-place-file (concat spacemacs-cache-directory "places"))))) + +(defun spacemacs-core/init-spacemacs-theme () + (use-package spacemacs-theme + :defer t + :init + (progn + (setq spacemacs-theme-comment-bg t) + (setq spacemacs-theme-org-height t)))) + +(defun spacemacs-core/init-subword () + (unless (version< emacs-version "24.4") + (use-package subword + :defer t + :init + (progn + (unless (category-docstring ?U) + (define-category ?U "Uppercase") + (define-category ?u "Lowercase")) + (modify-category-entry (cons ?A ?Z) ?U) + (modify-category-entry (cons ?a ?z) ?u) + (make-variable-buffer-local 'evil-cjk-word-separating-categories) + (defun spacemacs//subword-enable-camel-case () + "Add support for camel case to subword." + (if subword-mode + (push '(?u . ?U) evil-cjk-word-separating-categories) + (setq evil-cjk-word-separating-categories + (default-value 'evil-cjk-word-separating-categories)))) + (add-hook 'subword-mode-hook 'spacemacs//subword-enable-camel-case) + (spacemacs|add-toggle camel-case-motion + :status subword-mode + :on (subword-mode +1) + :off (subword-mode -1) + :documentation "Toggle CamelCase motions." + :evil-leader "tc") + (spacemacs|add-toggle camel-case-motion-globally + :status subword-mode + :on (global-subword-mode +1) + :off (global-subword-mode -1) + :documentation "Globally toggle CamelCase motions." + :evil-leader "t C-c")) + :config + (spacemacs|diminish subword-mode " ⓒ" " c")))) + +(defun spacemacs-core/init-undo-tree () + (use-package undo-tree + :init + (global-undo-tree-mode) + (setq undo-tree-visualizer-timestamps t) + (setq undo-tree-visualizer-diff t) + :config + (spacemacs|hide-lighter undo-tree-mode))) + +(defun spacemacs-core/init-use-package ()) + +(defun spacemacs-core/init-which-key () + (use-package which-key + :init + (progn + (spacemacs|add-toggle which-key + :status which-key-mode + :on (which-key-mode) + :off (which-key-mode -1) + :documentation + "Display a buffer with available key bindings." + :evil-leader "tK") + (let ((new-descriptions + ;; being higher in this list means the replacement is applied later + '( + ("spacemacs/\\(.+\\)" . "\\1") + ("spacemacs/toggle-\\(.+\\)" . "\\1") + ("select-window-\\([0-9]\\)" . "window \\1") + ("spacemacs/alternate-buffer" . "last buffer") + ("avy-goto-word-or-subword-1" . "avy word") + ("shell-command" . "shell cmd") + ("spacemacs/default-pop-shell" . "open shell") + ("spacemacs/helm-project-smart-do-search-region-or-symbol" . "smart search") + ("helm-descbinds" . "show keybindings") + ("sp-split-sexp" . "split sexp") + ("avy-goto-line" . "avy line") + ("universal-argument" . "universal arg") + ("er/expand-region" . "expand region") + ("helm-apropos" . "apropos") + ("evil-lisp-state-\\(.+\\)" . "\\1")))) + (dolist (nd new-descriptions) + ;; ensure the target matches the whole string + (push (cons (concat "\\`" (car nd) "\\'") (cdr nd)) + which-key-description-replacement-alist))) + (dolist (leader-key `(,dotspacemacs-leader-key ,dotspacemacs-emacs-leader-key)) + (which-key-add-key-based-replacements + (concat leader-key " m") "major mode commands" + (concat leader-key " " dotspacemacs-command-key) "M-x")) + (if (fboundp 'which-key-declare-prefixes) + (which-key-declare-prefixes + dotspacemacs-leader-key '("root" . "Spacemacs root") + dotspacemacs-emacs-leader-key '("root" . "Spacemacs root") + (concat dotspacemacs-leader-key " m") + '("major-mode-cmd" . "Major mode commands") + (concat dotspacemacs-emacs-leader-key " m") + '("major-mode-cmd" . "Major mode commands")) + ;; no need to use this after everyone updates which-key + (setq which-key-prefix-title-alist + `((,(listify-key-sequence + (kbd (concat dotspacemacs-leader-key " m"))) . "Major mode commands") + (,(listify-key-sequence + (kbd (concat dotspacemacs-emacs-leader-key " m"))) . "Major mode commands") + (,(listify-key-sequence + (kbd dotspacemacs-leader-key)) . "Spacemacs root") + (,(listify-key-sequence + (kbd dotspacemacs-emacs-leader-key)) . "Spacemacs root"))) + (nconc which-key-prefix-title-alist spacemacs/prefix-titles)) + ;; disable special key handling for spacemacs, since it can be + ;; disorienting if you don't understand it + (pcase dotspacemacs-which-key-position + (`right (which-key-setup-side-window-right)) + (`bottom (which-key-setup-side-window-bottom)) + (`right-then-bottom (which-key-setup-side-window-right-bottom))) + (setq which-key-special-keys nil + which-key-use-C-h-for-paging t + which-key-prevent-C-h-from-cycling t + which-key-echo-keystrokes 0.02 + which-key-max-description-length 32 + which-key-idle-delay dotspacemacs-which-key-delay) + (which-key-mode) + (spacemacs|diminish which-key-mode " Ⓚ" " K")))) + +(defun spacemacs-core/init-whitespace () + (use-package whitespace + :defer t + :init + (progn + (setq spacemacs-show-trailing-whitespace t) + (defun spacemacs//show-trailing-whitespace () + (when spacemacs-show-trailing-whitespace + (set-face-attribute 'trailing-whitespace nil + :background + (face-attribute 'font-lock-comment-face + :foreground)) + (setq show-trailing-whitespace 1))) + (add-hook 'prog-mode-hook 'spacemacs//show-trailing-whitespace) + + (spacemacs|add-toggle whitespace + :status whitespace-mode + :on (whitespace-mode) + :off (whitespace-mode -1) + :documentation "Display whitespace." + :evil-leader "tw") + (spacemacs|add-toggle whitespace-globally + :status global-whitespace-mode + :on (global-whitespace-mode) + :off (global-whitespace-mode -1) + :documentation "Display whitespace globally." + :evil-leader "t C-w") + + (defun spacemacs//set-whitespace-style-for-diff () + "Whitespace configuration for `diff-mode'" + (setq-local whitespace-style '(face + tabs + tab-mark + spaces + space-mark + trailing + indentation::space + indentation::tab + newline + newline-mark))) + (add-hook 'diff-mode-hook 'whitespace-mode) + (add-hook 'diff-mode-hook 'spacemacs//set-whitespace-style-for-diff)) + :config + (progn + (set-face-attribute 'whitespace-space nil + :background nil + :foreground (face-attribute 'font-lock-warning-face + :foreground)) + (set-face-attribute 'whitespace-tab nil + :background nil) + (set-face-attribute 'whitespace-indentation nil + :background nil) + (spacemacs|diminish whitespace-mode " ⓦ" " w") + (spacemacs|diminish global-whitespace-mode " Ⓦ" " W")))) + +(defun spacemacs-core/init-winner () + (use-package winner + :init + (progn + (winner-mode t) + (setq spacemacs/winner-boring-buffers '("*Completions*" + "*Compile-Log*" + "*inferior-lisp*" + "*Fuzzy Completions*" + "*Apropos*" + "*Help*" + "*cvs*" + "*Buffer List*" + "*Ibuffer*" + "*esh command on file*" + )) + (setq winner-boring-buffers + (append winner-boring-buffers spacemacs/winner-boring-buffers)) + (winner-mode t)))) diff --git a/layers/!distribution/spacemacs/config.el b/layers/!distribution/spacemacs/config.el new file mode 100644 index 000000000000..29bdd0e16232 --- /dev/null +++ b/layers/!distribution/spacemacs/config.el @@ -0,0 +1,16 @@ +;;; config.el --- Spacemacs Layer configuration File +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2014-2015 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +;; Prerequisites + +(configuration-layer/declare-layer 'spacemacs-core) + diff --git a/layers/!distribution/spacemacs/local/centered-cursor/centered-cursor-mode.el b/layers/!distribution/spacemacs/local/centered-cursor/centered-cursor-mode.el new file mode 100644 index 000000000000..35565b8f3f6b --- /dev/null +++ b/layers/!distribution/spacemacs/local/centered-cursor/centered-cursor-mode.el @@ -0,0 +1,421 @@ +;;; centered-cursor-mode.el --- cursor stays vertically centered + +;; Copyright (C) 2007 André Riemann + +;; Author: André Riemann +;; Maintainer: André Riemann +;; Created: 2007-09-14 +;; Keywords: convenience + +;; URL: http://www.emacswiki.org/cgi-bin/wiki/centered-cursor-mode.el +;; Compatibility: only tested with GNU Emacs 23.0 +;; Version: 0.5.2 +;; Last-Updated: 2009-08-31 + +;; This file 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, or (at your option) +;; any later version. + +;; This file 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 GNU Emacs; see the file COPYING. If not, write to the Free +;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301, USA. + +;;; Commentary: + +;; Makes the cursor stay vertically in a defined position (usually +;; centered). The vertical position can be altered, see key definition +;; below. + +;; To load put that in .emacs: +;; (require 'centered-cursor-mode) +;; To activate do: +;; M-x centered-cursor-mode +;; for buffer local or +;; M-x global-centered-cursor-mode +;; for global minor mode. +;; Also possible: put that in .emacs +;; (and +;; (require 'centered-cursor-mode) +;; (global-centered-cursor-mode +1)) +;; to always have centered-cursor-mode on in all buffers. + +;;; TODO: +;; - the code is a mess +;; - ccm-vpos-inverted doesn't work with ccm-vpos == 0, because first +;; position from top is 0 and from bottom -1 +;; - interactive first start isn't animated when calling global-... +;; because it starts the modes for each buffer and interactive-p fails +;; for that +;; - more bugs? + +;;; Change Log: +;; 2009-08-31 andre-r +;; * replaced window-body-height with window-text-height +;; (partially visible lines are not counted in window-text-height) +;; * bug fixed in ccm-vpos-recenter +;; (some parentheses where wrong after the last update) +;; 2009-02-23 andre-r +;; * some simplifications +;; 2009-02-22 andre-r +;; * some tips from Drew Adams: +;; - new local variable coding:utf-8 +;; - made recenter-sequence a defvar +;; - added groups scrolling and convenience +;; - replaced mouse-4 and mouse-5 with +;; mouse-wheel-up-event and mouse-wheel-down-event +;; - added scroll-bar-toolkit-scroll to ccm-ignored-commands +;; - made ccm-ignored-commands customisable +;; * removed a bug where it didn't work with more than one window +;; displaying the same buffer +;; * added function for page up and down scrolling +;; (standard ones didn't work well with this mode) +;; * made the animation delay customisable +;; * made the initial vertical position customisable +;; * made the behaviour at the end of the file customisable +;; 2008-02-02 andre-r +;; * fixed bug that led to wrong-type-argument +;; when opening a new buffer +;; * some other minor stuff +;; 2007-09-24 andre-r +;; * added global minor mode +;; 2007-09-21 andre-r +;; * not recentering at end of buffer +;; * defvar animate-first-start-p +;; 2007-09-14 andre-r +;; * inital release + +;; This file is *NOT* part of GNU Emacs. + +;;; Code: + +(defgroup centered-cursor nil + "Makes the cursor stay vertically in a defined position (usually centered). +Instead the cursor the text moves around the cursor." + :group 'scrolling + :group 'convenience + :link '(emacs-library-link :tag "Source Lisp File" "centered-cursor-mode.el") + :link '(url-link "http://www.emacswiki.org/cgi-bin/wiki/centered-cursor-mode.el")) + +(defcustom ccm-step-size 2 + "Step size when animated recentering." + :group 'centered-cursor + :tag "Animation step size" + :type 'integer) + +(defcustom ccm-step-delay 0.02 + "Delay between animation steps. +If you want a different animation speed." + :group 'centered-cursor + :tag "Animation step delay" + :type 'number) + +(defcustom ccm-ignored-commands '(mouse-drag-region + mouse-set-point + widget-button-click + scroll-bar-toolkit-scroll) + "After these commands recentering is ignored. +This is to prevent unintentional jumping (especially when mouse +clicking). Following commands (except the ignored ones) will +cause an animated recentering to give a feedback and not just +jumping to the center." + :group 'centered-cursor + :tag "Ignored commands" + :type '(repeat (symbol :tag "Command"))) + +(defcustom ccm-vpos-init '(round (window-text-height) 2) + "This is the screen line position where the cursor initially stays." + :group 'centered-cursor + :tag "Vertical cursor position" + :type '(choice (const :tag "Center" (round (window-text-height) 2)) + (const :tag "Golden ratio" (round (* 21 (window-text-height)) 34)) + (integer :tag "Lines from top" :value 10))) +(make-variable-buffer-local 'ccm-vpos-init) + +(defcustom ccm-vpos-inverted 1 + "Inverted vertical cursor position. +Defines if the initial vertical position `ccm-vpos-init' is +measured from the bottom instead from the top." + :group 'centered-cursor + :tag "Inverted cursor position" + :type '(choice (const :tag "Inverted" -1) + (const :tag "Not inverted" 1))) +(make-variable-buffer-local 'ccm-vpos-inverted) + +(defcustom ccm-recenter-at-end-of-file nil + "Recenter at the end of the file. +If non-nil the end of the file is recentered. If nil the end of +the file stays at the end of the window." + :group 'centered-cursor + :tag "Recenter at EOF" + :type '(choice (const :tag "Don't recenter at the end of the file" nil) + (const :tag "Recenter at the end of the file" t))) +(make-variable-buffer-local 'ccm-recenter-end-of-file) + +(defvar ccm-vpos nil + "This is the screen line position where the cursor stays.") +(make-variable-buffer-local 'ccm-vpos) + +(defvar animate-first-start-p nil + "Whether or not to animate at first start. It is set to nil, if +centered-cursor-mode is called non-interactively.") +(make-variable-buffer-local 'animate-first-start-p) + +(defvar recenter-sequence nil + "Before animated recentering a list is generated first with positions +to successively recenter to") +(make-variable-buffer-local 'recenter-sequence) + +(defvar ccm-map + (let ((ccm-map (make-sparse-keymap))) + (define-key ccm-map [(control meta -)] 'ccm-vpos-up) + (define-key ccm-map [(control meta +)] 'ccm-vpos-down) + (define-key ccm-map [(control meta =)] 'ccm-vpos-down) + (define-key ccm-map [(control meta ?0)] 'ccm-vpos-recenter) + (when mouse-wheel-mode + (mapc (lambda (key) + (define-key ccm-map key 'ccm-mwheel-scroll)) + (list (vector mouse-wheel-up-event) + (vector mouse-wheel-down-event) + (vector (list 'control mouse-wheel-up-event)) + (vector (list 'control mouse-wheel-down-event)) + (vector (list 'shift mouse-wheel-up-event)) + (vector (list 'shift mouse-wheel-down-event))))) + (define-key ccm-map [(meta v)] 'ccm-scroll-down) + (define-key ccm-map [(control v)] 'ccm-scroll-up) + (define-key ccm-map [prior] 'ccm-scroll-down) + (define-key ccm-map [next] 'ccm-scroll-up) + ccm-map) + "Keymap used in centered-cursor-mode.") + + +(defun ccm-mwheel-scroll (event) + "Very similar to `mwheel-scroll', but does not use `scroll-down' +and `scroll-up' but `previous-line' and `next-line', that is, the +cursor is moved and thus the text in the window is scrolled +due to `recenter'. + +The customizable variable `mouse-wheel-scroll-amount' is used to +determine how much to scroll, where nil instead of a number means +the same as in mwheel-scroll, scroll by a near full screen. + +This command exists, because mwheel-scroll caused strange +behaviour with automatic recentering." +;; (interactive (list last-input-event)) + (interactive "e") + (let* ((mods (delq 'click (delq 'double (delq 'triple (event-modifiers event))))) + (amt (assoc mods mouse-wheel-scroll-amount))) + ;;(message "%S" mods) + (if amt + (setq amt (or (cdr amt) + (- (window-text-height) + next-screen-context-lines))) + (let ((list-elt mouse-wheel-scroll-amount)) + (while (consp (setq amt (pop list-elt)))))) + (if mouse-wheel-follow-mouse + (select-window (posn-window (event-start event)))) + (let ((button (mwheel-event-button event))) + (cond + ((eq button mouse-wheel-down-event) + (forward-line (- amt))) + ;;(princ amt)) + ((eq button mouse-wheel-up-event) + (forward-line amt)) + ;;(princ amt)) + (t (error "Bad binding in ccm-mwheel-scroll")))))) + +(defun ccm-scroll-down (&optional arg) + "Replaces `scroll-down' because with scroll-down +`centered-cursor-mode' sometimes doesn't reach the top of the +buffer. This version actually moves the cursor with +`previous-line'. Since with centered-cursor-mode the cursor is in +a fixed position the movement appears as page up." + (interactive "P") + (let ((amt (or arg (- (window-text-height) + next-screen-context-lines)))) + (forward-line (- amt)))) + +(defun ccm-scroll-up (&optional arg) + "Replaces `scroll-up' to be consistent with `ccm-scroll-down'. +This version actually moves the cursor with `previous-line'. +Since with centered-cursor-mode the cursor is in a fixed position +the movement appears as page up." + (interactive "P") + (let ((amt (or arg (- (window-text-height) + next-screen-context-lines)))) + (forward-line amt))) + + +(defun ccm-vpos-down (arg) + "Adjust the value of the screen line (where the cursor stays) by arg. +Negative values for arg are possible. Just the variable ccm-vpos +is set." + (interactive "p") + (or arg (setq arg 1)) + (let ((new-pos (if (< ccm-vpos 0) + (- ccm-vpos arg) + (+ ccm-vpos arg))) + ;; see pos-visible-in-window-p + (vpos-max (if (< ccm-vpos 0) + -1 + (- (window-text-height) 1))) + (vpos-min (if (< ccm-vpos 0) + (- (window-text-height)) + 0))) + (setq ccm-vpos + (cond + ((< new-pos vpos-min) + vpos-min) + ((> new-pos vpos-max) + vpos-max) + (t + new-pos))))) + +(defun ccm-vpos-up (arg) + "See `ccm-vpos-down'." + (interactive "p") + (or arg (setq arg 1)) + (ccm-vpos-down (- arg))) + +(defun ccm-vpos-recenter () + "Set the value of the screen line (where the cursor stays) in +the center. Just the variable ccm-vpos is set." + (interactive) + (if (equal (current-buffer) + (window-buffer (selected-window))) + (setq ccm-vpos (* (eval ccm-vpos-init) + ccm-vpos-inverted)))) + +(defun ccm-position-cursor () + "Do the actual recentering at the position `ccm-vpos'." + (unless (member this-command ccm-ignored-commands) + (unless ccm-vpos + (ccm-vpos-recenter)) + (unless (minibufferp (current-buffer)) + (if (equal (current-buffer) + (window-buffer (selected-window))) + (let* ((current-line + (if (< ccm-vpos 0) + ;; one-based, from bottom, negative + (- (count-lines (point) + ;; window-end is sometimes < 0 + ;; when opening a help buffer + (if (> (window-end) 0) + (window-end) + 1))) + ;; zero-based, from top, positive + (+ (count-lines (window-start) (point)) + ;; count-lines returns different value in column 0 + (if (= (current-column) 0) 0 -1)))) + (diff (- ccm-vpos current-line)) + (step-size ccm-step-size) + (step-delay ccm-step-delay) + (vpos-inverted ccm-vpos-inverted) + (recenter-at-end-of-file ccm-recenter-at-end-of-file)) + + (let* ((bottom-vpos (if (< ccm-vpos 0) + (- ccm-vpos) + (- (window-text-height) ccm-vpos))) + (correction (save-excursion + (if (or (= (point) (point-max)) + (progn + (goto-char (point-max)) + (zerop (current-column)))) + 1 0))) + ;; lines from point to end of buffer + (bottom-lines (+ (count-lines (point) (point-max)) + correction))) + + ;; only animate if the point was moved rather far away + ;; before by a mouseclick (see ccm-ignored-commands) + ;; or if minor mode is just entered interactively + (if (not (and (> (abs diff) 4) + (or (member last-command ccm-ignored-commands) + animate-first-start-p))) + + (recenter (if (and (< bottom-lines bottom-vpos) + (not recenter-at-end-of-file)) + ;; if near the bottom, recenter in the + ;; negative screen line that equals the + ;; bottom buffer line, i.e. if we are in + ;; the second last line (-2) of the + ;; buffer, the cursor will be recentered + ;; in -2 + (- bottom-lines) + ccm-vpos)) + + (setq animate-first-start-p nil) + ;; first build a list with positions to successively recenter to + (setq recenter-sequence + ;; reverse: because we build the list not FROM -> TO but + ;; TO -> FROM because if step size in number-sequence is + ;; bigger than one, TO might not included, that means the + ;; ccm-vpos would not be reached + ;; cdr: don't recenter the current-line + (if (and (< bottom-lines bottom-vpos) + (not recenter-at-end-of-file)) + ;; this one is for animation near the bottom + (cdr (reverse (number-sequence + (- bottom-lines) + (if (< ccm-vpos 0) + current-line + (- (- (window-text-height) current-line))) + (* (/ diff (abs diff)) (- step-size))))) + (cdr (reverse (number-sequence + ccm-vpos + current-line + (* (/ diff (abs diff)) (- step-size))))))) + ;; (message "%d %d %d (%d): %S" current-line ccm-vpos bottom-lines diff recenter-sequence) + (while recenter-sequence + ;; actual animation + (recenter (pop recenter-sequence)) + (if (car recenter-sequence) (sit-for step-delay t)))))))))) + +(defun ccm-first-start (animate) + "Called from centered-cursor-mode. Animate at first start, if +centered-cursor-mode is called interactively." + (let ((animate-first-start-p animate)) + (ccm-vpos-recenter) + (ccm-position-cursor))) + +;;(defalias 'ccm 'centered-cursor-mode) +(define-minor-mode centered-cursor-mode + "Makes the cursor stay vertically in a defined +position (usually centered)." + :init-value nil +;; :lighter nil + :lighter " ¢" + :keymap ccm-map + (cond + (centered-cursor-mode + (ccm-first-start (interactive-p)) + (add-hook 'post-command-hook 'ccm-position-cursor t t) + (add-hook 'window-configuration-change-hook 'ccm-vpos-recenter t t)) + (t + (remove-hook 'post-command-hook 'ccm-position-cursor t) + (remove-hook 'window-configuration-change-hook 'ccm-vpos-recenter t)))) + + +(define-global-minor-mode global-centered-cursor-mode centered-cursor-mode + centered-cursor-mode) + +(provide 'centered-cursor-mode) + +;;; Help: +;; (info "(elisp)Defining Minor Modes") +;; (info "(elisp)Screen Lines") +;; (info "(elisp)Hooks") +;; (info "(elisp)Customization") +;; (find-function 'mwheel-scroll) + +;; Local Variables: +;; coding: utf-8 +;; End: + +;;; centered-cursor-mode.el ends here diff --git a/layers/!distribution/spacemacs/local/experimental-iedit/experimental-iedit.el b/layers/!distribution/spacemacs/local/experimental-iedit/experimental-iedit.el new file mode 100644 index 000000000000..952504b4239d --- /dev/null +++ b/layers/!distribution/spacemacs/local/experimental-iedit/experimental-iedit.el @@ -0,0 +1,128 @@ +;;; experimental-iedit.el --- iedit experimentations. + +;; Author: Sylvain Benner +;; Keywords: helm, spacemacs +;; Version: 0.1 +;; Package-Requires: ((helm "1.5")) + +;; This file 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 3, or (at your option) +;; any later version. + +;; This file 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 GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; This package adds a convenient way to discover Spacemacs configuration +;; layers thanks to helm. + +;;; Code: + +(require 'iedit) +(require 'evil-iedit-state) + +(define-key evil-iedit-state-map (kbd "H") 'ex-iedit-move-overlays-backward) +(define-key evil-iedit-state-map (kbd "J") 'ex-iedit-move-overlays-next-line) +(define-key evil-iedit-state-map (kbd "K") 'ex-iedit-move-overlays-previous-line) +(define-key evil-iedit-state-map (kbd "L") 'ex-iedit-move-overlays-forward) +(define-key evil-iedit-state-map (kbd "C-S-h") '(lambda () (interactive) (ex-iedit-expand-overlays -1))) +(define-key evil-iedit-state-map (kbd "C-S-l") '(lambda () (interactive) (ex-iedit-expand-overlays 1))) +(define-key evil-iedit-state-map (kbd "w") '(lambda () (interactive) (ex-iedit-expand-overlays 'evil-forward-word-begin t))) +(define-key evil-iedit-state-map (kbd "gj") 'ex-iedit-toggle-point-overlay-next-line) +(define-key evil-iedit-state-map (kbd "gk") 'ex-iedit-toggle-point-overlay-previous-line) + +(defun iedit-toggle-selection () + "Override default iedit function to be able to add arbitrary overlays. + +It will toggle the overlay under point or create an overlay of one character." + (interactive) + (iedit-barf-if-buffering) + (let ((ov (iedit-find-current-occurrence-overlay))) + (if ov + (iedit-restrict-region (overlay-start ov) (overlay-end ov) t) + (save-excursion + (push (iedit-make-occurrence-overlay (point) (1+ (point))) + iedit-occurrences-overlays)) + (setq iedit-mode + (propertize + (concat " Iedit:" (number-to-string + (length iedit-occurrences-overlays))) + 'face 'font-lock-warning-face)) + (force-mode-line-update)))) + +(defun ex-iedit-move-overlays (func) + (dolist (o iedit-occurrences-overlays) + (let* ((start (overlay-start o)) + (end (overlay-end o)) + (len (- end start))) + (save-excursion + (goto-char (overlay-start o)) + (ignore-errors (call-interactively func)) + (move-overlay o (point) (+ (point) len)))))) + +(defun ex-iedit-expand-overlays (arg &optional from-end) + (when (iedit-find-current-occurrence-overlay) + (dolist (o iedit-occurrences-overlays) + (let ((start (overlay-start o)) + (end (overlay-end o))) + (save-excursion + (if from-end + (goto-char end) + (goto-char start)) + (cond + ((numberp arg) + (when (> (+ (- end start) arg) 0) + (move-overlay o start (+ arg end)))) + ((functionp arg) + (ignore-errors (call-interactively arg)) + (move-overlay o start (point))))))))) + +(defun ex-iedit-move-overlays-forward () + (interactive) + (ex-iedit-move-overlays 'evil-forward-char)) + +(defun ex-iedit-move-overlays-backward () + (interactive) + (ex-iedit-move-overlays 'evil-backward-char)) + +(defun ex-iedit-move-overlays-next-line () + (interactive) + (ex-iedit-move-overlays 'evil-next-line)) + +(defun ex-iedit-move-overlays-previous-line () + (interactive) + (ex-iedit-move-overlays 'evil-previous-line)) + +(defun ex-iedit-toggle-point-overlay-next-line (count) + (interactive "p") + (unless (iedit-find-current-occurrence-overlay) + (iedit-toggle-selection)) + (let ((i (when count count 1))) + (save-excursion + (evil-next-line) + (while (and (> i 0) + (iedit-find-current-occurrence-overlay)) + (1- i) + (evil-next-line)) + (message "i %s" i) + (when (not (iedit-find-current-occurrence-overlay)) + (dotimes (j (1+(- count i))) + (iedit-toggle-selection) + (evil-next-line)))))) + +(defun ex-iedit-toggle-point-overlay-previous-line (count) + (interactive "p") + (save-excursion + (dotimes (i count) + (evil-previous-line) + (iedit-toggle-selection)))) + + (provide 'experimental-iedit) diff --git a/layers/!distribution/spacemacs/local/helm-spacemacs/helm-spacemacs.el b/layers/!distribution/spacemacs/local/helm-spacemacs/helm-spacemacs.el new file mode 100644 index 000000000000..3b72d4ef52eb --- /dev/null +++ b/layers/!distribution/spacemacs/local/helm-spacemacs/helm-spacemacs.el @@ -0,0 +1,249 @@ +;;; helm-spacemacs.el --- Spacemacs layer exploration with `helm'. + +;; Author: Sylvain Benner +;; Keywords: helm, spacemacs +;; Version: 0.1 +;; Package-Requires: ((helm "1.5")) + +;; This file 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 3, or (at your option) +;; any later version. + +;; This file 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 GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; This package adds a convenient way to discover Spacemacs configuration +;; layers thanks to helm. + +;;; Code: + +(require 'cl) +(require 'ht) +(require 'helm) +(require 'core-configuration-layer) + +(defvar helm-spacemacs-all-layers nil + "Alist of all configuration layers.") + +(defvar helm-spacemacs-all-packages nil + "Hash table of all packages in all layers.") + +;;;###autoload +(define-minor-mode helm-spacemacs-mode + "Layers discovery with helm interface." + :group 'spacemacs + :global t) + +(defun helm-spacemacs//init (&optional arg) + (when (or arg (null helm-spacemacs-all-packages)) + (mapc (lambda (layer) (push (configuration-layer/make-layer layer) + helm-spacemacs-all-layers)) + (configuration-layer/get-layers-list)) + (dolist (layer helm-spacemacs-all-layers) + (unless (configuration-layer/layer-usedp (oref layer :name)) + (configuration-layer//load-layer-files layer '("funcs.el" + "config.el")))) + (setq helm-spacemacs-all-packages (configuration-layer/get-packages + helm-spacemacs-all-layers)))) + +;;;###autoload +(defun helm-spacemacs (arg) + "Layers discovery with helm interface." + (interactive "P") + (helm-spacemacs-mode) + (helm-spacemacs//init arg) + (helm :buffer "*helm: spacemacs*" + :sources `(,(helm-spacemacs//documentation-source) + ,(helm-spacemacs//layer-source) + ,(helm-spacemacs//package-source) + ,(helm-spacemacs//dotspacemacs-source) + ,(helm-spacemacs//toggle-source)))) + +(defun helm-spacemacs//documentation-source () + "Construct the helm source for the documentation section." + (helm-build-sync-source "Spacemacs Documentation" + :candidates #'helm-spacemacs//documentation-candidates + :persistent-action #'helm-spacemacs//documentation-action-open-file + :keymap helm-map + :action (helm-make-actions + "Open Documentation" #'helm-spacemacs//documentation-action-open-file))) + +(defun helm-spacemacs//documentation-candidates () + (let (result file-extension) + (dolist (filename (directory-files spacemacs-docs-directory)) + (setq file-extension (file-name-extension filename)) + (when (or (equal file-extension "md") + (equal file-extension "org")) + (push filename result))) + ;; delete DOCUMENTATION.org to make it the first guide + (delete "DOCUMENTATION.org" result) + (push "DOCUMENTATION.org" result) + + ;; give each document an appropriate title + (mapcar (lambda (r) + (cond + ((string-equal r "CONTRIBUTE.org") + `("How to contribute to Spacemacs" . ,r)) + ((string-equal r "CONVENTIONS.org") + `("Spacemacs conventions" . ,r)) + ((string-equal r "DOCUMENTATION.org") + `("Spacemacs starter guide" . ,r)) + ((string-equal r "HOWTOs.org") + `("Quick HOW-TOs for Spacemacs" . ,r)) + ((string-equal r "LAYERS.org") + `("Tips on writing layers for Spacemacs" . ,r)) + ((string-equal r "VIMUSERS.org") + `("Vim users migration guide" . ,r)) + (t + `(r . ,r)))) + result))) + +(defun helm-spacemacs//documentation-action-open-file (candidate) + "Open documentation FILE." + (let ((file (concat spacemacs-docs-directory candidate))) + (cond ((and (equal (file-name-extension file) "md") + (not helm-current-prefix-arg)) + (condition-case nil + (with-current-buffer (find-file-noselect file) + (gh-md-render-buffer) + (kill-this-buffer)) + ;; if anything fails, fall back to simply open file + (find-file file))) + ((equal (file-name-extension file) "org") + (spacemacs/view-org-file file "^" 'all)) + (t + (find-file file))))) + +(defun helm-spacemacs//layer-source () + "Construct the helm source for the layer section." + `((name . "Layers") + (candidates . ,(sort (configuration-layer/get-layers-list) 'string<)) + (candidate-number-limit) + (action . (("Open README.org" + . helm-spacemacs//layer-action-open-readme) + ("Open packages.el" + . helm-spacemacs//layer-action-open-packages) + ;; TODO remove extensions in 0.105.0 + ("Open extensions.el" + . helm-spacemacs//layer-action-open-extensions))))) + +(defun helm-spacemacs//package-source () + "Construct the helm source for the packages." + `((name . "Packages") + (candidates . ,(helm-spacemacs//package-candidates)) + (candidate-number-limit) + (action . (("Go to init function" + . helm-spacemacs//package-action-goto-init-func))))) + +(defun helm-spacemacs//package-candidates () + "Return the sorted candidates for package source." + (let (result) + (dolist (pkg helm-spacemacs-all-packages) + (push (format "(%S) package: %S" (oref pkg :owner) (oref pkg :name)) + result)) + (sort result 'string<))) + +(defun helm-spacemacs//toggle-source () + "Construct the helm source for the toggles." + (helm-build-sync-source "Toggles" + :candidates #'helm-spacemacs//toggle-candidates + :persistent-action #'helm-spacemacs//toggle + :keymap helm-map + :action (helm-make-actions "Toggle" #'helm-spacemacs//toggle))) + +(defun helm-spacemacs//toggle-candidates () + "Return the sorted candidates for toggle source." + (let (result) + (dolist (toggle spacemacs-toggles) + (let* ((toggle-symbol (symbol-name (car toggle))) + (toggle-name (capitalize (replace-regexp-in-string "-" " " toggle-symbol))) + (toggle-doc (format "%s: %s" toggle-name (plist-get (cdr toggle) :documentation)))) + (if (plist-member (cdr toggle) :documentation) + (push `(,toggle-doc . ,toggle-symbol) result) + (push `(,toggle-name . ,toggle-symbol) result)))) + (setq result (cl-sort result 'string< :key 'car)) + result)) + +(defun helm-spacemacs//dotspacemacs-source () + `((name . "Dotfile") + (candidates . ,(helm-spacemacs//dotspacemacs-candidates)) + (candidate-number-limit) + (action . (("Go to variable" . helm-spacemacs//go-to-dotfile-variable))))) + +(defun helm-spacemacs//dotspacemacs-candidates () + "Return the sorted candidates for all the dospacemacs variables." + (sort (dotspacemacs/get-variable-string-list) 'string<)) + +(defun helm-spacemacs//layer-action-open-file (file candidate) + "Open FILE of the passed CANDIDATE." + (let ((path (if (and (equalp file "README.org") (equalp candidate "spacemacs")) + ;; Readme for spacemacs is in the project root + (ht-get configuration-layer-paths (intern candidate)) + (file-name-as-directory + (concat (ht-get configuration-layer-paths + (intern candidate)) + candidate))))) + (if (and (equal (file-name-extension file) "org") + (not helm-current-prefix-arg)) + (spacemacs/view-org-file (concat path file) "^" 'all) + (find-file (concat path file))))) + +(defun helm-spacemacs//layer-action-open-readme (candidate) + "Open the `README.org' file of the passed CANDIDATE." + (helm-spacemacs//layer-action-open-file "README.org" candidate)) + +(defun helm-spacemacs//layer-action-open-packages (candidate) + "Open the `packages.el' file of the passed CANDIDATE." + (helm-spacemacs//layer-action-open-file "packages.el" candidate)) + +;; TODO remove extensions in 0.105.0 +(defun helm-spacemacs//layer-action-open-extensions (candidate) + "Open the `extensions.el' file of the passed CANDIDATE." + (helm-spacemacs//layer-action-open-file "extensions.el" candidate)) + +(defun helm-spacemacs//package-action-goto-init-func (candidate) + "Open the file `packages.el' and go to the init function." + (save-match-data + (string-match "^(\\(.+\\))\s\\(.+\\):\s\\(.+\\)$" candidate) + (let* ((layer (match-string 1 candidate)) + (type (match-string 2 candidate)) + (package (match-string 3 candidate)) + (path (file-name-as-directory + (concat (ht-get configuration-layer-paths (intern layer)) + layer))) + (filename (cond ((string-equal "package" type) + (concat path "packages.el")) + ;; TODO remove extensions in 0.105.0 + (t (concat path "extensions.el"))))) + (find-file filename) + (goto-char (point-min)) + (re-search-forward (format "init-%s" package)) + (beginning-of-line)))) + +(defun helm-spacemacs//toggle (candidate) + "Toggle candidate." + (let ((toggle (assq (intern candidate) spacemacs-toggles))) + (when toggle + (funcall (plist-get (cdr toggle) :function))))) + +(defun helm-spacemacs//go-to-dotfile-variable (candidate) + "Go to candidate in the dotfile." + (find-file dotspacemacs-filepath) + (goto-char (point-min)) + ;; try to exclude comments + (re-search-forward (format "^[a-z\s\\(\\-]*%s" candidate)) + (beginning-of-line)) + + +(provide 'helm-spacemacs) + +;;; helm-spacemacs.el ends here diff --git a/layers/!distribution/spacemacs/local/holy-mode/holy-mode.el b/layers/!distribution/spacemacs/local/holy-mode/holy-mode.el new file mode 100644 index 000000000000..2832c3a2e4e5 --- /dev/null +++ b/layers/!distribution/spacemacs/local/holy-mode/holy-mode.el @@ -0,0 +1,111 @@ +;;; holy-mode.el --- Enter the church of Emacs + +;; Copyright (C) 2014-2015 syl20bnr +;; +;; Author: Sylvain Benner +;; Keywords: convenience editing +;; Created: 18 Mar 2015 +;; Version: 1.00 +;; Package-Requires: ((emacs "24") (evil "1.0.9")) +;; URL: https://github.com/syl20bnr/spacemacs + +;; This file is not part of GNU Emacs. + +;; 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 3 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: + +;;; Code: + +(defvar holy-mode-normal-state-modes-backup nil + "Backup of `evil-normal-state-modes'.") + +(defvar holy-mode-motion-state-modes-backup nil + "Backup of `evil-motion-state-modes'.") + +(defadvice evil-insert-state (around benedictus-dominus disable) + "Preparing the holy water flasks." + (evil-emacs-state)) + +;;;###autoload +(define-minor-mode holy-mode + "Global minor mode to repulse the evil from spacemacs. + +The `insert state' is replaced by the `emacs state'." + :global t + :lighter " holy" + :group 'spacemacs + (if holy-mode + (in-nominus-patris-et-filii-et-sipritus-sancti) + (amen))) + +(defun in-nominus-patris-et-filii-et-sipritus-sancti () + "Enter the church of Emacs (wash your hands)." + ;; transfert all modes defaulting to `evilified state' to + ;; `emacs state' + (setq evil-evilified-state-modes nil) + (mapc (lambda (x) (push x evil-emacs-state-modes)) + spacemacs-core-evilified-state--modes) + ;; allow to return to `normal state' with escape + (define-key evil-emacs-state-map [escape] 'evil-normal-state) + ;; replace `insert state' by `emacs state' + (ad-enable-advice 'evil-insert-state 'around 'benedictus-dominus) + (ad-activate 'evil-insert-state) + ;; start all buffers in `emacs state' + (setq evil-default-state 'emacs) + (setq holy-mode-normal-state-modes-backup evil-normal-state-modes) + (setq evil-normal-state-modes nil) + (setq holy-mode-motion-state-modes-backup evil-motion-state-modes) + (setq evil-motion-state-modes nil) + ;; helm navigation + (when (fboundp 'spacemacs//helm-hjkl-navigation) + (spacemacs//helm-hjkl-navigation nil)) + ;; initiate `emacs state' and enter the church + (holy-mode//update-states-for-current-buffers)) + +(defun amen () + "May the force be with you my son (or not)." + ;; restore default `evilified state' + (mapc (lambda (x) (delq x evil-emacs-state-modes)) + spacemacs-core-evilified-state--modes) + (setq evil-evilified-state-modes spacemacs-core-evilified-state--modes) + ;; restore `insert state' + (ad-disable-advice 'evil-insert-state 'around 'benedictus-dominus) + (ad-activate 'evil-insert-state) + ;; restore `normal state' + (setq evil-default-state 'normal) + ;; restore per mode default states + (setq evil-normal-state-modes holy-mode-normal-state-modes-backup) + (setq evil-motion-state-modes holy-mode-motion-state-modes-backup) + ;; restore helm navigation + (when (fboundp 'spacemacs//helm-hjkl-navigation) + (spacemacs//helm-hjkl-navigation t)) + ;; restore the states + (holy-mode//update-states-for-current-buffers t)) + +(defun holy-mode//update-states-for-current-buffers (&optional arg) + "Update the active state in all current buffers. +ARG non nil means that the editing style is `vim'." + (dolist (buffer (buffer-list)) + (with-current-buffer buffer + ;; switch to holy-mode + (when (and (not arg) (or (eq 'evilified evil-state) + (eq 'normal evil-state))) + (evil-emacs-state)) + ;; disable holy-mode + (when (and arg (eq 'emacs evil-state)) + (cond + ((memq major-mode evil-evilified-state-modes) (evil-evilified-state)) + ((memq major-mode evil-motion-state-modes) (evil-motion-state)) + (t (evil-normal-state))))))) diff --git a/layers/!distribution/spacemacs/local/hybrid-mode/hybrid-mode.el b/layers/!distribution/spacemacs/local/hybrid-mode/hybrid-mode.el new file mode 100644 index 000000000000..8748adf98bcb --- /dev/null +++ b/layers/!distribution/spacemacs/local/hybrid-mode/hybrid-mode.el @@ -0,0 +1,105 @@ +;;; hybrid-mode.el --- Put one foot in the church of Emacs + +;; Copyright (C) 2014-2015 syl20bnr +;; +;; Author: Justin Burkett , Chris Ewald +;; Keywords: convenience editing +;; Created: 12 Aug 2015 +;; Version: 1.00 +;; Package-Requires: ((emacs "24") (evil "1.0.9")) +;; URL: https://github.com/syl20bnr/spacemacs + +;; This file is not part of GNU Emacs. + +;; 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 3 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: + +;;; Code: + +(require 'evil) + +(defgroup hybrid-mode nil + "Customization options for hybrid-mode" + :group 'emulations + :prefix "hybrid-mode-") + +(defcustom hybrid-mode-insert-state-cursor 'bar + "Cursor spec for hybrid mode in insert state." + :group 'hybrid-mode) + +(defvar hybrid-mode-insert-state-cursor-backup evil-insert-state-cursor + "Backup of `evil-insert-state-cursor'") + +(defvar hybrid-mode-emacs-state-map (make-sparse-keymap) + "Keymap that only applies in insert mode with hybrid mode +activated. Inherits bindings from `evil-emacs-state-map', which +may be overridden here.") + +(defvar hybrid-mode-insert-state-local-map (make-sparse-keymap) + "Local keymap for hybrid-mode. May be customized. Sets + `evil-insert-state-local-map' as its parent. Takes precedence + over `hybrid-mode-emacs-state-map'.") + +;;;###autoload +(define-minor-mode hybrid-mode + "Global minor mode to repulse the evil from spacemacs (in insert mode). +Emacs in insert mode. Replaces the `evil-insert-state' keymap +with `hybrid-mode-emacs-state-map'." + :global t + :lighter " hybrid" + :group 'spacemacs + (if hybrid-mode + (hybrid-mode-setup-keymaps) + (hybrid-mode-restore-keymaps))) + +(defun hybrid-mode-setup-keymaps () + "Enter the church of Emacs in insert mode only." + + ;; Backup and set the insert-state-cursor to the hybrid variant. + (setq hybrid-mode-insert-state-cursor-backup evil-insert-state-cursor + evil-insert-state-cursor hybrid-mode-insert-state-cursor) + + ;; Create the hybrid mode parent keymap by overriding the essential changes + ;; from `evil-emacs-state-map'. Set this as the parent keymap of + ;; `hybrid-mode-emacs-state-map' so that all key bindings may be overridden. + (setq hybrid-mode-parent-map (make-sparse-keymap)) + (set-keymap-parent hybrid-mode-parent-map evil-emacs-state-map) + (define-key hybrid-mode-parent-map (read-kbd-macro evil-toggle-key) nil) + (define-key hybrid-mode-parent-map [escape] 'evil-normal-state) + (set-keymap-parent hybrid-mode-emacs-state-map hybrid-mode-parent-map) + + ;; Set evil-insert-state-local-map to be the parent map of + ;; hybrid-mode-insert-state-local-map. Makes for a more clear category + ;; `helm-descbinds'. + (set-keymap-parent hybrid-mode-insert-state-local-map evil-insert-state-local-map) + + ;; Override the mode and keymap of evil-insert-state to use the hybrid-mode + ;; variants. + (evil-put-property 'evil-state-properties 'insert + :mode 'hybrid-mode-emacs-state + :keymap 'hybrid-mode-emacs-state-map + :local 'hybrid-mode-local-insert-state + :local-keymap 'hybrid-mode-insert-state-local-map)) + +(defun hybrid-mode-restore-keymaps () + "Restore `evil-insert-state' to it's original form." + ;; Return evil-insert-state cursor and properties to how they are defined in + ;; evil-states.el + (setq evil-insert-state-cursor hybrid-mode-insert-state-cursor-backup) + (evil-put-property 'evil-state-properties 'insert + :mode 'evil-insert-state-minor-mode + :keymap 'evil-insert-state-map + :local 'evil-insert-state-local-minor-mode + :local-keymap 'evil-insert-state-local-map)) diff --git a/layers/!distribution/spacemacs/local/paradox/README.md b/layers/!distribution/spacemacs/local/paradox/README.md new file mode 100644 index 000000000000..7796c8413198 --- /dev/null +++ b/layers/!distribution/spacemacs/local/paradox/README.md @@ -0,0 +1,103 @@ +Paradox +======= + +Project for modernizing Emacs' Package Menu. With package ratings, +usage statistics, customizability, and more. + +Here are some visual comparisons: + +#### Regular Package Menu #### +![Regular Package Menu](https://raw.github.com/Bruce-Connor/paradox/master/before.png) + +#### Paradox #### +![Paradox Package Menu](https://raw.github.com/Bruce-Connor/paradox/master/after.png) + +#### Paradox (multi-line) #### +![Paradox Package Menu](https://raw.github.com/Bruce-Connor/paradox/master/multi-line.png) +*These screenshots use smart-mode-line, but a similar effect is obtained with the regular mode-line.* + +Usage +=== + +Paradox can be installed from Melpa with `M-x package-install RET +paradox`. +It can also be installed manually in the usual way, just be mindful of +the dependencies. + +To use it, simply call `M-x paradox-list-packages` (instead of the +regular `list-packages`). +This will give you most features out of the box. If you want to be +able to star packages as well, just configure the +`paradox-github-token` variable then call `paradox-list-packages` +again. + +If you'd like to stop using Paradox, you may call `paradox-disable` +and go back to using the regular `list-packages`. + +## Current Features ## + +### Several Improvements ### + +Paradox implements many small improvements to the package menu +itself. They all work out of the box and are completely customizable! +*(Also, hit `h` to see all keys.)* + +* Visit the package's homepage with `v` (or just use the provided buttons). +* View a list of recent commits with `l`. +* Use `paradox-require` instead of `require` to automatically install + absent packages. +* Shortcuts for package filtering: + * `f r` filters by regexp (`occur`); + * `f u` display only packages with upgrades; + * `f k` filters by keyword (emacs 24.4 only). + +And some more... +* `hl-line-mode` enabled by default. +* Display useful information on the mode-line and cleanup a bunch of + useless stuff. +* **Customization!** Just call `M-x paradox-customize` to see what you can + do. + * Customize column widths. + * Customize faces (`paradox-star-face`, + `paradox-status-face-alist` and `paradox-archive-face`). + * Customize local variables. + + +### Package Ratings ### + +Paradox also integrates with +**GitHub Stars**, which works as **rough** package rating system. +That is, Paradox package menu will: + +1. Display the number of GitHub Stars each package has (assuming it's + in a github repo, of course); +2. Possibly automatically star packages you install, and unstar + packages you delete (you will be asked the first time whether you + want this); +3. Let you star and unstar packages by hitting the `s` key; +4. Let you star all packages you have installed with `M-x paradox-star-all-installed-packages`. + +Item **1.** will work out of the box, the other items obviously +require a github account (Paradox will help you generate a token the +first time you call `paradox-list-packages`). + +## Known Bugs ## + +* On some cases there's an annoying gnutls error message after downloading the star counts `gnutls.c: [0] (Emacs) fatal error: The TLS connection was non-properly terminated.`. + If anyone knows how to fix it, I'm all ears. + +## How Star Displaying Works ## + +We generate a map of `Package Name -> Repository` from +[Melpa](https://github.com/milkypostman/melpa.git)'s `recipe` +directory, some repos may correspond to more than one package. +This map is used count the stars a given package has. +_This doesn't mean you need Melpa to see the star counts, the numbers +will be displayed regardless of what archives you use._ + +Currently, packages that are not hosted on GitHub are listed with a +blank star count, which is clearly different from 0-star packages +(which are displayed with a 0, obviously). +If you know of an alternative that could be used for these packages, +[open an issue](https://github.com/Bruce-Connor/paradox/issues/new) +here, I'd love to hear. diff --git a/layers/!distribution/spacemacs/local/paradox/paradox-compat.el b/layers/!distribution/spacemacs/local/paradox/paradox-compat.el new file mode 100644 index 000000000000..66a4085e7c8b --- /dev/null +++ b/layers/!distribution/spacemacs/local/paradox/paradox-compat.el @@ -0,0 +1,212 @@ +;;; paradox-compat.el --- Compatibility functions for using paradox with emacs < 24.4 + +;; Copyright (C) 2014 Artur Malabarba + +;; Author: Artur Malabarba +;; URL: https://github.com/Bruce-Connor/paradox +;; Version: 1.0.1 +;; Keywords: package packages mode-line +;; Package-Requires: ((emacs "24.1") (tabulated-list "1.0") (package "1.0") (json "1.4")) +;; Prefix: paradox +;; Separator: - + +;;; License: +;; +;; This file is NOT part of GNU Emacs. +;; +;; 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. +;; + +;;; Code: + +(eval-when-compile (require 'package)) +;; (require 'json) +;; (require 'cl) + +(defun paradox--print-info-compat (pkg) + "Return a package entry suitable for `tabulated-list-entries' (package-1.0 version). +PKG has the form ((PACKAGE . VERSION) STATUS DOC). +Return (KEY [NAME VERSION STATUS DOC]), where KEY is the +identifier (NAME . VERSION-LIST)." + (let* ((package (caar pkg)) + (version (cdr (car pkg))) + (status (nth 1 pkg)) + (doc (or (nth 2 pkg) "")) + (face (or (cdr (assoc-string status paradox-status-face-alist)) + 'font-lock-warning-face)) + (url (paradox--package-homepage package)) + (name (symbol-name package)) + (name-length (length name)) + (button-length (length paradox-homepage-button-string))) + (paradox--incf status) + (list (cons package version) + (vconcat + (append (list (concat + (propertize name + 'face 'paradox-name-face + 'button t + 'follow-link t + 'package-symbol package + 'help-echo (format "Package: %s" name) + 'action 'package-menu-describe-package) + (if (and paradox-use-homepage-buttons url + (< (+ name-length button-length) paradox-column-width-package)) + (concat + (make-string (- paradox-column-width-package name-length button-length) ?\s) + (propertize paradox-homepage-button-string + 'face 'paradox-homepage-button-face + 'mouse-face 'custom-button-mouse + 'help-echo (format "Visit %s" url) + 'button t + 'follow-link t + 'action 'paradox-menu-visit-homepage)) + "")) + (propertize (package-version-join version) + 'font-lock-face face) + (propertize status 'font-lock-face face)) + (paradox--count-print package) + (list + (propertize (concat desc-prefix doc desc-suffix) + 'font-lock-face + (if (> paradox-lines-per-entry 1) + 'paradox-description-face-multiline + 'paradox-description-face)))))))) + +(defun paradox--print-entry-compat (id cols) + "Printer used by `paradox-menu-mode'. +Just like default printer, except columns are printed with +`paradox--print-col-compat'." + (let ((beg (point)) + (x (max tabulated-list-padding 0)) + (ncols (length tabulated-list-format)) + (inhibit-read-only t)) + (if (> tabulated-list-padding 0) + (insert (make-string x ?\s))) + (dotimes (n ncols) + (setq x (paradox--print-col-compat n (aref cols n) x))) + (insert ?\n) + (put-text-property beg (point) 'tabulated-list-id id) + (put-text-property beg (point) 'tabulated-list-entry cols))) + +(defun paradox--print-col-compat (n col-desc x) + "Insert a specified Tabulated List entry at point. +N is the column number, COL-DESC is a column descriptor \(see +`tabulated-list-entries'), and X is the column number at point. +Return the column number after insertion. + +This is like `tabulated-list-print-col', except the help-echo +property is respected." + ;; TODO: don't truncate to `width' if the next column is align-right + ;; and has some space left. + (let* ((format (aref tabulated-list-format n)) + (name (nth 0 format)) + (width (nth 1 format)) + (props (nthcdr 3 format)) + (pad-right (or (plist-get props :pad-right) 1)) + (right-align (plist-get props :right-align)) + (label (if (stringp col-desc) col-desc (car col-desc))) + (label-width (string-width label)) + (help-echo (concat (car format) ": " label)) + (opoint (point)) + (not-last-col (< (1+ n) (length tabulated-list-format)))) + ;; Truncate labels if necessary (except last column). + (and not-last-col + (> label-width width) + (setq label (truncate-string-to-width label width nil nil t) + label-width width)) + (setq label (bidi-string-mark-left-to-right label)) + (when (and right-align (> width label-width)) + (let ((shift (- width label-width))) + (insert (propertize (make-string shift ?\s) + 'display `(space :align-to ,(+ x shift)))) + (setq width (- width shift)) + (setq x (+ x shift)))) + (if (stringp col-desc) + (insert (if (get-text-property 0 'help-echo label) + label + (propertize label 'help-echo help-echo))) + (apply 'insert-text-button label (cdr col-desc))) + (let ((next-x (+ x pad-right width))) + ;; No need to append any spaces if this is the last column. + (when not-last-col + (when (> pad-right 0) (insert (make-string pad-right ?\s))) + (insert (propertize + (make-string (- next-x x label-width pad-right) ?\s) + 'display `(space :align-to ,next-x)))) + (put-text-property opoint (point) 'tabulated-list-column-name name) + next-x))) + +(defun paradox--package-homepage (pkg) + "PKG is just the symbol that identifies the package." + (let ((extras (elt (cdr-safe (assoc pkg package-archive-contents)) 4))) + (and (listp extras) (cdr-safe (assoc :url extras))))) + +(defmacro package--push-compat (package desc status listname) + "Convenience macro for `package-menu--generate'. +If the alist stored in the symbol LISTNAME lacks an entry for a +package PACKAGE with descriptor DESC, add one. The alist is +keyed with cons cells (PACKAGE . VERSION-LIST), where PACKAGE is +a symbol and VERSION-LIST is a version list." + `(let* ((version (package-desc-vers ,desc)) + (key (cons ,package version))) + (unless (assoc key ,listname) + (push (list key ,status (package-desc-doc ,desc)) ,listname)))) + +(defun paradox-menu--refresh (packages &optional keywords) + ;; Construct list of ((PACKAGE . VERSION) STATUS DESCRIPTION). + (let (info-list name) + ;; Installed packages: + (dolist (elt package-alist) + (setq name (car elt)) + (when (or (eq packages t) (memq name packages)) + (package--push-compat name (cdr elt) + (if (stringp (cadr (assq name package-load-list))) + "held" "installed") + info-list))) + + ;; Built-in packages: + (dolist (elt package--builtins) + (setq name (car elt)) + (when (and (not (eq name 'emacs)) ; Hide the `emacs' package. + (or (eq packages t) (memq name packages))) + (package--push-compat name (cdr elt) "built-in" info-list))) + + ;; Available and disabled packages: + (dolist (elt package-archive-contents) + (setq name (car elt)) + (when (or (eq packages t) (memq name packages)) + (let ((hold (assq name package-load-list))) + (package--push-compat name (cdr elt) + (cond + ((and hold (null (cadr hold))) "disabled") + ((memq name package-menu--new-package-list) "new") + (t "available")) + info-list)))) + + ;; Obsolete packages: + (dolist (elt package-obsolete-alist) + (dolist (inner-elt (cdr elt)) + (when (or (eq packages t) (memq (car elt) packages)) + (package--push-compat (car elt) (cdr inner-elt) "obsolete" info-list)))) + + ;; Print the result. + (setq tabulated-list-entries (mapcar 'package-menu--print-info info-list)) + (tabulated-list-print remember-pos))) + +(defun paradox--get-or-return-package (pkg) + (if (or (markerp pkg) (null pkg)) + (if (derived-mode-p 'package-menu-mode) + (car (tabulated-list-get-id)) + (error "Not in Package Menu.")) + pkg)) + +(provide 'paradox-compat) +;;; paradox-compat.el ends here. diff --git a/layers/!distribution/spacemacs/local/paradox/paradox.el b/layers/!distribution/spacemacs/local/paradox/paradox.el new file mode 100644 index 000000000000..7a3413fc1dc1 --- /dev/null +++ b/layers/!distribution/spacemacs/local/paradox/paradox.el @@ -0,0 +1,1503 @@ +;;; paradox.el --- A modern Packages Menu. Colored, with package ratings, and customizable. + +;; Copyright (C) 2014 Artur Malabarba + +;; Author: Artur Malabarba +;; URL: https://github.com/Bruce-Connor/paradox +;; Version: 2.0 +;; Keywords: package packages mode-line +;; Package-Requires: ((emacs "24.1") (dash "2.6.0") (cl-lib "0.5") (json "1.3")) +;; Prefix: paradox +;; Separator: - + +;;; Commentary: +;; +;; Paradox can be installed from Melpa with M-x `package-install' RET +;; paradox. +;; It can also be installed manually in the usual way, just be mindful of +;; the dependencies. +;; +;; To use it, simply call M-x `paradox-list-packages' (instead of the +;; regular `list-packages'). +;; This will give you most features out of the box. If you want to be +;; able to star packages as well, just configure the +;; `paradox-github-token' variable then call `paradox-list-packages' +;; again. +;; +;; If you'd like to stop using Paradox, you may call `paradox-disable' +;; and go back to using the regular `list-packages'. +;; +;; ## Current Features ## +;; +;; ### Several Improvements ### +;; +;; Paradox implements many small improvements to the package menu +;; itself. They all work out of the box and are completely customizable! +;; *(Also, hit `h' to see all keys.)* +;; +;; * Visit the package's homepage with `v' (or just use the provided buttons). +;; * Shortcuts for package filtering: +;; * filters by regexp (`occur'); +;; * display only packages with upgrades; +;; * filters by keyword (Emacs 24.4 only). +;; * `hl-line-mode' enabled by default. +;; * Display useful information on the mode-line and cleanup a bunch of +;; useless stuff. +;; * **Customization!** Just call M-x `paradox-customize' to see what you can +;; do. +;; * Customize column widths. +;; * Customize faces (`paradox-star-face', `paradox-status-face-alist' and `paradox-archive-face'). +;; * Customize local variables. +;; +;; ### Package Ratings ### +;; +;; Paradox also integrates with +;; **GitHub Stars**, which works as **rough** package rating system. +;; That is, Paradox package menu will: +;; +;; 1. Display the number of GitHub Stars each package has (assuming it's +;; in a github repo, of course); +;; 2. Possibly automatically star packages you install, and unstar +;; packages you delete (you will be asked the first time whether you +;; want this); +;; 3. Let you star and unstar packages by hitting the `s' key; +;; 4. Let you star all packages you have installed with M-x `paradox-star-all-installed-packages'. +;; +;; Item **1.** will work out of the box, the other items obviously +;; require a github account (Paradox will help you generate a token the +;; first time you call `paradox-list-packages'). +;; +;; ## How Star Displaying Works ## +;; +;; We generate a map of Package Name -> Repository from +;; [Melpa](https://github.com/milkypostman/melpa.git)'s `recipe' +;; directory, some repos may correspond to more than one package. +;; This map is used count the stars a given package has. +;; _This doesn't mean you need Melpa to see the star counts, the numbers +;; will be displayed regardless of what archives you use._ +;; +;; Currently, packages that are not hosted on GitHub are listed with a +;; blank star count, which is clearly different from 0-star packages +;; (which are displayed with a 0, obviously). +;; If you know of an alternative that could be used for these packages, +;; [open an issue](https://github.com/Bruce-Connor/paradox/issues/new) +;; here, I'd love to hear. + +;;; License: +;; +;; This file is NOT part of GNU Emacs. +;; +;; 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. +;; + +;;; Change Log: +;; 2.0 - 2014/12/25 - `paradox-upgrade-packages' upgrades everything without question. +;; 2.0 - 2014/12/13 - `paradox-menu-execute' can do asynchronous (background) operations. +;; 1.2 - 2014/05/15 - Integration with smart-mode-line. +;; 1.1 - 2014/07/02 - NEW FUNCTION: paradox-require. +;; 1.1 - 2014/05/10 - Added Download column. +;; 1.0.2 - 2014/05/09 - Small improvements to paradox--github-action. +;; 1.0.1 - 2014/05/09 - Fix weird corner case in --package-homepage. +;; 1.0 - 2014/05/05 - New Feature! The l key displays a list of recent commits under a package. +;; 1.0 - 2014/05/04 - q key is smarter. It closes other generated windows. +;; 1.0 - 2014/05/04 - j and k describe the next and previous entries. +;; 0.11 - 2014/05/01 - Sorting commands and keys (under "S"). +;; 0.10 - 2014/04/26 - New help menu! +;; 0.10 - 2014/04/25 - Display description on a separate line with paradox-lines-per-entry. +;; 0.10 - 2014/04/25 - Links to package homepages. +;; 0.9.2 - 2014/04/15 - Fix advice being enabled automatically. +;; 0.9.2 - 2014/04/15 - Ask the user before automatically starring. +;; 0.9.1 - 2014/04/14 - paradox-filter-upgrades is informative when there are no upgrades. +;; 0.9 - 2014/04/14 - First full feature release. +;; 0.5 - 2014/04/14 - Star all installed packages. +;; 0.5 - 2014/04/13 - (Un)Star packages with the "s" key!. +;; 0.2 - 2014/04/13 - Control the face used for each status with paradox-status-face-alist. +;; 0.2 - 2014/04/13 - New archive face. +;; 0.2 - 2014/04/13 - Define filtering keys (fk, fu, fr). +;; 0.2 - 2014/04/11 - Hide buffer-name with paradox-display-buffer-name. +;; 0.2 - 2014/04/08 - Even better mode-line. +;; 0.2 - 2014/04/08 - Intelligent width for the "archive" column. +;; 0.2 - 2014/04/08 - Customizable widths. +;; 0.2 - 2014/04/08 - Prettier trunctation. +;; 0.1 - 2014/04/03 - Created File. + +;;; Code: + +(require 'package) +(require 'cl-lib) +(require 'dash) +(defconst paradox-version "2.0" "Version of the paradox.el package.") +(defun paradox-bug-report () + "Opens github issues page in a web browser. Please send any bugs you find. +Please include your Emacs and paradox versions." + (interactive) + (message "Your paradox-version is: %s, and your emacs version is: %s.\nPlease include this in your report!" + paradox-version emacs-version) + (browse-url "https://github.com/Bruce-Connor/paradox/issues/new")) +(defun paradox-customize () + "Open the customization menu in the `paradox' group." + (interactive) + (customize-group 'paradox t)) +(defgroup paradox nil + "Customization group for paradox." + :prefix "paradox-" + :group 'emacs + :package-version '(paradox . "0.1")) +(defgroup paradox-commit-list nil + "Customization group for paradox." + :prefix "paradox-" + :group 'paradox + :package-version '(paradox . "1.2.3")) +(defun paradox--compat-p () + "Non-nil if we need to enable pre-24.4 compatibility features." + (version< emacs-version "24.3.50")) + + +;;; Customization Variables +(defcustom paradox-column-width-package 18 + "Width of the \"Package\" column." + :type 'integer + :group 'paradox + :package-version '(paradox . "0.1")) + +(defcustom paradox-column-width-version 9 + "Width of the \"Version\" column." + :type 'integer + :group 'paradox + :package-version '(paradox . "0.1")) + +(defcustom paradox-column-width-status 10 + "Width of the \"Status\" column." + :type 'integer + :group 'paradox + :package-version '(paradox . "0.1")) + +(defcustom paradox-column-width-star 4 + "Width of the \"Star\" column." + :type 'integer + :group 'paradox + :package-version '(paradox . "0.1")) + +(defvar paradox--column-name-star + (if (char-displayable-p ?★) "★" "*")) + +(defcustom paradox-column-width-download 4 + "Width of the \"Download Count\" column." + :type 'integer + :group 'paradox + :package-version '(paradox . "1.1")) + +(defvar paradox--column-name-download + (if (char-displayable-p ?↓) "↓" "DC")) + +(defcustom paradox-github-token nil + "Access token to use for github actions. +Currently, that means (un)starring repos. + +To generate an access token: + 1. Visit the page https://github.com/settings/tokens/new and + login to github (if asked). + 2. Give the token any name you want (Paradox, for instance). + 3. The only permission we need is \"public_repo\", so unmark + all others. + 4. Click on \"Generate Token\", copy the generated token, and + save it to this variable by writing + (setq paradox-github-token TOKEN) + somewhere in your configuration and evaluating it (or just + restart emacs). + +This is similar to how erc or jabber handle authentication in +emacs, but the following disclaimer always worth reminding. + +DISCLAIMER +When you save this variable, DON'T WRITE IT ANYWHERE PUBLIC. This +token grants (very) limited access to your account. +END DISCLAIMER + +Paradox will ask you whether you want github integration the +first time you start it. If you answer \"no\", it will remember +your choice via `customize-save-variable'. You can do this +manually by setting this variable to t. Setting it to nil means +it hasn't been configured yet." + :type '(choice (string :tag "Token") + (const :tag "Disable" t) + (const :tag "Ask me next time" nil)) + :group 'paradox + :package-version '(paradox . "0.2")) + +(defcustom paradox-automatically-star 'unconfigured + "When you install new packages, should they be automatically starred? +This variable has no effect if `paradox-github-token' isn't set +to a string. + +Paradox is capable of automatically starring packages when you +install them, and unstarring when you delete them. This only +applies to actual installation/deletion, i.e. Paradox doesn't +auto (un)star packages that were simply upgraded. + +If this variable is nil, this behaviour is disabled. \\ + +On the Package Menu, you can always manually star packages with \\[paradox-menu-mark-star-unstar]." + :type '(choice (const :tag "Yes." t) + (const :tag "No." nil) + (const :tag "Ask later." unconfigured)) + :group 'paradox + :package-version '(paradox . "0.2")) + +(defcustom paradox-display-star-count t + "If non-nil, adds a \"Star\" column to the Package Menu." + :type 'boolean + :group 'paradox + :package-version '(paradox . "1.1")) + +(defcustom paradox-display-download-count nil + "If non-nil, adds a \"Download\" column to the Package Menu." + :type 'boolean + :group 'paradox + :package-version '(paradox . "1.2.3")) + +(defface paradox-mode-line-face + '((t :inherit mode-line-buffer-id :weight normal :foreground "Black")) + "Face used on the package's name." + :group 'paradox) +(defface paradox-name-face + '((t :inherit link)) + "Face used on the package's name." + :group 'paradox) +(defface paradox-homepage-button-face + '((t :underline t :inherit font-lock-comment-face)) + "Face used on the homepage button." + :group 'paradox) +;; (defface paradox-version-face +;; '((t :inherit default)) +;; "Face used on the version column." +;; :group 'paradox) +(defface paradox-archive-face + '((t :inherit paradox-comment-face)) + "Face used on the archive column." + :group 'paradox) +(defface paradox-star-face + '((t :inherit font-lock-string-face)) + "Face used on the star column, for packages you haven't starred." + :group 'paradox) +(defface paradox-starred-face + '((t :weight bold :inherit paradox-star-face)) + "Face used on the star column, for packages you have starred." + :group 'paradox) +(defface paradox-download-face + '((t :inherit font-lock-keyword-face)) + "Face used on the Downloads column." + :group 'paradox) +(defface paradox-description-face + '((t :inherit default)) + "Face used on the description column. +If `paradox-lines-per-entry' > 1, the face +`paradox-description-face-multiline' is used instead." + :group 'paradox) +(defface paradox-description-face-multiline + '((t :inherit font-lock-doc-face)) + "Face used on the description column when `paradox-lines-per-entry' > 1. +If `paradox-lines-per-entry' = 1, the face +`paradox-description-face' is used instead." + :group 'paradox) + +(defface paradox-comment-face + '((((background light)) :foreground "Grey30") + (((background dark)) :foreground "Grey60")) + "Face used on faded out stuff." + :group 'paradox) +(defface paradox-highlight-face + '((t :weight bold :inherit font-lock-variable-name-face)) + "Face used on highlighted stuff." + :group 'paradox) + +(defface paradox-commit-tag-face + '((t :foreground "goldenrod4" + :background "LemonChiffon1" + :box 1)) + "Face used for tags on the commit list." + :group 'paradox-commit-list) + +(defcustom paradox-execute-asynchronously 'ask + "Whether the install/delete/upgrade should be asynchronous. +Possible values are: + t, which means always; + nil, which means never; + ask, which means ask each time." + :type '(choice (const :tag "Always" t) + (const :tag "Never" nil) + (const :tag "Ask each time" ask)) + :package-version '(paradox . "2.0")) + + +;;; Internal Variables +(defvar paradox--star-count nil) +(defvar paradox--download-count nil) +(defvar paradox--package-repo-list nil) + +(defvar paradox--star-count-url + "https://raw.githubusercontent.com/Bruce-Connor/paradox/data/data" + "Address of the raw star-count file.") + +(defvar paradox--package-count + '(("total" . 0) ("built-in" . 0) + ("obsolete" . 0) ("deleted" . 0) + ("available" . 0) ("new" . 0) + ("held" . 0) ("disabled" . 0) + ("installed" . 0) ("unsigned" . 0))) + +(defvar paradox--current-filter nil) +(make-variable-buffer-local 'paradox--current-filter) + +(defvar paradox--commit-list-buffer "*Package Commit List*") + +(defvar paradox--truncate-string-to-width-backup) + +(defmacro paradox--cas (string) + "Same as (cdr (assoc-string ,STRING paradox--package-count))." + `(cdr (assoc-string ,string paradox--package-count))) + +(defvar paradox--data-url "https://raw.github.com/Bruce-Connor/paradox/data/full" + "Address of the raw data file.") + + +;;; Mode Definition +(define-derived-mode paradox-menu-mode tabulated-list-mode "Paradox Menu" + "Major mode for browsing a list of packages. +Letters do not insert themselves; instead, they are commands. +\\ +\\{paradox-menu-mode-map}" + (hl-line-mode 1) + (paradox--update-mode-line) + (when (paradox--compat-p) + (require 'paradox-compat) + (setq tabulated-list-printer 'paradox--print-entry-compat)) + (setq tabulated-list-format + `[("Package" ,paradox-column-width-package package-menu--name-predicate) + ("Version" ,paradox-column-width-version nil) + ("Status" ,paradox-column-width-status package-menu--status-predicate) + ,@(paradox--archive-format) + ,@(paradox--count-format) + ("Description" 0 nil)]) + (setq paradox--column-index-star + (paradox--column-index paradox--column-name-star)) + (setq paradox--column-index-download + (paradox--column-index paradox--column-name-download)) + (setq tabulated-list-padding 2) + (setq tabulated-list-sort-key (cons "Status" nil)) + ;; (add-hook 'tabulated-list-revert-hook 'package-menu--refresh nil t) + (add-hook 'tabulated-list-revert-hook 'paradox-refresh-upgradeable-packages nil t) + (add-hook 'tabulated-list-revert-hook 'paradox--refresh-star-count nil t) + (add-hook 'tabulated-list-revert-hook 'paradox--update-mode-line nil t) + (tabulated-list-init-header) + ;; We need package-menu-mode to be our parent, otherwise some + ;; commands throw errors. But we can't actually derive from it, + ;; otherwise its initialization will screw up the header-format. So + ;; we "patch" it like this. + (put 'paradox-menu-mode 'derived-mode-parent 'package-menu-mode) + (run-hooks 'package-menu-mode-hook)) + +(defun paradox--define-sort (name &optional key) + "Define sorting function paradox-sort-by-NAME and bind it to KEY." + (let ((symb (intern (format "paradox-sort-by-%s" (downcase name)))) + (key (or key (substring name 0 1)))) + (eval + `(progn + (defun ,symb + (invert) + ,(format "Sort Package Menu by the %s column." name) + (interactive "P") + (when invert + (setq tabulated-list-sort-key (cons ,name nil))) + (tabulated-list--sort-by-column-name ,name)) + (define-key paradox-menu-mode-map ,(concat "S" (upcase key)) ',symb) + (define-key paradox-menu-mode-map ,(concat "S" (downcase key)) ',symb))))) + +(paradox--define-sort "Package") +(paradox--define-sort "Status") +(paradox--define-sort paradox--column-name-star "*") + +(defvar paradox--filter-map) +(set-keymap-parent paradox-menu-mode-map package-menu-mode-map) +(define-prefix-command 'paradox--filter-map) +(define-key paradox-menu-mode-map "q" #'paradox-quit-and-close) +(define-key paradox-menu-mode-map "p" #'paradox-previous-entry) +(define-key paradox-menu-mode-map "n" #'paradox-next-entry) +(define-key paradox-menu-mode-map "k" #'paradox-previous-describe) +(define-key paradox-menu-mode-map "j" #'paradox-next-describe) +(define-key paradox-menu-mode-map "f" #'paradox--filter-map) +(define-key paradox-menu-mode-map "s" #'paradox-menu-mark-star-unstar) +(define-key paradox-menu-mode-map "h" #'paradox-menu-quick-help) +(define-key paradox-menu-mode-map "v" #'paradox-menu-visit-homepage) +(define-key paradox-menu-mode-map "l" #'paradox-menu-view-commit-list) +(define-key paradox-menu-mode-map "x" #'paradox-menu-execute) +(define-key paradox-menu-mode-map "\r" #'paradox-push-button) +(define-key paradox-menu-mode-map "F" 'package-menu-filter) +(define-key paradox--filter-map "k" #'package-menu-filter) +(define-key paradox--filter-map "f" #'package-menu-filter) +(define-key paradox--filter-map "r" #'occur) +(define-key paradox--filter-map "o" #'occur) +(define-key paradox--filter-map "u" #'paradox-filter-upgrades) + + +;;; Menu Mode Commands +(defun paradox-previous-entry (&optional n) + "Move to previous entry, which might not be the previous line. +With prefix N, move to the N-th previous entry." + (interactive "p") + (paradox-next-entry (- n)) + (forward-line 0) + (forward-button 1)) + +(defun paradox-next-entry (&optional n) + "Move to next entry, which might not be the next line. +With prefix N, move to the N-th next entry." + (interactive "p") + (dotimes (it (abs n)) + (let ((d (cl-signum n))) + (forward-line (if (> n 0) 1 0)) + (if (eobp) (forward-line -1)) + (forward-button d)))) + +(defun paradox-next-describe (&optional n) + "Move to the next package and describe it. +With prefix N, move to the N-th next package instead." + (interactive "p") + (paradox-next-entry n) + (call-interactively 'package-menu-describe-package)) + +(defun paradox-previous-describe (&optional n) + "Move to the previous package and describe it. +With prefix N, move to the N-th previous package instead." + (interactive "p") + (paradox-previous-entry n) + (call-interactively 'package-menu-describe-package)) + +(defun paradox-filter-upgrades () + "Show only upgradable packages." + (interactive) + (if (null paradox--upgradeable-packages) + (message "No packages have upgrades.") + (package-show-package-list + (mapcar 'car paradox--upgradeable-packages)) + (setq paradox--current-filter "Upgrade"))) + +(defun paradox-push-button () + "Push button under point, or describe package." + (interactive) + (if (get-text-property (point) 'action) + (call-interactively 'push-button) + (call-interactively 'package-menu-describe-package))) + +(defvar paradox--key-descriptors + '(("next," "previous," "install," "delete," ("execute," . 1) "refresh," "help") + ("star," "visit homepage") + ("list commits") + ("filter by" "+" "upgrades" "regexp" "keyword") + ("Sort by" "+" "Package name" "Status" "*(star)"))) + +(defun paradox-menu-quick-help () + "Show short key binding help for `paradox-menu-mode'. +The full list of keys can be viewed with \\[describe-mode]." + (interactive) + (message (mapconcat 'paradox--prettify-key-descriptor + paradox--key-descriptors "\n"))) + +(defun paradox-quit-and-close (kill) + "Bury this buffer and close the window. +With prefix KILL, kill the buffer instead of burying." + (interactive "P") + (if paradox--current-filter + (package-show-package-list) + (let ((log (get-buffer-window paradox--commit-list-buffer))) + (when (window-live-p log) + (quit-window kill log)) + (quit-window kill)))) + +(defun paradox-menu-visit-homepage (pkg) + "Visit the homepage of package named PKG. +PKG is a symbol. Interactively it is the package under point." + (interactive '(nil)) + (let ((url (paradox--package-homepage + (paradox--get-or-return-package pkg)))) + (if (stringp url) + (browse-url url) + (message "Package %s has no homepage." + (propertize (symbol-name pkg) + 'face 'font-lock-keyword-face))))) + +(defun paradox-menu-execute (&optional noquery) + "Perform marked Package Menu actions. +Packages marked for installation are downloaded and installed; +packages marked for deletion are removed. + +Afterwards, if `paradox-automatically-star' is t, automatically +star new packages, and unstar removed packages. Upgraded packages +aren't changed. + +Synchronicity of the actions depends on +`paradox-execute-asynchronously'. Optional argument NOQUERY +non-nil means do not ask the user to confirm. If asynchronous, +never ask anyway." + (interactive) + (unless (derived-mode-p 'paradox-menu-mode) + (error "The current buffer is not in Paradox Menu mode")) + (when (and (stringp paradox-github-token) + (eq paradox-automatically-star 'unconfigured)) + (customize-save-variable + 'paradox-automatically-star + (y-or-n-p "When you install new packages would you like them to be automatically starred?\n(They will be unstarred when you delete them) "))) + (paradox--menu-execute-1)) + +(defun paradox--menu-execute-1 (&optional noquery) + (if (and (not noquery) + (or (not paradox-execute-asynchronously) + (and (eq 'ask paradox-execute-asynchronously) + (not (y-or-n-p "Execute in the background? (see `paradox-execute-asynchronously')"))))) + ;; Synchronous execution + (progn + (if (and (stringp paradox-github-token) paradox-automatically-star) + (let ((before-alist (paradox--repo-alist)) after) + (package-menu-execute noquery) + (setq after (paradox--repo-alist)) + (mapc #'paradox--star-repo + (-difference (-difference after before) paradox--user-starred-list)) + (mapc #'paradox--unstar-repo + (-intersection (-difference before after) paradox--user-starred-list))) + (package-menu-execute noquery)) + (package-menu--generate t t)) + ;; Async execution + (unless (require 'async nil t) + (error "For asynchronous execution please install the `async' package")) + (let ((buffer (current-buffer)) + (before-alist (paradox--repo-alist)) + install-list delete-list) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (cl-case (char-after) + (?\s) + (?D (push (tabulated-list-get-id) delete-list)) + (?I (push (tabulated-list-get-id) install-list))) + (forward-line))) + (unless (or delete-list install-list) + (message "No operations specified.")) + ;; We have to do this with eval, because `async-start' is a + ;; macro and it might not have been defined at compile-time. + (eval + `(async-start + (lambda () + (setq package-user-dir ,package-user-dir + package-archives ',package-archives + package-archive-contents ',package-archive-contents) + (package-initialize) + (let (activated-packages message-list) + (defadvice package-activate-1 (before paradox-track-activated (pkg) activate) + "Track which packages are being activated in the background." + (add-to-list 'activated-packages pkg 'append)) + (mapc #'package-install ',install-list) + (push (concat "[Paradox] " + ,(cond ((and install-list delete-list) "Upgrade") + (delete-list "Deletion") + (install-list "Installation")) + " finished.") + message-list) + (dolist (elt ',delete-list) + (condition-case err (package-delete elt) + (error (push (cadr err) message-list)))) + (list + (mapconcat #'identity (nreverse message-list) "\n") + package-alist + package-archive-contents + activated-packages))) + (lambda (x) + (let ((message (pop x))) + (setq package-alist (pop x) + package-archive-contents (pop x)) + (mapc #'package-activate-1 (pop x)) + (let ((after (paradox--repo-alist))) + (mapc #'paradox--star-repo + (-difference (-difference after ',before-alist) paradox--user-starred-list)) + (mapc #'paradox--unstar-repo + (-intersection (-difference ',before-alist after) paradox--user-starred-list))) + (when (buffer-live-p ,buffer) + (with-current-buffer ,buffer + (package-menu--generate t t))) + (message "%s" message)))))))) + + +;;; External Commands +;;;###autoload +(defun paradox-list-packages (no-fetch) + "Improved version of `package-list-packages'. The heart of Paradox. +Function is equivalent to `package-list-packages' (including the +prefix NO-FETCH), but the resulting Package Menu is improved in +several ways. + +Among them: + +1. Uses `paradox-menu-mode', which has more functionality and +keybinds than `package-menu-mode'. + +2. Uses some font-locking to improve readability. + +3. Optionally shows the number GitHub stars and Melpa downloads +for packages. + +4. Adds useful information in the mode-line." + (interactive "P") + (when (paradox--check-github-token) + (paradox-enable) + (unless no-fetch (paradox--refresh-star-count)) + (package-list-packages no-fetch))) + +;;;###autoload +(defun paradox-upgrade-packages (&optional no-fetch) + "Upgrade all packages. No questions asked. +This function is equivalent to `list-packages', followed by a +`package-menu-mark-upgrades' and a `package-menu-execute'. Except +the user isn't asked to confirm deletion of packages. + +If `paradox-execute-asynchronously' is non-nil, part of this +operation may be performed in the background. + +The NO-FETCH prefix argument is passed to `list-packages'. It +prevents re-download of information about new versions. It does +not prevent downloading the actual packages (obviously)." + (interactive "P") + (save-window-excursion + (paradox-list-packages no-fetch) + (paradox-filter-upgrades) + (package-menu-mark-upgrades) + (paradox-menu-execute 'noquery))) + +(defun paradox-enable () + "Enable paradox, overriding the default package-menu." + (interactive) + (if (paradox--compat-p) + (progn + (require 'paradox-compat) + (paradox--override-definition 'package-menu--print-info 'paradox--print-info-compat)) + (paradox--override-definition 'package-menu--print-info 'paradox--print-info)) + (paradox--override-definition 'package-menu--generate 'paradox--generate-menu) + (paradox--override-definition 'truncate-string-to-width 'paradox--truncate-string-to-width) + (paradox--override-definition 'package-menu-mode 'paradox-menu-mode)) + +(defvar paradox--backups nil) + +(defun paradox-disable () + "Disable paradox, and go back to regular package-menu." + (interactive) + (dolist (it paradox--backups) + (message "Restoring %s to %s" (car it) (eval (cdr it))) + (fset (car it) (eval (cdr it)))) + (setq paradox--backups nil)) + +(defun paradox--override-definition (sym newdef) + "Temporarily override SYM's function definition with NEWDEF. +The original definition is saved to paradox--SYM-backup." + (let ((backup-name (intern (format "paradox--%s-backup" sym))) + (def (symbol-function sym))) + (unless (assoc sym paradox--backups) + (message "Overriding %s with %s" sym newdef) + (eval (list 'defvar backup-name nil)) + (add-to-list 'paradox--backups (cons sym backup-name)) + (set backup-name def) + (fset sym newdef)))) + +;;; Right now this is trivial, but we leave it as function so it's easy to improve. +(defun paradox--active-p () + "Non-nil if paradox has been activated." + paradox--backups) + + +;;; `paradox-menu-mode' configuration +(defcustom paradox-status-face-alist + '(("built-in" . font-lock-builtin-face) + ("available" . default) + ("new" . bold) + ("held" . font-lock-constant-face) + ("disabled" . font-lock-warning-face) + ("installed" . font-lock-comment-face) + ("deleted" . font-lock-comment-face) + ("unsigned" . font-lock-warning-face)) + "List of (\"STATUS\" . FACE) cons cells. +When displaying the package menu, FACE will be used to paint the +Version, Status, and Description columns of each package whose +status is STATUS." + :type '(repeat (cons string face)) + :group 'paradox + :package-version '(paradox . "0.2")) + +(defcustom paradox-homepage-button-string "h" + "String used to for the link that takes you to a package's homepage." + :type 'string + :group 'paradox + :package-version '(paradox . "0.10")) + +(defcustom paradox-use-homepage-buttons t + "If non-nil a button will be added after the name of each package. +This button takes you to the package's homepage." + :type 'boolean + :group 'paradox + :package-version '(paradox . "0.10")) + +(defcustom paradox-lines-per-entry 1 + "Number of lines used to display each entry in the Package Menu. +1 Gives you the regular package menu. +2 Displays the description on a separate line below the entry. +3+ Adds empty lines separating the entries." + :type 'integer + :group 'paradox + :package-version '(paradox . "0.10")) + + +;;; Building the packages buffer. +(defun paradox--truncate-string-to-width (&rest args) + "Like `truncate-string-to-width', but uses \"…\" on package buffer. +All arguments STR, END-COLUMN, START-COLUMN, PADDING, and +ELLIPSIS are passed to `truncate-string-to-width'. + +\(fn STR END-COLUMN &optional START-COLUMN PADDING ELLIPSIS)" + (when (and (eq major-mode 'paradox-menu-mode) + (eq t (nth 4 args))) + (setf (nth 4 args) (if (char-displayable-p ?…) "…" "$"))) + (apply paradox--truncate-string-to-width-backup args)) + +(defvar paradox--upgradeable-packages nil) +(defvar paradox--upgradeable-packages-number nil) +(defvar paradox--upgradeable-packages-any? nil) + +(defun paradox-refresh-upgradeable-packages () + "Refresh the list of upgradeable packages." + (interactive) + (setq paradox--upgradeable-packages (package-menu--find-upgrades)) + (setq paradox--upgradeable-packages-number + (length paradox--upgradeable-packages)) + (setq paradox--upgradeable-packages-any? + (> paradox--upgradeable-packages-number 0))) + +(defvar desc-suffix nil) +(defvar desc-prefix nil) + +(defun paradox--print-info (pkg) + "Return a package entry suitable for `tabulated-list-entries'. +PKG has the form (PKG-DESC . STATUS). +Return (PKG-DESC [STAR NAME VERSION STATUS DOC])." + (let* ((pkg-desc (car pkg)) + (status (cdr pkg)) + (face (or (cdr (assoc-string status paradox-status-face-alist)) + 'font-lock-warning-face)) + (url (paradox--package-homepage pkg-desc)) + (name (symbol-name (package-desc-name pkg-desc))) + (name-length (length name)) + (button-length (length paradox-homepage-button-string))) + (paradox--incf status) + (list pkg-desc + `[,(concat + (propertize name + 'face 'paradox-name-face + 'button t + 'follow-link t + 'help-echo (format "Package: %s" name) + 'package-desc pkg-desc + 'action 'package-menu-describe-package) + (if (and paradox-use-homepage-buttons url + (< (+ name-length button-length) paradox-column-width-package)) + (concat + (make-string (- paradox-column-width-package name-length button-length) ?\s) + (propertize paradox-homepage-button-string + 'face 'paradox-homepage-button-face + 'mouse-face 'custom-button-mouse + 'help-echo (format "Visit %s" url) + 'button t + 'follow-link t + 'action 'paradox-menu-visit-homepage)) + "")) + ,(propertize (package-version-join + (package-desc-version pkg-desc)) + 'font-lock-face face) + ,(propertize status 'font-lock-face face) + ,@(if (cdr package-archives) + (list (propertize (or (package-desc-archive pkg-desc) "") + 'font-lock-face 'paradox-archive-face))) + ,@(paradox--count-print (package-desc-name pkg-desc)) + ,(propertize ;; (package-desc-summary pkg-desc) + (concat desc-prefix (package-desc-summary pkg-desc) desc-suffix) ;└╰ + 'font-lock-face + (if (> paradox-lines-per-entry 1) + 'paradox-description-face-multiline + 'paradox-description-face))]))) + +(defun paradox--count-print (pkg) + "Return counts of PKG as a package-desc list." + (append + (when (and paradox-display-star-count (listp paradox--star-count)) + (list (paradox--package-star-count pkg))) + (when (and paradox-display-download-count (listp paradox--download-count)) + (list (paradox--package-download-count pkg))))) + +(defun paradox--package-download-count (pkg) + "Return propertized string with the download count of PKG." + (let ((c (cdr-safe (assoc pkg paradox--download-count)))) + (propertize + (if (numberp c) + (if (> c 999) (format "%sK" (truncate c 1000)) (format "%s" c)) + " ") + 'face 'paradox-download-face + 'value (or c 0)))) + +(unless (paradox--compat-p) + (defun paradox--package-homepage (pkg) + "PKG can be the package-name symbol or a package-desc object." + (let* ((object (if (symbolp pkg) (cadr (assoc pkg package-archive-contents)) pkg)) + (name (if (symbolp pkg) pkg (package-desc-name pkg))) + (extras (package-desc-extras object)) + (homepage (and (listp extras) (cdr-safe (assoc :url extras))))) + (or homepage + (and (setq extras (cdr (assoc name paradox--package-repo-list))) + (format "https://github.com/%s" extras))))) + (defun paradox--get-or-return-package (pkg) + (if (or (markerp pkg) (null pkg)) + (if (derived-mode-p 'package-menu-mode) + (package-desc-name (tabulated-list-get-id)) + (error "Not in Package Menu")) + pkg))) + +(defun paradox--incf (status) + "Increment the count for STATUS on `paradox--package-count'. +Also increments the count for \"total\"." + (paradox--inc-count status) + (unless (string= status "obsolete") + (paradox--inc-count "total"))) + +(defun paradox--inc-count (string) + "Increment the cdr of (assoc-string STRING paradox--package-count)." + (let ((cons (assoc-string string paradox--package-count))) + (setcdr cons (1+ (cdr cons))))) + +(defun paradox--entry-star-count (entry) + "Get the star count of the package in ENTRY." + (paradox--package-star-count + ;; The package symbol should be in the ID field, but that's not mandatory, + (or (ignore-errors (elt (car entry) 1)) + ;; So we also try interning the package name. + (intern (car (elt (cadr entry) 0)))))) + +(defvar paradox--user-starred-list nil) + +(defun paradox--refresh-star-count () + "Download the star-count file and populate the respective variable." + (interactive) + (unwind-protect + (with-current-buffer + (url-retrieve-synchronously paradox--star-count-url) + (when (search-forward "\n\n" nil t) + (setq paradox--star-count (read (current-buffer))) + (setq paradox--package-repo-list (read (current-buffer))) + (setq paradox--download-count (read (current-buffer)))) + (kill-buffer)) + (unless (and (listp paradox--star-count) + (listp paradox--package-repo-list) + (listp paradox--download-count)) + (message "[Paradox] Error downloading the list of repositories. This might be a proxy")) + (unless (listp paradox--download-count) + (setq paradox--download-count nil)) + (unless (listp paradox--package-repo-list) + (setq paradox--package-repo-list nil)) + (unless (listp paradox--star-count) + (setq paradox--star-count nil))) + (when (stringp paradox-github-token) + (paradox--refresh-user-starred-list))) + +(defun paradox--package-star-count (package) + "Get the star count of PACKAGE." + (let ((count (cdr (assoc package paradox--star-count))) + (repo (cdr-safe (assoc package paradox--package-repo-list)))) + (propertize + (format "%s" (or count "")) + 'face + (if (and repo (assoc-string repo paradox--user-starred-list)) + 'paradox-starred-face + 'paradox-star-face)))) + +(defvar paradox--column-index-star nil) +(defvar paradox--column-index-download nil) + +(defun paradox--star-predicate (A B) + "Non-nil t if star count of A is larget than B." + (> (string-to-number (elt (cadr A) paradox--column-index-star)) + (string-to-number (elt (cadr B) paradox--column-index-star)))) +(defun paradox--download-predicate (A B) + "Non-nil t if download count of A is larget than B." + (> (get-text-property 0 'value (elt (cadr A) paradox--column-index-download)) + (get-text-property 0 'value (elt (cadr B) paradox--column-index-download)))) + +(defun paradox--generate-menu (remember-pos packages &optional keywords) + "Populate the Package Menu, without hacking into the header-format. +If REMEMBER-POS is non-nil, keep point on the same entry. +PACKAGES should be t, which means to display all known packages, +or a list of package names (symbols) to display. + +With KEYWORDS given, only packages with those keywords are +shown." + (mapc (lambda (x) (setf (cdr x) 0)) paradox--package-count) + (let ((desc-prefix (if (> paradox-lines-per-entry 1) " \n " "")) + (desc-suffix (make-string (max 0 (- paradox-lines-per-entry 2)) ?\n))) + (paradox-menu--refresh packages keywords)) + (setq paradox--current-filter + (if keywords (mapconcat 'identity keywords ",") + nil)) + (let ((idx (paradox--column-index "Package"))) + (setcar (aref tabulated-list-format idx) + (if keywords + (concat "Package[" paradox--current-filter "]") + "Package"))) + (tabulated-list-print remember-pos) + (tabulated-list-init-header) + (paradox--update-mode-line) + (paradox-refresh-upgradeable-packages)) + +(if (paradox--compat-p) + (require 'paradox-compat) + (defalias 'paradox-menu--refresh 'package-menu--refresh)) + +(defun paradox--column-index (regexp) + "Find the index of the column that matches REGEXP." + (cl-position (format "\\`%s\\'" (regexp-quote regexp)) tabulated-list-format + :test (lambda (x y) (string-match x (or (car-safe y) ""))))) + +(defun paradox--count-format () + "List of star/download counts to be used as part of the entry." + (remove + nil + (list + (when paradox-display-star-count + (list paradox--column-name-star paradox-column-width-star + 'paradox--star-predicate :right-align t)) + (when paradox-display-download-count + (list paradox--column-name-download paradox-column-width-download + 'paradox--download-predicate :right-align t))))) + +(defun paradox--archive-format () + "List containing archive to be used as part of the entry." + (when (and (cdr package-archives) + (null (paradox--compat-p))) + (list (list "Archive" + (apply 'max (mapcar 'length (mapcar 'car package-archives))) + 'package-menu--archive-predicate)))) + +(add-hook 'paradox-menu-mode-hook 'paradox-refresh-upgradeable-packages) + + +;;; Mode-line Construction +(defcustom paradox-local-variables + '(mode-line-mule-info + mode-line-client + mode-line-remote mode-line-position + column-number-mode size-indication-mode) + "Variables which will take special values on the Packages buffer. +This is a list, where each element is either SYMBOL or (SYMBOL . VALUE). + +Each SYMBOL (if it is bound) will be locally set to VALUE (or +nil) on the Packages buffer." + :type '(repeat (choice symbol (cons symbol sexp))) + :group 'paradox + :package-version '(paradox . "0.1")) + +(defcustom paradox-display-buffer-name nil + "If nil, *Packages* buffer name won't be displayed in the mode-line." + :type 'boolean + :group 'paradox + :package-version '(paradox . "0.2")) + +(defun paradox--build-buffer-id (st n) + "Return a list that propertizes ST and N for the mode-line." + `((:propertize ,st + face paradox-mode-line-face) + (:propertize ,(int-to-string n) + face mode-line-buffer-id))) + +(defun paradox--update-mode-line () + "Update `mode-line-format'." + (mapc #'paradox--set-local-value paradox-local-variables) + (let ((total-lines (int-to-string (line-number-at-pos (point-max))))) + (paradox--update-mode-line-front-space total-lines) + (paradox--update-mode-line-buffer-identification total-lines)) + (set-face-foreground + 'paradox-mode-line-face + (-when-let (fg (or (face-foreground 'mode-line-buffer-id nil t) + (face-foreground 'default nil t))) + (if (> (color-distance "white" fg) + (color-distance "black" fg)) + "black" "white")))) + +(defun paradox--update-mode-line-buffer-identification (total-lines) + "Update `mode-line-buffer-identification'. +TOTAL-LINES is currently unused." + (setq mode-line-buffer-identification + (list + (list 'paradox-display-buffer-name + (propertized-buffer-identification + (format "%%%sb" (length (buffer-name))))) + '(paradox--current-filter (:propertize ("[" paradox--current-filter "]") face paradox-mode-line-face)) + '(paradox--upgradeable-packages-any? + (:eval (paradox--build-buffer-id " Upgrade:" paradox--upgradeable-packages-number))) + '(package-menu--new-package-list + (:eval (paradox--build-buffer-id " New:" (paradox--cas "new")))) + (paradox--build-buffer-id " Installed:" (+ (paradox--cas "installed") (paradox--cas "unsigned"))) + `(paradox--current-filter + "" ,(paradox--build-buffer-id " Total:" (length package-archive-contents)))))) + +(defun paradox--update-mode-line-front-space (total-lines) + "Update `mode-line-front-space'. +TOTAL-LINES is the number of lines in the buffer." + (if (memq 'sml/post-id-separator mode-line-format) + (progn + (add-to-list (make-local-variable 'mode-line-front-space) + (propertize " (" 'face 'sml/col-number)) + (setq column-number-mode line-number-mode) + (set (make-local-variable 'sml/numbers-separator) "") + (set (make-local-variable 'sml/col-number-format) + (format "/%s)" total-lines)) + (set (make-local-variable 'sml/line-number-format) + (format "%%%sl" (length total-lines))) + (make-local-variable 'sml/position-construct) + (sml/compile-position-construct)) + (set (make-local-variable 'mode-line-front-space) + `(line-number-mode + ("(" (:propertize ,(format "%%%sl" (length total-lines)) face mode-line-buffer-id) "/" + ,total-lines ")"))) + (set (make-local-variable 'mode-line-modified) nil))) + +(defun paradox--set-local-value (x) + "Locally set value of (car X) to (cdr X)." + (let ((sym (or (car-safe x) x))) + (when (boundp sym) + (set (make-local-variable sym) (cdr-safe x))))) + +(defun paradox--repo-alist () + "List of known repos." + (cl-remove-duplicates + (remove nil + (--map (cdr-safe (assoc (car it) paradox--package-repo-list)) + package-alist)))) + + +;;; Github api stuff +(defmacro paradox--enforce-github-token (&rest forms) + "If a token is defined, perform FORMS, otherwise ignore forms ask for it be defined." + `(if (stringp paradox-github-token) + (progn ,@forms) + (setq paradox-github-token nil) + (paradox--check-github-token))) + +(defun paradox-menu-mark-star-unstar (&optional n) + "Star or unstar a package and move to the next line. +With prefix N, mark N packages." + (interactive "p") + (paradox--enforce-github-token + (unless paradox--user-starred-list + (paradox--refresh-user-starred-list)) + ;; Get package name + (let ((pkg (paradox--get-or-return-package nil)) + will-delete repo) + (unless pkg (error "Couldn't find package-name for this entry")) + ;; get repo for this package + (setq repo (cdr-safe (assoc pkg paradox--package-repo-list))) + ;; (Un)Star repo + (if (not repo) + (message "This package is not a GitHub repo.") + (setq will-delete (member repo paradox--user-starred-list)) + (paradox--star-repo repo will-delete) + (cl-incf (cdr (assoc pkg paradox--star-count)) + (if will-delete -1 1)) + (tabulated-list-set-col paradox--column-name-star + (paradox--package-star-count pkg))))) + (forward-line 1)) + +(defun paradox-star-all-installed-packages () + "Star all of your currently installed packages. +No questions asked." + (interactive) + (paradox--enforce-github-token + (mapc (lambda (x) (paradox--star-package-safe (car-safe x))) package-alist))) + +(defun paradox--star-package-safe (pkg &optional delete query) + "Star PKG without throwing errors, unless DELETE is non-nil, then unstar. +If QUERY is non-nil, ask the user first." + (let ((repo (cdr-safe (assoc pkg paradox--package-repo-list)))) + (when (and repo (not (assoc repo paradox--user-starred-list))) + (paradox--star-repo repo delete query)))) + +(defun paradox--star-repo (repo &optional delete query) + "Star REPO, unless DELETE is non-nil, then unstar. +If QUERY is non-nil, ask the user first. + +Throws error if repo is malformed." + (when (or (not query) + (y-or-n-p (format "Really %sstar %s? " + (if delete "un" "") repo))) + (paradox--github-action-star repo delete) + (message "%starred %s." (if delete "Uns" "S") repo) + (if delete + (setq paradox--user-starred-list + (remove repo paradox--user-starred-list)) + (add-to-list 'paradox--user-starred-list repo)))) + +(defun paradox--unstar-repo (repo &optional delete query) + "Unstar REPO. +Calls (paradox--star-repo REPO (not DELETE) QUERY)." + (paradox--star-repo repo (not delete) query)) + +(defun paradox--refresh-user-starred-list () + "Fetch the user's list of starred repos." + (setq paradox--user-starred-list + (ignore-errors + (paradox--github-action + "user/starred?per_page=100" nil + 'paradox--full-name-reader)))) + +(defun paradox--prettify-key-descriptor (desc) + "Prettify DESC to be displayed as a help menu." + (if (listp desc) + (if (listp (cdr desc)) + (mapconcat 'paradox--prettify-key-descriptor desc " ") + (let ((place (cdr desc)) + (out (car desc))) + (setq out (propertize out 'face 'paradox-comment-face)) + (add-text-properties place (1+ place) '(face paradox-highlight-face) out) + out)) + (paradox--prettify-key-descriptor (cons desc 0)))) + +(defun paradox--full-name-reader () + "Return all \"full_name\" properties in the buffer. Much faster than `json-read'." + (let (out) + (while (search-forward-regexp + "^ *\"full_name\" *: *\"\\(.*\\)\", *$" nil t) + (add-to-list 'out (match-string-no-properties 1))) + (goto-char (point-max)) + out)) + +(defun paradox--github-action-star (repo &optional delete no-result) + "Call `paradox--github-action' with \"user/starred/REPO\" as the action. +DELETE and NO-RESULT are passed on." + (paradox--github-action (concat "user/starred/" repo) + (if (stringp delete) delete (if delete "DELETE" "PUT")) + (null no-result))) + +(defun paradox--github-action (action &optional method reader max-pages) + "Contact the github api performing ACTION with METHOD. +Default METHOD is \"GET\". + +Action can be anything such as \"user/starred?per_page=100\". If +it's not a full url, it will be prepended with +\"https://api.github.com/\". + +The api action might not work if `paradox-github-token' isn't +set. This function also handles the pagination used in github +results, results of each page are appended. Use MAX-PAGES to +limit the number of pages that are fetched. + +Return value is always a list. +- If READER is nil, the result of the action is completely + ignored (no pagination is performed on this case, making it + much faster). +- Otherwise: + - If the result was a 404, the function returns nil; + - Otherwise, READER is called as a function with point right + after the headers and should always return a list. As a + special exception, if READER is t, it is equivalent to a + function that returns (t)." + ;; Make sure the token's configured. + (unless (string-match "\\`https?://" action) + (setq action (concat "https://api.github.com/" action))) + ;; Make the request + (message "Contacting %s" action) + (let ((pages (if (boundp 'pages) (1+ pages) 1)) next) + (append + (with-temp-buffer + (save-excursion + (shell-command + (if (stringp paradox-github-token) + (format "curl -s -i -d \"\" -X %s -u %s:x-oauth-basic \"%s\" " + (or method "GET") paradox-github-token action) + + (format "curl -s -i -d \"\" -X %s \"%s\" " + (or method "GET") action)) t)) + (when reader + (unless (search-forward " " nil t) + (message "%s" (buffer-string)) + (error "")) + ;; 204 means OK, but no content. + (if (looking-at "204") '(t) + ;; 404 is not found. + (if (looking-at "404") nil + ;; Anything else gets interpreted. + (when (search-forward-regexp "^Link: .*<\\([^>]+\\)>; rel=\"next\"" nil t) + (setq next (match-string-no-properties 1))) + (search-forward-regexp "^ ?$") + (skip-chars-forward "[:blank:]\n") + (delete-region (point-min) (point)) + (unless (eobp) (if (eq reader t) t (funcall reader))))))) + (when (and next (or (null max-pages) (< pages max-pages))) + (paradox--github-action next method reader))))) + +(defun paradox--check-github-token () + "Check that the user has either set or refused the github token. +If neither has happened, ask the user now whether he'd like to +configure or refuse the token." + (if (stringp + paradox-github-token) t + (if paradox-github-token + t + (if (not (y-or-n-p "Would you like to set up GitHub integration? +This will allow you to star/unstar packages from the Package Menu. ")) + (customize-save-variable 'paradox-github-token t) + (describe-variable 'paradox-github-token) + (when (get-buffer "*Help*") + (switch-to-buffer "*Help*") + (delete-other-windows)) + (if (y-or-n-p "Follow the instructions on the `paradox-github-token' variable. +May I take you to the token generation page? ") + (browse-url "https://github.com/settings/tokens/new")) + (message "Once you're finished, simply call `paradox-list-packages' again.") + nil)))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Paradox Commit List Mode +(defcustom paradox-commit-list-query-max-pages 1 + "Max number of pages we read from github when fetching the commit-list. +Each page lists 100 commits, so 1 page should be more than enough +for most repositories. + +Increasing this number consequently multiplies the time it takes +to load the commit list on repos which actually use that many +pages." + :type 'integer + :group 'paradox + :package-version '(paradox . "1.2.3")) + +(defcustom paradox-date-format "%Y-%m-%d" + "Format used for the date displayed on the commit list. +See `format-time-string' for more information. + +Set it to \"%x\" for a more \"human\" date format." + :type 'string + :group 'paradox-commit-list + :package-version '(paradox . "1.2.3")) + +(defvar paradox--commit-message-face nil + "Face currently being used on commit messages. +Gets dynamically changed to `font-lock-comment-face' on old commits. +nil means `default'.") + +(defvar-local paradox--package-repo nil + "Repo of the package in a commit-list buffer.") +(defvar-local paradox--package-name nil + "Name of the package in a commit-list buffer.") +(defvar-local paradox--package-version nil + "Installed version of the package in a commit-list buffer.") +(defvar-local paradox--package-tag-commit-alist nil + "Alist of (COMMIT-SHA . TAG) for this package's repo.") + +(defun paradox-menu-view-commit-list (pkg) + "Visit the commit list of package named PKG. +PKG is a symbol. Interactively it is the package under point." + (interactive '(nil)) + (let* ((name (paradox--get-or-return-package pkg)) + (repo (cdr (assoc name paradox--package-repo-list)))) + (if repo + (with-selected-window + (display-buffer (get-buffer-create paradox--commit-list-buffer)) + (paradox-commit-list-mode) + (setq paradox--package-repo repo) + (setq paradox--package-name name) + (setq paradox--package-version + (paradox--get-installed-version name)) + (setq paradox--package-tag-commit-alist + (paradox--get-tag-commit-alist repo)) + (paradox--commit-list-update-entries) + (tabulated-list-print)) + (message "Package %s is not a GitHub repo." pkg)))) + +(defun paradox--get-tag-commit-alist (repo) + "Get REPO's tag list and associate them to commit hashes." + (require 'json) + (mapcar + (lambda (x) + (cons + (cdr (assoc 'sha (cdr (assoc 'commit x)))) + (cdr (assoc 'name x)))) + (paradox--github-action + (format "repos/%s/tags?per_page=100" repo) + "GET" 'json-read paradox-commit-list-query-max-pages))) + +(defun paradox--get-installed-version (pkg) + "Return the installed version of PKG. +- If PKG isn't installed, return '(0). +- If it has a Melpa-like version (YYYYMMDD HHMM), return it as a + time value. +- If it has a regular version number, return it as a string." + (-if-let (desc (and (null (paradox--compat-p)) + (cadr (assoc pkg package-alist)))) + (let ((version (package-desc-version desc))) + (if (> (car version) 19000000) + (date-to-time + (format "%8dT%2d:%2d" + (car version) + (/ (cadr version) 100) + (% (cadr version) 100))) + ;; Regular version numbers. + (mapconcat 'int-to-string version "."))) + '(0 0))) + +(defun paradox--commit-tabulated-list (repo) + "Return the tabulated list for REPO's commit list." + (require 'json) + (let ((paradox--commit-message-face nil) + (feed (paradox--github-action + (format "repos/%s/commits?per_page=100" repo) + "GET" 'json-read paradox-commit-list-query-max-pages))) + (apply 'append (mapcar 'paradox--commit-print-info feed)))) + +(defun paradox--commit-print-info (x) + "Parse json in X into a tabulated list entry." + (let* ((commit (cdr (assoc 'commit x))) + (date (date-to-time (cdr (assoc 'date (cdr (assoc 'committer commit)))))) + (title (split-string (cdr (assoc 'message commit)) "[\n\r][ \t]*" t)) + ;; (url (cdr (assoc 'html_url commit))) + (cc (cdr (assoc 'comment_count commit))) + (sha (cdr (assoc 'sha x))) + (tag (cdr (assoc-string sha paradox--package-tag-commit-alist)))) + ;; Have we already crossed the installed commit, or is it not even installed? + (unless (or paradox--commit-message-face + (equal '(0) paradox--package-version)) + ;; Is this where we cross to old commits? + (when (paradox--version<= date tag paradox--package-version) + (setq paradox--commit-message-face 'paradox-comment-face))) + ;; Return the tabulated list entry. + (cons + ;; The ID + (list `((is-old . ,(null paradox--commit-message-face)) + (lisp-date . ,date) + ,@x) + ;; The actual displayed data + (vector + (propertize (format-time-string paradox-date-format date) + 'button t + 'follow-link t + 'action 'paradox-commit-list-visit-commit + 'face (or paradox--commit-message-face 'link)) + (concat (if (> cc 0) + (propertize (format "(%s comments) " cc) + 'face 'font-lock-function-name-face) + "") + (if (stringp tag) + (propertize tag 'face 'paradox-commit-tag-face) + "") + (if (stringp tag) " " "") + (propertize (or (car-safe title) "") + 'face paradox--commit-message-face)))) + (mapcar + (lambda (m) (list x (vector "" (propertize m 'face paradox--commit-message-face)))) + (cdr title))))) + +(defun paradox--version<= (date version package-version) + "Non-nil if commit at DATE tagged with VERSION is older or equal to PACKAGE-VERSION." + ;; Melpa date-like versions + (if (listp paradox--package-version) + ;; Installed date >= to commit date + (null (time-less-p paradox--package-version date)) + ;; Regular version numbers. + (and version + (ignore-errors (version<= version paradox--package-version))))) + +(defun paradox--commit-list-update-entries () + "Update entries of current commit-list." + (setq tabulated-list-entries + (paradox--commit-tabulated-list paradox--package-repo))) + +(defun paradox-commit-list-visit-commit (&optional ignore) + "Visit this commit on GitHub. +IGNORE is ignored." + (interactive) + (when (derived-mode-p 'paradox-commit-list-mode) + (browse-url (cdr (assoc 'html_url (tabulated-list-get-id)))))) + +(defun paradox-previous-commit (&optional n) + "Move to previous commit, which might not be the previous line. +With prefix N, move to the N-th previous commit." + (interactive "p") + (paradox-next-commit (- n))) + +(defun paradox-next-commit (&optional n) + "Move to next commit, which might not be the next line. +With prefix N, move to the N-th next commit." + (interactive "p") + (dotimes (it (abs n)) + (let ((d (cl-signum n))) + (forward-line d) + (while (looking-at " +") + (forward-line d))))) + +(define-derived-mode paradox-commit-list-mode + tabulated-list-mode "Paradox Commit List" + "Major mode for browsing a list of commits. +Letters do not insert themselves; instead, they are commands. +\\ +\\{paradox-commit-list-mode-map}" + (hl-line-mode 1) + (setq tabulated-list-format + `[("Date" ,(length (format-time-string paradox-date-format (current-time))) nil) + ("Message" 0 nil)]) + (setq tabulated-list-padding 1) + (setq tabulated-list-sort-key nil) + (add-hook 'tabulated-list-revert-hook 'paradox--commit-list-update-entries nil t) + (tabulated-list-init-header)) + +(define-key paradox-commit-list-mode-map " " #'paradox-commit-list-visit-commit) +(define-key paradox-commit-list-mode-map "p" #'paradox-previous-commit) +(define-key paradox-commit-list-mode-map "n" #'paradox-next-commit) + +;;;###autoload +(defun paradox-require (feature &optional filename noerror package refresh) + "A replacement for `require' which also installs the feature if it is absent. +- If FEATURE is present, `require' it and return t. + +- If FEATURE is not present, install PACKAGE with `package-install'. +If PACKAGE is nil, assume FEATURE is the package name. +After installation, `require' FEATURE. + +FILENAME is passed to `require'. + +If NOERROR is non-nil, don't complain if the feature couldn't be +installed, just return nil. + +By default, the current package database (stored in +`package-archive-contents') is only updated if it is empty. +Passing a non-nil REFRESH argument forces this update." + (or (require feature filename t) + (let ((package (or package + (if (stringp feature) + (intern feature) + feature)))) + (require 'package) + (unless (and package-archive-contents (null refresh)) + (package-refresh-contents)) + (and (condition-case e + (package-install package) + (error (if noerror nil (error (cadr e))))) + (require feature filename noerror))))) + +(provide 'paradox) +;;; paradox.el ends here. diff --git a/layers/!distribution/spacemacs/local/solarized-theme/README.md b/layers/!distribution/spacemacs/local/solarized-theme/README.md new file mode 100644 index 000000000000..fcf7f7fbe4ca --- /dev/null +++ b/layers/!distribution/spacemacs/local/solarized-theme/README.md @@ -0,0 +1,122 @@ +[![License GPL 3][badge-license]](http://www.gnu.org/licenses/gpl-3.0.txt) +[![MELPA](http://melpa.org/packages/solarized-theme-badge.svg)](http://melpa.org/#/solarized-theme) +[![MELPA Stable](http://stable.melpa.org/packages/solarized-theme-badge.svg)](http://stable.melpa.org/#/solarized-theme) + +## Solarized for Emacs + +Solarized for Emacs is an Emacs port of the [Solarized theme for vim](http://ethanschoonover.com/solarized), +developed by Ethan Schoonover. + +Solarized for Emacs is tested only under Emacs 24, but should be +working under Emacs 23 as well. The theme is implemented in terms of +customizations and `deftheme` and does not require the +`color-theme-package`. + +## Installation + +Solarized for Emacs is available for installation via the +[MELPA](http://melpa.org) and +[Marmalade](http://marmalade-repo.org/) `package.el` +repositories. Assuming you've set one of the them up (I recommend +MELPA) you can install solarized like this: + +`M-x package-install solarized-theme` + +Afterwards - business as usual, just load one of the theme variants with `M-x +load-theme`. + +(If you want to install manually that procedure is briefly documented in the +FAQ at the end of this document.) + +## Customisations + +### Theme specific settings + +If you don't like low-contrast modeline or fringe, you can `customize` them +either by doing `M-x customize-group solarized` or setting the values using +elisp code: + +```el +;; make the fringe stand out from the background +(setq solarized-distinct-fringe-background t) + +;; make the modeline high contrast +(setq solarized-high-contrast-mode-line t) + +;; Use less bolding +(setq solarized-use-less-bold t) + +;; Use more italics +(setq solarized-use-more-italic t) + +;; Use less colors for indicators such as git:gutter, flycheck and similar. +(setq solarized-emphasize-indicators nil) + +;; Don't change size of org-mode headlines (but keep other size-changes) +(setq solarized-scale-org-headlines nil) + +;; Avoid all font-size changes +(setq solarized-height-minus-1 1) +(setq solarized-height-plus-1 1) +(setq solarized-height-plus-2 1) +(setq solarized-height-plus-3 1) +(setq solarized-height-plus-4 1) + +``` + +Note that these need to be set **before** `load-theme` is invoked for Solarized. + +### Underline position setting for X + +If you are using Emacs under X you might like the following setting which puts +the underline below the +[font bottomline instead of the baseline](https://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.graPHIGS/doc/phigstrf/figures/afma5rbd.jpg). + +Imho it enhances the general readability and also it fits well with the default +`solarized-high-contrast-mode-line` setting which uses an slightly emphazised +underline for the modeline to create one horizontal window border in the same +manner as the vertical border. + +```el +(setq x-underline-at-descent-line t) +``` + +## Bugs & Improvements + +Please, report any problems that you find on the projects integrated +issue tracker. If you've added some improvements and you want them +included upstream don't hesitate to send me a patch or even better - a +GitHub pull request. + +## FAQ + +### Stand-alone manual installation + +Save the following files in a folder that's on your Emacs' `load-path`: + +* [dash.el](https://raw.githubusercontent.com/magnars/dash.el/master/dash.el) - [dash](https://github.com/magnars/dash.el), a modern list library for Emacs +* [solarized.el](https://raw.githubusercontent.com/bbatsov/solarized-emacs/master/solarized.el) - the solarized theme + +Save the following files into `~/.emacs.d/themes`: + +* [solarized-light-theme.el](https://raw.githubusercontent.com/bbatsov/solarized-emacs/master/solarized-light-theme.el) +* [solarized-dark-theme.el](https://raw.githubusercontent.com/bbatsov/solarized-emacs/master/solarized-dark-theme.el) + +Add this your `.emacs.d`: + +```el +(add-to-list 'custom-theme-load-path "~/.emacs.d/themes") +``` + +Now you can load the theme with the interactive function `load-theme`. + +## Contributors + +- [Thomas Frössman](http://t.jossystem.se) + +(Add yourself to the list) + +Cheers, +[Bozhidar](http://twitter.com/bbatsov) + +[badge-license]: https://img.shields.io/badge/license-GPL_3-green.svg diff --git a/layers/!distribution/spacemacs/local/solarized-theme/solarized-dark-theme.el b/layers/!distribution/spacemacs/local/solarized-theme/solarized-dark-theme.el new file mode 100644 index 000000000000..548b48ed53fc --- /dev/null +++ b/layers/!distribution/spacemacs/local/solarized-theme/solarized-dark-theme.el @@ -0,0 +1,7 @@ +(require 'solarized) + +(deftheme solarized-dark "The dark variant of the Solarized colour theme") + +(create-solarized-theme 'dark 'solarized-dark) + +(provide-theme 'solarized-dark) diff --git a/layers/!distribution/spacemacs/local/solarized-theme/solarized-light-theme.el b/layers/!distribution/spacemacs/local/solarized-theme/solarized-light-theme.el new file mode 100644 index 000000000000..15802c965451 --- /dev/null +++ b/layers/!distribution/spacemacs/local/solarized-theme/solarized-light-theme.el @@ -0,0 +1,7 @@ +(require 'solarized) + +(deftheme solarized-light "The light variant of the Solarized colour theme") + +(create-solarized-theme 'light 'solarized-light) + +(provide-theme 'solarized-light) diff --git a/layers/!distribution/spacemacs/local/solarized-theme/solarized-theme-pkg.el b/layers/!distribution/spacemacs/local/solarized-theme/solarized-theme-pkg.el new file mode 100644 index 000000000000..5eebc89a4e7c --- /dev/null +++ b/layers/!distribution/spacemacs/local/solarized-theme/solarized-theme-pkg.el @@ -0,0 +1,5 @@ +(define-package + "solarized-theme" + "1.2.1" + "The Solarized color theme, ported to Emacs." + '((dash "2.6.0"))) diff --git a/layers/!distribution/spacemacs/local/solarized-theme/solarized-theme-utils.el b/layers/!distribution/spacemacs/local/solarized-theme/solarized-theme-utils.el new file mode 100644 index 000000000000..35b039cff8bc --- /dev/null +++ b/layers/!distribution/spacemacs/local/solarized-theme/solarized-theme-utils.el @@ -0,0 +1,73 @@ +;;; solarized-theme-utils.el --- Utilities for solarized theme development + +;; Copyright (C) 2012 Thomas Frössman + +;; Author: Thomas Frössman +;; URL: https://github.com/bbatsov/solarized-emacs + +;; 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 3 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: +;; +;; Development utilities, these are not needed for normal theme usage +;; + +;;;; Code: +(require 'cl) +(require 'solarized) + +(defun solarized-import-faces (&optional regexp already-defined) + "Imports current effective face definitions by regular expression +in the format of solarized-theme.el." + (interactive (list (read-regexp "List faces matching regexp"))) + (let* + ((all-faces (zerop (length regexp))) + (faces + (delq nil + (mapcar (lambda (face) + (let ((s (symbol-name face))) + (when (or all-faces (string-match regexp s)) + face))) + (sort (face-list) #'string-lessp))))) + (mapc (lambda(face) + (when (or (not (get face 'theme-face)) already-defined) + (insert (format + "`(%s ((,class %s)))%s +" + face + (let (result) + (dolist (entry face-attribute-name-alist result) + (let* ((attribute (car entry)) + (value (face-attribute face attribute))) + (unless (eq value 'unspecified) + (setq result + (nconc (list attribute + (cond + ((member* attribute + '(":background" + ":foreground") + :test 'string=) + (format "\"%s\"" value)) + (t value))) result)))))) + (if (get face 'theme-face) + (format " ;; Already set by current theme!") + ""))))) + faces))) + +;; Local Variables: +;; byte-compile-warnings: (not cl-functions) +;; indent-tabs-mode: nil +;; End: +(provide 'solarized-theme-utils) +;;; solarized-theme-utils.el ends here diff --git a/layers/!distribution/spacemacs/local/solarized-theme/solarized-theme.el b/layers/!distribution/spacemacs/local/solarized-theme/solarized-theme.el new file mode 100644 index 000000000000..f2c69d5ce773 --- /dev/null +++ b/layers/!distribution/spacemacs/local/solarized-theme/solarized-theme.el @@ -0,0 +1,2 @@ +(require 'solarized) +(provide 'solarized-theme) diff --git a/layers/!distribution/spacemacs/local/solarized-theme/solarized.el b/layers/!distribution/spacemacs/local/solarized-theme/solarized.el new file mode 100644 index 000000000000..b6048e620055 --- /dev/null +++ b/layers/!distribution/spacemacs/local/solarized-theme/solarized.el @@ -0,0 +1,2065 @@ +;;; solarized.el --- Solarized for Emacs. + +;; Copyright (C) 2011-2015 Bozhidar Batsov + +;; Author: Bozhidar Batsov +;; Author: Thomas Frössman +;; URL: http://github.com/bbatsov/solarized-emacs +;; Version: 1.2.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 3 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: +;; +;; A port of Solarized to Emacs. +;; +;;; Installation: +;; +;; Drop the `solarized-theme.el` somewhere in your `load-path` and +;; the two themes in a folder that is on `custom-theme-load-path' +;; and enjoy! +;; +;; Don't forget that the theme requires Emacs 24. +;; +;;; Credits +;; +;; Ethan Schoonover created the original theme for vim on such this port +;; is based. +;; +;;; Code: + +(require 'dash) + +;;; Options + +(defgroup solarized nil + "Solarized theme options. +The theme has to be reloaded after changing anything in this group." + :group 'faces) + +(defcustom solarized-distinct-fringe-background nil + "Make the fringe background different from the normal background color. +Also affects `linum-mode' background." + :type 'boolean + :group 'solarized) + +(defcustom solarized-use-variable-pitch t + "Use variable pitch face for some headings and titles." + :type 'boolean + :group 'solarized) + +(defcustom solarized-use-less-bold nil + "Use bold weight less often." + :type 'boolean + :group 'solarized) + +(defcustom solarized-use-more-italic nil + "Use italic slant more often." + :type 'boolean + :group 'solarized) + +(defcustom solarized-emphasize-indicators t + "Use more colors for indicators such as git:gutter, flycheck and similar." + :type 'boolean + :group 'solarized) + +(defcustom solarized-high-contrast-mode-line nil + "Make the active/inactive mode line stand out more." + :type 'boolean + :group 'solarized) + +(defcustom solarized-height-minus-1 0.8 + "Font size -1." + :type 'number + :group 'solarized) + +(defcustom solarized-height-plus-1 1.1 + "Font size +1." + :type 'number + :group 'solarized) + +(defcustom solarized-height-plus-2 1.15 + "Font size +2." + :type 'number + :group 'solarized) + +(defcustom solarized-height-plus-3 1.2 + "Font size +3." + :type 'number + :group 'solarized) + +(defcustom solarized-height-plus-4 1.3 + "Font size +4." + :type 'number + :group 'solarized) + +(defcustom solarized-scale-org-headlines t + "Whether scaling of outline-headlines should apply to org-mode headlines." + :type 'boolean + :group 'solarized) + +;;; Utilities + +(defun solarized-color-name-to-rgb (color &optional frame) + "Convert COLOR string to a list of normalized RGB components. +COLOR should be a color name (e.g. \"white\") or an RGB triplet +string (e.g. \"#ff12ec\"). + +Normally the return value is a list of three floating-point +numbers, (RED GREEN BLUE), each between 0.0 and 1.0 inclusive. + +Optional argument FRAME specifies the frame where the color is to be +displayed. If FRAME is omitted or nil, use the selected frame. +If FRAME cannot display COLOR, return nil." + ;; `colors-values' maximum value is either 65535 or 65280 depending on the + ;; display system. So we use a white conversion to get the max value. + (let ((valmax (float (car (color-values "#ffffff"))))) + (mapcar (lambda (x) (/ x valmax)) (color-values color frame)))) + +(defun solarized-color-rgb-to-hex (red green blue) + "Return hexadecimal notation for the color RED GREEN BLUE. +RED, GREEN, and BLUE should be numbers between 0.0 and 1.0, inclusive." + (format "#%02x%02x%02x" + (* red 255) (* green 255) (* blue 255))) + +(defun solarized-color-blend (color1 color2 alpha) + "Blends COLOR1 onto COLOR2 with ALPHA. + +COLOR1 and COLOR2 should be color names (e.g. \"white\") or RGB +triplet strings (e.g. \"#ff12ec\"). + +Alpha should be a float between 0 and 1." + (apply 'solarized-color-rgb-to-hex + (-zip-with '(lambda (it other) + (+ (* alpha it) (* other (- 1 alpha)))) + (solarized-color-name-to-rgb color1) + (solarized-color-name-to-rgb color2)))) + +;;; Setup Start + +(defun create-solarized-theme (variant theme-name &optional childtheme) + "Create a VARIANT of the theme named THEME-NAME. + +When optional argument CHILDTHEME function is supplied it's invoked to further +customize the resulting theme." +;;; Color palette + (let* ((class '((class color) (min-colors 89))) + (s-base03 "#002b36") + (s-base02 "#073642") + ;; emphasized content + (s-base01 "#586e75") + ;; primary content + (s-base00 "#657b83") + (s-base0 "#839496") + ;; comments + (s-base1 "#93a1a1") + ;; background highlight light + (s-base2 "#eee8d5") + ;; background light + (s-base3 "#fdf6e3") + + ;; Solarized accented colors + (yellow "#b58900") + (orange "#cb4b16") + (red "#dc322f") + (magenta "#d33682") + (violet "#6c71c4") + (blue "#268bd2") + (cyan "#2aa198") + (green "#859900") + + ;; Darker and lighter accented colors + ;; Only use these in exceptional circumstances! + (yellow-d "#7B6000") + (yellow-l "#DEB542") + (orange-d "#8B2C02") + (orange-l "#F2804F") + (red-d "#990A1B") + (red-l "#FF6E64") + (magenta-d "#93115C") + (magenta-l "#F771AC") + (violet-d "#3F4D91") + (violet-l "#9EA0E5") + (blue-d "#00629D") + (blue-l "#69B7F0") + (cyan-d "#00736F") + (cyan-l "#69CABF") + (green-d "#546E00") + (green-l "#B4C342") + + ;; Solarized palette names, use these instead of -fg -bg... + (base0 (if (eq variant 'light) s-base00 s-base0)) + (base00 (if (eq variant 'light) s-base0 s-base00)) + (base1 (if (eq variant 'light) s-base01 s-base1)) + (base01 (if (eq variant 'light) s-base1 s-base01)) + (base2 (if (eq variant 'light) s-base02 s-base2)) + (base02 (if (eq variant 'light) s-base2 s-base02)) + (base3 (if (eq variant 'light) s-base03 s-base3)) + (base03 (if (eq variant 'light) s-base3 s-base03)) + + ;; Line drawing color + ;; + ;; NOTE only use this for very thin lines that are hard to see using base02, in low + ;; color displayes base02 might be used instead + (s-line (if (eq variant 'light) "#cccec4" "#284b54")) + + ;; Light/Dark adaptive higher/lower contrast accented colors + ;; + ;; NOTE Only use these in exceptional cirmumstances! + (yellow-hc (if (eq variant 'light) yellow-d yellow-l)) + (yellow-lc (if (eq variant 'light) yellow-l yellow-d)) + (orange-hc (if (eq variant 'light) orange-d orange-l)) + (orange-lc (if (eq variant 'light) orange-l orange-d)) + (red-hc (if (eq variant 'light) red-d red-l)) + (red-lc (if (eq variant 'light) red-l red-d)) + (magenta-hc (if (eq variant 'light) magenta-d magenta-l)) + (magenta-lc (if (eq variant 'light) magenta-l magenta-d)) + (violet-hc (if (eq variant 'light) violet-d violet-l)) + (violet-lc (if (eq variant 'light) violet-l violet-d)) + (blue-hc (if (eq variant 'light) blue-d blue-l)) + (blue-lc (if (eq variant 'light) blue-l blue-d)) + (cyan-hc (if (eq variant 'light) cyan-d cyan-l)) + (cyan-lc (if (eq variant 'light) cyan-l cyan-d)) + (green-hc (if (eq variant 'light) green-d green-l)) + (green-lc (if (eq variant 'light) green-l green-d)) + + ;; customize based face properties + (s-maybe-bold (if solarized-use-less-bold + 'unspecified 'bold)) + (s-maybe-italic (if solarized-use-more-italic + 'italic 'normal)) + (s-variable-pitch (if solarized-use-variable-pitch + 'variable-pitch 'default)) + (s-fringe-bg (if solarized-distinct-fringe-background + base02 base03)) + (s-fringe-fg base01) + + + (s-header-line-fg (if solarized-high-contrast-mode-line + base1 base0)) + (s-header-line-bg (if solarized-high-contrast-mode-line + base02 base03)) + (s-header-line-underline (if solarized-high-contrast-mode-line + nil base02)) + + (s-mode-line-fg (if solarized-high-contrast-mode-line + base03 base0)) + (s-mode-line-bg (if solarized-high-contrast-mode-line + base0 base02)) + (s-mode-line-underline (if solarized-high-contrast-mode-line + nil s-line)) + + (s-mode-line-buffer-id-fg (if solarized-high-contrast-mode-line + 'unspecified base1)) + (s-mode-line-inactive-fg (if solarized-high-contrast-mode-line + base0 base01)) + (s-mode-line-inactive-bg (if solarized-high-contrast-mode-line + base02 base03)) + (s-mode-line-inactive-bc (if solarized-high-contrast-mode-line + base02 base02))) +;;; Theme Faces + (custom-theme-set-faces + theme-name +;;;; Built-in +;;;;; basic coloring + `(default ((,class (:foreground ,base0 :background ,base03)))) + `(shadow ((,class (:foreground ,base01)))) + `(match ((,class (:background ,base02 :foreground ,base1 :weight bold)))) + `(cursor ((,class (:foreground ,base03 :background ,base0 + :inverse-video t)))) + `(escape-glyph ((,class (:foreground ,violet)))) + `(fringe ((,class (:foreground ,s-fringe-fg :background ,s-fringe-bg)))) + `(highlight ((,class (:background ,base02)))) + `(link ((,class (:foreground ,yellow :underline t :weight bold)))) + `(link-visited ((,class (:foreground ,yellow :underline t :weight normal)))) + `(success ((,class (:foreground ,green )))) + `(warning ((,class (:foreground ,yellow )))) + `(error ((,class (:foreground ,orange)))) + `(lazy-highlight ((,class (:foreground ,base03 :background ,yellow + :weight normal)))) + `(widget-field ((,class (:background ,base02)))) + '(button ((t (:underline t)))) +;;;;; compilation + `(compilation-column-face ((,class (:foreground ,cyan :underline nil)))) + `(compilation-column-number ((,class (:inherit font-lock-doc-face :foreground ,cyan + :underline nil)))) + `(compilation-enter-directory-face ((,class (:foreground ,green :underline nil)))) + `(compilation-error ((,class (:inherit error :underline nil)))) + `(compilation-error-face ((,class (:foreground ,red : :underline nil)))) + `(compilation-face ((,class (:foreground ,base0 :underline nil)))) + `(compilation-info ((,class (:foreground ,base01 :underline nil :bold nil)))) + `(compilation-info-face ((,class (:foreground ,blue :underline nil)))) + `(compilation-leave-directory-face ((,class (:foreground ,green :underline nil)))) + `(compilation-line-face ((,class (:foreground ,green :underline nil)))) + `(compilation-line-number ((,class (:foreground ,green :underline nil)))) + `(compilation-warning ((,class (:inherit warning :underline nil)))) + `(compilation-warning-face ((,class (:foreground ,yellow :weight normal :underline nil)))) + + `(compilation-mode-line-exit + ((,class (:foreground unspecified :weight bold)))) + `(compilation-mode-line-fail + ((,class (:inherit compilation-error :foreground ,red :weight bold)))) + `(compilation-mode-line-run ((,class (:foreground ,orange :weight bold)))) +;;;;; cua + `(cua-global-mark ((,class (:background ,yellow :foreground ,base03)))) + `(cua-rectangle ((,class (:inherit region + :background ,magenta :foreground ,base03)))) + `(cua-rectangle-noselect ((,class (:inherit region :background ,base02 + :foreground ,base01)))) +;;;;; diary + `(diary ((,class (:foreground ,yellow)))) +;;;;; dired + `(dired-directory ((,class (:foreground ,blue :weight normal)))) + `(dired-flagged ((,class (:foreground ,red)))) + `(dired-header ((,class (:foreground ,base03 :background ,blue)))) + `(dired-ignored ((,class (:inherit shadow)))) + `(dired-mark ((,class (:foreground ,yellow :weight bold)))) + `(dired-marked ((,class (:foreground ,magenta :weight bold)))) + `(dired-perm-write ((,class (:foreground ,base0 :underline t)))) + `(dired-symlink ((,class (:foreground ,cyan :weight normal :slant italic)))) + `(dired-warning ((,class (:foreground ,orange :underline t)))) +;;;;; dired-async + `(dired-async-message ((,class (:background ,(if (eq variant 'light) yellow-l yellow) )))) + `(dired-async-mode-message + ((,class (:background ,(if (eq variant 'light) red-l red) )))) +;;;;; dired-efap + `(dired-efap-face ((,class (:box nil + :background ,base02 + :foreground ,base1 + :underline ,s-line + :weight bold)))) +;;;;; dropdown + `(dropdown-list-face ((,class (:background ,base02 :foreground ,cyan)))) + `(dropdown-list-selection-face ((,class (:background ,cyan-lc :foreground ,cyan-hc)))) +;;;;; ecb + `(ecb-default-highlight-face ((,class (:background ,blue :foreground ,base03)))) + `(ecb-history-bucket-node-dir-soure-path-face + ((,class (:inherit ecb-history-bucket-node-face :foreground ,yellow)))) + `(ecb-source-in-directories-buffer-face ((,class (:inherit ecb-directories-general-face + :foreground ,base0)))) + `(ecb-history-dead-buffer-face ((,class (:inherit ecb-history-general-face + :foreground ,base01)))) + `(ecb-directory-not-accessible-face ((,class (:inherit ecb-directories-general-face + :foreground ,base01)))) + `(ecb-bucket-node-face ((,class (:inherit ecb-default-general-face :weight normal + :foreground ,blue)))) + `(ecb-tag-header-face ((,class (:background ,base02)))) + `(ecb-analyse-bucket-element-face ((,class (:inherit ecb-analyse-general-face + :foreground ,green)))) + `(ecb-directories-general-face ((,class (:inherit ecb-default-general-face :height 1.0)))) + `(ecb-method-non-semantic-face ((,class (:inherit ecb-methods-general-face + :foreground ,cyan)))) + `(ecb-mode-line-prefix-face ((,class (:foreground ,green)))) + `(ecb-tree-guide-line-face ((,class (:inherit ecb-default-general-face + :foreground ,base02 :height 1.0)))) +;;;;; ee + `(ee-bookmarked ((,class (:foreground ,base1)))) + `(ee-category ((,class (:foreground ,blue)))) + `(ee-link ((,class (:inherit link)))) + `(ee-link-visited ((,class (:inherit link-visited)))) + `(ee-marked ((,class (:foreground ,magenta :weight bold)))) + `(ee-omitted ((,class (:foreground ,base01)))) + `(ee-shadow ((,class (:inherit shadow)))) +;;;;; enh-ruby-mode + `(enh-ruby-string-delimiter-face ((,class (:foreground ,yellow)))) + `(enh-ruby-heredoc-delimiter-face ((,class (:inherit enh-ruby-string-delimiter-face)))) + `(enh-ruby-regexp-delimiter-face ((,class (:inherit enh-ruby-string-delimiter-face)))) + `(enh-ruby-op-face ((,class (:foreground ,base0)))) + `(erm-syn-errline ((,class (:inherit flymake-errline)))) + `(erm-syn-warnline ((,class (:inherit flymake-warnline)))) +;;;;; completions + `(completions-annotations ((t (:foreground ,base01)))) +;;;;; grep + `(grep-context-face ((,class (:foreground ,base0)))) + `(grep-error-face ((,class (:foreground ,red :weight bold :underline t)))) + `(grep-hit-face ((,class (:foreground ,blue)))) + `(grep-match-face ((,class (:foreground ,orange :weight bold)))) +;;;;; isearch + `(isearch ((,class (:foreground ,base03 :background ,magenta :weight normal)))) + `(isearch-fail ((,class (:foreground ,red :background ,base03 :bold t)))) +;;;;; man + `(Man-overstrike ((,class (:foreground ,blue :weight bold)))) + `(Man-reverse ((,class (:foreground ,orange)))) + `(Man-underline ((,class (:foreground ,green :underline t)))) +;;;;; misc faces + `(menu ((,class (:foreground ,base0 :background ,base03)))) + `(minibuffer-prompt ((,class (:foreground ,base0)))) + `(mode-line + ((,class (:foreground ,s-mode-line-fg + :background ,s-mode-line-bg + :box (:color ,s-mode-line-fg :line-width 1) + )))) + ;; `(mode-line-buffer-id ((,class (:foreground ,s-mode-line-buffer-id-fg :weight bold)))) + `(mode-line-inactive + ((,class (:foreground ,s-mode-line-inactive-fg + :background ,s-mode-line-inactive-bg + :box (:color ,s-mode-line-inactive-fg :line-width 1) + )))) + ;; `(header-line + ;; ((,class (:inverse-video unspecified + ;; :overline nil + ;; :underline ,s-header-line-underline + ;; :foreground ,s-header-line-fg + ;; :background ,s-header-line-bg + ;; :box (:line-width 2 :color ,s-header-line-bg + ;; :style unspecified) + ;; )))) + `(region ((,class (:foreground ,base03 :background ,base1)))) + `(secondary-selection ((,class (:background ,base02)))) + + `(trailing-whitespace ((,class (:background ,red)))) + `(vertical-border ((,class (:foreground ,s-line)))) +;;;;; font lock + `(font-lock-builtin-face ((,class (:foreground ,base0 :weight ,s-maybe-bold + :slant ,s-maybe-italic)))) + `(font-lock-comment-delimiter-face + ((,class (:foreground ,base01 :slant ,s-maybe-italic)))) + `(font-lock-comment-face ((,class (:foreground ,base01)))) + `(font-lock-constant-face ((,class (:foreground ,blue :weight bold)))) + `(font-lock-doc-face ((,class (:foreground ,cyan :slant ,s-maybe-italic)))) + `(font-lock-function-name-face ((,class (:foreground ,blue)))) + `(font-lock-keyword-face ((,class (:foreground ,green :weight ,s-maybe-bold)))) + `(font-lock-negation-char-face ((,class (:foreground ,yellow :weight bold)))) + `(font-lock-preprocessor-face ((,class (:foreground ,blue)))) + `(font-lock-regexp-grouping-construct ((,class (:foreground ,yellow :weight bold)))) + `(font-lock-regexp-grouping-backslash ((,class (:foreground ,green :weight bold)))) + `(font-lock-string-face ((,class (:foreground ,cyan)))) + `(font-lock-type-face ((,class (:foreground ,yellow)))) + `(font-lock-variable-name-face ((,class (:foreground ,blue)))) + `(font-lock-warning-face ((,class (:inherit error :weight bold)))) + `(c-annotation-face ((,class (:inherit font-lock-constant-face)))) +;;;; Third-party +;;;;; ace-jump-mode + `(ace-jump-face-background + ((,class (:foreground ,base01 :background ,base03 + :inverse-video nil)))) + `(ace-jump-face-foreground + ((,class (:foreground ,red :background ,base03 :inverse-video nil :weight bold)))) +;;;;; auctex + `(font-latex-bold-face ((,class (:inherit bold :foreground ,base1)))) + `(font-latex-doctex-documentation-face ((,class (:background unspecified)))) + `(font-latex-doctex-preprocessor-face ((,class + (:inherit (font-latex-doctex-documentation-face + font-lock-builtin-face + font-lock-preprocessor-face))))) + `(font-latex-italic-face ((,class (:inherit italic :foreground ,base1)))) + `(font-latex-math-face ((,class (:foreground ,violet)))) + `(font-latex-sectioning-0-face ((,class (:inherit font-latex-sectioning-1-face + :height ,solarized-height-plus-1)))) + `(font-latex-sectioning-1-face ((,class (:inherit font-latex-sectioning-2-face + :height ,solarized-height-plus-1)))) + `(font-latex-sectioning-2-face ((,class (:inherit font-latex-sectioning-3-face + :height ,solarized-height-plus-1)))) + `(font-latex-sectioning-3-face ((,class (:inherit font-latex-sectioning-4-face + :height ,solarized-height-plus-1)))) + `(font-latex-sectioning-4-face ((,class (:inherit font-latex-sectioning-5-face + :height ,solarized-height-plus-1)))) + `(font-latex-sectioning-5-face ((,class (:inherit ,s-variable-pitch :foreground ,yellow + :weight bold)))) + `(font-latex-sedate-face ((,class (:foreground ,base1)))) + `(font-latex-slide-title-face ((,class (:inherit (,s-variable-pitch font-lock-type-face) + :weight bold :height ,solarized-height-plus-3)))) + `(font-latex-string-face ((,class (:foreground ,cyan)))) + `(font-latex-subscript-face ((,class (:height ,solarized-height-minus-1)))) + `(font-latex-superscript-face ((,class (:height ,solarized-height-minus-1)))) + `(font-latex-verbatim-face ((,class (:inherit fixed-pitch :foreground ,base0 + :slant italic)))) + `(font-latex-warning-face ((,class (:inherit bold :foreground ,orange)))) +;;;;; auto-complete + `(ac-candidate-face ((,class (:background ,base02 :foreground ,cyan)))) + `(ac-selection-face ((,class (:background ,cyan-lc :foreground ,cyan-hc)))) + `(ac-candidate-mouse-face ((,class (:background ,cyan-hc :foreground ,cyan-lc)))) + `(ac-completion-face ((,class (:foreground ,base1 :underline t)))) + `(ac-gtags-candidate-face ((,class (:background ,base02 :foreground ,blue)))) + `(ac-gtags-selection-face ((,class (:background ,blue-lc :foreground ,blue-hc)))) + `(ac-yasnippet-candidate-face ((,class (:background ,base02 :foreground ,yellow)))) + `(ac-yasnippet-selection-face ((,class (:background ,yellow-lc :foreground ,yellow-hc)))) +;;;;; auto highlight symbol + `(ahs-definition-face ((,class (:foreground ,magenta :background unspecified :underline t + :slant normal :weight bold)))) + `(ahs-edit-mode-face ((,class (:foreground ,base03 :background ,magenta :weight bold)))) + `(ahs-face ((,class (:foreground ,magenta :background unspecified :weight bold)))) + `(ahs-plugin-bod-face ((,class (:foreground ,magenta :background unspecified :weight bold)))) + `(ahs-plugin-defalt-face ((,class (:foreground ,magenta :background unspecified :weight bold)))) + `(ahs-plugin-whole-buffer-face ((,class (:foreground ,magenta :background unspecified :weight bold)))) + `(ahs-warning-face ((,class (:foreground ,red :weight bold)))) +;;;;; android mode + `(android-mode-debug-face ((,class (:foreground ,green)))) + `(android-mode-error-face ((,class (:foreground ,orange :weight bold)))) + `(android-mode-info-face ((,class (:foreground ,base0)))) + `(android-mode-verbose-face ((,class (:foreground ,base01)))) + `(android-mode-warning-face ((,class (:foreground ,yellow)))) +;;;;; anzu-mode + `(anzu-mode-line ((,class (:foreground ,yellow :weight bold)))) +;;;;; bm + `(bm-face ((,class (:overline ,base0)))) + `(bm-fringe-face ((,class (:overline ,base0)))) + `(bm-fringe-persistent-face ((,class (:overline ,base0)))) + `(bm-persistent-face ((,class (:overline ,base0)))) +;;;;; calfw + `(cfw:face-day-title ((,class (:background ,base02)))) + `(cfw:face-annotation ((,class (:inherit cfw:face-day-title :foreground ,yellow)))) + `(cfw:face-default-content ((,class (:foreground ,green)))) + `(cfw:face-default-day ((,class (:inherit cfw:face-day-title :weight bold)))) + `(cfw:face-disable ((,class (:inherit cfw:face-day-title + :foreground ,base01)))) + `(cfw:face-grid ((,class (:foreground ,base01)))) + `(cfw:face-header ((,class (:foreground ,blue-hc :background ,blue-lc :weight bold)))) + `(cfw:face-holiday ((,class (:background nil :foreground ,red :weight bold)))) + `(cfw:face-periods ((,class (:foreground ,magenta)))) + `(cfw:face-select ((,class (:background ,magenta-lc :foreground ,magenta-hc)))) + `(cfw:face-saturday ((,class (:foreground ,cyan-hc :background ,cyan-lc)))) + `(cfw:face-sunday ((,class (:foreground ,red-hc :background ,red-lc :weight bold)))) + `(cfw:face-title ((,class (:inherit ,s-variable-pitch :foreground ,yellow + :weight bold :height ,solarized-height-plus-4)))) + `(cfw:face-today ((,class (:weight bold :background ,base02 :foreground nil)))) + `(cfw:face-today-title ((,class (:background ,yellow-lc + :foreground ,yellow-hc :weight bold)))) + `(cfw:face-toolbar ((,class (:background ,base02 :foreground ,base0)))) + `(cfw:face-toolbar-button-off ((,class (:background ,yellow-lc :foreground ,yellow-hc + :weight bold)))) + `(cfw:face-toolbar-button-on ((,class (:background ,yellow-hc :foreground ,yellow-lc + :weight bold)))) +;;;;; clojure-test-mode + `(clojure-test-failure-face ((t (:foreground ,orange :weight bold :underline t)))) + `(clojure-test-error-face ((t (:foreground ,red :weight bold :underline t)))) + `(clojure-test-success-face ((t (:foreground ,green :weight bold :underline t)))) +;;;;; cider-repl-mode + `(cider-repl-err-output-face ((t (:inherit ,font-lock-warning-face :underline nil)))) +;;;;; cider-test-mode + `(cider-test-failure-face ((t (:foreground ,orange :weight bold :underline t)))) + `(cider-test-error-face ((t (:foreground ,red :weight bold :underline t)))) + `(cider-test-success-face ((t (:foreground ,green :weight bold :underline t)))) +;;;;; company-mode + `(company-template-field ((,class (:background ,yellow :foreground ,base02)))) + `(company-tooltip ((,class (:background ,base02 :foreground ,cyan)))) + `(company-tooltip-selection ((,class (:background ,cyan-lc :foreground ,cyan-hc)))) + `(company-tooltip-mouse ((,class (:background ,cyan-hc :foreground ,cyan-lc)))) + `(company-tooltip-common ((,class (:foreground ,base1 :underline t)))) + `(company-tooltip-common-selection ((,class (:foreground ,base1 :underline t)))) + `(company-tooltip-annotation ((,class (:foreground ,base1 :background ,base02)))) + `(company-scrollbar-fg ((,class (:foreground ,base03 :background ,base0)))) + `(company-scrollbar-bg ((,class (:background ,base02 :foreground ,cyan)))) + `(company-preview ((,class (:background ,base02 :foreground ,cyan)))) + `(company-preview-common ((,class (:foreground ,base1 :underline t)))) +;;;;; column-enforce-mode + `(column-enforce-face ((,class (:background unspecified :foreground ,magenta + :inverse-video unspecified)))) +;;;;; cscope + `(cscope-file-face ((,class (:foreground ,green :weight bold)))) + `(cscope-function-face ((,class (:foreground ,blue)))) + `(cscope-line-number-face ((,class (:foreground ,yellow)))) + `(cscope-line-face ((,class (:foreground ,base0)))) + `(cscope-mouse-face ((,class (:background ,blue :foreground ,base0)))) +;;;;; ctable + `(ctbl:face-cell-select ((,class (:background ,base02 :foreground ,base1 + :underline ,base1 :weight bold)))) + `(ctbl:face-continue-bar ((,class (:background ,base02 :foreground ,yellow)))) + `(ctbl:face-row-select ((,class (:background ,base02 :foreground ,base0 + :underline t)))) +;;;;; coffee + `(coffee-mode-class-name ((,class (:foreground ,yellow :weight bold)))) + `(coffee-mode-function-param ((,class (:foreground ,violet :slant italic)))) + +;;;;; cperl-mode + `(cperl-array-face ((,class (:background unspecified :foreground ,blue)))) + `(cperl-hash-face ((,class (:background unspecified :foreground ,blue)))) + `(cperl-nonoverridable-face ((,class (:foreground ,base0 :weight bold)))) + +;;;;; custom + `(custom-face-tag ((,class (:inherit ,s-variable-pitch :height ,solarized-height-plus-3 + :foreground ,violet :weight normal)))) + `(custom-variable-tag ((,class (:inherit ,s-variable-pitch + :foreground ,cyan :height ,solarized-height-plus-3)))) + `(custom-comment-tag ((,class (:foreground ,base01)))) + `(custom-group-tag ((,class (:inherit ,s-variable-pitch :foreground ,blue :height ,solarized-height-plus-3)))) + `(custom-group-tag-1 ((,class (:inherit ,s-variable-pitch :foreground ,red :height ,solarized-height-plus-3)))) + `(custom-state ((,class (:foreground ,green)))) + `(custom-button ((,class (:background ,base02 :foreground ,base1 + :box (:line-width 2 :style released-button))))) + `(custom-button-mouse ((,class (:background ,base01 :foreground ,base02 + :box (:line-width 2 :style released-button))))) + `(custom-button-pressed ((,class (:background ,base01 :foreground ,base1 + :box (:line-width 2 :style pressed-button))))) + `(custom-button-unraised ((,class (:inherit underline)))) + `(custom-button-pressed-unraised ((,class (:inherit custom-button-unraised :foreground ,magenta)))) +;;;;; diff + `(diff-added ((,class (:foreground ,green :background nil)))) + `(diff-changed ((,class (:foreground ,blue :background nil)))) + `(diff-removed ((,class (:foreground ,red :background nil)))) + `(diff-header ((,class (:background ,base03)))) + `(diff-file-header + ((,class (:background ,base03 :foreground ,base0 :weight bold)))) + `(diff-refine-added ((,class (:foreground ,green :background ,base03 + :inverse-video t)))) + `(diff-refine-change ((,class (:foreground ,blue :background ,base03 + :inverse-video t)))) + `(diff-refine-removed ((,class (:foreground ,red :background ,base03 + :inverse-video t)))) +;;;;; ediff + `(ediff-fine-diff-A ((,class (:background ,orange-lc)))) + `(ediff-fine-diff-B ((,class (:background ,green-lc)))) + `(ediff-fine-diff-C ((,class (:background ,yellow-lc)))) + + `(ediff-current-diff-C ((,class (:background ,blue-lc)))) + + `(ediff-even-diff-A ((,class (:background ,base01 + :foreground ,base3 )))) + `(ediff-odd-diff-A ((,class (:background ,base01 + :foreground ,base03 )))) + `(ediff-even-diff-B ((,class (:background ,base01 + :foreground ,base03 )))) + `(ediff-odd-diff-B ((,class (:background ,base01 + :foreground ,base03 )))) + `(ediff-even-diff-C ((,class (:background ,base01 + :foreground ,base0 )))) + `(ediff-odd-diff-C ((,class (:background ,base01 + :foreground ,base03 )))) + +;;;;;; alternative ediff (not finished) + ;; `(ediff-fine-diff-A ((,class ( + ;; :background ,(solarized-color-blend blue base03 0.25)) + ;; ))) + ;; `(ediff-fine-diff-B ((,class ( + ;; :background ,(solarized-color-blend violet base03 0.25)) + ;; ))) + ;; `(ediff-fine-diff-C ((,class ( + ;; :background ,(solarized-color-blend yellow base03 0.25)) + ;; ))) + ;; `(ediff-current-diff-A ((,class ( + ;; :background ,(solarized-color-blend blue base03 0.15) + ;; )))) + ;; `(ediff-current-diff-B ((,class ( + ;; :background ,(solarized-color-blend violet base03 0.15) + ;; )))) + ;; `(ediff-current-diff-C ((,class ( + ;; :background ,(solarized-color-blend yellow base03 0.15) + ;; )))) + ;; `(ediff-even-diff-A ((,class ( + ;; ;; :background ,(solarized-color-blend base0 base03 0.15) + ;; :background ,base02 + ;; ;; :foreground ,base2 + ;; ;; :background ,(solarized-color-blend green base02 0.15) + ;; )))) + ;; `(ediff-even-diff-B ((,class ( + ;; ;; :background ,base01 + ;; :background ,base02 + ;; ;; :foreground ,base2 + ;; )))) + ;; `(ediff-even-diff-C ((,class ( + ;; ;; :background ,base01 + ;; :background ,base02 + ;; ;; :foreground ,base2 + ;; )))) + ;; `(ediff-odd-diff-A ((,class ( + ;; ;; :background ,base01 + ;; :background ,base02 + ;; )))) + ;; `(ediff-odd-diff-B ((,class ( + ;; ;; :background ,base01 + ;; :background ,base02 + ;; )))) + ;; `(ediff-odd-diff-C ((,class ( + ;; ;; :background ,base01 + ;; :background ,base03 + ;; )))) + ;; `(ediff-current-diff-Ancestor ((,class (:background "VioletRed" :foreground "Black")))) + ;; `(ediff-even-diff-Ancestor ((,class (:background "Grey" :foreground "White")))) + ;; `(ediff-fine-diff-Ancestor ((,class (:background "Green" :foreground "Black")))) + ;; `(ediff-odd-diff-Ancestor ((,class (:background "gray40" :foreground "cyan3")))) + ;; `(ediff-even-diff-A ((,class (:underline ,base01)))) + ;; `(ediff-odd-diff-A ((,class (:underline ,base01 + ;; )))) + ;; `(ediff-even-diff-B ((,class (:background ,base01 + ;; :foreground ,base03 + ;; )))) + ;; `(ediff-odd-diff-B ((,class (:background ,base01 + ;; :foreground ,base03 + ;; )))) + ;; `(ediff-even-diff-C ((,class (:background ,base01 + ;; :foreground ,base0 + ;; )))) + ;; `(ediff-odd-diff-C ((,class (:background ,base01 + ;; :foreground ,base03 + ;; )))) +;;;;; diff-hl + `(diff-hl-change ((,class (:background ,blue-lc :foreground ,blue-hc)))) + `(diff-hl-delete ((,class (:background ,red-lc :foreground ,red-hc)))) + `(diff-hl-insert ((,class (:background ,green-lc :foreground ,green-hc)))) + `(diff-hl-unknown ((,class (:background ,cyan-lc :foreground ,cyan-hc)))) +;;;;; edts + `(edts-face-error-line + ((,(append '((supports :underline (:style line))) class) + (:underline (:style line :color ,(if (eq variant 'light) red-l red)) :inherit unspecified)) + (,class (:foreground ,red-hc :background ,red-lc :weight bold :underline t)))) + `(edts-face-warning-line + ((,(append '((supports :underline (:style line))) class) + (:underline (:style line :color ,(if (eq variant 'light) yellow-l yellow)) :inherit unspecified)) + (,class (:foreground ,yellow-hc :background ,yellow-lc :weight bold :underline t)))) + `(edts-face-error-fringe-bitmap + ((,class (:foreground ,(if (eq variant 'light) red-l red) :background unspecified :weight bold)))) + `(edts-face-warning-fringe-bitmap + ((,class (:foreground ,(if (eq variant 'light) yellow-l yellow) :background unspecified :weight bold)))) + `(edts-face-error-mode-line + ((,class (:background ,(if (eq variant 'light) red-l red) :foreground unspecified)))) + `(edts-face-warning-mode-line + ((,class (:background ,(if (eq variant 'light) yellow-l yellow) :foreground unspecified)))) +;;;;; elfeed + `(elfeed-search-date-face ((,class (:foreground ,base01)))) + `(elfeed-search-feed-face ((,class (:foreground ,base01)))) + `(elfeed-search-tag-face ((,class (:foreground ,base0)))) + `(elfeed-search-title-face ((,class (:foreground ,base0)))) + +;;;;; elscreen + `(elscreen-tab-background-face ((,class (:background ,base03)))) + `(elscreen-tab-current-screen-face ((,class (:background ,base1 :foreground ,base03)) (t (:underline t)))) + `(elscreen-tab-other-screen-face ((,class (:background ,base02 :foreground ,base01)))) + `(elscreen-tab-control-face ((,class (:background ,base03 :foreground ,base0)))) +;;;;; epa + `(epa-mark ((,class (:foreground ,magenta :weight bold)))) + `(epa-string ((,class (:foreground ,violet)))) + `(epa-validity-disabled ((,class (:inverse-video t :slant italic)))) + `(epa-validity-high ((,class (:weight bold)))) + `(epa-validity-low ((,class (:slant italic)))) + `(epa-validity-medium ((,class (:slant italic)))) +;;;;; epc + `(epc:face-title ((,class (:foreground ,blue :background ,base03 + :weight normal :underline nil)))) +;;;;; eshell + `(eshell-prompt ((,class (:foreground ,yellow :weight bold)))) + `(eshell-ls-archive ((,class (:foreground ,red :weight bold)))) + `(eshell-ls-backup ((,class (:inherit font-lock-comment-face)))) + `(eshell-ls-clutter ((,class (:inherit font-lock-comment-face)))) + `(eshell-ls-directory ((,class (:foreground ,blue :weight bold)))) + `(eshell-ls-executable ((,class (:foreground ,red :weight bold)))) + `(eshell-ls-unreadable ((,class (:foreground ,base0)))) + `(eshell-ls-missing ((,class (:inherit font-lock-warning-face)))) + `(eshell-ls-product ((,class (:inherit font-lock-doc-face)))) + `(eshell-ls-special ((,class (:foreground ,yellow :weight bold)))) + `(eshell-ls-symlink ((,class (:foreground ,cyan :weight bold)))) +;;;;; evil-search-highlight-persist + `(evil-search-highlight-persist-highlight-face ((,class (:background ,(if (eq variant 'light) green-lc violet-lc))))) +;;;;; fic + `(fic-author-face ((,class (:background ,base03 :foreground ,orange + :underline t :slant italic)))) + `(fic-face ((,class (:background ,base03 :foreground ,orange + :weight normal :slant italic)))) + `(font-lock-fic-face ((,class (:background ,base03 :foreground ,orange + :weight normal :slant italic)))) +;;;;; fixmee + `(fixmee-notice-face ((,class (:background nil :foreground ,base1 + :underline nil :slant italic :weight bold)))) + +;;;;; flx + `(flx-highlight-face ((,class (:foreground ,blue + :weight normal :underline nil)))) +;;;;; flymake + `(flymake-errline + ((,(append '((supports :underline (:style wave))) class) + (:underline (:style wave :color ,red) :inherit unspecified + :foreground unspecified :background unspecified)) + (,class (:foreground ,red-hc :background ,red-lc :weight bold :underline t)))) + `(flymake-infoline + ((,(append '((supports :underline (:style wave))) class) + (:underline (:style wave :color ,green) :inherit unspecified + :foreground unspecified :background unspecified)) + (,class (:foreground ,green-hc :background ,green-lc)))) + `(flymake-warnline + ((,(append '((supports :underline (:style wave))) class) + (:underline (:style wave :color ,yellow) :inherit unspecified + :foreground unspecified :background unspecified)) + (,class (:foreground ,yellow-hc :background ,yellow-lc :weight bold :underline t)))) +;;;;; flycheck + `(flycheck-error + ((,(append '((supports :underline (:style line))) class) + (:underline (:style line :color ,(if (eq variant 'light) red-l red)) :inherit unspecified)) + (,class (:foreground ,red-hc :background ,red-lc :weight bold :underline t)))) + `(flycheck-warning + ((,(append '((supports :underline (:style line))) class) + (:underline (:style line :color ,(if (eq variant 'light) yellow-l yellow)) :inherit unspecified)) + (,class (:foreground ,yellow-hc :background ,yellow-lc :weight bold :underline t)))) + `(flycheck-info + ((,(append '((supports :underline (:style line))) class) + (:underline (:style line :color ,(if (eq variant 'light) blue-l blue)) :inherit unspecified)) + (,class (:foreground ,blue-hc :background ,blue-lc :weight bold :underline t)))) + `(flycheck-fringe-error + ((,class (:foreground ,(if (eq variant 'light) red-l red) :background unspecified :weight bold)))) + `(flycheck-fringe-warning + ((,class (:foreground ,(if (eq variant 'light) yellow-l yellow) :background unspecified :weight bold)))) + `(flycheck-fringe-info + ((,class (:foreground ,(if solarized-emphasize-indicators + blue-hc base01) + :background ,(if solarized-emphasize-indicators + blue-lc base03) :weight bold)))) +;;;;; flyspell + `(flyspell-duplicate + ((,(append '((supports :underline (:style wave))) class) + (:underline (:style wave :color ,yellow) :inherit unspecified)) + (,class (:foreground ,yellow :weight bold :underline t)))) + `(flyspell-incorrect + ((,(append '((supports :underline (:style wave))) class) + (:underline (:style wave :color ,red) :inherit unspecified)) + (,class (:foreground ,red :weight bold :underline t)))) +;;;;; erc + `(erc-action-face ((,class (:inherit erc-default-face)))) + `(erc-bold-face ((,class (:weight bold)))) + `(erc-current-nick-face ((,class (:foreground ,blue :weight bold)))) + `(erc-dangerous-host-face ((,class (:inherit font-lock-warning-face)))) + `(erc-default-face ((,class (:foreground ,base0)))) + `(erc-highlight-face ((,class (:inherit erc-default-face + :background ,base02)))) + `(erc-direct-msg-face ((,class (:inherit erc-default-face)))) + `(erc-error-face ((,class (:inherit font-lock-warning-face)))) + `(erc-fool-face ((,class (:inherit erc-default-face)))) + `(erc-input-face ((,class (:foreground ,yellow)))) + `(erc-keyword-face ((,class (:foreground ,blue :weight bold)))) + `(erc-nick-default-face ((,class (:foreground ,yellow :weight bold)))) + `(erc-my-nick-face ((,class (:foreground ,red :weight bold)))) + `(erc-nick-msg-face ((,class (:inherit erc-default-face)))) + `(erc-notice-face ((,class (:foreground ,green)))) + `(erc-pal-face ((,class (:foreground ,orange :weight bold)))) + `(erc-prompt-face ((,class (:foreground ,orange :background ,base03 :weight bold)))) + `(erc-timestamp-face ((,class (:foreground ,green)))) + `(erc-underline-face ((t (:underline t)))) +;;;;; git-gutter + `(git-gutter:added + ((,class (:weight normal + :foreground ,(if solarized-emphasize-indicators + green s-fringe-fg) + :background ,s-fringe-bg + )))) + `(git-gutter:deleted + ((,class (:weight normal + :foreground ,(if solarized-emphasize-indicators + red s-fringe-fg) + :background ,s-fringe-bg + )))) + `(git-gutter:modified + ((,class (:weight normal + :foreground ,(if solarized-emphasize-indicators + blue s-fringe-fg) + :background ,s-fringe-bg + )))) + `(git-gutter:unchanged + ((,class (:weight normal + :foreground ,(if solarized-emphasize-indicators + base01 s-fringe-fg) + :background ,s-fringe-bg + )))) +;;;;; git-gutter-fr + `(git-gutter-fr:added ((,class (:foreground ,green :weight bold)))) + `(git-gutter-fr:deleted ((,class (:foreground ,red :weight bold)))) + `(git-gutter-fr:modified ((,class (:foreground ,blue :weight bold)))) +;;;;; git-gutter+ and git-gutter+-fr + `(git-gutter+-added ((,class (:background ,green :foreground ,base03 + :weight bold)))) + `(git-gutter+-deleted ((,class (:background ,red :foreground ,base03 + :weight bold)))) + `(git-gutter+-modified ((,class (:background ,blue :foreground ,base03 + :weight bold)))) + `(git-gutter+-unchanged ((,class (:background ,base02 + :foreground ,base03 + :weight bold)))) + `(git-gutter-fr+-added ((,class (:foreground ,green :weight bold)))) + `(git-gutter-fr+-deleted ((,class (:foreground ,red :weight bold)))) + `(git-gutter-fr+-modified ((,class (:foreground ,blue :weight bold)))) +;;;;; go-direx + `(go-direx-header ((,class (:foreground ,blue)))) + `(go-direx-label ((,class (:foreground ,green)))) + `(go-direx-package ((,class (:foreground ,base1 :weight bold)))) +;;;;; guide-key + `(guide-key/highlight-command-face ((,class (:foreground ,blue)))) + `(guide-key/key-face ((,class (:foreground ,base01)))) + `(guide-key/prefix-command-face ((,class (:foreground ,green)))) +;;;;; gnus + `(gnus-group-mail-1 ((,class (:weight bold :inherit gnus-group-mail-1-empty)))) + `(gnus-group-mail-1-empty ((,class (:inherit gnus-group-news-1-empty)))) + `(gnus-group-mail-2 ((,class (:weight bold :inherit gnus-group-mail-2-empty)))) + `(gnus-group-mail-2-empty ((,class (:inherit gnus-group-news-2-empty)))) + `(gnus-group-mail-3 ((,class (:weight bold :inherit gnus-group-mail-3-empty)))) + `(gnus-group-mail-3-empty ((,class (:inherit gnus-group-news-3-empty)))) + `(gnus-group-mail-low ((,class (:weight bold :inherit gnus-group-mail-low-empty)))) + `(gnus-group-mail-low-empty ((,class (:inherit gnus-group-news-low-empty)))) + `(gnus-group-news-1 ((,class (:weight bold :inherit gnus-group-news-1-empty)))) + `(gnus-group-news-2 ((,class (:weight bold :inherit gnus-group-news-2-empty)))) + `(gnus-group-news-3 ((,class (:weight bold :inherit gnus-group-news-3-empty)))) + `(gnus-group-news-4 ((,class (:weight bold :inherit gnus-group-news-4-empty)))) + `(gnus-group-news-5 ((,class (:weight bold :inherit gnus-group-news-5-empty)))) + `(gnus-group-news-6 ((,class (:weight bold :inherit gnus-group-news-6-empty)))) + `(gnus-group-news-low ((,class (:weight bold :inherit gnus-group-news-low-empty)))) + `(gnus-header-content ((,class (:inherit message-header-other)))) + `(gnus-header-from ((,class (:inherit message-header-other)))) + `(gnus-header-name ((,class (:inherit message-header-name)))) + `(gnus-header-newsgroups ((,class (:inherit message-header-other)))) + `(gnus-header-subject ((,class (:inherit message-header-subject)))) + `(gnus-summary-cancelled ((,class (:foreground ,orange)))) + `(gnus-summary-high-ancient ((,class (:foreground ,blue :weight bold)))) + `(gnus-summary-high-read ((,class (:foreground ,green :weight bold)))) + `(gnus-summary-high-ticked ((,class (:foreground ,orange :weight bold)))) + `(gnus-summary-high-unread ((,class (:foreground ,base0 :weight bold)))) + `(gnus-summary-low-ancient ((,class (:foreground ,blue)))) + `(gnus-summary-low-read ((t (:foreground ,green)))) + `(gnus-summary-low-ticked ((,class (:foreground ,orange)))) + `(gnus-summary-low-unread ((,class (:foreground ,base0)))) + `(gnus-summary-normal-ancient ((,class (:foreground ,blue)))) + `(gnus-summary-normal-read ((,class (:foreground ,green)))) + `(gnus-summary-normal-ticked ((,class (:foreground ,orange)))) + `(gnus-summary-normal-unread ((,class (:foreground ,base0)))) + `(gnus-summary-selected ((,class (:foreground ,yellow :weight bold)))) + `(gnus-cite-1 ((,class (:foreground ,blue)))) + `(gnus-cite-2 ((,class (:foreground ,blue)))) + `(gnus-cite-3 ((,class (:foreground ,blue)))) + `(gnus-cite-4 ((,class (:foreground ,green)))) + `(gnus-cite-5 ((,class (:foreground ,green)))) + `(gnus-cite-6 ((,class (:foreground ,green)))) + `(gnus-cite-7 ((,class (:foreground ,red)))) + `(gnus-cite-8 ((,class (:foreground ,red)))) + `(gnus-cite-9 ((,class (:foreground ,red)))) + `(gnus-cite-10 ((,class (:foreground ,yellow)))) + `(gnus-cite-11 ((,class (:foreground ,yellow)))) + `(gnus-group-news-1-empty ((,class (:foreground ,yellow)))) + `(gnus-group-news-2-empty ((,class (:foreground ,green)))) + `(gnus-group-news-3-empty ((,class (:foreground ,green)))) + `(gnus-group-news-4-empty ((,class (:foreground ,blue)))) + `(gnus-group-news-5-empty ((,class (:foreground ,blue)))) + `(gnus-group-news-6-empty ((,class (:foreground ,blue-lc)))) + `(gnus-group-news-low-empty ((,class (:foreground ,base01)))) + `(gnus-signature ((,class (:foreground ,yellow)))) + `(gnus-x-face ((,class (:background ,base0 :foreground ,base03)))) +;;;;; helm + ;; These probably needs tweaking. + `(helm-apt-deinstalled ((,class (:foreground ,base01)))) + `(helm-apt-installed ((,class (:foreground ,green)))) + `(helm-bookmark-directory ((,class (:inherit helm-ff-directory)))) + `(helm-bookmark-file ((,class (:foreground ,base0)))) + `(helm-bookmark-gnus ((,class (:foreground ,cyan)))) + `(helm-bookmark-info ((,class (:foreground ,green)))) + `(helm-bookmark-man ((,class (:foreground ,violet)))) + `(helm-bookmark-w3m ((,class (:foreground ,yellow)))) + `(helm-bookmarks-su ((,class (:foreground ,orange)))) + `(helm-buffer-not-saved ((,class (:foreground ,orange)))) + `(helm-buffer-saved-out ((,class (:foreground ,red :background ,base03 + :inverse-video t)))) + `(helm-buffer-size ((,class (:foreground ,base01)))) + `(helm-candidate-number ((,class (:background ,base02 :foreground ,base1 + :bold t)))) + `(helm-ff-directory ((,class (:background ,base03 :foreground ,blue)))) + `(helm-ff-executable ((,class (:foreground ,green)))) + `(helm-ff-file ((,class (:background ,base03 :foreground ,base0)))) + `(helm-ff-invalid-symlink ((,class (:background ,base03 :foreground ,orange + :slant italic)))) + `(helm-ff-prefix ((,class (:background ,yellow :foreground ,base03)))) + `(helm-ff-symlink ((,class (:foreground ,cyan)))) + `(helm-grep-file ((,class (:foreground ,cyan :underline t)))) + `(helm-grep-finish ((,class (:foreground ,green)))) + `(helm-grep-lineno ((,class (:foreground ,orange)))) + `(helm-grep-match ((,class (:inherit match)))) + `(helm-grep-running ((,class (:foreground ,red)))) + `(helm-header ((,class (:inherit header-line)))) + `(helm-lisp-completion-info ((,class (:foreground ,base0)))) + `(helm-lisp-show-completion ((,class (:foreground ,yellow :background ,base02 + :bold t)))) + `(helm-M-x-key ((,class (:foreground ,orange :underline t)))) + `(helm-moccur-buffer ((,class (:foreground ,cyan :underline t)))) + `(helm-match ((,class (:inherit match)))) + `(helm-selection ((,class (:background ,base02 :underline t)))) + `(helm-selection-line ((,class (:background ,base02 :foreground ,base1 + :underline nil)))) + `(helm-separator ((,class (:foreground ,red)))) + `(helm-source-header ((,class (:background ,blue-lc :foreground ,base03 + :underline nil)))) + `(helm-time-zone-current ((,class (:foreground ,green)))) + `(helm-time-zone-home ((,class (:foreground ,red)))) + `(helm-visible-mark ((,class (:background ,base03 :foreground ,magenta :bold t)))) +;;;;; helm-css-scss + `(helm-css-scss-selector-depth-face-1 ((,class (:foreground ,base0)))) + `(helm-css-scss-selector-depth-face-2 ((,class (:foreground ,blue)))) + `(helm-css-scss-selector-depth-face-3 ((,class (:foreground ,cyan)))) + `(helm-css-scss-selector-depth-face-4 ((,class (:foreground ,green)))) + `(helm-css-scss-selector-depth-face-5 ((,class (:foreground ,yellow)))) + `(helm-css-scss-selector-depth-face-6 ((,class (:foreground ,violet)))) + `(helm-css-scss-target-line-face ((,class (:background unspecified :foreground ,magenta)))) +;;;;; helm-go-package + `(helm-source-go-package-godoc-description ((,class (:foreground ,base01)))) +;;;;; helm-swoop + `(helm-swoop-target-line-face ((,class (:foreground unspecified :background ,base02)))) + `(helm-swoop-target-line-block-face ((,class (:foreground unspecified :background ,base02)))) + `(helm-swoop-target-word-face ((,class (:foreground ,magenta :background unspecified)))) +;;;;; hi-lock-mode + `(hi-yellow ((,class (:foreground ,(solarized-color-blend yellow base1 0.5) + :background,(solarized-color-blend yellow base03 0.15))))) + `(hi-pink ((,class (:foreground ,(solarized-color-blend magenta base1 0.5) + :background,(solarized-color-blend magenta base03 0.15))))) + `(hi-green ((,class (:foreground ,(solarized-color-blend green base1 0.5) + :background,(solarized-color-blend green base03 0.15))))) + `(hi-blue ((,class (:foreground ,(solarized-color-blend blue base1 0.5) + :background,(solarized-color-blend blue base03 0.15))))) + `(hi-black-b ((,class (:foreground ,base1 + :background ,base03 + :weight bold)))) + `(hi-blue-b ((,class (:weight bold + :foreground ,(solarized-color-blend cyan base1 0.7) + :background ,(solarized-color-blend cyan base03 0.2))))) + `(hi-green-b ((,class (:weight bold + :foreground ,(solarized-color-blend green base1 0.7) + :background ,(solarized-color-blend green base03 0.2))))) + `(hi-red-b ((,class (:weight bold + :foreground ,(solarized-color-blend red base1 0.7) + :background ,(solarized-color-blend red base03 0.2))))) + `(hi-black-hb ((,class (:weight bold + :foreground ,base1 + :background ,base02)))) +;;;;; highlight-changes + `(highlight-changes ((,class (:foreground ,orange)))) + `(highlight-changes-delete ((,class (:foreground ,red :underline t)))) +;;;;; highlight-indentation + `(highlight-indentation-face ((,class (:background ,base02)))) + `(highlight-indentation-current-column-face((,class (:background ,base02)))) +;;;;; highlight-symbol + `(highlight-symbol-face ((,class (:foreground ,magenta)))) +;;;;; hl-line-mode + `(hl-line ((,class (:background ,base02)))) + `(hl-line-face ((,class (:background ,base02)))) +;;;;; ido-mode + `(ido-first-match ((,class (:foreground ,yellow :weight normal)))) + `(ido-only-match ((,class (:foreground ,base03 :background ,yellow :weight normal)))) + `(ido-subdir ((,class (:foreground ,blue)))) + `(ido-incomplete-regexp ((,class (:foreground ,red :weight bold )))) + `(ido-indicator ((,class (:background ,red :foreground ,base03 :width condensed)))) + `(ido-virtual ((,class (:foreground ,cyan)))) +;;;;; info + `(info-title-1 ((,class (:foreground ,base1 :weight bold)))) + `(info-title-2 ((,class (:foreground ,base1 :weight bold)))) + `(info-title-3 ((,class (:weight bold)))) + `(info-title-4 ((,class (:weight bold)))) + `(info-node ((,class (:foreground ,base1 :slant italic :weight bold)))) + `(info-header-node ((,class (:inherit info-node)))) + `(info-header-xref ((,class (:inherit info-xref)))) + `(info-index-match ((,class (:inherit match)))) + `(info-menu-header ((,class (:inherit variable-pitch :weight bold)))) + `(info-menu-star ((,class (:foreground ,orange)))) + `(info-xref ((,class (:inherit link)))) + `(info-xref-visited ((,class (:inherit (link-visited info-xref))))) +;;;;; info+ + `(info-file + ((,class (:foreground ,yellow :background ,base02)))) + `(info-menu + ((,class (:foreground ,violet :background ,base02)))) + `(info-single-quote + ((,class (:foreground ,cyan :inherit font-lock-string-face)))) + `(info-quoted-name + ((,class (:foreground ,orange :inherit font-lock-string-face)))) + `(info-string + ((,class (:foreground ,blue :inherit font-lock-string-face)))) + `(info-command-ref-item + ((,class (:foreground ,green :background ,base02)))) + `(info-constant-ref-item + ((,class (:foreground ,red :background ,base02)))) + `(info-function-ref-item + ((,class (:foreground ,cyan :background ,base02)))) + `(info-macro-ref-item + ((,class (:foreground ,green :background ,base02)))) + `(info-reference-item + ((,class (:background ,base02)))) + `(info-special-form-ref-item + ((,class (:foreground ,magenta :background ,base02)))) + `(info-syntax-class-item + ((,class (:foreground ,magenta :background ,base02)))) + `(info-user-option-ref-item + ((,class (:foreground ,orange :background ,base02)))) +;;;;; jabber + `(jabber-activity-face ((,class (:weight bold :foreground ,red)))) + `(jabber-activity-personal-face ((,class (:weight bold :foreground ,blue)))) + `(jabber-chat-error ((,class (:weight bold :foreground ,red)))) + `(jabber-chat-prompt-foreign ((,class (:weight bold :foreground ,red)))) + `(jabber-chat-prompt-local ((,class (:weight bold :foreground ,blue)))) + `(jabber-chat-prompt-system ((,class (:weight bold :foreground ,green)))) + `(jabber-chat-text-foreign ((,class (:foreground ,base1)))) + `(jabber-chat-text-local ((,class (:foreground ,base0)))) + `(jabber-chat-rare-time-face ((,class (:underline t :foreground ,green)))) + `(jabber-roster-user-away ((,class (:slant italic :foreground ,green)))) + `(jabber-roster-user-chatty ((,class (:weight bold :foreground ,orange)))) + `(jabber-roster-user-dnd ((,class (:slant italic :foreground ,red)))) + `(jabber-roster-user-error ((,class (:weight light :slant italic :foreground ,red)))) + `(jabber-roster-user-offline ((,class (:foreground ,base01)))) + `(jabber-roster-user-online ((,class (:weight bold :foreground ,blue)))) + `(jabber-roster-user-xa ((,class (:slant italic :foreground ,magenta)))) +;;;;; js2-mode colors + `(js2-error ((,class (:foreground ,red)))) + `(js2-external-variable ((,class (:foreground ,orange)))) + `(js2-function-param ((,class (:foreground ,green)))) + `(js2-instance-member ((,class (:foreground ,magenta)))) + `(js2-jsdoc-html-tag-delimiter ((,class (:foreground ,cyan)))) + `(js2-jsdoc-html-tag-name ((,class (:foreground ,orange)))) + `(js2-jsdoc-tag ((,class (:foreground ,cyan)))) + `(js2-jsdoc-type ((,class (:foreground ,blue)))) + `(js2-jsdoc-value ((,class (:foreground ,violet)))) + `(js2-magic-paren ((,class (:underline t)))) + `(js2-private-function-call ((,class (:foreground ,yellow)))) + `(js2-private-member ((,class (:foreground ,blue)))) + `(js2-warning ((,class (:underline ,orange)))) +;;;;; jedi + `(jedi:highlight-function-argument ((,class (:inherit bold)))) +;;;;; kite + ;; Sadly kite is not very stable for me so these faces might miss out things. + `(bg:kite-dataReceived ((,class (:background ,magenta)))) + `(bg:kite-receiveHeadersEnd ((,class (:background ,green)))) + `(bg:kite-requestStart ((,class (:background ,red)))) + `(bg:kite-sendEnd ((,class (:background ,cyan)))) + `(bg:kite-table-head ((,class (:background ,base02)))) + `(bg:kite-tick ((,class (:background ,base02)))) + `(kite-css-computed-proprietary-unused-property ((,class (:inherit kite-css-proprietary-property :foreground ,blue)))) + `(kite-css-computed-unused-property ((,class (:inherit kite-css-property :foreground ,blue)))) + `(kite-css-value-widget-error ((,class (:background ,orange-lc :foreground ,orange-hc)))) + `(kite-css-value-widget-modified ((,class (:background ,base02 :foreground ,yellow)))) + `(kite-delimited-data-face ((,class (:foreground ,green)))) + `(kite-delimiter-face ((,class (:foreground ,base1)))) + `(kite-modified-attribute-local-name-face ((,class (:inherit kite-attribute-local-name-face :background ,base02)))) + `(kite-modified-attribute-value-face ((,class (:inherit kite-attribute-value-face :background ,base02)))) + `(kite-modified-element-local-name-face ((,class (:inherit kite-element-local-name-face :background ,base02)))) + `(kite-name-face ((,class (:foreground ,blue)))) + `(kite-proto-property-name ((,class (:inherit default :foreground ,base02)))) + `(kite-ref-face ((,class (:foreground ,cyan)))) + `(kite-session-closed ((,class (:inherit default :background ,red)))) + `(kite-text-face ((,class (:background nil :foreground ,base01)))) + `(kite-node-highlight-face ((,class (:background ,base02)))) + `(bg:kite-pageStart ((,class nil))) + `(kite-attribute-colon-face ((,class (:inherit kite-name-face)))) + `(kite-attribute-local-name-face ((,class (:inherit kite-name-face)))) + `(kite-attribute-prefix-face ((,class (:inherit kite-name-face)))) + `(kite-attribute-value-delimiter-face ((,class (:inherit kite-delimiter-face)))) + `(kite-attribute-value-face ((,class (:inherit kite-delimited-data-face)))) + `(kite-boolean ((,class (:inherit nxml-char-ref-number)))) + `(kite-cdata-section-CDATA-face ((,class (:inherit kite-name-face)))) + `(kite-cdata-section-content-face ((,class (:inherit kite-text-face)))) + `(kite-cdata-section-delimiter-face ((,class (:inherit kite-delimiter-face)))) + `(kite-char-ref-delimiter-face ((,class (:inherit kite-ref-face)))) + `(kite-char-ref-number-face ((,class (:inherit kite-ref-face)))) + `(kite-comment-content-face ((,class (:slant italic)))) + `(kite-comment-delimiter-face ((,class (:inherit kite-delimiter-face)))) + `(kite-console-prompt-face ((,class (:inherit default)))) + `(kite-css-property ((,class (:inherit css-property)))) + `(kite-css-proprietary-property ((,class (:inherit css-proprietary-property)))) + `(kite-css-selected-overlay ((,class (:inherit secondary-selection)))) + `(kite-css-selector ((,class (:inherit css-selector)))) + `(kite-element-colon-face ((,class (:inherit kite-name-face)))) + `(kite-element-local-name-face ((,class (:inherit kite-name-face)))) + `(kite-element-prefix-face ((,class (:inherit kite-name-face)))) + `(kite-entity-ref-delimiter-face ((,class (:inherit kite-ref-face)))) + `(kite-entity-ref-name-face ((,class (:inherit kite-ref-face)))) + `(kite-hash-face ((,class (:inherit kite-name-face)))) + `(kite-link-face ((,class (:inherit change-log-file)))) + `(kite-loading ((,class (:inherit font-lock-comment)))) + `(kite-log-debug ((,class (:inherit font-lock-comment)))) + `(kite-log-error ((,class (:inherit error)))) + `(kite-log-log ((,class (:inherit default)))) + `(kite-log-warning ((,class (:inherit warning)))) + `(kite-markup-declaration-delimiter-face ((,class (:inherit kite-delimiter-face)))) + `(kite-namespace-attribute-colon-face ((,class (:inherit kite-name-face)))) + `(kite-namespace-attribute-prefix-face ((,class (:inherit kite-name-face)))) + `(kite-namespace-attribute-value-delimiter-face ((,class (:inherit kite-attribute-value-delimiter-face)))) + `(kite-namespace-attribute-value-face ((,class (:inherit kite-attribute-value-face)))) + `(kite-namespace-attribute-xmlns-face ((,class (:inherit kite-name-face)))) + `(kite-null ((,class (:inherit nxml-char-ref-number)))) + `(kite-number ((,class (:inherit nxml-char-ref-number)))) + `(kite-object ((,class (:inherit font-lock-variable-name)))) + `(kite-processing-instruction-content-face ((,class (:inherit kite-delimited-data-face)))) + `(kite-processing-instruction-delimiter-face ((,class (:inherit kite-delimiter-face)))) + `(kite-processing-instruction-target-face ((,class (:inherit kite-name-face)))) + `(kite-prolog-keyword-face ((,class (:inherit kite-name-face)))) + `(kite-prolog-literal-content-face ((,class (:inherit kite-delimited-data-face)))) + `(kite-prolog-literal-delimiter-face ((,class (:inherit kite-delimiter-face)))) + `(kite-property-name ((,class (:inherit default)))) + `(kite-quote ((,class (:inherit font-lock-keyword)))) + `(kite-stack-column-number ((,class (:inherit kite-number)))) + `(kite-stack-error-message ((,class (:inherit default)))) + `(kite-stack-error-type ((,class (:inherit error)))) + `(kite-stack-file-name ((,class (:inherit link)))) + `(kite-stack-function-name ((,class (:inherit font-lock-function-name-face)))) + `(kite-stack-line-number ((,class (:inherit kite-number)))) + `(kite-stack-pseudo-file-name ((,class (:inherit default)))) + `(kite-string ((,class (:inherit font-lock-string)))) + `(kite-table-head ((,class (:inherit highlight)))) + `(kite-tag-delimiter-face ((,class (:inherit kite-delimiter-face)))) + `(kite-tag-slash-face ((,class (:inherit kite-name-face)))) + `(kite-undefined ((,class (:inherit nxml-char-ref-number)))) +;;;;; ledger-mode + `(ledger-font-payee-uncleared-face ((t (:foreground ,red)))) + `(ledger-font-payee-cleared-face ((t (:foreground ,green :weight normal)))) + `(ledger-font-xact-highlight-face ((t (:background ,base02)))) + `(ledger-font-pending-face ((t (:foreground ,yellow weight: normal)))) + `(ledger-font-other-face ((t (:foreground ,base0)))) + `(ledger-font-posting-account-face ((t (:foreground ,cyan)))) + `(ledger-font-posting-account-cleared-face ((t (:foreground ,base0)))) + `(ledger-font-posting-account-pending-face ((t (:foreground ,yellow)))) + `(ledger-font-posting-amount-face ((t (:foreground ,yellow)))) + `(ledger-occur-narrowed-face ((t (:foreground ,base3 :invisible t)))) + `(ledger-occur-xact-face ((t (:background ,base02)))) + `(ledger-font-comment-face ((t (:foreground ,base01)))) + `(ledger-font-reconciler-uncleared-face ((t (:foreground ,red :weight bold)))) + `(ledger-font-reconciler-cleared-face ((t (:foreground ,base0 :weight normal)))) + `(ledger-font-reconciler-pending-face ((t (:foreground ,yellow :weight normal)))) + `(ledger-font-report-clickable-face ((t (:foreground ,yellow :weight normal)))) +;;;;; linum-mode + `(linum ((,class (:foreground ,s-fringe-fg :background ,s-fringe-bg)))) +;;;;; lusty-explorer + `(lusty-directory-face ((,class (:inherit dired-directory)))) + `(lusty-file-face ((,class nil))) + `(lusty-match-face ((,class (:inherit ido-first-match)))) + `(lusty-slash-face ((,class (:foreground ,cyan :weight bold)))) +;;;;; magit + `(magit-section-title ((,class (:foreground ,yellow :weight bold)))) + `(magit-branch ((,class (:foreground ,orange :weight bold)))) + `(magit-item-highlight ((,class (:background ,base02 :weight unspecified)))) + `(magit-log-author ((,class (:foreground ,cyan)))) + `(magit-log-graph ((,class (:foreground ,base01)))) + `(magit-log-head-label-bisect-bad ((,class (:background ,red-hc :foreground ,red-lc + :box 1)))) + `(magit-log-head-label-bisect-good ((,class (:background ,green-hc :foreground ,green-lc + :box 1)))) + `(magit-log-head-label-default ((,class (:background ,base02 :box 1)))) + `(magit-log-head-label-local ((,class (:background ,blue-lc :foreground ,blue-hc + :box 1)))) + `(magit-log-head-label-patches ((,class (:background ,red-lc :foreground ,red-hc + :box 1)))) + `(magit-log-head-label-remote ((,class (:background ,green-lc :foreground ,green-hc + :box 1)))) + `(magit-log-head-label-tags ((,class (:background ,yellow-lc :foreground ,yellow-hc + :box 1)))) + ;; magit hotfix + `(magit-header ((,class (:inherit default)))) + ;; TODO + `(magit-log-sha1 ((,class (:foreground ,yellow)))) + `(magit-cherry-equivalent ((,class (:foreground ,magenta)))) + `(magit-cherry-unmatched ((,class (:foreground ,cyan)))) + ;; `(magit-log-head-label-bisect-skip ((,class (:background "light goldenrod" :foreground "dark goldenrod" :box 1)))) + ;; `(magit-log-head-label-head ((,class (:background "Grey70" :foreground "Black" :box 1)))) + ;; `(magit-log-head-label-wip ((,class (:background "Grey95" :foreground "LightSkyBlue3" :box 1)))) + ;; `(magit-log-reflog-label-checkout ((,class (:background "Grey85" :foreground "LightSkyBlue4" :box 1)))) + ;; `(magit-log-reflog-label-cherry-pick ((,class (:background "light green" :foreground "dark olive green" :box 1)))) + ;; `(magit-log-reflog-label-commit ((,class (:background "LemonChiffon1" :foreground "goldenrod4" :box 1)))) + ;; `(magit-log-reflog-label-other ((,class (:background "Grey50" :box 1)))) + ;; `(magit-log-reflog-label-rebase ((,class (:background "Grey85" :foreground "OliveDrab4" :box 1)))) + ;; `(magit-log-reflog-label-remote ((,class (:background "Grey50" :box 1)))) + ;; `(magit-log-reflog-label-reset ((,class (:background "IndianRed1" :foreground "IndianRed4" :box 1)))) + `(magit-process-ng ((,class (:inherit magit-header :foreground ,red)))) + `(magit-process-ok ((,class (:inherit magit-header :foreground ,green)))) + `(magit-signature-bad ((,class (:foreground ,red)))) + `(magit-signature-good ((,class (:foreground ,green)))) + `(magit-signature-none ((,class (:inherit magit-log-message)))) + `(magit-signature-untrusted ((,class (:foreground ,cyan)))) + `(magit-whitespace-warning-face ((,class (:inherit trailing-whitespace)))) +;;;;; markdown-mode + `(markdown-blockquote-face ((,class (:inherit font-lock-doc-face)))) + `(markdown-bold-face ((,class (:inherit bold)))) + `(markdown-comment-face ((,class (:foreground ,base01 :strike-through t)))) + `(markdown-footnote-face ((,class (:inherit default)))) + `(markdown-header-delimiter-face ((,class (:foreground ,base01)))) + `(markdown-header-face ((,class (:foreground ,blue)))) + `(markdown-header-face-1 ((,class (:inherit markdown-header-face)))) + `(markdown-header-face-2 ((,class (:inherit markdown-header-face)))) + `(markdown-header-face-3 ((,class (:inherit markdown-header-face)))) + `(markdown-header-face-4 ((,class (:inherit markdown-header-face)))) + `(markdown-header-face-5 ((,class (:inherit markdown-header-face)))) + `(markdown-header-face-6 ((,class (:inherit markdown-header-face)))) + `(markdown-header-rule-face ((,class (:foreground ,base01)))) + `(markdown-inline-code-face ((,class (:foreground ,base01)))) + `(markdown-italic-face ((,class (:inherit italic)))) + `(markdown-language-keyword-face ((,class (:inherit default)))) + `(markdown-line-break-face ((,class (:inherit default :underline t)))) + `(markdown-link-face ((,class (:inherit default :foreground ,yellow)))) + `(markdown-link-title-face ((,class (:inherit font-lock-comment-face)))) + `(markdown-list-face ((,class (:inherit font-lock-builtin-face)))) + `(markdown-math-face ((,class (:inherit font-lock-string-face)))) + `(markdown-metadata-key-face ((,class (:inherit font-lock-comment-face)))) + `(markdown-metadata-value-face ((,class (:inherit default)))) + `(markdown-missing-link-face ((,class (:inherit font-lock-warning-face)))) + `(markdown-pre-face ((,class (:foreground ,base01)))) + `(markdown-reference-face ((,class (:inherit default :foreground ,base01)))) + `(markdown-url-face ((,class (:foreground ,base01)))) +;;;;; multiple-cursors + `(mc/cursor-face ((,class (:inherit cursor :inverse-video nil)))) +;;;;; message-mode + `(message-cited-text ((,class (:foreground ,base01)))) + `(message-header-name ((,class (:foreground ,base01)))) + `(message-header-other ((,class (:foreground ,base0 :weight normal)))) + `(message-header-to ((,class (:foreground ,base0 :weight normal)))) + `(message-header-cc ((,class (:foreground ,base0 :weight normal)))) + `(message-header-newsgroups ((,class (:foreground ,yellow :weight bold)))) + `(message-header-subject ((,class (:foreground ,cyan :weight normal)))) + `(message-header-xheader ((,class (:foreground ,cyan)))) + `(message-mml ((,class (:foreground ,yellow :weight bold)))) + `(message-separator ((,class (:foreground ,base01 :slant italic)))) +;;;;; mew + `(mew-face-header-subject ((,class (:foreground ,orange)))) + `(mew-face-header-from ((,class (:foreground ,yellow)))) + `(mew-face-header-date ((,class (:foreground ,green)))) + `(mew-face-header-to ((,class (:foreground ,red)))) + `(mew-face-header-key ((,class (:foreground ,green)))) + `(mew-face-header-private ((,class (:foreground ,green)))) + `(mew-face-header-important ((,class (:foreground ,blue)))) + `(mew-face-header-marginal ((,class (:foreground ,base0 :weight bold)))) + `(mew-face-header-warning ((,class (:foreground ,red)))) + `(mew-face-header-xmew ((,class (:foreground ,green)))) + `(mew-face-header-xmew-bad ((,class (:foreground ,red)))) + `(mew-face-body-url ((,class (:foreground ,orange)))) + `(mew-face-body-comment ((,class (:foreground ,base0 :slant italic)))) + `(mew-face-body-cite1 ((,class (:foreground ,green)))) + `(mew-face-body-cite2 ((,class (:foreground ,blue)))) + `(mew-face-body-cite3 ((,class (:foreground ,orange)))) + `(mew-face-body-cite4 ((,class (:foreground ,yellow)))) + `(mew-face-body-cite5 ((,class (:foreground ,red)))) + `(mew-face-mark-review ((,class (:foreground ,blue)))) + `(mew-face-mark-escape ((,class (:foreground ,green)))) + `(mew-face-mark-delete ((,class (:foreground ,red)))) + `(mew-face-mark-unlink ((,class (:foreground ,yellow)))) + `(mew-face-mark-refile ((,class (:foreground ,green)))) + `(mew-face-mark-unread ((,class (:foreground ,red)))) + `(mew-face-eof-message ((,class (:foreground ,green)))) + `(mew-face-eof-part ((,class (:foreground ,yellow)))) +;;;;; mic-paren + `(paren-face-match + ((,class (:foreground ,magenta :background unspecified + :weight ,s-maybe-bold)))) + `(paren-face-mismatch + ((,class (:foreground ,base02 :background ,red + :weight ,s-maybe-bold)))) + `(paren-face-no-match + ((,class (:foreground ,base02 :background ,red + :weight ,s-maybe-bold)))) +;;;;; mingus + `(mingus-directory-face ((,class (:foreground ,blue)))) + `(mingus-pausing-face ((,class (:foreground ,magenta)))) + `(mingus-playing-face ((,class (:foreground ,cyan)))) + `(mingus-playlist-face ((,class (:foreground ,cyan )))) + `(mingus-song-file-face ((,class (:foreground ,yellow)))) + `(mingus-stopped-face ((,class (:foreground ,red)))) +;;;;; moccur + `(moccur-current-line-face ((,class (:underline t)))) + `(moccur-edit-done-face ((,class + (:foreground ,base01 + :background ,base03 + :slant italic)))) + `(moccur-edit-face + ((,class (:background ,yellow :foreground ,base03)))) + `(moccur-edit-file-face ((,class (:background ,base02)))) + `(moccur-edit-reject-face ((,class (:foreground ,red)))) + `(moccur-face ((,class (:background ,base02 :foreground ,base1 + :weight bold)))) + `(search-buffers-face ((,class (:background ,base02 :foreground ,base1 + :weight bold)))) + `(search-buffers-header-face ((,class (:background ,base02 :foreground ,yellow + :weight bold)))) +;;;;; mu4e + `(mu4e-cited-1-face ((,class (:foreground ,green :slant italic :weight normal)))) + `(mu4e-cited-2-face ((,class (:foreground ,blue :slant italic :weight normal)))) + `(mu4e-cited-3-face ((,class (:foreground ,orange :slant italic :weight normal)))) + `(mu4e-cited-4-face ((,class (:foreground ,yellow :slant italic :weight normal)))) + `(mu4e-cited-5-face ((,class (:foreground ,cyan :slant italic :weight normal)))) + `(mu4e-cited-6-face ((,class (:foreground ,green :slant italic :weight normal)))) + `(mu4e-cited-7-face ((,class (:foreground ,blue :slant italic :weight normal)))) + `(mu4e-flagged-face ((,class (:foreground ,blue :weight normal)))) + `(mu4e-unread-face ((,class (:foreground ,green :weight normal)))) + `(mu4e-view-url-number-face ((,class (:foreground ,yellow :weight normal)))) + `(mu4e-warning-face ((,class (:foreground ,red :slant normal :weight bold)))) + `(mu4e-header-highlight-face + ((,class (:inherit unspecified :foreground unspecified :background ,base02 + :underline unspecified :weight unspecified)))) + `(mu4e-view-contact-face ((,class (:foreground ,base0 :weight normal)))) + `(mu4e-view-header-key-face ((,class (:inherit message-header-name :weight normal)))) + `(mu4e-view-header-value-face ((,class (:foreground ,cyan :weight normal :slant normal)))) + `(mu4e-view-link-face ((,class (:inherit link)))) + `(mu4e-view-special-header-value-face ((,class (:foreground ,blue :weight normal :underline nil)))) +;;;;; mumamo + `(mumamo-background-chunk-submode1 ((,class (:background ,base02)))) +;;;;; nav + `(nav-face-heading ((,class (:foreground ,yellow)))) + `(nav-face-button-num ((,class (:foreground ,cyan)))) + `(nav-face-dir ((,class (:foreground ,green)))) + `(nav-face-hdir ((,class (:foreground ,red)))) + `(nav-face-file ((,class (:foreground ,base0)))) + `(nav-face-hfile ((,class (:foreground ,red)))) +;;;;; nav-flash + ;; `(nav-flash-face ((,class (:background ,base02)))) + `(nav-flash-face ((,class (:foreground + ,(apply 'solarized-color-blend + (if + (eq variant 'light) + (list yellow base1 0.2) + (list cyan base1 0.1))) + :background + ,(apply 'solarized-color-blend + (if + (eq variant 'light) + (list yellow base03 0.2) + (list cyan base03 0.3))))))) +;;;;; navi2ch + `(navi2ch-list-category-face ((,class (:foreground ,blue )))) + `(navi2ch-list-add-board-name-face ((,class (:foreground ,yellow)))) + `(navi2ch-list-board-name-face ((,class (:foreground ,blue)))) + `(navi2ch-list-change-board-name-face ((,class (:foreground ,green :weight bold)))) + `(navi2ch-bm-unread-face ((,class (:foreground ,green)))) + `(navi2ch-bm-view-face ((,class (:foreground ,yellow)))) + `(navi2ch-bm-cache-face ((,class (:foreground ,blue)))) + `(navi2ch-bm-update-face ((,class (:foreground ,orange)))) + `(navi2ch-bm-down-face ((,class (:foreground ,base1)))) + `(navi2ch-bm-mark-face ((,class (:foreground ,red)))) + `(navi2ch-bm-new-unread-face ((,class (:foreground ,green)))) + `(navi2ch-bm-new-view-face ((,class (:foreground ,yellow)))) + `(navi2ch-bm-new-cache-face ((,class (:foreground ,blue)))) + `(navi2ch-bm-new-update-face ((,class (:foreground ,orange)))) + `(navi2ch-bm-new-mark-face ((,class (:foreground ,red)))) + `(navi2ch-bm-updated-unread-face ((,class (:foreground ,green)))) + `(navi2ch-bm-updated-view-face ((,class (:foreground ,yellow)))) + `(navi2ch-bm-updated-cache-face ((,class (:foreground ,blue)))) + `(navi2ch-bm-updated-update-face ((,class (:foreground ,orange)))) + `(navi2ch-bm-updated-navi2ch-bm-updated-mark-facemark-face ((,class (:foreground ,red)))) + `(navi2ch-bm-seen-unread-face ((,class (:foreground ,green)))) + `(navi2ch-bm-seen-view-face ((,class (:foreground ,yellow)))) + `(navi2ch-bm-seen-cache-face ((,class (:foreground ,blue)))) + `(navi2ch-bm-seen-update-face ((,class (:foreground ,orange)))) + `(navi2ch-bm-seen-mark-face ((,class (:foreground ,red)))) + `(navi2ch-article-header-face ((,class (:foreground ,base1)))) + `(navi2ch-article-header-contents-face ((,class (:foreground ,blue)))) + `(navi2ch-article-header-fusianasan-face ((,class (:foreground ,blue :underline t)))) + `(navi2ch-article-link-face ((,class (:weight bold)))) + `(navi2ch-article-url-face ((,class (:weight bold)))) + `(navi2ch-article-citation-face ((,class (:foreground ,yellow)))) + `(navi2ch-article-auto-decode-face ((,class (:foreground ,base03)))) + `(navi2ch-article-message-separator-face ((,class (:foreground ,green)))) + `(navi2ch-splash-screen-face ((,class (:foreground ,cyan)))) + `(navi2ch-message-link-face ((,class (:weight bold)))) + `(navi2ch-message-url-face ((,class (:weight bold)))) + `(navi2ch-message-citation-face ((,class (:foreground ,magenta)))) +;;;;; neotree + `(neo-banner-face ((,class (:foreground ,base01)))) + `(neo-header-face ((,class (:foreground ,blue)))) + `(neo-root-dir-face ((,class (:foreground ,base1 :weight bold)))) + `(neo-dir-link-face ((,class (:foreground ,blue)))) + `(neo-file-link-face ((,class (:foreground ,base0)))) + `(neo-expand-btn-face ((,class (:foreground ,base01)))) +;;;;; org-mode + `(org-agenda-structure + ((,class (:foreground ,base1 :background ,base02 + :weight bold :slant normal :inverse-video nil :height ,solarized-height-plus-1 + :underline nil + :box (:line-width 2 :color ,base03))))) + `(org-agenda-calendar-event ((,class (:foreground ,base1)))) + `(org-agenda-calendar-sexp ((,class (:foreground ,base0 :slant italic)))) + `(org-agenda-date + ((,class (:foreground ,base01 :background ,base03 :weight normal + :box (:line-width 2 :color ,base03) + :inverse-video nil :overline nil :slant normal :height 1.0)))) + `(org-agenda-date-weekend + ((,class (:inherit org-agenda-date :inverse-video nil :background unspecified + :foreground ,base01 :weight unspecified + :underline t :overline nil :box unspecified)))) + `(org-agenda-date-today + ((,class (:inherit org-agenda-date :inverse-video t :weight bold + :underline unspecified :overline nil :box unspecified + :foreground ,blue :background ,base03)))) + `(org-agenda-done ((,class (:foreground ,base01 :slant italic)))) + `(org-archived ((,class (:foreground ,base01 :weight normal)))) + `(org-block ((,class (:foreground ,base01)))) + `(org-block-begin-line ((,class (:foreground ,base01 :slant italic)))) + `(org-checkbox ((,class (:background ,base03 :foreground ,base0 + :box (:line-width 1 :style released-button))))) + `(org-code ((,class (:foreground ,base01)))) + `(org-date ((,class (:foreground ,blue :underline t)))) + `(org-done ((,class (:weight bold :foreground ,green)))) + `(org-ellipsis ((,class (:foreground ,base01)))) + `(org-formula ((,class (:foreground ,yellow)))) + `(org-headline-done ((,class (:foreground ,green)))) + `(org-hide ((,class (:foreground ,base03)))) + `(org-level-1 ((,class (:inherit ,s-variable-pitch :foreground ,orange + ,@(when solarized-scale-org-headlines + (list :height solarized-height-plus-4)))))) + `(org-level-2 ((,class (:inherit ,s-variable-pitch :foreground ,green + ,@(when solarized-scale-org-headlines + (list :height solarized-height-plus-3)))))) + `(org-level-3 ((,class (:inherit ,s-variable-pitch :foreground ,blue + ,@(when solarized-scale-org-headlines + (list :height solarized-height-plus-2)))))) + `(org-level-4 ((,class (:inherit ,s-variable-pitch :foreground ,yellow + ,@(when solarized-scale-org-headlines + (list :height solarized-height-plus-1)))))) + `(org-level-5 ((,class (:inherit ,s-variable-pitch + :foreground ,cyan)))) + `(org-level-6 ((,class (:inherit ,s-variable-pitch + :foreground ,green)))) + `(org-level-7 ((,class (:inherit ,s-variable-pitch + :foreground ,red)))) + `(org-level-8 ((,class (:inherit ,s-variable-pitch + :foreground ,blue)))) + `(org-link ((,class (:foreground ,yellow :underline t)))) + `(org-sexp-date ((,class (:foreground ,violet)))) + `(org-scheduled ((,class (:foreground ,green)))) + `(org-scheduled-previously ((,class (:foreground ,cyan)))) + `(org-scheduled-today ((,class (:foreground ,blue :weight normal)))) + `(org-special-keyword ((,class (:foreground ,base01 :weight bold)))) + `(org-table ((,class (:foreground ,green)))) + `(org-tag ((,class (:weight bold)))) + `(org-time-grid ((,class (:foreground ,base01)))) + `(org-todo ((,class (:foreground ,cyan :weight bold)))) + `(org-upcoming-deadline ((,class (:foreground ,yellow :weight normal :underline nil)))) + `(org-warning ((,class (:foreground ,orange :weight normal :underline nil)))) + ;; org-habit + ;; (clear=blue, ready=green, alert=yellow, overdue=red. future=lower contrast) + `(org-habit-clear-face ((,class (:background ,blue-lc :foreground ,blue-hc)))) + `(org-habit-clear-future-face ((,class (:background ,blue-lc)))) + `(org-habit-ready-face ((,class (:background ,green-lc :foreground ,green)))) + `(org-habit-ready-future-face ((,class (:background ,green-lc)))) + `(org-habit-alert-face ((,class (:background ,yellow :foreground ,yellow-lc)))) + `(org-habit-alert-future-face ((,class (:background ,yellow-lc)))) + `(org-habit-overdue-face ((,class (:background ,red :foreground ,red-lc)))) + `(org-habit-overdue-future-face ((,class (:background ,red-lc)))) + ;; latest additions + `(org-agenda-dimmed-todo-face ((,class (:foreground ,base01)))) + `(org-agenda-restriction-lock ((,class (:background ,yellow)))) + `(org-clock-overlay ((,class (:background ,yellow)))) + `(org-column ((,class (:background ,base02 :strike-through nil + :underline nil :slant normal :weight normal :inherit default)))) + `(org-column-title ((,class (:background ,base02 :underline t :weight bold)))) + `(org-date-selected ((,class (:foreground ,red :inverse-video t)))) + `(org-document-info ((,class (:foreground ,base0)))) + `(org-document-title ((,class (:foreground ,base1 :weight bold :height ,solarized-height-plus-4)))) + `(org-drawer ((,class (:foreground ,cyan)))) + `(org-footnote ((,class (:foreground ,magenta :underline t)))) + `(org-latex-and-export-specials ((,class (:foreground ,orange)))) + `(org-mode-line-clock-overrun ((,class (:inherit mode-line :background ,red)))) +;;;;; outline + `(outline-1 ((,class (:inherit org-level-1 :height ,solarized-height-plus-4)))) + `(outline-2 ((,class (:inherit org-level-2 :height ,solarized-height-plus-3)))) + `(outline-3 ((,class (:inherit org-level-3 :height ,solarized-height-plus-2)))) + `(outline-4 ((,class (:inherit org-level-4 :height ,solarized-height-plus-1)))) + `(outline-5 ((,class (:inherit org-level-5)))) + `(outline-6 ((,class (:inherit org-level-6)))) + `(outline-7 ((,class (:inherit org-level-7)))) + `(outline-8 ((,class (:inherit org-level-8)))) +;;;;; paren-face + `(paren-face ((,class (:foreground ,base01)))) +;;;;; perspective + `(persp-selected-face ((,class (:foreground ,yellow)))) +;;;;; pretty-mode + `(pretty-mode-symbol-face ((,class (:foreground ,yellow :weight normal)))) +;;;;; prodigy + `(prodigy-green-face ((,class (:foreground ,green)))) + `(prodigy-red-face ((,class (:foreground ,orange)))) + `(prodigy-yellow-face ((,class (:foreground ,yellow)))) + `(prodigy-line-face ((,class (:background ,base02)))) +;;;;; popup + `(popup-face ((,class (:background ,base02 :foreground ,base0)))) + `(popup-isearch-match ((,class (:background ,yellow :foreground ,base03)))) + `(popup-menu-face ((,class (:background ,base02 :foreground ,base0)))) + `(popup-menu-mouse-face ((,class (:background ,blue :foreground ,base03)))) + `(popup-menu-selection-face ((,class (:background ,magenta :foreground ,base03)))) + `(popup-scroll-bar-background-face ((,class (:background ,base01)))) + `(popup-scroll-bar-foreground-face ((,class (:background ,base1)))) + `(popup-tip-face ((,class (:background ,base02 :foreground ,base0)))) +;;;;; pophint + `(pophint:tip-face ((,class (:background ,magenta :foreground ,base03)))) + `(pophint:match-face ((,class (:background ,blue :foreground ,base03)))) + `(pophint:pos-tip-face ((,class (:background ,base02 :foreground ,base0)))) +;;;;; powerline + `(powerline-active1 ((,class ,(if solarized-high-contrast-mode-line + `(:background ,base00 :foreground ,base03) + `(:background ,base03 :foreground ,base00))))) + `(powerline-active2 ((,class ,(if solarized-high-contrast-mode-line + `(:background ,base01 :foreground ,base03) + `(:background ,base02 :foreground ,base00))))) + `(powerline-inactive1 ((,class ,(if solarized-high-contrast-mode-line + `(:background ,base03 :foreground ,base1) + `(:background ,base02 :foreground ,base01))))) + `(powerline-inactive2 ((,class ,(if solarized-high-contrast-mode-line + `(:background ,base02 :foreground ,base1) + `(:background ,base03 :foreground ,base01))))) +;;;;; rainbow-blocks + `(rainbow-blocks-depth-1-face ((,class (:foreground ,cyan)))) + `(rainbow-blocks-depth-2-face ((,class (:foreground ,yellow)))) + `(rainbow-blocks-depth-3-face ((,class (:foreground ,blue)))) + `(rainbow-blocks-depth-4-face ((,class (:foreground ,violet)))) + `(rainbow-blocks-depth-5-face ((,class (:foreground ,green)))) + `(rainbow-blocks-depth-6-face ((,class (:foreground ,yellow)))) + `(rainbow-blocks-depth-7-face ((,class (:foreground ,blue)))) + `(rainbow-blocks-depth-8-face ((,class (:foreground ,violet)))) + `(rainbow-blocks-depth-9-face ((,class (:foreground ,green)))) + `(rainbow-blocks-unmatched-face ((,class (:foreground ,red)))) +;;;;; rainbow-delimiters + `(rainbow-delimiters-depth-1-face ((,class (:foreground ,cyan)))) + `(rainbow-delimiters-depth-2-face ((,class (:foreground ,yellow)))) + `(rainbow-delimiters-depth-3-face ((,class (:foreground ,blue)))) + `(rainbow-delimiters-depth-4-face ((,class (:foreground ,violet)))) + `(rainbow-delimiters-depth-5-face ((,class (:foreground ,green)))) + `(rainbow-delimiters-depth-6-face ((,class (:foreground ,yellow)))) + `(rainbow-delimiters-depth-7-face ((,class (:foreground ,blue)))) + `(rainbow-delimiters-depth-8-face ((,class (:foreground ,violet)))) + `(rainbow-delimiters-depth-9-face ((,class (:foreground ,green)))) + `(rainbow-delimiters-depth-10-face ((,class (:foreground ,yellow)))) + `(rainbow-delimiters-depth-11-face ((,class (:foreground ,blue)))) + `(rainbow-delimiters-depth-12-face ((,class (:foreground ,violet)))) + `(rainbow-delimiters-unmatched-face + ((,class (:foreground ,base0 :background ,base03 :inverse-video t)))) +;;;;; rst-mode + `(rst-level-1-face ((,class (:background ,yellow :foreground ,base03)))) + `(rst-level-2-face ((,class (:background ,cyan :foreground ,base03)))) + `(rst-level-3-face ((,class (:background ,blue :foreground ,base03)))) + `(rst-level-4-face ((,class (:background ,violet :foreground ,base03)))) + `(rst-level-5-face ((,class (:background ,magenta :foreground ,base03)))) + `(rst-level-6-face ((,class (:background ,red :foreground ,base03)))) +;;;;; rpm-mode + `(rpm-spec-dir-face ((,class (:foreground ,green)))) + `(rpm-spec-doc-face ((,class (:foreground ,green)))) + `(rpm-spec-ghost-face ((,class (:foreground ,red)))) + `(rpm-spec-macro-face ((,class (:foreground ,yellow)))) + `(rpm-spec-obsolete-tag-face ((,class (:foreground ,red)))) + `(rpm-spec-package-face ((,class (:foreground ,red)))) + `(rpm-spec-section-face ((,class (:foreground ,yellow)))) + `(rpm-spec-tag-face ((,class (:foreground ,blue)))) + `(rpm-spec-var-face ((,class (:foreground ,red)))) +;;;;; sh-mode + `(sh-quoted-exec ((,class (:foreground ,violet :weight bold)))) + `(sh-escaped-newline ((,class (:foreground ,yellow :weight bold)))) + `(sh-heredoc ((,class (:foreground ,yellow :weight bold)))) +;;;;; skewer-mode + `(skewer-error-face ((,class (:foreground ,orange :underline nil)))) + `(skewer-repl-log-face ((,class (:foreground ,violet)))) +;;;;; smart-mode-line + ;; use (setq sml/theme nil) to enable Solarized for sml + `(sml/filename ((,class (:foreground ,base1 :weight bold)))) + `(sml/prefix ((,class (:foreground unspecified)))) + `(sml/git ((,class (:foreground unspecified)))) + `(sml/process ((,class (:weight bold)))) + `(sml/sudo ((,class (:foreground ,orange :weight bold)))) + `(sml/read-only ((,class (:foreground ,cyan)))) + `(sml/outside-modified ((,class (:foreground , cyan)))) + `(sml/modified ((,class (:foreground ,cyan)))) + `(sml/vc-edited ((,class (:foreground ,green)))) + `(sml/charging ((,class (:foreground ,base1)))) + `(sml/discharging ((,class (:foreground ,base1 :weight bold)))) +;;;;; smartparens + `(sp-pair-overlay-face ((,class (:background ,base02)))) + `(sp-wrap-overlay-face ((,class (:background ,base02)))) + `(sp-wrap-tag-overlay-face ((,class (:background ,base02)))) + `(sp-show-pair-enclosing ((,class (:inherit highlight)))) + `(sp-show-pair-match-face + ((,class (:background unspecified :foreground ,magenta + :weight ,s-maybe-bold)))) + `(sp-show-pair-mismatch-face + ((,class (:foreground ,base02 :background ,red + :weight ,s-maybe-bold)))) +;;;;; show-paren + `(show-paren-match + ((,class (:foreground ,magenta :background unspecified + :weight ,s-maybe-bold)))) + `(show-paren-mismatch + ((,class (:foreground ,base02 :background ,red + :weight ,s-maybe-bold)))) +;;;;; syslog-mode + `(syslog-ip ((,class (:background unspecified + :foreground ,green + :underline nil + :weight normal + :slant normal)))) + `(syslog-hour ((,class (:background unspecified + :foreground ,yellow)))) + `(syslog-error ((,class (:background unspecified + :foreground ,orange + :weight bold)))) + `(syslog-warn ((,class (:background unspecified + :foreground ,yellow + :weight bold)))) + `(syslog-info ((,class (:background unspecified + :foreground ,blue + :weight bold)))) + `(syslog-debug ((,class (:background unspecified + :foreground ,cyan + :weight bold)))) + `(syslog-su ((,class (:background unspecified + :foreground ,violet + :weight normal)))) +;;;;; slime + `(slime-repl-inputed-output-face ((,class (:foreground ,red)))) +;;;;; speedbar + `(speedbar-button-face ((,class (:inherit ,s-variable-pitch + :foreground ,base01)))) + `(speedbar-directory-face ((,class (:inherit ,s-variable-pitch :foreground ,blue)))) + `(speedbar-file-face ((,class (:inherit ,s-variable-pitch :foreground ,base0)))) + `(speedbar-highlight-face ((,class (:inherit ,s-variable-pitch :background ,base02)))) + `(speedbar-selected-face ((,class (:inherit ,s-variable-pitch + :foreground ,yellow :underline t)))) + `(speedbar-separator-face ((,class (:inherit ,s-variable-pitch + :background ,blue :foreground ,base03 + :overline ,cyan-lc)))) + `(speedbar-tag-face ((,class (:inherit ,s-variable-pitch :foreground ,green)))) +;;;;; stripe-buffer + `(stripe-highlight ((,class (:background ,base02)))) +;;;;; structured-haskell + `(shm-current-face ((,class (:background ,base02)))) + `(shm-quarantine-face ((,class (:background ,base01)))) +;;;;; sunrise commander +;;;;;; headings + `(sr-active-path-face ((,class (:background ,blue :foreground ,base03 + :height ,solarized-height-plus-1 :weight bold)))) + `(sr-editing-path-face ((,class (:background ,yellow :foreground ,base03 + :weight bold :height ,solarized-height-plus-1)))) + `(sr-highlight-path-face ((,class (:background ,green :foreground ,base03 + :weight bold :height ,solarized-height-plus-1)))) + `(sr-passive-path-face ((,class (:background ,base01 :foreground ,base03 + :weight bold :height ,solarized-height-plus-1)))) +;;;;;; marked + `(sr-marked-dir-face ((,class (:inherit dired-marked)))) + `(sr-marked-file-face ((,class (:inherit dired-marked)))) + `(sr-alt-marked-dir-face ((,class (:background ,magenta :foreground ,base03 + :weight bold)))) + `(sr-alt-marked-file-face ((,class (:background ,magenta :foreground ,base03 + :weight bold)))) +;;;;;; fstat + `(sr-directory-face ((,class (:inherit dired-directory :weight normal)))) + `(sr-symlink-directory-face ((,class (:inherit dired-directory + :slant italic :weight normal)))) + `(sr-symlink-face ((,class (:inherit dired-symlink :slant italic :weight normal)))) + `(sr-broken-link-face ((,class (:inherit dired-warning :slant italic :weight normal)))) +;;;;;; file types + `(sr-compressed-face ((,class (:foreground ,base0)))) + `(sr-encrypted-face ((,class (:foreground ,base0)))) + `(sr-log-face ((,class (:foreground ,base0)))) + `(sr-packaged-face ((,class (:foreground ,base0)))) + `(sr-html-face ((,class (:foreground ,base0)))) + `(sr-xml-face ((,class (:foreground ,base0)))) +;;;;;; misc + `(sr-clex-hotchar-face ((,class (:background ,red :foreground ,base03 + :weight bold)))) +;;;;; swoop + `(swoop-face-header-format-line ((,class (:foreground ,yellow :weight bold + :height unspecified)))) + `(swoop-face-line-buffer-name ((,class (:background ,base02 :foreground ,base1 + :weight bold :height unspecified)))) + `(swoop-face-line-number ((,class (:foreground ,base01)))) + `(swoop-face-target-line ((,class (:background ,base02 :foreground unspecified)))) + `(swoop-face-target-words ((,class (:background unspecified :foreground ,magenta)))) +;;;;; table + `(table-cell ((,class (:foreground ,base0 :background ,base02)))) +;;;;; term + `(term ((t ( :background ,base03 :foreground ,base0)))) + `(term-color-black ((t (:foreground ,base02 :background ,base02)))) + `(term-color-red ((t (:foreground ,red :background ,red)))) + `(term-color-green ((t (:foreground ,green :background ,green)))) + `(term-color-yellow ((t (:foreground ,yellow :background ,yellow)))) + `(term-color-blue ((t (:foreground ,blue :background ,blue)))) + `(term-color-magenta ((t (:foreground ,magenta :background ,magenta)))) + `(term-color-cyan ((t (:foreground ,cyan :background ,cyan)))) + `(term-color-white ((t (:foreground ,base2 :background ,base2)))) +;;;;; todotxt + `(todotxt-priority-a-face ((,class (:foreground ,orange)))) + `(todotxt-priority-b-face ((,class (:foreground ,yellow)))) + `(todotxt-priority-c-face ((,class (:foreground ,violet)))) +;;;;; tooltip + ;; NOTE: This setting has no effect on the os widgets for me + ;; zencoding uses this. + `(tooltip ((,class (:background ,yellow-lc :foreground ,yellow-hc + :inherit ,s-variable-pitch)))) +;;;;; tuareg + `(tuareg-font-lock-governing-face ((,class (:foreground ,magenta :weight bold)))) + `(tuareg-font-lock-multistage-face ((,class (:foreground ,blue :background ,base02 + :weight bold)))) + `(tuareg-font-lock-operator-face ((,class (:foreground ,base1)))) + `(tuareg-font-lock-error-face ((,class (:foreground ,yellow :background ,red + :weight bold)))) + `(tuareg-font-lock-interactive-output-face ((,class (:foreground ,cyan)))) + `(tuareg-font-lock-interactive-error-face ((,class (:foreground ,red)))) +;;;;; undo-tree + `(undo-tree-visualizer-default-face + ((,class (:foreground ,base01 :background ,base03)))) + `(undo-tree-visualizer-unmodified-face ((,class (:foreground ,green)))) + `(undo-tree-visualizer-current-face ((,class (:foreground ,blue :inverse-video t)))) + `(undo-tree-visualizer-active-branch-face + ((,class (:foreground ,base1 :background ,base03 :weight bold)))) + `(undo-tree-visualizer-register-face ((,class (:foreground ,yellow)))) +;;;;; volatile highlights + `(vhl/default-face ((,class (:background ,green-lc :foreground ,green-hc)))) +;;;;; w3m + `(w3m-anchor ((,class (:inherit link)))) + `(w3m-arrived-anchor ((,class (:inherit link-visited)))) + `(w3m-form ((,class (:background ,base03 :foreground ,base0)))) + `(w3m-header-line-location-title + ((,class (:background ,base02 :foreground ,yellow)))) + `(w3m-header-line-location-content + ((,class (:background ,base02 :foreground ,base0)))) + `(w3m-bold ((,class (:foreground ,base1 :weight bold)))) + `(w3m-image-anchor ((,class (:background ,base03 :foreground ,cyan :inherit link)))) + `(w3m-image ((,class (:background ,base03 :foreground ,cyan)))) + `(w3m-lnum-minibuffer-prompt ((,class (:foreground ,base1)))) + `(w3m-lnum-match ((,class (:background ,base02)))) + `(w3m-lnum ((,class (:underline nil :bold nil :foreground ,red)))) + `(w3m-session-select ((,class (:foreground ,base0)))) + `(w3m-session-selected ((,class (:foreground ,base1 :bold t :underline t)))) + `(w3m-tab-background ((,class (:background ,base03 :foreground ,base0)))) + `(w3m-tab-selected-background + ((,class (:background ,base03 :foreground ,base0)))) + `(w3m-tab-mouse ((,class (:background ,base02 :foreground ,yellow)))) + `(w3m-tab-selected ((,class (:background ,base02 :foreground ,base1 + :bold t)))) + `(w3m-tab-unselected ((,class (:background ,base02 :foreground ,base0)))) + `(w3m-tab-selected-retrieving ((,class (:background ,base02 :foreground ,red)))) + `(w3m-tab-unselected-retrieving + ((,class (:background ,base02 :foreground ,orange)))) + `(w3m-tab-unselected-unseen ((,class (:background ,base02 :foreground ,violet)))) +;;;;; web-mode + `(web-mode-builtin-face ((,class (:inherit font-lock-builtin-face)))) + `(web-mode-comment-face ((,class (:foreground ,base01)))) + `(web-mode-constant-face ((,class (:foreground ,blue :weight bold)))) + `(web-mode-current-element-highlight-face ((,class + (:underline unspecified :weight unspecified + :background ,base02)))) + `(web-mode-css-at-rule-face ((,class (:foreground ,violet :slant italic)))) + `(web-mode-css-pseudo-class-face ((,class (:foreground ,green :slant italic)))) + `(web-mode-doctype-face ((,class (:foreground ,base01 + :slant italic :weight bold)))) + `(web-mode-folded-face ((,class (:underline t)))) + `(web-mode-function-name-face ((,class (:foreground ,blue)))) + `(web-mode-html-attr-name-face ((,class (:foreground ,blue :slant normal)))) + `(web-mode-html-attr-value-face ((,class (:foreground ,cyan :slant italic)))) + `(web-mode-html-tag-face ((,class (:foreground ,green)))) + `(web-mode-keyword-face ((,class (:foreground ,yellow :weight normal)))) + `(web-mode-preprocessor-face ((,class (:foreground ,yellow :slant normal :weight unspecified)))) + `(web-mode-string-face ((,class (:foreground ,cyan)))) + `(web-mode-type-face ((,class (:foreground ,yellow)))) + `(web-mode-variable-name-face ((,class (:foreground ,blue)))) + `(web-mode-warning-face ((,class (:inherit font-lock-warning-face)))) + `(web-mode-block-attr-name-face ((,class (:inherit web-mode-html-attr-name-face)))) + `(web-mode-block-attr-value-face ((,class (:inherit web-mode-html-attr-value-face)))) + `(web-mode-block-comment-face ((,class (:inherit web-mode-comment-face)))) + `(web-mode-block-control-face ((,class (:inherit font-lock-preprocessor-face)))) + `(web-mode-block-face ((,class (:background unspecified)))) + `(web-mode-block-string-face ((,class (:inherit web-mode-string-face)))) + `(web-mode-comment-keyword-face ((,class (:box 1 :weight bold)))) + `(web-mode-css-color-face ((,class (:inherit font-lock-builtin-face)))) + `(web-mode-css-function-face ((,class (:inherit font-lock-builtin-face)))) + `(web-mode-css-priority-face ((,class (:inherit font-lock-builtin-face)))) + `(web-mode-css-property-name-face ((,class (:inherit font-lock-variable-name-face)))) + `(web-mode-css-selector-face ((,class (:inherit font-lock-keyword-face)))) + `(web-mode-css-string-face ((,class (:inherit web-mode-string-face)))) + `(web-mode-javascript-string-face ((,class (:inherit web-mode-string-face)))) + `(web-mode-json-context-face ((,class (:foreground ,violet)))) + `(web-mode-json-key-face ((,class (:foreground ,violet)))) + `(web-mode-json-string-face ((,class (:inherit web-mode-string-face)))) + `(web-mode-param-name-face ((,class (:foreground ,base0)))) + `(web-mode-part-comment-face ((,class (:inherit web-mode-comment-face)))) + `(web-mode-part-face ((,class (:inherit web-mode-block-face)))) + `(web-mode-part-string-face ((,class (:inherit web-mode-string-face)))) + `(web-mode-symbol-face ((,class (:foreground ,yellow)))) + `(web-mode-whitespace-face ((,class (:background ,red)))) + `(web-mode-html-tag-bracket-face ((,class (:foreground ,base01)))) + `(web-mode-block-delimiter-face ((,class (:inherit font-lock-preprocessor-face)))) + `(web-mode-css-comment-face ((,class (:inherit web-mode-comment-face)))) + `(web-mode-css-variable-face ((,class (:inherit web-mode-variable-name-face :slant italic)))) + `(web-mode-error-face ((,class (:background ,red)))) + `(web-mode-function-call-face ((,class (:inherit font-lock-function-name-face)))) + `(web-mode-html-attr-custom-face ((,class (:inherit web-mode-html-attr-name-face)))) + `(web-mode-html-attr-engine-face ((,class (:inherit web-mode-html-attr-custom-face)))) + `(web-mode-html-attr-equal-face ((,class (:inherit web-mode-html-attr-name-face)))) + `(web-mode-html-tag-custom-face ((,class (:inherit web-mode-html-tag-face)))) + `(web-mode-javascript-comment-face ((,class (:inherit web-mode-comment-face)))) + `(web-mode-json-comment-face ((,class (:inherit web-mode-comment-face)))) +;;;;; weather-metno + `(weather-metno-date ((,class (:foreground ,yellow :height ,solarized-height-plus-3)))) + `(weather-metno-date-range ((,class (:foreground ,blue)))) + `(weather-metno-entry ((,class (:foreground ,cyan)))) + `(weather-metno-footer ((,class (:inherit font-lock-comment-face)))) + `(weather-metno-header ((,class (:inherit header-line)))) +;;;;; wgrep + `(wgrep-delete-face ((,class (:background unspecified :foreground ,blue)))) + `(wgrep-done-face ((,class (:foreground ,green)))) + `(wgrep-face ((,class (:background unspecified :foreground ,blue)))) + `(wgrep-file-face ((,class (:background unspecified :foreground ,magenta)))) + `(wgrep-reject-face ((,class (:foreground ,red :weight unspecified)))) +;;;;; whitespace-mode + `(whitespace-space ((,class (:background unspecified :foreground ,base01 + :inverse-video unspecified :slant italic)))) + `(whitespace-hspace ((,class (:background unspecified :foreground ,base1 + :inverse-video unspecified)))) + `(whitespace-tab ((,class (:background unspecified :foreground ,red + :inverse-video unspecified :weight bold)))) + `(whitespace-newline ((,class(:background unspecified :foreground ,base01 + :inverse-video unspecified)))) + `(whitespace-trailing ((,class (:background unspecified :foreground ,orange-lc + :inverse-video t)))) + `(whitespace-line ((,class (:background unspecified :foreground ,magenta + :inverse-video unspecified)))) + `(whitespace-space-before-tab ((,class (:background ,red-lc :foreground unspecified + :inverse-video unspecified)))) + `(whitespace-indentation ((,class (:background unspecified :foreground ,yellow + :inverse-video unspecified :weight bold)))) + `(whitespace-empty ((,class (:background unspecified :foreground ,red-lc + :inverse-video t)))) + `(whitespace-space-after-tab ((,class (:background unspecified :foreground ,orange + :inverse-video t :weight bold)))) +;;;;; wanderlust + `(wl-highlight-folder-few-face ((,class (:foreground ,red)))) + `(wl-highlight-folder-many-face ((,class (:foreground ,red)))) + `(wl-highlight-folder-path-face ((,class (:foreground ,orange)))) + `(wl-highlight-folder-unread-face ((,class (:foreground ,blue)))) + `(wl-highlight-folder-zero-face ((,class (:foreground ,base0)))) + `(wl-highlight-folder-unknown-face ((,class (:foreground ,blue)))) + `(wl-highlight-message-citation-header ((,class (:foreground ,red)))) + `(wl-highlight-message-cited-text-1 ((,class (:foreground ,red)))) + `(wl-highlight-message-cited-text-2 ((,class (:foreground ,green)))) + `(wl-highlight-message-cited-text-3 ((,class (:foreground ,blue)))) + `(wl-highlight-message-cited-text-4 ((,class (:foreground ,blue)))) + `(wl-highlight-message-header-contents-face ((,class (:foreground ,green)))) + `(wl-highlight-message-headers-face ((,class (:foreground ,red)))) + `(wl-highlight-message-important-header-contents ((,class (:foreground ,green)))) + `(wl-highlight-message-header-contents ((,class (:foreground ,green)))) + `(wl-highlight-message-important-header-contents2 ((,class (:foreground ,green)))) + `(wl-highlight-message-signature ((,class (:foreground ,green)))) + `(wl-highlight-message-unimportant-header-contents ((,class (:foreground ,base0)))) + `(wl-highlight-summary-answered-face ((,class (:foreground ,blue)))) + `(wl-highlight-summary-disposed-face ((,class (:foreground ,base0 :slant italic)))) + `(wl-highlight-summary-new-face ((,class (:foreground ,blue)))) + `(wl-highlight-summary-normal-face ((,class (:foreground ,base0)))) + `(wl-highlight-summary-thread-top-face ((,class (:foreground ,yellow)))) + `(wl-highlight-thread-indent-face ((,class (:foreground ,magenta)))) + `(wl-highlight-summary-refiled-face ((,class (:foreground ,base0)))) + `(wl-highlight-summary-displaying-face ((,class (:underline t :weight bold)))) +;;;;; weechat + `(weechat-error-face ((,class (:inherit error)))) + `(weechat-highlight-face ((,class (:foreground ,base0 :weight bold)))) + `(weechat-nick-self-face ((,class (:foreground ,base01 :weight unspecified)))) + `(weechat-prompt-face ((,class (:inherit minibuffer-prompt)))) + `(weechat-time-face ((,class (:foreground ,base01)))) +;;;;; which-func-mode + `(which-func ((,class (:foreground ,green)))) +;;;;; window-number-mode + `(window-number-face ((,class (:foreground ,green)))) +;;;;; yascroll + `(yascroll:thumb-text-area + ((,class (:foreground ,base01 :background ,base01)))) + `(yascroll:thumb-fringe + ((,class (:foreground ,base01 :background ,base01)))) +;;;;; yasnippet + `(yas-field-highlight-face ((,class (:inherit secondary-selection)))) +;;;;; zencoding + `(zencoding-preview-input ((,class (:background ,base02 :box ,base1)))) +;;;;; ztree + `(ztreep-arrow-face ((,class (:foreground ,base01)))) + `(ztreep-diff-header-face ((,class (:foreground ,base01 :weight bold :height 1.2)))) + `(ztreep-diff-header-small-face ((,class (:foreground ,base01 :weight bold)))) + `(ztreep-diff-model-add-face ((,class (:foreground ,blue)))) + `(ztreep-diff-model-diff-face ((,class (:foreground ,red)))) + `(ztreep-diff-model-normal-face ((,class (:foreground ,base0)))) + `(ztreep-expand-sign-face ((,class (:foreground ,base01)))) + `(ztreep-header-face ((,class (:foreground ,base01 :weight bold :height 1.2)))) + `(ztreep-leaf-face ((,class (:foreground ,base0)))) + `(ztreep-node-face ((,class (:foreground ,blue)))) + ) ; END custom-theme-set-faces +;;; Theme Variables + (custom-theme-set-variables + theme-name +;;;;; ansi-colors + `(ansi-color-names-vector + [,base02 ,red ,green ,yellow ,blue ,magenta ,cyan ,base00]) +;;;;; compilation + `(compilation-message-face 'default) +;;;;; cua + `(cua-normal-cursor-color ,base0) + `(cua-read-only-cursor-color ,green) + `(cua-global-mark-cursor-color ,cyan) + `(cua-overwrite-cursor-color ,yellow) +;;;;; fill-column-indicator + `(fci-rule-color ,base02) +;;;;; magit + `(magit-diff-use-overlays nil) +;;;;; highlight-changes + `(highlight-changes-colors '(,magenta ,violet)) +;;;;; highlight-symbol + `(highlight-symbol-foreground-color ,base1) + `(highlight-symbol-colors + (--map (solarized-color-blend it ,base03 0.25) + '(,yellow ,cyan ,red ,violet ,green ,orange ,blue))) +;;;;; highlight-tail + `(highlight-tail-colors + '((,base02 . 0)(,green-lc . 20)(,cyan-lc . 30)(,blue-lc . 50) + (,yellow-lc . 60)(,orange-lc . 70)(,magenta-lc . 85)(,base02 . 100))) +;;;;; hl-anything + `(hl-fg-colors '(,base03 ,base03 ,base03 ,base03 ,base03 ,base03 + ,base03 ,base03)) + `(hl-bg-colors '(,yellow-lc ,orange-lc ,red-lc ,magenta-lc + ,violet-lc ,blue-lc ,cyan-lc ,green-lc)) +;;;;; pos-tip + `(pos-tip-foreground-color ,base1) + `(pos-tip-background-color ,base02) +;;;;; smartrep + `(smartrep-mode-line-active-bg (solarized-color-blend ,green ,s-mode-line-bg 0.2)) +;;;;; term + `(term-default-fg-color ,base0) ;; @deprecated24.3 + `(term-default-bg-color ,base03) ;; @deprecated24.3 +;;;;; vc + `(vc-annotate-color-map + '((20 . ,red) + (40 . ,(solarized-color-blend yellow red (/ 2.0 4))) + (60 . ,(solarized-color-blend yellow red (/ 3.0 4))) + (80 . ,yellow) + (100 . ,(solarized-color-blend green yellow (/ 2.0 6))) + (120 . ,(solarized-color-blend green yellow (/ 3.0 6))) + (140 . ,(solarized-color-blend green yellow (/ 4.0 6))) + (160 . ,(solarized-color-blend green yellow (/ 5.0 6))) + (180 . ,green) + (200 . ,(solarized-color-blend cyan green (/ 2.0 6))) + (220 . ,(solarized-color-blend cyan green (/ 3.0 6))) + (240 . ,(solarized-color-blend cyan green (/ 4.0 6))) + (260 . ,(solarized-color-blend cyan green (/ 5.0 6))) + (280 . ,cyan) + (300 . ,(solarized-color-blend blue cyan (/ 2.0 5))) + (320 . ,(solarized-color-blend blue cyan (/ 3.0 5))) + (340 . ,(solarized-color-blend blue cyan (/ 4.0 5))) + (360 . ,blue))) + `(vc-annotate-very-old-color nil) + `(vc-annotate-background nil) +;;;;; weechat + `(weechat-color-list + '(unspecified ,base03 ,base02 + ,red-d ,red + ,green-d ,green + ,yellow-d ,yellow + ,blue-d ,blue + ,magenta-d ,magenta + ,cyan-d ,cyan + ,base0 ,base00))) +;;;;; xterm-color + `(xterm-color-names [,base02 ,red ,green ,yellow + ,blue ,magenta ,cyan ,base2]) + `(xterm-color-names-bright [,base03 ,orange ,base01 ,base00 + ,base0 ,violet ,base1 ,base3]) +;;; Setup End + (when childtheme + (funcall childtheme)) + ) ; END custom-theme-set-variables + ) ; END defun create-solarized-theme + +;;; Footer + +;;;###autoload +(when (and (boundp 'custom-theme-load-path) load-file-name) + (add-to-list 'custom-theme-load-path + (file-name-as-directory (file-name-directory load-file-name)))) + +(provide 'solarized) + +;; Local Variables: +;; no-byte-compile: t +;; eval: (when (fboundp 'rainbow-mode) (rainbow-mode 1)) +;; indent-tabs-mode: nil +;; fill-column: 95 +;; End: +;;; solarized.el ends here diff --git a/layers/!distribution/spacemacs/local/zoom-frm/frame-cmds.el b/layers/!distribution/spacemacs/local/zoom-frm/frame-cmds.el new file mode 100644 index 000000000000..61810c6003a4 --- /dev/null +++ b/layers/!distribution/spacemacs/local/zoom-frm/frame-cmds.el @@ -0,0 +1,1961 @@ +;;; frame-cmds.el --- Frame and window commands (interactive functions). +;; +;; Filename: frame-cmds.el +;; Description: Frame and window commands (interactive functions). +;; Author: Drew Adams +;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com") +;; Copyright (C) 1996-2015, Drew Adams, all rights reserved. +;; Created: Tue Mar 5 16:30:45 1996 +;; Version: 0 +;; Package-Requires: ((frame-fns "0")) +;; Last-Updated: Thu Jan 1 10:44:52 2015 (-0800) +;; By: dradams +;; Update #: 3036 +;; URL: http://www.emacswiki.org/frame-cmds.el +;; Doc URL: http://emacswiki.org/FrameModes +;; Doc URL: http://www.emacswiki.org/OneOnOneEmacs +;; Doc URL: http://www.emacswiki.org/Frame_Tiling_Commands +;; Keywords: internal, extensions, mouse, frames, windows, convenience +;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x, 25.x +;; +;; Features that might be required by this library: +;; +;; `avoid', `frame-fns', `misc-fns', `strings', `thingatpt', +;; `thingatpt+'. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; Frame and window commands (interactive functions). +;; +;; +;; Summary: +;; +;; Load this library from your init file (~/.emacs or _emacs). +;; Add the suggested key bindings (below) to your init file. +;; Use `M-up|down|left|right' to move frames around incrementally. +;; Use `C-S-v', `M-S-v', `C-S-next', `C-S-prior' to move frames to screen edges. +;; Use `C-M-up|down|left|right' to resize frames incrementally. +;; Use `C-M-z' or `C-x C-z' to iconify/hide all frames. +;; Use `C-M-z' in a lone frame to restore all frames. +;; Use `C-mouse-1' in the minibuffer to restore all frames. +;; Use `C-mouse-1' in Dired to mark/unmark a file. +;; Use `C-mouse-3' on the mode line to remove window from frame. +;; Use `tile-frames-horizontally', `-vertically' to tile frames. +;; Use `C-x o' to select `other-window' or `other-frame'. +;; +;; Commands to incrementally resize frames are `enlarge-frame' and +;; `enlarge-frame-horizontally'. Sarir Khamsi +;; [sarir.khamsi@raytheon.com] originally wrote `enlarge-frame', +;; which he called `sk-grow-frame'. +;; +;; Note on saving changes made with the commands defined here: +;; +;; Some of the commands defined here change frame properties. +;; You can save any changes you have made, by using Customize. +;; To visit a Customize buffer of all unsaved changes you have +;; made, use command `customize-customized'. +;; +;; Frame parameter changes, such as background color, can be saved +;; for future use by all frames or all frames of a certain +;; kind. For that, you must change the frame parameters of the +;; correponding frame-alist variable. +;; +;; There is no single variable for saving changes to parameters of +;; the current frame. Instead, there are several different +;; frame-alist variables, which you can use to define different +;; kinds of frames. These include: `default-frame-alist', +;; `initial-frame-alist', and `special-display-frame-alist'. The +;; complete list of such frame alist variables is available using +;; function `frame-alist-var-names', defined here. +;; +;; Example: Suppose you change the background color of a frame and +;; want to make that the default background color for new frames in +;; the future. You will need to update the value of variable +;; `default-frame-alist' to use the `background-color' parameter +;; setting of the changed frame. +;; +;; You can easily copy one or all parameter values from any given +;; frame to any frame alist (such as `default-frame-alist'), by +;; using the commands `set-frame-alist-parameter-from-frame' and +;; `set-all-frame-alist-parameters-from-frame'. Those commands are +;; defined here. +;; +;; NOTE: If you also use library `fit-frame.el', and you are on MS +;; Windows, then load that library before `frame-cmds.el'. The +;; commands `maximize-frame' and `restore-frame' defined here are +;; more general and non-Windows-specific than the commands of the +;; same name defined in `fit-frame.el'. +;; +;; +;; User options defined here: +;; +;; `available-screen-pixel-bounds', `enlarge-font-tries', +;; `frame-config-register', `frame-parameters-to-exclude', +;; `move-frame-wrap-within-display-flag' +;; `rename-frame-when-iconify-flag', `show-hide-show-function', +;; `window-mgr-title-bar-pixel-height'. +;; +;; Commands defined here: +;; +;; `create-frame-tiled-horizontally', +;; `create-frame-tiled-vertically', `delete-1-window-frames-on', +;; `delete/iconify-window', `delete/iconify-windows-on', +;; `delete-other-frames', `delete-windows-for', `enlarge-font', +;; `enlarge-frame', `enlarge-frame-horizontally', +;; `hide-everything', `hide-frame', `iconify-everything', +;; `iconify/map-frame', `iconify/show-frame', +;; `jump-to-frame-config-register', `maximize-frame', +;; `maximize-frame-horizontally', `maximize-frame-vertically', +;; `mouse-iconify/map-frame', `mouse-iconify/show-frame', +;; `mouse-remove-window', `mouse-show-hide-mark-unmark', +;; `move-frame-down', `move-frame-left', `move-frame-right', +;; `move-frame-to-screen-bottom', `move-frame-to-screen-left', +;; `move-frame-to-screen-right', `move-frame-to-screen-top', +;; `move-frame-to-screen-top-left', `move-frame-up', +;; `name-all-frames-numerically', `name-frame-numerically', +;; `other-window-or-frame', `remove-window', `remove-windows-on', +;; `rename-frame', `rename-non-minibuffer-frame', `restore-frame', +;; `restore-frame-horizontally', `restore-frame-vertically', +;; `save-frame-config', +;; `set-all-frame-alist-parameters-from-frame', +;; `set-frame-alist-parameter-from-frame', `show-*Help*-buffer', +;; `show-a-frame-on', `show-buffer-menu', `show-frame', +;; `show-hide', `shrink-frame', `shrink-frame-horizontally', +;; `split-frame-horizontally', `split-frame-vertically', +;; `tell-customize-var-has-changed', `tile-frames', +;; `tile-frames-horizontally', `tile-frames-side-by-side', +;; `tile-frames-top-to-bottom', `tile-frames-vertically', +;; `toggle-max-frame', `toggle-max-frame-horizontally', +;; `toggle-max-frame-vertically'. +;; +;; Non-interactive functions defined here: +;; +;; `assq-delete-all' (Emacs 20), `butlast' (Emacs 20), +;; `frcmds-available-screen-pixel-bounds', +;; `frcmds-available-screen-pixel-height', +;; `frcmds-available-screen-pixel-width', +;; `frcmds-effective-screen-pixel-bounds', +;; `frcmds-enlarged-font-name', `frcmds-extra-pixels-width', +;; `frcmds-extra-pixels-height', `frcmds-frame-alist-var-names', +;; `frcmds-frame-parameter-names', `frcmds-frame-iconified-p', +;; `frcmds-frame-number', `frcmds-new-frame-position', +;; `frcmds-read-args-for-tiling', +;; `frcmds-read-buffer-for-delete-windows', +;; `frcmds-set-difference', `frcmds-smart-tool-bar-pixel-height', +;; `frcmds-split-frame-1', `frcmds-tile-frames', `nbutlast' (Emacs +;; 20). +;; +;; Error symbols defined here: +;; +;; `font-too-small', `font-size'. +;; +;; +;; ***** NOTE: The following EMACS PRIMITIVE has been ADVISED HERE: +;; +;; `delete-window' - If only one window in frame, `delete-frame'. +;; +;; +;; ***** NOTE: The following EMACS PRIMITIVE has been REDEFINED HERE: +;; +;; `delete-windows-on' - +;; 1) Reads buffer differently. Only buffers showing windows are candidates. +;; 2) Calls `delete-window', so this also deletes frames where +;; window showing the BUFFER is the only window. +;; (That's true also for vanilla Emacs 23+, but not before.) +;; +;; +;; Suggested key bindings: +;; +;; (global-set-key [(meta up)] 'move-frame-up) +;; (global-set-key [(meta down)] 'move-frame-down) +;; (global-set-key [(meta left)] 'move-frame-left) +;; (global-set-key [(meta right)] 'move-frame-right) +;; (global-set-key [(meta shift ?v)] 'move-frame-to-screen-top) ; like `M-v' +;; (global-set-key [(control shift ?v)] 'move-frame-to-screen-bottom) ; like `C-v' +;; (global-set-key [(control shift prior)] 'move-frame-to-screen-left) ; like `C-prior' +;; (global-set-key [(control shift next)] 'move-frame-to-screen-right) ; like `C-next' +;; (global-set-key [(control shift home)] 'move-frame-to-screen-top-left) +;; (global-set-key [(control meta down)] 'enlarge-frame) +;; (global-set-key [(control meta right)] 'enlarge-frame-horizontally) +;; (global-set-key [(control meta up)] 'shrink-frame) +;; (global-set-key [(control meta left)] 'shrink-frame-horizontally) +;; (global-set-key [(control ?x) (control ?z)] 'iconify-everything) +;; (global-set-key [vertical-line S-down-mouse-1] 'iconify-everything) +;; (global-set-key [(control ?z)] 'iconify/show-frame) +;; (global-set-key [mode-line mouse-3] 'mouse-iconify/show-frame) +;; (global-set-key [mode-line C-mouse-3] 'mouse-remove-window) +;; (global-set-key [(control meta ?z)] 'show-hide) +;; (global-set-key [vertical-line C-down-mouse-1] 'show-hide) +;; (global-set-key [C-down-mouse-1] 'mouse-show-hide-mark-unmark) +;; (substitute-key-definition 'delete-window 'remove-window global-map) +;; (define-key ctl-x-map "o" 'other-window-or-frame) +;; (define-key ctl-x-4-map "1" 'delete-other-frames) +;; (define-key ctl-x-5-map "h" 'show-*Help*-buffer) +;; (substitute-key-definition 'delete-window 'delete-windows-for global-map) +;; (define-key global-map "\C-xt." 'save-frame-config) +;; (define-key ctl-x-map "o" 'other-window-or-frame) +;; +;; (defalias 'doremi-prefix (make-sparse-keymap)) +;; (defvar doremi-map (symbol-function 'doremi-prefix) "Keymap for Do Re Mi commands.") +;; (define-key global-map "\C-xt" 'doremi-prefix) +;; (define-key doremi-map "." 'save-frame-config) +;; +;; Customize the menu. Uncomment this to try it out. +;; +;; (defvar menu-bar-frames-menu (make-sparse-keymap "Frames")) +;; (define-key global-map [menu-bar frames] +;; (cons "Frames" menu-bar-frames-menu))) +;; (define-key menu-bar-frames-menu [set-all-params-from-frame] +;; '(menu-item "Set All Frame Parameters from Frame" set-all-frame-alist-parameters-from-frame +;; :help "Set frame parameters of a frame to their current values in frame")) +;; (define-key menu-bar-frames-menu [set-params-from-frame] +;; '(menu-item "Set Frame Parameter from Frame..." set-frame-alist-parameter-from-frame +;; :help "Set parameter of a frame alist to its current value in frame")) +;; (define-key menu-bar-frames-menu [separator-frame-1] '("--")) +;; (define-key menu-bar-frames-menu [tile-frames-vertically] +;; '(menu-item "Tile Frames Vertically..." tile-frames-vertically +;; :help "Tile all visible frames vertically")) +;; (define-key menu-bar-frames-menu [tile-frames-horizontally] +;; '(menu-item "Tile Frames Horizontally..." tile-frames-horizontally +;; :help "Tile all visible frames horizontally")) +;; (define-key menu-bar-frames-menu [separator-frame-2] '("--")) +;; (define-key menu-bar-frames-menu [toggle-max-frame-vertically] +;; '(menu-item "Toggle Max Frame Vertically" toggle-max-frame-vertically +;; :help "Maximize or restore the selected frame vertically" +;; :enable (frame-parameter nil 'restore-height))) +;; (define-key menu-bar-frames-menu [toggle-max-frame-horizontally] +;; '(menu-item "Toggle Max Frame Horizontally" toggle-max-frame-horizontally +;; :help "Maximize or restore the selected frame horizontally" +;; :enable (frame-parameter nil 'restore-width))) +;; (define-key menu-bar-frames-menu [toggle-max-frame] +;; '(menu-item "Toggle Max Frame" toggle-max-frame +;; :help "Maximize or restore the selected frame (in both directions)" +;; :enable (or (frame-parameter nil 'restore-width) (frame-parameter nil 'restore-height)))) +;; (define-key menu-bar-frames-menu [maximize-frame-vertically] +;; '(menu-item "Maximize Frame Vertically" maximize-frame-vertically +;; :help "Maximize the selected frame vertically")) +;; (define-key menu-bar-frames-menu [maximize-frame-horizontally] +;; '(menu-item "Maximize Frame Horizontally" maximize-frame-horizontally +;; :help "Maximize the selected frame horizontally")) +;; (define-key menu-bar-frames-menu [maximize-frame] +;; '(menu-item "Maximize Frame" maximize-frame +;; :help "Maximize the selected frame (in both directions)")) +;; (define-key menu-bar-frames-menu [separator-frame-3] '("--")) +;; (define-key menu-bar-frames-menu [iconify-everything] +;; '(menu-item "Iconify All Frames" iconify-everything +;; :help "Iconify all frames of session at once")) +;; (define-key menu-bar-frames-menu [show-hide] +;; '(menu-item "Hide Frames / Show Buffers" show-hide +;; :help "Show, if only one frame visible; else hide."))) +;; +;; (defvar menu-bar-doremi-menu (make-sparse-keymap "Do Re Mi")) +;; (define-key global-map [menu-bar doremi] +;; (cons "Do Re Mi" menu-bar-doremi-menu)) +;; (define-key menu-bar-doremi-menu [doremi-font+] +;; '("Save Frame Configuration" . save-frame-config)) +;; +;; See also these files for other frame commands: +;; +;; `autofit-frame.el' - Automatically fit each frame to its +;; selected window. Uses `fit-frame.el'. +;; +;; `fit-frame.el' - 1) Fit a frame to its selected window. +;; 2) Incrementally resize a frame. +;; +;; `doremi-frm.el' - Incrementally adjust frame properties +;; using arrow keys and/or mouse wheel. +;; +;; `thumb-frm.el' - Shrink frames to a thumbnail size and +;; restore them again. +;; +;; `zoom-frm.el' - Zoom a frame or buffer, so that its text +;; appears larger or smaller. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Change Log: +;; +;; 2014/12/09 dadams +;; Added: frcmds-frame-pixel-height. +;; frcmds-split-frame-1: Use frame-pixel-width and frcmds-frame-pixel-height, instead of working +;; with width and height frame parameters (char-based). +;; frcmds-tile-frames: +;; If Emacs 24.4+, use PIXELWISE arg with set-frame-size. +;; Otherwise: * Always subtract frcmds-extra-pixels-width. +;; * Do not subtract borders. +;; * Increment origin by one border-width. +;; 2014/12/07 dadams +;; Added: split-frame-horizontally, split-frame-vertically. +;; frcmds-tile-frames: Added optional args, so can tile within a rectangle. +;; create-frame-tiled-(horizontally|vertically): Keep same font size. +;; 2014/12/06 dadams +;; Added: create-frame-tiled-horizontally, create-frame-tiled-vertically. +;; Added aliases: tile-frames-side-by-side, tile-frames-top-to-bottom. +;; window-mgr-title-bar-pixel-height: Changed default value for ns to 50. Thx to Nate Eagleson. +;; 2014/10/15 dadams +;; window-mgr-title-bar-pixel-height: Added default value for ns (Next). Thx to Nate Eagleson. +;; 2014/10/13 dadams +;; Removed extra, empty Package-Requires. +;; 2014/07/21 dadams +;; Do not redefine delete-window - just advise it. +;; delete/iconify-window: Just use delete-window, not old-delete-window. +;; 2014/04/19 dadams +;; Added: frcmds-frame-number, name-all-frames-numerically, name-frame-numerically. +;; Renamed: available-screen-pixel-* to frcmds-available-screen-pixel-*, +;; enlarged-font-name to frcmds-enlarged-font-name, +;; extra-pixels-* to frcmds-extra-pixels-*, +;; frame-alist-var-names to frcmds-frame-alist-var-names, +;; frame-parameter-names to frcmds-frame-parameter-names, +;; frame-iconified-p to frcmds-frame-iconified-p, +;; new-frame-position to frcmds-new-frame-position, +;; read-args-for-tile-frames to frcmds-read-args-for-tiling, +;; read-buffer-for-delete-windows to frcmds-read-buffer-for-delete-windows, +;; frame-cmds-set-difference to frcmds-set-difference, +;; smart-tool-bar-pixel-height to frcmds-smart-tool-bar-pixel-height, +;; tile-frames to frcmds-tile-frames. +;; rename-non-minibuffer-frame: Pass OLD-NAME and NEW-NAME to rename-frame. +;; Group Frame-Commands: Added :prefix frcmds-. +;; +;; 2014/02/24 dadams +;; rename-frame, rename-non-minibuffer-frame: Fixed default buffer name for non-interactive. +;; 2013/09/21 dadams +;; maximize-frame: Apply frame-geom-value-numeric to new-* also. Bug report thx: Mike Fitzgerald. +;; 2013/07/21 dadams +;; Added Package-Requires to header, at least temporarily, but should not need to specify version. +;; 2013/07/12 dadams +;; set-frame-alist-parameter-from-frame: Use lax completion, so do not limit to known parameters. +;; frame-parameter-names: Updated for Emacs 24. +;; 2013/07/05 dadams +;; Added: move-frame-to-screen-top-left. +;; move-frame-to-screen-*: Read FRAME name in interactive spec. +;; 2013/07/04 dadams +;; show-hide-show-function: Use function-item instead of const for jump-to-frame-config-register. +;; 2013/05/15 dadams +;; Added error symbols font-too-small and font-size. +;; enlarged-font-name: Signal font-too-small error. +;; 2013/04/29 dadams +;; Added: deiconify-everything, (mouse-)iconify/show-frame (renamed (mouse-)iconify/map-frame). +;; iconify/show-frame: Negative prefix arg now deiconifies all. +;; 2013/03/12 dadams +;; maximize-frame: Corrected new-left, new-top. +;; Corrected arg to modify-frame-parameters - use frame-geom-value-numeric +;; Do not alias if function name is already fboundp. +;; toggle-max-frame-*: Use toggle-max-frame, not restore-frame (the alias). +;; toggle-max-frame: If no restore-* parameter then first maximize. +;; Condition last four parameters on orig-*, not restore-*. +;; 2013/02/06 dadams +;; move-frame-(up|down|left|right): Set N to 1 if nil. +;; 2013/01/17 dadams +;; Added: move-frame-to-screen-(top|bottom|left|right). +;; move-frame-(up|down|left|right): Redefined so prefix arg moves increments of char size. +;; 2012/02/29 dadams +;; Added, for Emacs 20 only: nbutlast, butlast. To avoid runtime load of cl.el. +;; Added frame-cmds-set-difference, to avoid runtime load of cl.el. +;; set-all-frame-alist-parameters-from-frame: Use frame-cmds-set-difference. +;; 2011/07/25 dadams +;; save-frame-config: Use fboundp, not featurep. +;; 2011/01/04 dadams +;; Removed autoload cookie from non-interactive function. +;; 2010/10/19 dadams +;; enlarge-font: Only do frame-update-faces if Emacs 20 (obsolete in 21). +;; 2010/06/04 dadams +;; Added: (toggle-max|restore)-frame(-horizontally|-vertically). Thx to Uday Reddy for suggestion. +;; Renamed max-frame to maximize-frame. +;; maximize-frame: Save original location & position params for later restoration. +;; 2010/05/25 dadams +;; Added: max-frame, maximize-frame-horizontally, maximize-frame-vertically. +;; 2009/10/02 dadams +;; delete-windows-on: Return nil. Make BUFFER optional: default is current buffer. +;; 2009/08/03 dadams +;; delete-window: Wrap with save-current-buffer. Thx to Larry Denenberg. +;; 2009/05/17 dadams +;; Updated to reflect thumb-frm.el name changes. +;; 2009/01/30 dadams +;; enlarge-font, enlarged-font-name, enlarge-font-tries: +;; Removed temporary workaround - Emacs 23 bug #119 was finally fixed. +;; 2009/01/01 dadams +;; Removed compile-time require of doremi-frm.el to avoid infinite recursion. +;; 2008/12/13 dadams +;; enlarge-font: Redefined for Emacs 23 - just use :height face attribute. +;; enlarge-font-tries, enlarged-font-name: Not used for Emacs 23. +;; 2008/10/31 dadams +;; Updated frame-parameter-names for Emacs 23. +;; 2008/07/29 dadams +;; Option available-screen-pixel-bounds: Use nil as default value. +;; available-screen-pixel-bounds: Redefined as the code that defined the option's default value. +;; Added: effective-screen-pixel-bounds - code taken from old available-screen-pixel-bounds, +;; but also convert frame geom value to numeric. +;; Everywhere: +;; Use effective-screen-pixel-bounds in place of available-screen-pixel-bounds function. +;; Use available-screen-pixel-bounds function instead of option. +;; available-screen-pixel-(width|height): Added optional INCLUDE-MINI-P arg. +;; new-frame-position: Call available-screen-pixel-(width|height) with arg. +;; save-frame-config: push-current-frame-config -> doremi-push-current-frame-config. +;; Soft-require doremi-frm.el when byte-compile. +;; 2008/06/02 dadams +;; Added: available-screen-pixel-bounds (option and function). +;; tile-frames, available-screen-pixel-(width|height): +;; Redefined to use available-screen-pixel-bounds. Thx to Nathaniel Cunningham for input. +;; 2008/05/29 dadams +;; Fixes for Mac by Nathaniel Cunningham and David Reitter: +;; window-mgr-title-bar-pixel-height, tile-frames, smart-tool-bar-pixel-height (added). +;; 2007/12/27 dadams +;; tile-frames: Restored border calculation, but using only external border. +;; Renamed window-mgr-*-width to window-mgr-*-height and changed default value from 32 to 27. +;; 2007/12/20 dadams +;; Added: frame-extra-pixels(width|height). Use in tile-frames. Thx to David Reitter. +;; frame-horizontal-extra-pixels: Changed default value from 30 to 32. +;; 2007/10/11 dadams +;; Added: assq-delete-all (for Emacs 20). +;; 2007/09/02 dadams +;; Added: available-screen-pixel-(width|height). Use in tile-frames, new-frame-position. +;; 2007/06/12 dadams +;; tile-frames: Corrected use of fboundp for thumbnail-frame-p. +;; 2007/05/27 dadams +;; enlarged-font-name: +;; Do nothing if null assq of ascii. Not sure what this means, but gets around Emacs 23 bug. +;; 2006/08/22 dadams +;; Added: delete-windows-for, read-buffer-for-delete-windows. +;; delete-windows-on: Use read-buffer-for-delete-windows. +;; Removed old-delete-windows-on (not used). +;; 2006/05/30 dadams +;; delete-windows-on: Return nil if buffer arg is nil. Thanks to Slawomir Nowaczyk. +;; 2006/01/07 dadams +;; Added :link for sending bug report. +;; 2006/01/06 dadams +;; Renamed group. Added :link. +;; 2006/01/04 dadams +;; Added: other-window-or-frame. +;; 2005/12/29 dadams +;; mouse-show-hide-mark-unmark: dired-mouse-mark/unmark -> diredp-mouse-mark/unmark. +;; 2005/12/13 dadams +;; Added: delete-other-frames. +;; 2005/11/18 dadams +;; enlarge-font: Try to increment or decrment further, testing for an existing font. +;; Added: enlarge-font-tries, enlarged-font-name. +;; 2005/10/03 dadams +;; Removed require of icomplete+.el (no longer redefines read-from-minibuffer). +;; 2005/07/03 dadams +;; Renamed: args-for-tile-frames to read-args-for-tile-frames. +;; 2005/06/19 dadams +;; tile-frames: Don't tile thumbnail frames. +;; 2005/05/29 dadams +;; Moved here from frame+.el and fit-frame.el: enlarge-frame*, shrink-frame*. +;; Added: move-frame-up|down|left|right, move-frame-wrap-within-display-flag, +;; new-frame-position. +;; 2005/05/28 dadams +;; show-a-frame-on: Use another-buffer as default for read-buffer, if available. +;; 2005/05/15 dadams +;; Renamed: minibuffer-frame to 1on1-minibuffer-frame. +;; 2005/05/10 dadams +;; remove-window: Removed definition; just defalias it to delete-window. +;; delete-window: (one-window-p) -> (one-window-p t). +;; set-frame-alist-parameter-from-frame: No longer use destructive fns. +;; 2005/01/19 dadams +;; set-all-frame-alist-parameters-from-frame: +;; Added really-all-p and use frame-parameters-to-exclude. +;; Added: frame-parameters-to-exclude, tell-customize-var-has-changed. +;; 2005/01/18 dadams +;; Added: set-all-frame-alist-parameters-from-frame, set-frame-alist-parameter-from-frame, +;; frame-alist-var-names, frame-parameter-names. +;; Added Note on saving changes. +;; 2005/01/08 dadams +;; Moved enlarge-font here from doremi-frm.el, where it was called doremi-grow-font. +;; 2005/01/04 dadams +;; Added rename-frame-when-iconify-flag. +;; Use it in iconify-everything, (mouse-)iconify/map-frame. +;; Added (defgroup frame-cmds). +;; 2004/12/23 dadams +;; frame-config-register, show-hide-show-function, window-mgr-title-bar-pixel-width: +;; Changed defvar to defcustom. +;; 2004/12/21 dadams +;; hide-everything, iconify-everything: bind thumbify-instead-of-iconify-flag to nil. +;; 2004/12/10 dadams +;; tile-frames: Change 15 to (frame-char-height fr) for scroll-bar-width. +;; tile-frames-*: Corrected doc strings for non-interactive case. +;; 2004/12/09 dadams +;; Changed compile-time require of strings to a soft require. +;; 2004/10/11 dadams +;; args-for-tile-frames: Fixed bug when non-existant frame in name history. +;; tile-frames: show-frame at end (for case where use prefix arg) +;; 2004/09/11 dadams +;; Moved to doremi-frm.el: frame-config-ring*, frame-config-wo-parameters, +;; push-frame-config. +;; 2004/09/07 dadams +;; Added: jump-to-frame-config-register, push-frame-config, save-frame-config. +;; 2004/09/01 dadams +;; Added: frame-config-register, show-hide-show-function, +;; jump-to-frame-config-register. +;; Rewrote to record frame config: iconify-everything, hide-everything. +;; Rewrote to use show-hide-show-function: show-hide. +;; 2004/03/22 dadams +;; Added: tile-frames, tile-frames-vertically, args-for-tile-frames. +;; Rewrote tile-frames-horizontally to use tile-frames. +;; 2004/03/19 dadams +;; Added tile-frames-horizontally. +;; 2000/11/27 dadams +;; hide-frame: fixed bug: Added get-a-frame for frame name read. +;; 2000/09/27 dadams +;; 1. Added: frame-iconified-p. +;; 2. remove-window: only make-frame-invisible if not iconified (HACK). +;; 1999/10/05 dadams +;; rename-frame: fixed bug if only 1 frame and old-name was a frame. +;; 1999/08/25 dadams +;; Added: hide-everything, show-buffer-menu, show-hide. +;; 1999/03/17 dadams +;; delete-1-window-frames-on: ensure a buffer object (not a name). +;; 1996/04/26 dadams +;; delete/iconify-windows-on, show-a-frame-on: Do nothing if null buffer. +;; 1996/03/12 dadams +;; delete/iconify-window: Unless one-window-p, do old-delete-window outside of +;; save-window-excursion. +;; 1996/03/08 dadams +;; 1. delete-windows-on: a. Fixed incorrect interactive spec (bad paren). +;; b. Second arg FRAME also provided interactively now. +;; 2. Added: delete/iconify-window, delete/iconify-windows-on. +;; 1996/02/27 dadams +;; show-frame: Call make-frame-visible. +;; 1996/02/09 dadams +;; Added show-*Help*-buffer. +;; 1996/01/30 dadams +;; 1. show-frame: Don't make-frame-visible. Done by raise-frame anyway. +;; 2. Added show-a-frame-on. +;; 1996/01/09 dadams +;; Added delete-windows-on and made it interactive. +;; 1996/01/08 dadams +;; Added rename-non-minibuffer-frame. Use in iconify-everything, +;; iconify/map-frame, mouse-iconify/map-frame. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; 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, 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; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Code: + +(eval-when-compile (require 'cl)) ;; case, incf (plus, for Emacs 20: dolist, dotimes) +(require 'frame-fns) ;; frame-geom-value-cons, frame-geom-value-numeric, frames-on, get-frame-name, + ;; get-a-frame, read-frame +(require 'strings nil t) ;; (no error if not found) read-buffer +(require 'misc-fns nil t) ;; (no error if not found) another-buffer + +;; Don't require even to byte-compile, because doremi-frm.el soft-requires frame-cmds.el +;; (eval-when-compile (require 'doremi-frm nil t)) ;; (no error if not found) +;; ;; doremi-push-current-frame-config + +;; Not required here, because this library requires `frame-cmds.el': `thumb-frm.el'. +;; However, `frame-cmds.el' soft-uses `thumfr-thumbnail-frame-p', which is defined +;; in `thumb-frm.el'. + +;; Quiet byte-compiler. +(defvar 1on1-minibuffer-frame) ; In `oneonone.el' +(defvar mac-tool-bar-display-mode) + +;;;;;;;;;;;;;;;;;;;;;;; + + + + +;;; USER OPTIONS (VARIABLES) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defgroup Frame-Commands nil + "Miscellaneous frame and window commands." + :group 'frames + :prefix "frcmds-" + :link `(url-link :tag "Send Bug Report" + ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\ +frame-cmds.el bug: \ +&body=Describe bug here, starting with `emacs -q'. \ +Don't forget to mention your Emacs and library versions.")) + :link '(url-link :tag "Other Libraries by Drew" + "http://www.emacswiki.org/cgi-bin/wiki/DrewsElispLibraries") + :link '(url-link :tag "Download" + "http://www.emacswiki.org/cgi-bin/wiki/frame-cmds.el") + :link '(url-link :tag "Description - `delete-window'" + "http://www.emacswiki.org/cgi-bin/wiki/FrameModes") + :link '(url-link :tag "Description - Frame Renaming" + "http://www.emacswiki.org/cgi-bin/wiki/FrameTitle") + :link '(url-link :tag "Description - Frame Resizing" + "http://www.emacswiki.org/cgi-bin/wiki/Shrink-Wrapping_Frames") + :link '(url-link :tag "Description - Frame Customization" + "http://www.emacswiki.org/cgi-bin/wiki/CustomizingAndSaving") + :link '(url-link :tag "Description - Frame Tiling" + "http://www.emacswiki.org/cgi-bin/wiki/Frame_Tiling_Commands") + :link '(url-link :tag "Description - General" + "http://www.emacswiki.org/cgi-bin/wiki/FrameModes") + :link '(emacs-commentary-link :tag "Commentary" "frame-cmds")) + +(defcustom rename-frame-when-iconify-flag t + "*Non-nil means frames are renamed when iconified. +The new name is the name of the current buffer." + :type 'boolean :group 'Frame-Commands) + +(defcustom frame-config-register ?\C-l ; Control-L is the name of the register. + "*Character naming register for saving/restoring frame configuration." + :type 'character :group 'Frame-Commands) + +(defcustom show-hide-show-function 'jump-to-frame-config-register + "*Function to show stuff that is hidden or iconified by `show-hide'. +Candidates include `jump-to-frame-config-register' and `show-buffer-menu'." + :type '(choice (function-item :tag "Restore frame configuration" jump-to-frame-config-register) + (function :tag "Another function")) + :group 'Frame-Commands) + +;; Use `cond', not `case', for Emacs 20 byte-compiler. +(defcustom window-mgr-title-bar-pixel-height (cond ((eq window-system 'mac) 22) + ;; For older versions of OS X, 40 might be better. + ((eq window-system 'ns) 50) + (t 27)) + "*Height of frame title bar provided by the window manager, in pixels. +You might alternatively call this constant the title-bar \"width\" or +\"thickness\". There is no way for Emacs to determine this, so you +must set it." + :type 'integer :group 'Frame-Commands) + +(defcustom enlarge-font-tries 100 + "*Number of times to try to change font-size, when looking for a font. +The font-size portion of a font name is incremented or decremented at +most this many times, before giving up and raising an error." + :type 'integer :group 'Frame-Commands) + +(defcustom frame-parameters-to-exclude '((window-id) (buffer-list) (name) (title) (icon-name)) + "*Parameters to exclude in `set-all-frame-alist-parameters-from-frame'. +An alist of the same form as that returned by `frame-parameters'. +The cdr of each alist element is ignored. +These frame parameters are not copied to the target alist." + :type '(repeat (cons symbol sexp)) :group 'Frame-Commands) + +(defcustom move-frame-wrap-within-display-flag t + "*Non-nil means wrap frame movements within the display. +Commands `move-frame-up', `move-frame-down', `move-frame-left', and +`move-frame-right' then move the frame back onto the display when it +moves off of it. +If nil, you can move the frame as far off the display as you like." + :type 'boolean :group 'Frame-Commands) + +(defcustom available-screen-pixel-bounds nil + "*Upper left and lower right of available screen space for tiling frames. +Integer list: (x0 y0 x1 y1), where (x0, y0) is the upper left position +and (x1, y1) is the lower right position. Coordinates are in pixels, +measured from the screen absolute origin, (0, 0), at the upper left. + +If this is nil, then the available space is calculated. That should +give good results in most cases." + :type '(list + (integer :tag "X0 (upper left) - pixels from screen left") + (integer :tag "Y0 (upper left) - pixels from screen top") + (integer :tag "X1 (lower right) - pixels from screen left" ) + (integer :tag "Y1 (lower right) - pixels from screen top")) + :group 'Frame-Commands) + + + +;;; FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;;;###autoload +(defun save-frame-config () + "Save current frame configuration. +You can restore it with \\[jump-to-frame-config-register]." + (interactive) + (frame-configuration-to-register frame-config-register) + (when (fboundp 'doremi-push-current-frame-config) ; In `doremi-frm.el'. + (doremi-push-current-frame-config)) + (message + (substitute-command-keys + (if (fboundp 'doremi-frame-configs) ; In `doremi-frm.el'. + (format "Use `\\[jump-to-frame-config-register]' (`C-x r j %c') or \ +`\\[doremi-frame-configs]' to restore frames as before (undo)." frame-config-register) + "Use `\\[jump-to-frame-config-register]' to restore frames as before (undo).")))) + +;;;###autoload +(defun jump-to-frame-config-register () + "Restore frame configuration saved in `frame-config-register'." + (interactive) + (jump-to-register frame-config-register)) + +;;;###autoload +(defun deiconify-everything () + "Deiconify any iconified frames." + (interactive) + (frame-configuration-to-register frame-config-register) + (dolist (frame (frame-list)) + (when (eq 'icon (frame-visible-p frame)) (make-frame-visible frame)))) + +;;;###autoload +(defun iconify-everything () + "Iconify all frames of session at once. +Remembers frame configuration in register `C-l' (Control-L). +To restore this frame configuration, use `\\[jump-to-register] C-l'." + (interactive) + (frame-configuration-to-register frame-config-register) + (let ((thumfr-thumbify-dont-iconify-flag nil)) ; Defined in `thumb-frm.el'. + (dolist (frame (visible-frame-list)) + (when rename-frame-when-iconify-flag (rename-non-minibuffer-frame frame)) + (iconify-frame frame)))) + +;;;###autoload +(defun hide-everything () + "Hide all frames of session at once. +Iconify minibuffer frame; make all others invisible. +Remembers frame configuration in register `C-l' (Control-L). +To restore this frame configuration, use `\\[jump-to-register] C-l'." + (interactive) + (frame-configuration-to-register frame-config-register) + (let ((minibuf-frame-name (and (boundp '1on1-minibuffer-frame) + (cdr (assq 'name (frame-parameters + 1on1-minibuffer-frame))))) + (thumfr-thumbify-dont-iconify-flag nil)) ; Defined in `thumb-frm.el'. + (dolist (frame (frame-list)) + (if (eq minibuf-frame-name (cdr (assq 'name (frame-parameters frame)))) + (iconify-frame frame) ; minibuffer frame + (make-frame-invisible frame t))))) ; other frames + +;;;###autoload +(defun show-hide () + "1 frame visible: `show-hide-show-function'; else: `hide-everything'. +This acts as a toggle between showing all frames and showing only an +iconified minibuffer frame." + (interactive) + (if (< (length (visible-frame-list)) 2) (funcall show-hide-show-function) (hide-everything))) + +;;;###autoload +(defun show-buffer-menu () + "Call `buffer-menu' after making all frames visible. +Useful after using `hide-everything' because of a Windows bug that +doesn't let you display frames that have been made visible after +being made invisible." + (interactive) + (let ((minibuf-frame-name (and (boundp '1on1-minibuffer-frame) + (cdr (assq 'name (frame-parameters 1on1-minibuffer-frame)))))) + (dolist (frame (frame-list)) + (if (eq minibuf-frame-name (cdr (assq 'name (frame-parameters frame)))) + (make-frame-visible frame) ; minibuffer frame + (iconify-frame frame))) ; other frames + (buffer-menu))) + +;;;###autoload +(defun mouse-show-hide-mark-unmark (event) + "In minibuffer: `show-hide'. In dired: mark/unmark; else: buffer menu." + (interactive "e") + (if (window-minibuffer-p (posn-window (event-start event))) + (show-hide) + (or (and (memq major-mode '(dired-mode vc-dired-mode)) + (fboundp 'diredp-mouse-mark/unmark) + (diredp-mouse-mark/unmark event)) ; Return nil if not on a file or dir. + (mouse-buffer-menu event)))) + +;;;###autoload +(defalias 'iconify/map-frame 'iconify/show-frame) ; `.../map...' is the old name. +;;;###autoload +(defun iconify/show-frame (&optional all-action) + "Iconify selected frame if now shown. Show it if now iconified. +A non-negative prefix arg iconifies all shown frames. +A negative prefix arg deiconifies all iconified frames." + (interactive "P") + (cond ((not all-action) + (when rename-frame-when-iconify-flag (rename-non-minibuffer-frame)) + (iconify-or-deiconify-frame)) + ((natnump (prefix-numeric-value all-action)) + (iconify-everything)) + (t + (deiconify-everything)))) + +;;;###autoload +(defalias 'mouse-iconify/map-frame 'mouse-iconify/show-frame) ; `.../map...' is the old name. +;;;###autoload +(defun mouse-iconify/show-frame (event) + "Iconify frame you click, if now shown. Show it if now iconified." + (interactive "e") + (select-window (posn-window (event-start event))) + (when rename-frame-when-iconify-flag (rename-non-minibuffer-frame)) + (iconify-or-deiconify-frame)) + + + +;; ADVISE ORIGINAL (built-in): +;; +;; If WINDOW is the only one in its frame, `delete-frame'. +(defadvice delete-window (around delete-frame-if-one-win activate) + "If WINDOW is the only one in its frame, then `delete-frame' too." + (save-current-buffer + (select-window (or (ad-get-arg 0) (selected-window))) + (if (one-window-p t) (delete-frame) ad-do-it))) + +;;;###autoload +(defun delete-windows-for (&optional buffer) + "`delete-window' or prompt for buffer and delete its windows. +With no prefix arg, delete the selected window. +With a prefix arg, prompt for a buffer and delete all windows, on any + frame, that show that buffer." + (interactive (list (and current-prefix-arg (frcmds-read-buffer-for-delete-windows)))) + (if buffer (delete-windows-on buffer) (delete-window))) + + + +;; REPLACES ORIGINAL (built-in): +;; +;; 1) Use `read-buffer' in interactive spec. +;; 2) Do not raise an error if BUFFER is a string that does not name a buffer. +;; 3) Call `delete-window', so if you use the advised `delete-window' here then this also deletes +;; frames where window showing the BUFFER is the only window. +;; +;;;###autoload +(defun delete-windows-on (&optional buffer frame) + "Delete windows showing BUFFER. +Optional arg BUFFER defaults to the current buffer. + +Optional second arg FRAME controls which frames are considered. + If nil or omitted, delete all windows showing BUFFER in any frame. + If t, delete only windows showing BUFFER in the selected frame. + If `visible', delete all windows showing BUFFER in any visible frame. + If a frame, delete only windows showing BUFFER in that frame. + +Interactively, FRAME depends on the prefix arg, as follows: + Without a prefix arg (prefix = nil), FRAME is nil (all frames). + With prefix arg >= 0, FRAME is t (this frame only). + With prefix arg < 0, FRAME is `visible' (all visible frames)." + (interactive + (list (frcmds-read-buffer-for-delete-windows) + (and current-prefix-arg + (or (natnump (prefix-numeric-value current-prefix-arg)) 'visible)))) + (unless buffer (setq buffer (current-buffer))) ; Like Emacs 23+ - unlike Emacs 21-22. + + ;; `get-buffer-window' interprets FRAME oppositely for t and nil, so switch. + (setq frame (if (eq t frame) nil (if (eq nil frame) t frame))) + (let (win) + ;; Vanilla Emacs version raises an error if BUFFER is a string that does not name a buffer. + ;; We do not raise an error - we do nothing. + (and (get-buffer buffer) + (while (setq win (get-buffer-window buffer frame)) (delete-window win)) + nil))) ; Return nil always, like vanilla Emacs. + +(defun frcmds-read-buffer-for-delete-windows () + "Read buffer name for delete-windows commands. +Only displayed buffers are completion candidates." + (completing-read "Delete windows on buffer: " + (let ((all-bufs (buffer-list)) + (cand-bufs ())) + (dolist (buf all-bufs) + (when (get-buffer-window buf t) + (push (list (buffer-name buf)) cand-bufs))) + cand-bufs) + nil t nil 'minibuffer-history (buffer-name (current-buffer)) t)) + +(defsubst frcmds-frame-iconified-p (frame) + "Return non-nil if FRAME is `frame-live-p' and `frame-visible-p'." + (and (frame-live-p frame) (eq (frame-visible-p frame) 'icon))) + +;; (defun remove-window (&optional window) +;; "Remove WINDOW from the display. Default is `selected-window'. +;; If WINDOW is the only one in its frame, then: +;; If WINDOW is dedicated to its buffer, then make its frame invisible. +;; Otherwise, delete its frame (as well as the window)." +;; (interactive) +;; (setq window (or window (selected-window))) +;; (select-window window) +;; (if (and (window-dedicated-p (selected-window)) +;; (one-window-p t)) +;; (let ((fr (selected-frame))) +;; ;; HACK because of Emacs bug: `raise-frame' won't raise a frame +;; ;; that was first iconified and then made invisible. +;; ;; So, here we don't make an iconified frame invisible. +;; (unless (frcmds-frame-iconified-p fr) +;; (make-frame-invisible fr))) +;; (delete-window))) + +;; REMOVED old definition, above, because of problems with invisible +;; *Completions* frame when use completion window with subsequent args +;; to a command. Just use `delete-window' now, which deletes frame if +;; `one-window-p'. Use a `defalias' because its easier than replacing +;; all my calls to `remove-window' with `delete-window'. +;; +;;;###autoload +(defalias 'remove-window 'delete-window) + +;;;###autoload +(defun remove-windows-on (buffer) + "Remove all windows showing BUFFER. This calls `remove-window' +on each window showing BUFFER." + (interactive + (list (read-buffer "Remove all windows showing buffer: " (current-buffer) 'existing))) + (setq buffer (get-buffer buffer)) ; Convert to buffer. + (when buffer ; Do nothing if null BUFFER. + (dolist (fr (frames-on buffer t)) + (remove-window (get-buffer-window buffer t))))) + +;;;###autoload +(defun mouse-remove-window (event) + "Remove the window you click on. (This calls `remove-window'.) +This command must be bound to a mouse click." + (interactive "e") + (mouse-minibuffer-check event) + (remove-window (posn-window (event-start event)))) + +;;;###autoload +(defun delete/iconify-window (&optional window frame-p) + "Delete or iconify WINDOW (default: `selected-window'). +If WINDOW is the only one in its frame (`one-window-p'), then optional +arg FRAME-P determines the behavior regarding the frame, as follows: + If FRAME-P is nil, then the frame is deleted (with the window). + If FRAME-P is t, then the frame is iconified. + If FRAME-P is a symbol naming a function, the function is applied + to WINDOW as its only arg. + If the result is nil, then the frame is deleted. + If the result is non-nil, then the frame is iconified. + If FRAME-P is anything else, then behavior is as if FRAME-P were the + symbol `window-dedicated-p': the frame is iconified if + WINDOW is dedicated, otherwise the frame is deleted. + +Interactively, FRAME-P depends on the prefix arg, as follows: + Without a prefix arg (prefix = nil), FRAME-P is `window-dedicated-p'. + With prefix arg < 0, FRAME-P is t. The frame is iconified. + With prefix arg >= 0, FRAME-P is nil. The frame is deleted." + (interactive + (list nil (if current-prefix-arg + (not (natnump (prefix-numeric-value current-prefix-arg))) + 'window-dedicated-p))) + (setq window (or window (selected-window))) + (let ((one-win-p t)) + (save-window-excursion + (select-window window) + (if (one-window-p) + (if frame-p + (if (eq t frame-p) + (iconify-frame) + (unless (and (symbolp frame-p) (fboundp frame-p)) + (setq frame-p 'window-dedicated-p)) + (if (funcall frame-p window) (iconify-frame) (delete-frame))) + (delete-frame)) ; Default. + (setq one-win-p nil))) + ;; Do this outside `save-window-excursion'. + (unless one-win-p (delete-window window)))) + +;;;###autoload +(defun delete/iconify-windows-on (buffer &optional frame frame-p) + "For each window showing BUFFER: delete it or iconify its frame. +\(This calls `delete/iconify-window' on each window showing BUFFER.) + +Optional second arg FRAME controls which frames are considered. + If nil or omitted, treat all windows showing BUFFER in any frame. + If t, treat only windows showing BUFFER in the selected frame. + If `visible', treat all windows showing BUFFER in any visible frame. + If a frame, treat only windows showing BUFFER in that frame. + +Optional third arg FRAME-P controls what to do with one-window frames. + If FRAME-P is nil, then one-window frames showing BUFFER are deleted. + If FRAME-P is t, then one-window frames are iconified. + If FRAME-P is a symbol naming a function, the function is applied + to each window showing buffer in a frame by itself. + If the result is nil, then the frame is deleted. + If the result is non-nil, then the frame is iconified. + If FRAME-P is anything else, then behavior is as if FRAME-P were the + symbol `window-dedicated-p': One-window frames are + iconified if window is dedicated, else they are deleted. + +Interactively, FRAME is nil, and FRAME-P depends on the prefix arg: + Without a prefix arg (prefix = nil), FRAME-P is `window-dedicated-p'. + With prefix arg < 0, FRAME-P is t. The frame is iconified. + With prefix arg >= 0, FRAME-P is nil. The frame is deleted." + (interactive + (list (read-buffer "Delete windows on buffer: " (current-buffer) 'existing) + nil + (if current-prefix-arg + (not (natnump (prefix-numeric-value current-prefix-arg))) + 'window-dedicated-p))) + (setq buffer (get-buffer buffer)) ; Convert to buffer. + (when buffer ; Do nothing if null BUFFER. + ;; `get-buffer-window' interprets FRAME oppositely for t and nil, + ;; so switch. + (setq frame (if (eq t frame) nil (if (eq nil frame) t frame))) + (dolist (fr (frames-on buffer frame)) + (delete/iconify-window (get-buffer-window buffer frame) frame-p)))) + +;;;###autoload +(defun rename-frame (&optional old-name new-name all-named) + "Rename a frame named OLD-NAME to NEW-NAME. +Prefix arg non-nil means rename all frames named OLD-NAME to NEWNAME. +OLD-NAME may be a frame, its name, or nil. Default is `selected-frame'. +NEW-NAME is a string or nil. Default NEW-NAME is current `buffer-name'." + (interactive + (list (read-frame (concat "Rename " (and current-prefix-arg "all ") + "frame" (and current-prefix-arg "s named") ": ") + nil t) ; Default = selected. Must exist. + (read-from-minibuffer "Rename to (new name): " (cons (buffer-name) 1)) + current-prefix-arg)) + (setq old-name (or old-name (get-frame-name)) ; Batch defaults from current. + new-name (or new-name (buffer-name (window-buffer (frame-selected-window))))) + ;; Convert to frame if string. + (let ((fr (get-a-frame old-name))) + (if all-named + (while fr + (modify-frame-parameters fr (list (cons 'name new-name))) + (setq fr (get-a-frame old-name))) ; Get another. + (when (string= (get-frame-name fr) (get-frame-name)) + (setq fr (selected-frame))) + (modify-frame-parameters fr (list (cons 'name new-name)))))) + +;;;###autoload +(defun rename-non-minibuffer-frame (&optional old-name new-name all-named) + "Unless OLD-NAME names the minibuffer frame, use `rename-frame' +to rename a frame named OLD-NAME to NEW-NAME. +Prefix arg non-nil means rename all frames named OLD-NAME to NEW-NAME. +OLD-NAME may be a frame, its name, or nil. Default is `selected-frame'. +NEW-NAME is a string or nil. Default NEW-NAME is current `buffer-name'." + (interactive + (list (read-frame (concat "Rename " (and current-prefix-arg "all ") + "frame" (and current-prefix-arg "s named") ": ") + nil t) ; Default = selected. Must exist. + (read-from-minibuffer "Rename to (new name): " (cons (buffer-name) 1)) + current-prefix-arg)) + (setq old-name (or old-name (get-frame-name)) ; Batch defaults from current. + new-name (or new-name (buffer-name (window-buffer (frame-selected-window))))) + (let ((fr (get-a-frame old-name))) ; Convert to frame if string. + (if (and (boundp '1on1-minibuffer-frame) + (eq (cdr (assq 'name (frame-parameters 1on1-minibuffer-frame))) + (cdr (assq 'name (frame-parameters fr))))) + (and (interactive-p) + (error "Use `rename-frame' if you really want to rename minibuffer frame")) + (rename-frame old-name new-name)))) + +;;;###autoload +(defun name-all-frames-numerically (&optional startover) + "Rename all frames to numerals in 1,2,3... +With optional arg STARTOVER (prefix arg, interactively), rename all +starting over from 1. Otherwise, numbering continues from the highest +existing frame number." + (interactive "P") + (when startover + (dolist (fr (frame-list)) + (rename-non-minibuffer-frame fr (format "a%s" (frame-parameter fr 'name))))) + (mapc #'name-frame-numerically (frame-list))) + +;;;###autoload +(defun name-frame-numerically (&optional frame frames) + "Name FRAME (default, selected frame) to a numeral in 1,2,3... +If FRAME's name is already such a numeral, do nothing. +Else: + Rename it to a numeral one greater than the max numeric frame name. + Rename any other frames to numerals also. + +To automatically name new frames numerically, you can do this in your +init file: + + (add-hook 'after-make-frame-functions 'name-frame-numerically)" + (interactive) + (setq frame (or frame (selected-frame)) + frames (or frames (list frame))) + (let ((onum (frcmds-frame-number frame)) + onums max) + (unless onum + (dolist (fr (frcmds-set-difference (frame-list) frames)) + (unless (eq fr frame) + (name-frame-numerically fr (cons fr frames)))) + (setq onums (delq nil (mapcar #'frcmds-frame-number (frame-list))) + max (if onums (apply #'max onums) 0)) + (rename-non-minibuffer-frame frame (number-to-string (1+ max)))))) + +(defun frcmds-frame-number (frame) + "Return FRAME's number, or nil if its name is not a numeral 1,2,3..." + (let ((num (string-to-number (frame-parameter frame 'name)))) + (and (wholenump num) (not (zerop num)) num))) + +;;;###autoload +(defun show-frame (frame) + "Make FRAME visible and raise it, without selecting it. +FRAME may be a frame or its name." + (interactive (list (read-frame "Frame to make visible: "))) + (setq frame (get-a-frame frame)) + (make-frame-visible frame) + (raise-frame frame)) + +;;;###autoload +(defun hide-frame (frame &optional prefix) + "Make FRAME invisible. Like `make-frame-invisible', but reads frame name. +Non-nil PREFIX makes it invisible even if all other frames are invisible." + (interactive (list (read-frame "Frame to make invisible: "))) + (make-frame-invisible (get-a-frame frame) prefix)) + +;;;###autoload +(defun show-a-frame-on (buffer) + "Make visible and raise a frame showing BUFFER, if there is one. +Neither the frame nor the BUFFER are selected. +BUFFER may be a buffer or its name (a string)." + (interactive + (list (read-buffer "Show a frame showing buffer: " + (if (fboundp 'another-buffer) ; Defined in `misc-fns.el'. + (another-buffer nil t) + (other-buffer (current-buffer))) + 'existing))) + (when buffer ; Do nothing if null BUFFER. + (let ((fr (car (frames-on buffer)))) (when fr (show-frame fr))))) + +;;;###autoload +(defun show-*Help*-buffer () + "Raise a frame showing buffer *Help*, without selecting it." + (interactive) (show-a-frame-on "*Help*")) + +;;;###autoload +(defun delete-1-window-frames-on (buffer) + "Delete all visible 1-window frames showing BUFFER." + (interactive + (list (read-buffer "Delete all visible 1-window frames showing buffer: " + (current-buffer) 'existing))) + (setq buffer (get-buffer buffer)) + (save-excursion + (when (buffer-live-p buffer) ; Do nothing if dead buffer. + (dolist (fr (frames-on buffer)) ; Is it better to search through + (save-window-excursion ; `frames-on' or `get-buffer-window-list'? + (select-frame fr) + (when (one-window-p t fr) (delete-frame))))))) + +;;;###autoload +(defun delete-other-frames (&optional frame) + "Delete all frames except FRAME (default: selected frame). +Interactively, use a prefix arg (`\\[universal-argument]') to be prompted for FRAME." + (interactive (list (if current-prefix-arg + (get-a-frame (read-frame "Frame to make invisible: ")) + (selected-frame)))) + (when frame + (dolist (fr (frame-list)) + (unless (eq fr frame) (condition-case nil (delete-frame fr) (error nil)))))) + +;;;###autoload +(defun maximize-frame-horizontally (&optional frame) + "Maximize selected frame horizontally." + (interactive (list (selected-frame))) + (maximize-frame 'horizontal frame)) + +;;;###autoload +(defun maximize-frame-vertically (&optional frame) + "Maximize selected frame vertically." + (interactive (list (selected-frame))) + (maximize-frame 'vertical frame)) + +;;;###autoload +(defun maximize-frame (&optional direction frame) + "Maximize selected frame horizontally, vertically, or both. +With no prefix arg, maximize both directions. +With a non-negative prefix arg, maximize vertically. +With a negative prefix arg, maximize horizontally. + +In Lisp code: + DIRECTION is the direction: `horizontal', `vertical', or `both'. + FRAME is the frame to maximize." + (interactive (list (if current-prefix-arg + (if (natnump (prefix-numeric-value current-prefix-arg)) + 'vertical + 'horizontal) + 'both))) + (unless frame (setq frame (selected-frame))) + (unless direction (setq direction 'both)) + (let (;; Size of a frame that uses all of the available screen area, + ;; but leaving room for a minibuffer frame at bottom of display. + (fr-pixel-width (frcmds-available-screen-pixel-width)) + (fr-pixel-height (frcmds-available-screen-pixel-height)) + (fr-origin (if (eq direction 'horizontal) + (car (frcmds-effective-screen-pixel-bounds)) + (cadr (frcmds-effective-screen-pixel-bounds)))) + (orig-left (frame-parameter frame 'left)) + (orig-top (frame-parameter frame 'top)) + (orig-width (frame-parameter frame 'width)) + (orig-height (frame-parameter frame 'height))) + (let* ((borders (* 2 (cdr (assq 'border-width (frame-parameters frame))))) + (new-left (if (memq direction '(horizontal both)) 0 orig-left)) + (new-top (if (memq direction '(vertical both)) 0 orig-top)) + ;; Subtract borders, scroll bars, & title bar, then convert pixel sizes to char sizes. + (new-width (if (memq direction '(horizontal both)) + (/ (- fr-pixel-width borders (frcmds-extra-pixels-width frame)) + (frame-char-width frame)) + orig-width)) + (new-height (if (memq direction '(vertical both)) + (- (/ (- fr-pixel-height borders + (frcmds-extra-pixels-height frame) + window-mgr-title-bar-pixel-height + (frcmds-smart-tool-bar-pixel-height)) + (frame-char-height frame)) + ;; Subtract menu bar unless on Carbon Emacs (menu bar not in the frame). + (if (eq window-system 'mac) + 0 + (cdr (assq 'menu-bar-lines (frame-parameters frame))))) + orig-height))) + (modify-frame-parameters + frame + `((left . ,new-left) + (width . ,new-width) + (top . ,new-top) + (height . ,new-height) + ;; If we actually changed a parameter, record the old one for restoration. + ,(and new-left (/= (frame-geom-value-numeric 'left orig-left) + (frame-geom-value-numeric 'left new-left)) + (cons 'restore-left orig-left)) + ,(and new-top (/= (frame-geom-value-numeric 'top orig-top) + (frame-geom-value-numeric 'top new-top)) + (cons 'restore-top orig-top)) + ,(and new-width (/= (frame-geom-value-numeric 'width orig-width) + (frame-geom-value-numeric 'width new-width)) + (cons 'restore-width orig-width)) + ,(and new-height (/= (frame-geom-value-numeric 'height orig-height) + (frame-geom-value-numeric 'height new-height)) + (cons 'restore-height orig-height))))) + (show-frame frame) + (incf fr-origin (if (eq direction 'horizontal) fr-pixel-width fr-pixel-height)))) + +;;;###autoload +(unless (fboundp 'restore-frame-horizontally) + (defalias 'restore-frame-horizontally 'toggle-max-frame-horizontally)) +;;;###autoload +(defun toggle-max-frame-horizontally (&optional frame) + "Toggle maximization of FRAME horizontally. +If used once, this restores the frame. If repeated, it maximizes. +This affects the `left' and `width' frame parameters. + +FRAME defaults to the selected frame." + (interactive (list (selected-frame))) + (toggle-max-frame 'horizontal frame)) + +;;;###autoload +(unless (fboundp 'restore-frame-vertically) + (defalias 'restore-frame-vertically 'toggle-max-frame-vertically)) +;;;###autoload +(defun toggle-max-frame-vertically (&optional frame) + "Toggle maximization of FRAME vertically. +If used once, this restores the frame. If repeated, it maximizes. +This affects the `top' and `height' frame parameters. + +FRAME defaults to the selected frame." + (interactive (list (selected-frame))) + (toggle-max-frame 'vertical frame)) + +;;;###autoload +(unless (fboundp 'restore-frame) (defalias 'restore-frame 'toggle-max-frame)) +;;;###autoload +(defun toggle-max-frame (&optional direction frame) + "Toggle maximization of FRAME horizontally, vertically, or both. +Reverses or (if restored) repeats the effect of the Emacs maximize +commands. Does not restore from maximization effected outside Emacs. + +With no prefix arg, toggle both directions. +With a non-negative prefix arg, toggle only vertically. +With a negative prefix arg, toggle horizontally. + +When toggling both directions, each is toggled from its last maximize +or restore state. This means that using this after +`maximize-frame-horizontally', `maximize-frame-vertically', +`toggle-max-frame-horizontally', or `toggle-max-frame-vertically' does +not necessarily just reverse the effect of that command. + +In Lisp code: + DIRECTION is the direction: `horizontal', `vertical', or `both'. + FRAME is the frame to change. It defaults to the selected frame." + (interactive (list (if current-prefix-arg + (if (natnump (prefix-numeric-value current-prefix-arg)) + 'vertical + 'horizontal) + 'both))) + (unless frame (setq frame (selected-frame))) + (unless direction (setq direction 'both)) + (let ((restore-left (frame-parameter frame 'restore-left)) + (restore-top (frame-parameter frame 'restore-top)) + (restore-width (frame-parameter frame 'restore-width)) + (restore-height (frame-parameter frame 'restore-height)) + (orig-left (frame-parameter frame 'left)) + (orig-top (frame-parameter frame 'top)) + (orig-width (frame-parameter frame 'width)) + (orig-height (frame-parameter frame 'height)) + (horiz (memq direction '(horizontal both))) + (vert (memq direction '(vertical both)))) + (case direction + (both (unless (and restore-left restore-width restore-top restore-height) + (maximize-frame 'both frame))) + (vertical (unless (and restore-top restore-height) (maximize-frame-vertically frame))) + (horizontal (unless (and restore-left restore-width) (maximize-frame-horizontally frame)))) + (modify-frame-parameters + frame `(,(and horiz restore-left (cons 'left restore-left)) + ,(and horiz restore-width (cons 'width restore-width)) + ,(and vert restore-top (cons 'top restore-top)) + ,(and vert restore-height (cons 'height restore-height)) + ,(and horiz orig-left (cons 'restore-left orig-left)) + ,(and horiz orig-width (cons 'restore-width orig-width)) + ,(and vert orig-top (cons 'restore-top orig-top)) + ,(and vert orig-height (cons 'restore-height orig-height))))) + (show-frame frame)) + +;;;###autoload +(defalias 'tile-frames-side-by-side 'tile-frames-horizontally) +;;;###autoload +(defun tile-frames-horizontally (&optional frames) + "Tile frames horizontally (side by side). +Interactively: + With prefix arg, you are prompted for names of two frames to tile. + With no prefix arg, all visible frames are tiled, except a + standalone minibuffer frame, if any. +If called from a program, all frames in list FRAMES are tiled." + (interactive (and current-prefix-arg (frcmds-read-args-for-tiling))) + (frcmds-tile-frames 'horizontal frames)) + +;;;###autoload +(defalias 'tile-frames-top-to-bottom 'tile-frames-vertically) +;;;###autoload +(defun tile-frames-vertically (&optional frames) + "Tile frames vertically (stacking from the top of the screen downward). +Interactively: + With prefix arg, you are prompted for names of two frames to tile. + With no prefix arg, all visible frames are tiled, except a + standalone minibuffer frame, if any. +If called from a program, all frames in list FRAMES are tiled." + (interactive (and current-prefix-arg (frcmds-read-args-for-tiling))) + (frcmds-tile-frames 'vertical frames)) + +;;;###autoload +(defun create-frame-tiled-horizontally () + "Horizontally tile screen with selected frame and a copy. +The same character size is used for the new frame." + (interactive) + (let* ((fr1 (selected-frame)) + (font1 (frame-parameter fr1 'font)) + (fr2 (make-frame-command))) + (save-selected-window (select-frame fr2) (set-frame-font font1)) + (frcmds-tile-frames 'horizontal (list fr1 fr2)))) + +;;;###autoload +(defun create-frame-tiled-vertically () + "Vertically tile screen with selected frame and a copy. +The same character size is used for the new frame." + (interactive) + (let* ((fr1 (selected-frame)) + (font1 (frame-parameter fr1 'font)) + (fr2 (make-frame-command))) + (frcmds-tile-frames 'vertical (list fr1 fr2)))) + +;;;###autoload +(defun split-frame-horizontally (num) + "Horizontally split the selected frame. +With a prefix arg, create that many new frames. +The same character size is used for the new frames." + (interactive "p") + (frcmds-split-frame-1 'horizontal num)) + +;;;###autoload +(defun split-frame-vertically (num) + "Vertically split the selected frame. +With a prefix arg, create that many new frames. +The same character size is used for the new frames." + (interactive "p") + (frcmds-split-frame-1 'vertical num)) + +(defun frcmds-split-frame-1 (direction num) + "Helper for `split-frame-horizontally' and `split-frame-vertically'. +DIRECTION is `horizontal' or `vertical'. +NUM is the desired number of new frames to create." + (let* ((fr1 (selected-frame)) + (font1 (frame-parameter fr1 'font)) + (x-min (frame-geom-value-numeric 'left (frame-parameter fr1 'left))) + (y-min (frame-geom-value-numeric 'top (frame-parameter fr1 'top))) + (wid (frame-pixel-width fr1)) + (hght (frcmds-frame-pixel-height fr1)) + (frames (list fr1)) + fr) + (dotimes (ii num) + (setq fr (make-frame-command)) + (save-selected-window (select-frame fr) (set-frame-font font1)) + (push fr frames)) + (frcmds-tile-frames direction frames x-min y-min wid hght))) + +(defun frcmds-frame-pixel-height (frame) + "Pixel height of FRAME, including the window-manager title bar and menu-bar. +For the title bar, `window-mgr-title-bar-pixel-height' is used. +For the menu-bar, the frame char size is multiplied by frame parameter +`menu-bar-lines'. But that parameter does not take into account +menu-bar wrapping." + (+ window-mgr-title-bar-pixel-height + (frame-pixel-height frame) + (if (not (eq window-system 'x)) + 0 + (+ (* (frame-char-height frame) + (cdr (assq 'menu-bar-lines (frame-parameters frame)))))))) + +(defun frcmds-tile-frames (direction frames &optional x-min-pix y-min-pix pix-width pix-height) + "Tile visible frames horizontally or vertically, depending on DIRECTION. +Arg DIRECTION is `horizontal' or `vertical' (meaning side by side or +above and below, respectively). + +Arg FRAMES is the list of frames to tile. If nil, then tile all visible +frames (except a standalone minibuffer frame, if any). + +The optional args cause tiling to be limited to the bounding rectangle +they specify. X-MIN-PIX and Y-MIN-PIX are the `left' and `top' screen +pixel positions of the rectangle. X-PIX-WIDTH and Y-PIX-HEIGHT are +the pixel width and height of the rectangle." + (let ((visible-frames (or frames + (filtered-frame-list ; Get visible frames, except minibuffer. + #'(lambda (fr) + (and (eq t (frame-visible-p fr)) + (or (not (fboundp 'thumfr-thumbnail-frame-p)) + (not (thumfr-thumbnail-frame-p fr))) + (or (not (boundp '1on1-minibuffer-frame)) + (not (eq (cdr (assq 'name (frame-parameters + 1on1-minibuffer-frame))) + (cdr (assq 'name (frame-parameters fr))))))))))) + ;; Size of a frame that uses all of the available screen area, + ;; but leaving room for a minibuffer frame at bottom of display. + (fr-pixel-width (or pix-width (frcmds-available-screen-pixel-width))) + (fr-pixel-height (or pix-height (frcmds-available-screen-pixel-height))) + (fr-origin (if (eq direction 'horizontal) + (or x-min-pix (car (frcmds-effective-screen-pixel-bounds))) + (or y-min-pix (cadr (frcmds-effective-screen-pixel-bounds)))))) + (case direction ; Size of frame in pixels. + (horizontal (setq fr-pixel-width (/ fr-pixel-width (length visible-frames)))) + (vertical (setq fr-pixel-height (/ fr-pixel-height (length visible-frames)))) + (otherwise (error "`frcmds-tile-frames': DIRECTION must be `horizontal' or `vertical'"))) + (dolist (fr visible-frames) + (if (or (> emacs-major-version 24) + (and (= emacs-major-version 24) (> emacs-minor-version 3))) + (let ((frame-resize-pixelwise t)) + (set-frame-size + fr + ;; Subtract scroll bars, & title bar. + (- fr-pixel-width (frcmds-extra-pixels-width fr)) + (- fr-pixel-height + window-mgr-title-bar-pixel-height + (if pix-height 0 (frcmds-smart-tool-bar-pixel-height fr)) + (if (not (eq window-system 'x)) ; Menu bar for X is not in the frame. + 0 + (* (frame-char-height fr) (cdr (assq 'menu-bar-lines (frame-parameters fr)))))) + 'PIXELWISE)) + (set-frame-size + fr + ;; Subtract scroll bars, & title bar, then convert pixel sizes to char sizes. + (/ (- fr-pixel-width + (frcmds-extra-pixels-width fr)) + (frame-char-width fr)) + (/ (- fr-pixel-height + (frcmds-extra-pixels-height fr) + window-mgr-title-bar-pixel-height + (if pix-height 0 (frcmds-smart-tool-bar-pixel-height fr)) + (if (not (eq window-system 'x)) ; Menu bar for X is not in the frame. + 0 + (* (frame-char-height fr) (cdr (assq 'menu-bar-lines (frame-parameters fr)))))) + (frame-char-height fr)))) + (set-frame-position fr + (if (eq direction 'horizontal) fr-origin (or x-min-pix 0)) + (if (eq direction 'horizontal) (or y-min-pix 0) fr-origin)) + (show-frame fr) + ;; Move over the width or height of one frame, and add one border width. + (incf fr-origin (+ (or (cdr (assq 'border-width (frame-parameters fr))) 0) + (if (eq direction 'horizontal) fr-pixel-width fr-pixel-height)))))) + +(defun frcmds-extra-pixels-width (frame) + "Pixel difference between FRAME total width and its text area width." + (- (frame-pixel-width frame) (* (frame-char-width frame) (frame-width frame)))) + +(defun frcmds-extra-pixels-height (frame) + "Pixel difference between FRAME total height and its text area height." + (- (frame-pixel-height frame) (* (frame-char-height frame) (frame-height frame)))) + +(defun frcmds-smart-tool-bar-pixel-height (&optional frame) + "Pixel height of Mac smart tool bar." + (if (and (boundp 'mac-tool-bar-display-mode) (> (frame-parameter frame 'tool-bar-lines) 0)) + (if (eq mac-tool-bar-display-mode 'icons) 40 56) + 0)) + +(defun frcmds-read-args-for-tiling () + "Read arguments for `frcmds-tile-frames'." + (list + (list + ;; Note: `read-frame' puts selected-frame name at front of `frame-name-history'. + (get-a-frame (read-frame "Tile two frames - First frame: " nil t)) + ;; Get next visible frame. For default (prompt) value: + ;; If there is another visible frame in `frame-name-history', use next such. + ;; Else if there is another visible frame in internal frame list, use next such. + ;; Else use selected frame. (`frame-name-history' is defined in `frame.el'.) + (get-a-frame + (read-frame + "Second frame: " + (let ((fr-names (cdr frame-name-history)) + (visible-p nil) + (fr nil)) + (while (and (not fr) fr-names) ; While no visible frame found and still fr-names to check. + (setq fr (car fr-names) ; Name + fr (get-a-frame fr) ; Frame + fr (and fr (eq t (frame-visible-p fr)) fr) ; Visible frame + fr-names (cdr fr-names))) + + ;; If no visible frames in history, besides selected-frame, + ;; then get next visible frame (not its name) from internal frame list. + (unless fr + (setq fr (selected-frame)) + (while (and (not visible-p) + (setq fr (next-frame fr)) + (not (equal fr (selected-frame)))) ; equal => no other found. + (setq visible-p (eq t (frame-visible-p fr))))) + fr) + t))))) + +(defun frcmds-available-screen-pixel-bounds () + "Returns a value of the same form as option `available-screen-pixel-bounds'. +This represents the currently available screen area." + (or available-screen-pixel-bounds ; Use the option value, if available. + (if (fboundp 'mac-display-available-pixel-bounds) ; Mac-OS-specific. + (mac-display-available-pixel-bounds) + (list 0 0 (x-display-pixel-width) (x-display-pixel-height))))) + +; Emacs 20 doesn't have `butlast'. Define it to avoid requiring `cl.el' at runtime. From `subr.el'. +(unless (fboundp 'butlast) + (defun nbutlast (list &optional n) + "Modifies LIST to remove the last N elements." + (let ((m (length list))) + (or n (setq n 1)) + (and (< n m) (progn (when (> n 0) (setcdr (nthcdr (- (1- m) n) list) ())) + list)))) + + (defun butlast (list &optional n) + "Return a copy of LIST with the last N elements removed." + (if (and n (<= n 0)) list (nbutlast (copy-sequence list) n)))) + +(defun frcmds-effective-screen-pixel-bounds () + "Upper left and lower right of available screen space for tiling frames. +This is `frcmds-available-screen-pixel-bounds', possibly adjusted to +allow for the standalone minibuffer frame provided by `oneonone.el'." + (if (boundp '1on1-minibuffer-frame) + (append (butlast (frcmds-available-screen-pixel-bounds)) + (list (frame-geom-value-numeric 'top (cdr (assq 'top (frame-parameters + 1on1-minibuffer-frame)))))) + (frcmds-available-screen-pixel-bounds))) + +(defun frcmds-available-screen-pixel-width (&optional include-mini-p) + "Width of the usable screen, in pixels. +Non-nil optional argument `include-mini-p' means include the space +occupied by a standalone minibuffer, if any." + (let ((bounds (if include-mini-p + (frcmds-available-screen-pixel-bounds) + (frcmds-effective-screen-pixel-bounds)))) + (- (caddr bounds) (car bounds)))) ; X1 - X0 + +(defun frcmds-available-screen-pixel-height (&optional include-mini-p) + "Height of the usable screen, in pixels. +Non-nil optional argument `include-mini-p' means include the +space occupied by a standalone minibuffer, if any." + (let ((bounds (if include-mini-p + (frcmds-available-screen-pixel-bounds) + (frcmds-effective-screen-pixel-bounds)))) + (- (cadddr bounds) (cadr bounds)))) ; Y1 - Y0 + +;; Inspired by `sk-grow-frame' from Sarir Khamsi [sarir.khamsi@raytheon.com] +;;;###autoload +(defun enlarge-frame (&optional increment frame) ; Suggested binding: `C-M-down'. + "Increase the height of FRAME (default: selected-frame) by INCREMENT. +INCREMENT is in lines (characters). +Interactively, it is given by the prefix argument." + (interactive "p") + (set-frame-height frame (+ (frame-height frame) increment))) + +;;;###autoload +(defun enlarge-frame-horizontally (&optional increment frame) ; Suggested binding: `C-M-right'. + "Increase the width of FRAME (default: selected-frame) by INCREMENT. +INCREMENT is in columns (characters). +Interactively, it is given by the prefix argument." + (interactive "p") + (set-frame-width frame (+ (frame-width frame) increment))) + +;;;###autoload +(defun shrink-frame (&optional increment frame) ; Suggested binding: `C-M-up'. + "Decrease the height of FRAME (default: selected-frame) by INCREMENT. +INCREMENT is in lines (characters). +Interactively, it is given by the prefix argument." + (interactive "p") + (set-frame-height frame (- (frame-height frame) increment))) + +;;;###autoload +(defun shrink-frame-horizontally (&optional increment frame) ; Suggested binding: `C-M-left'. + "Decrease the width of FRAME (default: selected-frame) by INCREMENT. +INCREMENT is in columns (characters). +Interactively, it is given by the prefix argument." + (interactive "p") + (set-frame-width frame (- (frame-width frame) increment))) + +;;;###autoload +(defun move-frame-down (&optional n frame) ; Suggested binding: `M-down'. + "Move selected frame down. +Move it N times `frame-char-height', where N is the prefix arg. +In Lisp code, FRAME is the frame to move." + (interactive "p") + (unless n (setq n 1)) + (setq n (* n (frame-char-height frame))) + (modify-frame-parameters frame (list (list 'top '+ (frcmds-new-frame-position frame 'top n))))) + +;;;###autoload +(defun move-frame-up (&optional n frame) ; Suggested binding: `M-up'. + "Move selected frame up. +Same as `move-frame-down', except movement is up." + (interactive "p") + (unless n (setq n 1)) + (move-frame-down (- n))) + +;;;###autoload +(defun move-frame-right (&optional n frame) ; Suggested binding: `M-right'. + "Move frame to the right. +Move it N times `frame-char-width', where N is the prefix arg. +In Lisp code, FRAME is the frame to move." + (interactive "p") + (unless n (setq n 1)) + (setq n (* n (frame-char-width frame))) + (modify-frame-parameters frame (list (list 'left '+ (frcmds-new-frame-position frame 'left n))))) + +;;;###autoload +(defun move-frame-left (&optional n frame) ; Suggested binding: `M-left'. + "Move frame to the left. +Same as `move-frame-right', except movement is to the left." + (interactive "p") + (unless n (setq n 1)) + (move-frame-right (- n))) + +;; Helper function. +(defun frcmds-new-frame-position (frame type incr) + "Return the new TYPE position of FRAME, incremented by INCR. +TYPE is `left' or `top'. +INCR is the increment to use when changing the position." + (let ((new-pos (+ incr (cadr (frame-geom-value-cons + type (cdr (assq type (frame-parameters frame))))))) + (display-dimension (if (eq 'left type) + (frcmds-available-screen-pixel-width t) + (frcmds-available-screen-pixel-height t))) + (frame-dimension (if (eq 'left type) (frame-pixel-width frame) (frame-pixel-height frame)))) + (if (not move-frame-wrap-within-display-flag) + new-pos + (when (< new-pos (- frame-dimension)) (setq new-pos display-dimension)) + (when (> new-pos display-dimension) (setq new-pos (- frame-dimension))) + new-pos))) + +;;;###autoload +(defun move-frame-to-screen-top (arg &optional frame) ; Suggested binding: `M-S-v'. + "Move FRAME (default: selected-frame) to the top of the screen. +With a prefix arg, offset it that many char heights from the top." + (interactive (list (if current-prefix-arg + (* (frame-char-height) (prefix-numeric-value current-prefix-arg)) + 0) + (get-a-frame (read-frame "Frame: " nil 'EXISTING)))) + (modify-frame-parameters frame `((top . ,arg)))) + +;;;###autoload +(defun move-frame-to-screen-bottom (arg &optional frame) ; Suggested binding: `C-S-v'. + "Move FRAME (default: selected-frame) to the bottom of the screen. +With a prefix arg, offset it that many char heights from the bottom." + (interactive (list (if current-prefix-arg + (* (frame-char-height) (prefix-numeric-value current-prefix-arg)) + 0) + (get-a-frame (read-frame "Frame: " nil 'EXISTING)))) + (let* ((borders (* 2 (cdr (assq 'border-width (frame-parameters frame))))) + (avail-height (- (/ (- (frcmds-available-screen-pixel-height) borders + (frcmds-extra-pixels-height frame) + window-mgr-title-bar-pixel-height + (frcmds-smart-tool-bar-pixel-height)) + (frame-char-height frame)) + ;; Subtract menu bar unless on Carbon Emacs (menu bar not in the frame). + (if (eq window-system 'mac) + 0 + (cdr (assq 'menu-bar-lines (frame-parameters frame))))))) + (modify-frame-parameters frame `((top . ,(- (+ avail-height arg))))))) + +;;;###autoload +(defun move-frame-to-screen-left (arg &optional frame) ; Suggested binding: `C-S-prior'. + "Move FRAME (default: selected-frame) to the left side of the screen. +With a prefix arg, offset it that many char widths from the left." + (interactive (list (if current-prefix-arg + (* (frame-char-width) (prefix-numeric-value current-prefix-arg)) + 0) + (get-a-frame (read-frame "Frame: " nil 'EXISTING)))) + (modify-frame-parameters frame `((left . ,arg)))) + +;;;###autoload +(defun move-frame-to-screen-right (arg &optional frame) ; Suggested binding: `C-S-next'. + "Move FRAME (default: selected-frame) to the right side of the screen. +With a prefix arg, offset it that many char widths from the right." + (interactive (list (if current-prefix-arg + (* (frame-char-width) (prefix-numeric-value current-prefix-arg)) + 0) + (get-a-frame (read-frame "Frame: " nil 'EXISTING)))) + (modify-frame-parameters + frame ; Hard-code 7 here - what does it depend on? + `((left . ,(- (x-display-pixel-width) (+ (frame-pixel-width) 7 arg)))))) + +;;;###autoload +(defun move-frame-to-screen-top-left (arg &optional frame) ; Suggested binding: `C-S-home'. + "Move FRAME (default: selected-frame) to the top and left of the screen. +With a prefix arg, offset it that many char widths from the edges. + +Note: You can use this command to move an off-screen (thus not +visible) frame back onto the screen." + (interactive (list (if current-prefix-arg + (* (frame-char-width) (prefix-numeric-value current-prefix-arg)) + 0) + (get-a-frame (read-frame "Frame: " nil 'EXISTING)))) + (modify-frame-parameters frame '((top . ,arg) (left . ,arg)))) + + +;; This does not work 100% well. For instance, set frame font to +;; "-raster-Terminal-normal-r-normal-normal-12-90-96-96-c-50-ms-oemlatin", then decrease font size. +;; The next smaller existing font on my machine is +;; "-raster-Terminal-normal-r-normal-normal-11-*-96-96-c-*-ms-oemlatin". Decrease size again. +;; Next smaller font is "-raster-Terminal-bold-r-normal-normal-5-37-96-96-c-60-ms-oemlatin". Notice +;; the switch to bold from regular. Cannot decrease any more. Increase size. Next larger font is +;; "-raster-Terminal-bold-r-normal-normal-8-*-96-96-c-*-ms-oemlatin". Can no longer increase size. +;; +;;;###autoload +(defun enlarge-font (&optional increment frame) + "Increase size of font in FRAME by INCREMENT. +Interactively, INCREMENT is given by the prefix argument. +Optional FRAME parameter defaults to current frame." + (interactive "p") + (setq frame (or frame (selected-frame))) + (let ((fontname (cdr (assq 'font (frame-parameters frame)))) + (count enlarge-font-tries)) + (setq fontname (frcmds-enlarged-font-name fontname frame increment)) + (while (and (not (x-list-fonts fontname)) (wholenump (setq count (1- count)))) + (setq fontname (frcmds-enlarged-font-name fontname frame increment))) + (unless (x-list-fonts fontname) (error "Cannot change font size")) + (modify-frame-parameters frame (list (cons 'font fontname))) + ;; Update faces that want a bold or italic version of the default font. + (when (< emacs-major-version 21) (frame-update-faces frame)))) + +;;; This was a workaround hack for an Emacs 23 bug (#119, aka #1562). +;;; This works OK, but it is not as refined as the version I use, and it does not work for +;;; older Emacs versions. +;;; +;;; (when (> emacs-major-version 22) +;;; (defun enlarge-font (&optional increment frame) +;;; "Increase size of font in FRAME by INCREMENT. +;;; Interactively, INCREMENT is given by the prefix argument. +;;; Optional FRAME parameter defaults to current frame." +;;; (interactive "p") +;;; (setq frame (or frame (selected-frame))) +;;; (set-face-attribute +;;; 'default frame :height (+ (* 10 increment) +;;; (face-attribute 'default :height frame 'default))))) + + + + + +;;; Define error symbols `font-too-small' and `font-size', and their error conditions and messages. +;;; +;;; You can use these to handle an error of trying to make the font too small. +;;; See library `thumb-frm.el', command `thumfr-thumbify-frame'. +;;; +(put 'font-too-small 'error-conditions '(error font-size font-too-small)) +(put 'font-too-small 'error-message "Font size is too small") + +(put 'font-size 'error-conditions '(error font-size)) +(put 'font-size 'error-message "Bad font size") + +(defun frcmds-enlarged-font-name (fontname frame increment) + "FONTNAME, after enlarging font size of FRAME by INCREMENT. +FONTNAME is the font of FRAME." + (when (query-fontset fontname) + (let ((ascii (assq 'ascii (aref (fontset-info fontname frame) 2)))) + (when ascii (setq fontname (nth 2 ascii))))) + (let ((xlfd-fields (x-decompose-font-name fontname))) + (unless xlfd-fields (error "Cannot decompose font name")) + (let ((new-size (+ (string-to-number (aref xlfd-fields xlfd-regexp-pixelsize-subnum)) + increment))) + (unless (> new-size 0) (signal 'font-too-small (list new-size))) + (aset xlfd-fields xlfd-regexp-pixelsize-subnum (number-to-string new-size))) + ;; Set point size & width to "*", so frame width will adjust to new font size + (aset xlfd-fields xlfd-regexp-pointsize-subnum "*") + (aset xlfd-fields xlfd-regexp-avgwidth-subnum "*") + (x-compose-font-name xlfd-fields))) + +;;;###autoload +(defun set-frame-alist-parameter-from-frame (alist parameter &optional frame) + "Set PARAMETER of frame alist ALIST to its current value in FRAME. +FRAME defaults to the selected frame. ALIST is a variable (symbol) +whose value is an alist of frame parameters." + (interactive + (let ((symb (or (and (fboundp 'symbol-nearest-point) + (symbol-nearest-point)) + (symbolp (variable-at-point)))) + (enable-recursive-minibuffers t)) + (list (intern (completing-read + "Frame alist to change (variable): " + (frcmds-frame-alist-var-names) nil t nil nil 'default-frame-alist t)) + (intern (completing-read "Parameter to set:" ; Lax completion - not just known parameters. + (frcmds-frame-parameter-names) nil nil nil nil 'left t)) + (get-a-frame (read-frame "Frame to copy parameter value from: " nil t))))) + (unless (boundp alist) + (error "Not a defined Emacs variable: `%s'" alist)) + (set alist (assq-delete-all parameter (copy-alist (eval alist)))) + (set alist (cons (assq parameter (frame-parameters frame)) (eval alist))) + (tell-customize-var-has-changed alist)) + +;;; Standard Emacs 21+ function, defined here for Emacs 20. +(unless (fboundp 'assq-delete-all) + (defun assq-delete-all (key alist) + "Delete from ALIST all elements whose car is `eq' to KEY. +Return the modified alist. +Elements of ALIST that are not conses are ignored." + (while (and (consp (car alist)) (eq (car (car alist)) key)) (setq alist (cdr alist))) + (let ((tail alist) + tail-cdr) + (while (setq tail-cdr (cdr tail)) + (if (and (consp (car tail-cdr)) (eq (car (car tail-cdr)) key)) + (setcdr tail (cdr tail-cdr)) + (setq tail tail-cdr)))) + alist)) + +;; Define this to avoid requiring `cl.el' at runtime. Same as `icicle-set-difference'. +(defun frcmds-set-difference (list1 list2 &optional key) + "Combine LIST1 and LIST2 using a set-difference operation. +Optional arg KEY is a function used to extract the part of each list +item to compare. + +The result list contains all items that appear in LIST1 but not LIST2. +This is non-destructive; it makes a copy of the data if necessary, to +avoid corrupting the original LIST1 and LIST2." + (if (or (null list1) (null list2)) + list1 + (let ((keyed-list2 (and key (mapcar key list2))) + (result ())) + (while list1 + (unless (if key + (member (funcall key (car list1)) keyed-list2) + (member (car list1) list2)) + (setq result (cons (car list1) result))) + (setq list1 (cdr list1))) + result))) + +;;;###autoload +(defun set-all-frame-alist-parameters-from-frame (alist &optional frame really-all-p) + "Set frame parameters of ALIST to their current values in FRAME. +Unless optional argument REALLY-ALL-P (prefix arg) is non-nil, the +frame parameters in list `frame-parameters-to-exclude' are +excluded: they are not copied from FRAME to ALIST. +ALIST is a variable (symbol) whose value is an alist of frame parameters. +FRAME defaults to the selected frame." + (interactive + (let ((symb (or (and (fboundp 'symbol-nearest-point) + (symbol-nearest-point)) + (symbolp (variable-at-point)))) + (enable-recursive-minibuffers t)) + (list (intern (completing-read + "Frame alist to change (variable): " + (frcmds-frame-alist-var-names) nil t nil nil 'default-frame-alist t)) + (get-a-frame (read-frame "Frame to copy parameter values from: " nil t)) + current-prefix-arg))) + (unless (boundp alist) + (error "Not a defined Emacs variable: `%s'" alist)) + (set alist (frcmds-set-difference (frame-parameters frame) + (and (not really-all-p) frame-parameters-to-exclude) + #'car)) + (tell-customize-var-has-changed alist)) + +(defun frcmds-frame-alist-var-names () + "Return an alist of all variable names that end in \"frame-alist\". +The CAR of each list item is a string variable name. +The CDR is nil." + (let ((vars ())) + (mapatoms (lambda (sym) (and (boundp sym) + (setq sym (symbol-name sym)) + (string-match "frame-alist$" sym) + (push (list sym) vars)))) + vars)) + +(defun frcmds-frame-parameter-names () + "Return an alist of all available frame-parameter names. +These are the documented, out-of-the-box (predefined) parameters. +The CAR of each list item is a string parameter name. +The CDR is nil." + (let ((params '(("auto-lower") + ("auto-raise") + ("background-color") + ("background-mode") + ("border-color") + ("border-width") + ("buffer-list") + ("buffer-predicate") + ("cursor-color") + ("cursor-type") + ("display") + ("display-type") + ("font") + ("foreground-color") + ("height") + ("horizontal-scroll-bars") + ("icon-left") + ("icon-name") + ("icon-top") + ("icon-type") + ("internal-border-width") + ("left") + ("menu-bar-lines") + ("minibuffer") + ("mouse-color") + ("name") + ("scroll-bar-width") + ("title") + ("top") + ("unsplittable") + ("user-position") + ("vertical-scroll-bars") + ("visibility") + ("width") + ("window-id")))) + (when (> emacs-major-version 20) + (setq params (nconc params '(("fullscreen") + ("left-fringe") + ("line-spacing") + ("outer-window-id") + ("right-fringe") + ("screen-gamma") + ("scroll-bar-background") + ("scroll-bar-foreground") + ("tool-bar-lines") + ("tty-color-mode") + ("wait-for-wm"))))) + (when (> emacs-major-version 21) + (setq params (nconc params '(("user-size"))))) + (when (> emacs-major-version 22) + (setq params (nconc params '(("alpha") + ("display-environment-variable") + ("font-backend") + ("sticky") + ("term-environment-variable"))))) + (when (> emacs-major-version 23) + (setq params (nconc params '(("explicit-name") + ("tool-bar-position"))))) + params)) + +;;;###autoload +(defun tell-customize-var-has-changed (variable) + "Tell Customize to recognize that VARIABLE has been set (changed). +VARIABLE is a symbol that names a user option." + (interactive "vVariable: ") + (put variable 'customized-value (list (custom-quote (eval variable))))) + +;;;###autoload +(defun other-window-or-frame (arg) + "`other-frame', if `one-window-p'; otherwise, `other-window'." + (interactive "p") + (if (one-window-p) (other-frame arg) (other-window arg))) + +;;;;;;;;;;;;;;;;;;;;;;; + +(provide 'frame-cmds) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; frame-cmds.el ends here diff --git a/layers/!distribution/spacemacs/local/zoom-frm/frame-fns.el b/layers/!distribution/spacemacs/local/zoom-frm/frame-fns.el new file mode 100644 index 000000000000..68b6b207f695 --- /dev/null +++ b/layers/!distribution/spacemacs/local/zoom-frm/frame-fns.el @@ -0,0 +1,313 @@ +;;; frame-fns.el --- Non-interactive frame and window functions. +;; +;; Filename: frame-fns.el +;; Description: Non-interactive frame and window functions. +;; Author: Drew Adams +;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com") +;; Copyright (C) 1996-2015, Drew Adams, all rights reserved. +;; Created: Tue Mar 5 16:15:50 1996 +;; Version: 0 +;; Package-Requires: () +;; Last-Updated: Thu Jan 1 10:45:03 2015 (-0800) +;; By: dradams +;; Update #: 227 +;; URL: http://www.emacswiki.org/frame-fns.el +;; Doc URL: http://emacswiki.org/FrameModes +;; Keywords: internal, extensions, local, frames +;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x, 25.x +;; +;; Features that might be required by this library: +;; +;; `avoid'. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; Non-interactive frame and window functions. +;; +;; Main new functions defined here: +;; +;; `1-window-frames-on', `distance', `flash-ding', +;; `frame-geom-spec-cons', `frame-geom-value-cons', +;; `frame-geom-spec-numeric', `frame-geom-value-numeric', +;; `frames-on', `get-a-frame', `get-frame-name', +;; `multi-window-frames-on', `read-frame', `window-coords'. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Change Log: +;; +;; 2011/01/04 dadams +;; Removed autoload cookies from non-interactive functions. +;; 2010/01/12 dadams +;; 1-window-frames-on, multi-window-frames-on: +;; save-excursion + set-buffer -> with-current-buffer. +;; 2008/04/05 dadams +;; get-a-frame: Define without using member-if. +;; 2005/10/31 dadams +;; read-frame: Swapped default and init values in call to completing-read. +;; 2004/11/26 dadams +;; Added frame-geom-spec-numeric and frame-geom-value-numeric. +;; 2004/03/19 dadams +;; read-frame: 1) if default is a frame, use its name, +;; 2) use frame-name-history, not minibuffer-history, +;; and use make-frame-names-alist, not frame-alist, +;; in completing-read +;; 1996/02/14 dadams +;; Added: window-coords, distance. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; 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, 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; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Code: + +(eval-when-compile (when (< emacs-major-version 21) (require 'cl))) + ;; dolist, push +(require 'avoid nil t) ;; mouse-avoidance-point-position + +;;;;;;;;;;;;;;;;;;;;;;; + +(defun window-coords (&optional position) + "Return window coordinates of buffer POSITION (default: point). +If POSITION is nil, (point) is used." + (unless (fboundp 'mouse-avoidance-point-position) (require 'avoid)) + (cdr (mouse-avoidance-point-position))) + +(defun distance (pt1 pt2) + "Distance as the crow flies between PT1 and PT2. +PT1 and PT2 are each a cons of the form (X . Y)." + (let ((xdiff (abs (- (car pt1) (car pt2)))) + (ydiff (abs (- (cdr pt1) (cdr pt2))))) + (sqrt (+ (* xdiff xdiff) (* ydiff ydiff))))) + +(defun frame-geom-value-numeric (type value &optional frame) + "Return equivalent geometry value for FRAME in numeric terms. +A geometry value equivalent to VALUE for FRAME is returned, +where the value is numeric, not a consp. +TYPE is the car of the original geometry spec (TYPE . VALUE). + It is `top' or `left', depending on which edge VALUE is related to. +VALUE is the cdr of a frame geometry spec: (left/top . VALUE). +If VALUE is a consp, then it is converted to a numeric value, perhaps + relative to the opposite frame edge from that in the original spec. +FRAME defaults to the selected frame. + +Examples (measures in pixels) - + Assuming display height/width=1024, frame height/width=600: + 300 inside display edge: 300 => 300 + (+ 300) => 300 + 300 inside opposite display edge: (- 300) => -300 + -300 => -300 + 300 beyond display edge + (= 724 inside opposite display edge): (+ -300) => -724 + 300 beyond display edge + (= 724 inside opposite display edge): (- -300) => 724 + +In the last two examples, the returned value is relative to the +opposite frame edge from the edge indicated in the input spec." + (if (consp value) + (if (natnump (cadr value)) + ;; e.g. (+ 300) or (- 300) => 300 or -300 + (funcall (car value) (cadr value)) + ;; e.g. (+ -300) or (- -300) + (let ((oppval (- (if (eq 'left type) + (x-display-pixel-width) + (x-display-pixel-height)) + (cadr value) + (if (eq 'left type) + (frame-pixel-width frame) + (frame-pixel-height frame))))) + (if (eq '+ (car value)) + (- oppval) ; e.g. (+ -300) => -724 + oppval))) ; e.g. (- -300) => 724 + ;; e.g. 300 or -300 + value)) + +(defun frame-geom-spec-numeric (spec &optional frame) + "Return equivalent geometry specification for FRAME in numeric terms. +A geometry specification equivalent to SPEC for FRAME is returned, +where the value is numeric, not a consp. +SPEC is a frame geometry spec: (left . VALUE) or (top . VALUE). +If VALUE is a consp, then it is converted to a numeric value, perhaps + relative to the opposite frame edge from that in the original SPEC. +FRAME defaults to the selected frame. + +Examples (measures in pixels) - + Assuming display height=1024, frame height=600: + top 300 below display top: (top . 300) => (top . 300) + (top + 300) => (top . 300) + bottom 300 above display bottom: (top - 300) => (top . -300) + (top . -300) => (top . -300) + top 300 above display top + (= bottom 724 above display bottom): (top + -300) => (top . -724) + bottom 300 below display bottom + (= top 724 below display top): (top - -300) => (top . 724) + +In the last two examples, the returned value is relative to the +opposite frame edge from the edge indicated in the input SPEC." + (cons (car spec) (frame-geom-value-numeric (car spec) (cdr spec)))) + +(defun frame-geom-value-cons (type value &optional frame) + "Return equivalent geometry value for FRAME as a cons with car `+'. +A geometry value equivalent to VALUE for FRAME is returned, +where the value is a cons with car `+', not numeric. +TYPE is the car of the original geometry spec (TYPE . VALUE). + It is `top' or `left', depending on which edge VALUE is related to. +VALUE is the cdr of a frame geometry spec: (left/top . VALUE). +If VALUE is a number, then it is converted to a cons value, perhaps + relative to the opposite frame edge from that in the original spec. +FRAME defaults to the selected frame. + +Examples (measures in pixels) - + Assuming display height/width=1024, frame height/width=600: + 300 inside display edge: 300 => (+ 300) + (+ 300) => (+ 300) + 300 inside opposite display edge: (- 300) => (+ 124) + -300 => (+ 124) + 300 beyond display edge + (= 724 inside opposite display edge): (+ -300) => (+ -300) + 300 beyond display edge + (= 724 inside opposite display edge): (- -300) => (+ 724) + +In the 3rd, 4th, and 6th examples, the returned value is relative to +the opposite frame edge from the edge indicated in the input spec." + (cond ((and (consp value) (eq '+ (car value))) ; e.g. (+ 300), (+ -300) + value) + ((natnump value) (list '+ value)) ; e.g. 300 => (+ 300) + (t ; e.g. -300, (- 300), (- -300) + (list '+ (- (if (eq 'left type) ; => (+ 124), (+ 124), (+ 724) + (x-display-pixel-width) + (x-display-pixel-height)) + (if (integerp value) (- value) (cadr value)) + (if (eq 'left type) + (frame-pixel-width frame) + (frame-pixel-height frame))))))) + +(defun frame-geom-spec-cons (spec &optional frame) + "Return equivalent geometry spec for FRAME as a cons with car `+'. +A geometry specification equivalent to SPEC for FRAME is returned, +where the value is a cons with car `+', not numeric. +SPEC is a frame geometry spec: (left . VALUE) or (top . VALUE). +If VALUE is a number, then it is converted to a cons value, perhaps + relative to the opposite frame edge from that in the original spec. +FRAME defaults to the selected frame. + +Examples (measures in pixels) - + Assuming display height=1024, frame height=600: + top 300 below display top: (top . 300) => (top + 300) + (top + 300) => (top + 300) + bottom 300 above display bottom: (top - 300) => (top + 124) + (top . -300) => (top + 124) + top 300 above display top + (= bottom 724 above display bottom): (top + -300) => (top + -300) + bottom 300 below display bottom + (= top 724 below display top): (top - -300) => (top + 724) + +In the 3rd, 4th, and 6th examples, the returned value is relative to +the opposite frame edge from the edge indicated in the input spec." + (cons (car spec) (frame-geom-value-cons (car spec) (cdr spec)))) + +(defun get-frame-name (&optional frame) + "Return the string that names FRAME (a frame). Default is selected frame." + (unless frame (setq frame (selected-frame))) + (if (framep frame) + (cdr (assq 'name (frame-parameters frame))) + (error "Function `get-frame-name': Argument not a frame: `%s'" frame))) + +(defun get-a-frame (frame) + "Return a frame, if any, named FRAME (a frame or a string). +If none, return nil. +If FRAME is a frame, it is returned." + (cond ((framep frame) frame) + ((stringp frame) + (catch 'get-a-frame-found + (dolist (fr (frame-list)) + (when (string= frame (get-frame-name fr)) + (throw 'get-a-frame-found fr))) + nil)) + (t (error + "Function `get-frame-name': Arg neither a string nor a frame: `%s'" + frame)))) + +(defun read-frame (prompt &optional default existing) + "Read the name of a frame, and return it as a string. +Prompts with 1st arg, PROMPT (a string). + +The default frame is named by the optional 2nd arg, DEFAULT, if a +string or a frame, or by the `selected-frame', if nil. + +Non-nil optional 3rd arg, EXISTING, means to allow only names of +existing frames." + (setq default (if (framep default) + (get-frame-name default) + (or default (get-frame-name)))) + (unless (stringp default) + (error "Function `read-frame': DEFAULT arg is neither a frame nor a string")) + (completing-read prompt (make-frame-names-alist) + ;; To limit to live frames: + ;; (function (lambda (fn+f)(frame-live-p (cdr fn+f)))) + ;; `frame-name-history' is defined in `frame.el'. + nil existing nil '(frame-name-history . 2) default)) + +(defun frames-on (buffer &optional frame) + "List of all live frames showing BUFFER (a buffer or its name). +The optional FRAME argument is as for function `get-buffer-window'." + (filtered-frame-list (function (lambda (fr) (get-buffer-window buffer fr))))) + +(defun 1-window-frames-on (buffer) + "List of all visible 1-window frames showing BUFFER." + (setq buffer (get-buffer buffer)) + (when buffer ; Do nothing if BUFFER is not a buffer. + (let ((frs ())) + (with-current-buffer buffer + (when (buffer-live-p buffer) ; Do nothing if dead buffer. + ;; $$$$$$ Is it better to search through frames-on or windows-on? + (dolist (fr (frames-on buffer)) + (save-window-excursion (select-frame fr) + (when (one-window-p t fr) (push fr frs)))))) + frs))) + +(defun multi-window-frames-on (buffer) + "List of all visible multi-window frames showing BUFFER." + (setq buffer (get-buffer buffer)) + (when buffer ; Do nothing if BUFFER is not a buffer. + (let ((frs ())) + (with-current-buffer buffer + (when (buffer-live-p buffer) ; Do nothing if dead buffer. + ;; $$$$$$ Is it better to search through frames-on or windows-on? + (dolist (fr (frames-on buffer)) + (save-window-excursion (select-frame fr) + (unless (one-window-p t fr) + (push fr frs)))))) + frs))) + +(defun flash-ding (&optional do-not-terminate frame) + "Ring bell (`ding'), after flashing FRAME (default: current), if relevant. +Terminates any keyboard macro executing, unless arg DO-NOT-TERMINATE non-nil." + (save-window-excursion + (when frame (select-frame frame)) + (let ((visible-bell t)) (ding 'DO-NOT-TERMINATE))) ; Flash. + (let ((visible-bell nil)) (ding 'DO-NOT-TERMINATE))) ; Bell. + +;;;;;;;;;;;;;;;;;;;;;;; + +(provide 'frame-fns) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; frame-fns.el ends here diff --git a/layers/!distribution/spacemacs/local/zoom-frm/zoom-frm.el b/layers/!distribution/spacemacs/local/zoom-frm/zoom-frm.el new file mode 100644 index 000000000000..91eac337ea54 --- /dev/null +++ b/layers/!distribution/spacemacs/local/zoom-frm/zoom-frm.el @@ -0,0 +1,439 @@ +;;; zoom-frm.el --- Commands to zoom frame font size. +;; +;; Filename: zoom-frm.el +;; Description: Commands to zoom frame font size. +;; Author: Drew Adams +;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com") +;; Copyright (C) 2005-2015, Drew Adams, all rights reserved. +;; Created: Fri Jan 07 10:24:35 2005 +;; Version: 0 +;; Package-Requires: ((frame-fns "0") (frame-cmds "0")) +;; Last-Updated: Thu Jan 1 11:24:13 2015 (-0800) +;; By: dradams +;; Update #: 322 +;; URL: http://www.emacswiki.org/zoom-frm.el +;; Doc URL: http://emacswiki.org/SetFonts +;; Keywords: frames, extensions, convenience +;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x, 25.x +;; +;; Features that might be required by this library: +;; +;; `avoid', `frame-cmds', `frame-fns', `misc-fns', `strings', +;; `thingatpt', `thingatpt+'. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; Commands to zoom into and out of text. They zoom a frame or a +;; buffer, so that the text appears larger or smaller. +;; +;; Commands `zoom-in', `zoom-out', and `zoom-in/out' do both kinds of +;; zooming. They can behave like command `text-scale-adjust', +;; zooming a buffer wherever it is displayed, or they can zoom an +;; entire single frame (all of its windows). Hit `C-u' at any time +;; while using these commands to toggle between buffer and frame +;; zooming. +;; +;; Because it is a more general replacement for `text-scale-adjust', +;; I suggest you bind `zoom-in/out' to the keys bound by default to +;; `text-scale-adjust': `C-x C-+', `C-x C-=', `C-x C--', and `C-x +;; C-0'. +;; +;; It is also handy to use a mouse button or wheel for zooming, hence +;; the mouse binding suggestions. For example, binding `zoom-in' and +;; `zoom-out' to mouse wheel events gives you the zooming effect you +;; are perhaps used to in a Web browser. +;; +;; User option `zoom-frame/buffer' determines which kind of zooming +;; (frame or buffer) is used by default. You can customize this +;; option, but (in Emacs 23 or later) you can also toggle it just by +;; providing a prefix arg (`C-u') to `zoom-in/out', `zoom-in', or +;; `zoom-out'. +;; +;; Note about saving changes made dynamically using the commands +;; defined here: +;; +;; Some of the commands defined here change frame properties. You +;; can save any changes you have made, by using Customize. To +;; visit a Customize buffer of all unsaved changes you have made, +;; use command `customize-customized'. +;; +;; Frame parameter changes, such as font size, can be saved for +;; future use by all frames or all frames of a certain kind. For +;; that, you must change the frame parameters of the correponding +;; frame-alist variable. +;; +;; There is no single variable for saving changes to parameters of +;; the current frame. Instead, there are several different +;; frame-alist variables, which you can use to define different +;; kinds of frames. These include: `default-frame-alist', +;; `initial-frame-alist', and `special-display-frame-alist'. The +;; complete list of such frame alist variables is available using +;; function `frame-alist-var-names', defined in library +;; `frame-cmds.el'. +;; +;; Example: Suppose you change the font size of a frame and want to +;; make that the default font size for new frames in the future. +;; You will need to update the value of variable +;; `default-frame-alist' to use the `font' parameter setting of the +;; changed frame. +;; +;; You can easily copy one or all parameter values from any given +;; frame to any frame alist (such as `default-frame-alist'), by +;; using the commands `set-frame-alist-parameter-from-frame' and +;; `set-all-frame-alist-parameters-from-frame'. Those commands are +;; defined in library `frame-cmds.el'. +;; +;; +;; Commands defined here: +;; +;; `toggle-zoom-frame', `zoom-all-frames-in', +;; `zoom-all-frames-out', `zoom-frm-in', `zoom-frm-out', +;; `zoom-frm-unzoom', `zoom-in', `zoom-in/out' (Emacs 23+), +;; `zoom-out'. +;; +;; +;; User options (variables) defined here: +;; +;; `frame-zoom-font-difference', `zoom-frame/buffer' (Emacs 23+). +;; +;; +;; Put this in your init file (`~/.emacs'): (require 'zoom-frm) +;; +;; Suggested key bindings: +;; +;; Emacs 23 and later: +;; +;; (define-key ctl-x-map [(control ?+)] 'zoom-in/out) +;; (define-key ctl-x-map [(control ?-)] 'zoom-in/out) +;; (define-key ctl-x-map [(control ?=)] 'zoom-in/out) +;; (define-key ctl-x-map [(control ?0)] 'zoom-in/out) +;; +;; Any Emacs version: +;; +;; (global-set-key (if (boundp 'mouse-wheel-down-event) ; Emacs 22+ +;; (vector (list 'control +;; mouse-wheel-down-event)) +;; [C-mouse-wheel]) ; Emacs 20, 21 +;; 'zoom-in) +;; (when (boundp 'mouse-wheel-up-event) ; Emacs 22+ +;; (global-set-key (vector (list 'control mouse-wheel-up-event)) +;; 'zoom-out)) +;; +;; (global-set-key [S-mouse-1] 'zoom-in) +;; (global-set-key [C-S-mouse-1] 'zoom-out) +;; ;; Get rid of `mouse-set-font' or `mouse-appearance-menu': +;; (global-set-key [S-down-mouse-1] nil) +;; +;; The first two of the mouse bindings mean that in Emacs 22 or later +;; you can hold the Control key and rotate the mouse wheel to zoom in +;; and out, just as you might do in a Web browser. +;; +;; (In Emacs 20 and 21, Control plus mouse wheeling zooms in, but to +;; zoom out you need to use `C--' before wheeling with Control. This +;; is because Emacs 20 and 21 do not have separate events for the +;; mouse wheel directions, and it is the prefix arg, not the wheel +;; direction, that determines the effect.) +;; +;; +;; See also these files for other frame commands: +;; +;; `autofit-frame.el' - Automatically fit each frame to its +;; selected window. Uses `fit-frame.el'. +;; +;; `fit-frame.el' - 1) Fit a frame to its selected window. +;; 2) Incrementally resize a frame. +;; +;; `doremi-frm.el' - Incrementally adjust frame properties +;; using arrow keys and/or mouse wheel. +;; +;; `frame-cmds.el' - Miscellaneous frame and window commands. +;; +;; `thumb-frm.el' - Shrink frames to a thumbnail size and +;; restore them again. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Change Log: +;; +;; 2013/12/31 dadams +;; zoom-in/out: Use set-transient-map, if defined. +;; 2013/09//29 dadams +;; zoom-in/out: Only for Emacs 24.3+ (needs set-temporary-overlay-map). +;; 2013/09/13 dadams +;; Added: zoom-all-frames-in, zoom-all-frames-out. +;; 2013/04/21 dadams +;; Added: zoom-in/out. +;; 2011/01/04 dadams +;; Added autoload cookies for defgroup and defcustom. +;; 2010/07/06 dadams +;; zoom-(in|out): Put doc strings before interactive spec. Thx to Yidong Chong. +;; 2009/06/11 dadams +;; Added buffer zooming, for Emacs 23. +;; Added zoom-(in|out), group zoom, zoom-frame/buffer. +;; 2006/01/07 dadams +;; Added :link for sending bug report. +;; 2006/01/06 dadams +;; frame-zoom-font-difference: Changed :group to Frame-Commands. Added :link. +;; 2005/01/18 dadams +;; Changed default value of frame-zoom-font-difference. +;; Added Note on saving changes. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; 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, 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; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Code: + +(require 'frame-cmds) ;; enlarge-font + + +(defvar zoom-frame/buffer) ;; Defined here for Emacs 22+. + +;;;;;;;;;;;;;;;;;;;;;;;; + + +;;; USER OPTIONS (VARIABLES) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;;###autoload +(defgroup zoom nil + "Zoom a frame or buffer." + :group 'frames :group 'Frame-Commands ; Defined in `frame-cmds.el'. + :link `(url-link :tag "Send Bug Report" + ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\ +zoom-frm.el bug: \ +&body=Describe bug here, starting with `emacs -q'. \ +Don't forget to mention your Emacs and library versions.")) + :link '(url-link :tag "Other Libraries by Drew" + "http://www.emacswiki.org/DrewsElispLibraries") + :link '(url-link :tag "Download" + "http://www.emacswiki.org/emacs-en/download/zoom-frm.el") + :link '(url-link :tag "Description" + "http://www.emacswiki.org/SetFonts#ChangingFontSize") + :link '(emacs-commentary-link :tag "Commentary" "zoom-frm")) + +;;;###autoload +(defcustom frame-zoom-font-difference 1 + "*Number of points to change the frame font size when zooming. +This applies to commands `zoom-in/out', `zoom-in', `zoom-out', +`zoom-frm-in', and `zoom-frm-out' when zooming a frame. + +The absolute value of the value must be less than the current font +size for the frame, because the new font size cannot be less than one +point." + :type 'integer :group 'zoom) + +(when (> emacs-major-version 22) + (defcustom zoom-frame/buffer 'frame + "*What to zoom: current frame or current buffer. +See command `zoom-in/out', `zoom-in', or `zoom-out'." + :type '(choice (const :tag "Zoom frame" frame) (const :tag "Zoom buffer" buffer)) + :group 'zoom)) + + +;;; FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(unless (> emacs-major-version 22) (defalias 'zoom-in 'zoom-frm-in)) +;;;###autoload +(defun zoom-frm-in (&optional frame flip) + "Zoom FRAME in by `frame-zoom-font-difference', making text larger. +If `frame-zoom-font-difference' is negative, make text smaller. +With prefix argument FLIP, reverse the direction: +if `frame-zoom-font-difference' is positive, then make text smaller. +This is equal but opposite to `zoom-frm-out'." + (interactive (list (selected-frame) current-prefix-arg)) + (setq frame (or frame (selected-frame))) + (let ((zoom-factor (frame-parameter frame 'zoomed)) + (increment (if flip (- frame-zoom-font-difference) frame-zoom-font-difference))) + (unless zoom-factor (setq zoom-factor 0)) + (setq zoom-factor (+ zoom-factor increment)) + (enlarge-font increment frame) + (modify-frame-parameters frame (list (cons 'zoomed zoom-factor))))) + +(unless (> emacs-major-version 22) (defalias 'zoom-out 'zoom-frm-out)) +;;;###autoload +(defun zoom-frm-out (&optional frame flip) + "Zoom FRAME out by `frame-zoom-font-difference', making text smaller. +If `frame-zoom-font-difference' is negative, make text larger. +With prefix argument FLIP, reverse the direction: +if `frame-zoom-font-difference' is positive, then make text larger. +This is equal but opposite to `zoom-frm-in'." + (interactive (list (selected-frame) current-prefix-arg)) + (setq frame (or frame (selected-frame))) + (let ((frame-zoom-font-difference (- frame-zoom-font-difference))) + (zoom-frm-in frame flip))) + +;;;###autoload +(defun zoom-frm-unzoom (&optional frame) + "Cancel zoom of FRAME." + (interactive) + (setq frame (or frame (selected-frame))) + (let ((zoom-factor (frame-parameter frame 'zoomed))) + (if (not zoom-factor) + (error "Frame is not zoomed") + (enlarge-font (- zoom-factor) frame) + (modify-frame-parameters frame '((zoomed)))))) + +;;;###autoload +(defun toggle-zoom-frame (&optional frame) + "Alternately zoom/unzoom FRAME by `frame-zoom-font-difference'." + (interactive) + (setq frame (or frame (selected-frame))) + (if (frame-parameter frame 'zoomed) + (zoom-frm-unzoom frame) + (zoom-frm-in frame))) + +(when (> emacs-major-version 22) + (defun zoom-in (arg) + "Zoom current frame or buffer in. +With a prefix arg, toggle between zooming frame and zooming buffer. +Frame zooming uses command `zoom-frm-in'. +Buffer zooming uses command `text-scale-increase'." + (interactive "P") + (when arg + (setq zoom-frame/buffer (if (eq zoom-frame/buffer 'frame) 'buffer 'frame))) + (if (eq zoom-frame/buffer 'frame) + (zoom-frm-in) + (with-current-buffer + (if (string-match "mouse" (format "%S" (event-basic-type + last-command-event))) + (window-buffer (posn-window (event-start last-command-event))) + (current-buffer)) + (text-scale-increase 1)))) + + (defun zoom-out (arg) + "Zoom current frame or buffer out. +With a prefix arg, toggle between zooming frame and zooming buffer. +Frame zooming uses command `zoom-frm-out'. +Buffer zooming uses command `text-scale-decrease'." + (interactive "P") + (when arg + (setq zoom-frame/buffer (if (eq zoom-frame/buffer 'frame) 'buffer 'frame))) + (if (eq zoom-frame/buffer 'frame) + (zoom-frm-out) + (with-current-buffer + (if (string-match "mouse" (format "%S" (event-basic-type + last-command-event))) + (window-buffer (posn-window (event-start last-command-event))) + (current-buffer)) + (text-scale-decrease 1)))) + + (when (or (fboundp 'set-transient-map) ; Emacs 24.4+ + (fboundp 'set-temporary-overlay-map)) ; Emacs 24.3 + + (defun zoom-in/out (arg) + "Zoom current frame or buffer in or out. +A prefix arg determines the behavior, as follows: + none : Use 1 as the zoom amount. + plain `C-u': Toggle between zooming frame and zooming buffer. + 0 : Unzoom: reset size to the default. + other : Use the numeric value as the zoom amount. + +Similar to the behavior of command `text-scale-adjust', you can +continue to use any of the keys `+', `-', `0', and `C-u' repeatedly. +The zoom amount from the initial key sequence is used each time. + +Example: `C-3 C-x C-- C-- C-- C--' zooms out 4 times with a zoom +amount of 3 each time. + +The zoom amount for frame zooming is a point-size increment/decrement. +The zoom amount for buffer zooming is a number of text-scaling steps. + +Frame zooming uses command `zoom-frm-in'. +Buffer zooming uses command `text-scale-increase'. + +User option `zoom-frame/buffer' determines the default zoom type: +frame or buffer. If the option value is `buffer' and you never use +plain `C-u' with this command then it acts like `text-scale-adjust'." + (interactive "P") + (when (or (equal arg '(4)) (eq ?\025 last-command-event)) ; `C-u' + (setq zoom-frame/buffer (if (eq zoom-frame/buffer 'frame) 'buffer 'frame) + arg 1) + (message "Zooming %sS from now on" (upcase (symbol-name zoom-frame/buffer))) + (sit-for 1)) + (let* ((ev last-command-event) + (echo-keystrokes nil) + (base (event-basic-type ev)) + (step (if (or (equal arg '(4)) (eq ?\025 last-command-event)) ; C-u + 'C-U-WAS-USED + (setq arg (prefix-numeric-value arg)) + (case base + ((?+ ?=) arg) + (?- (- arg)) + (?0 0) + (t arg))))) + (message (if (eq step 0) + "Reset to default size. Use +/- to zoom in/out" + "Use +/- to zoom in/out, 0 to reset (unzoom)")) + (unless (eq step 'C-U-WAS-USED) + (if (eq zoom-frame/buffer 'frame) + (if (eq step 0) + (zoom-frm-unzoom) + (let ((frame-zoom-font-difference step)) (zoom-frm-in))) + (with-current-buffer + (if (string-match "mouse" (format "%S" (event-basic-type last-command-event))) + (window-buffer (posn-window (event-start last-command-event))) + (current-buffer)) + (text-scale-increase step)))) + (let ((fun (if (fboundp 'set-transient-map) + #'set-transient-map + #'set-temporary-overlay-map))) + (funcall fun + (let ((map (make-sparse-keymap))) + (dolist (mods '(() (control))) + (dolist (key '(?- ?+ ?= ?0)) ; The `=' key is often unshifted `+' key. + (define-key map (vector (append mods (list key))) + `(lambda () (interactive) (zoom-in/out ',arg))))) + (define-key map "\C-u" `(lambda () (interactive) (zoom-in/out ',arg))) + map))))))) + +;; These are not so useful, but some people might like them. +(when (fboundp 'set-face-attribute) ; Emacs 22+ + (defun zoom-all-frames-in (&optional flip) + "Zoom all frames in by `frame-zoom-font-difference', making text larger. +If `frame-zoom-font-difference' is negative, make text smaller. +With prefix argument FLIP, reverse the direction: +if `frame-zoom-font-difference' is positive, then make text smaller. +This is equal but opposite to `zoom-all-frames-out'. +Note: This zooming is unaffected by `zoom-frm-unzoom'." + (interactive "P") + (let ((increment (if flip (- frame-zoom-font-difference) frame-zoom-font-difference))) + (set-face-attribute 'default nil + :height (+ (* 10 increment) + (face-attribute 'default :height nil 'default))))) + + (defun zoom-all-frames-out (&optional flip) + "Zoom all frames out by `frame-zoom-font-difference', making text smaller. +If `frame-zoom-font-difference' is negative, make text larger. +With prefix argument FLIP, reverse the direction: +if `frame-zoom-font-difference' is positive, then make text larger. +This is equal but opposite to `zoom-frm-in'. +Note: This zooming is unaffected by `zoom-frm-unzoom'." + (interactive "P") + (let ((increment (if flip frame-zoom-font-difference (- frame-zoom-font-difference)))) + (set-face-attribute 'default nil + :height (+ (* 10 increment) + (face-attribute 'default :height nil 'default)))))) + +;;;;;;;;;;;;;;;;;;;;;;;;; + +(provide 'zoom-frm) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; zoom-frm.el ends here diff --git a/spacemacs/packages.el b/layers/!distribution/spacemacs/packages.el similarity index 62% rename from spacemacs/packages.el rename to layers/!distribution/spacemacs/packages.el index f57df8b98b45..6ed380e77e46 100644 --- a/spacemacs/packages.el +++ b/layers/!distribution/spacemacs/packages.el @@ -12,8 +12,6 @@ (setq spacemacs-packages '( - ;; pre - (holy-mode :location local :step pre) ;; default ace-link ace-window @@ -22,57 +20,34 @@ auto-dictionary auto-highlight-symbol avy - bind-key - bookmark buffer-move (centered-cursor :location local) clean-aindent-mode define-word desktop - diminish doc-view - ediff - eldoc - ;; hack to be able to wrap built-in emacs modes in an init function - (emacs-builtin-process-menu :location local) eval-sexp-fu - evil evil-anzu evil-args - evil-escape evil-exchange evil-iedit-state (evil-indent-textobject :location (recipe :fetcher github :repo "TheBB/evil-indent-textobject")) evil-jumper - evil-leader evil-lisp-state evil-nerd-commenter evil-matchit evil-numbers evil-search-highlight-persist - evil-surround evil-terminal-cursor-changer evil-tutor - evil-visualstar - exec-path-from-shell expand-region fancy-battery - fill-column-indicator flx-ido - fringe-helper - gh-md golden-ratio google-translate - ;; guide-key-tip - helm helm-ag - helm-descbinds helm-make helm-mode-manager - ;; not working for now - ;; helm-proc - helm-projectile - (helm-spacemacs :location local) helm-swoop helm-themes highlight-indentation @@ -82,8 +57,7 @@ ;; see https://github.com/syl20bnr/spacemacs/issues/2529 (hl-anything :excluded t) hungry-delete - (hybrid-mode :location local) - ido-vertical-mode + ido-vertical info+ iedit indent-guide @@ -92,34 +66,21 @@ linum-relative move-text neotree - page-break-lines pcre2el - popup - popwin powerline - projectile - quelpa rainbow-delimiters recentf - rfringe - savehist - saveplace smartparens smooth-scrolling (solarized-theme :location local) spacemacs-theme spray - subword - undo-tree - use-package vi-tilde-fringe volatile-highlights - whitespace - which-key window-numbering - winner (zoom-frm :location local) )) + ;; Paradox from MELPA is not compatible with 24.3, so we use ;; a local paradox with 24.3 (if (version< emacs-version "24.4") @@ -429,16 +390,6 @@ :config (evil-leader/set-key "`" 'avy-pop-mark))) -(defun spacemacs/init-bind-key ()) - -(defun spacemacs/init-bookmark () - (use-package bookmark - :defer t - :init - (setq bookmark-default-file (concat spacemacs-cache-directory "bookmarks") - ;; autosave each change - bookmark-save-flag 1))) - (defun spacemacs/init-buffer-move () (use-package buffer-move :defer t @@ -500,27 +451,6 @@ (evil-leader/set-key "xwd" 'define-word-at-point))) -(defun spacemacs/init-diminish () - (use-package diminish - :init - (progn - ;; Minor modes abbrev -------------------------------------------------------- - (when (display-graphic-p) - (eval-after-load "eproject" - '(diminish 'eproject-mode " eⓅ")) - (eval-after-load "flymake" - '(diminish 'flymake-mode " Ⓕ2"))) - ;; Minor Mode (hidden) ------------------------------------------------------ - (eval-after-load 'elisp-slime-nav - '(diminish 'elisp-slime-nav-mode)) - (eval-after-load "hi-lock" - '(diminish 'hi-lock-mode)) - (eval-after-load "abbrev" - '(diminish 'abbrev-mode)) - (eval-after-load "subword" - '(when (eval-when-compile (version< "24.3.1" emacs-version)) - (diminish 'subword-mode)))))) - (defun spacemacs/init-dired+ () (use-package dired+ :defer t)) @@ -568,357 +498,11 @@ (doc-view-minor-mode)) ad-do-it))))) -;; notes from mijoharas -;; We currently just set a few variables to make it look nicer. -;; Here is my first attempt at evilifying the buffer, does not work correctly, help is very much welcome. - -;; ``` -;; (defun ediff/setup-ediff-keymaps () -;; "setup the evil ediff keymap" -;; (progn -;; (add-to-list 'evil-emacs-state-modes 'Ediff) -;; (spacemacs|evilify ediff-mode-map) -;; (spacemacs/activate-evil-leader-for-map 'ediff-mode-map) -;; ) -;; ) - -;; ;; inside the use-package function -;; (add-hook 'ediff-keymap-setup-hook 'ediff/setup-ediff-keymaps) -;; ``` -(defun spacemacs/init-ediff () - (use-package ediff - :defer t - :init - (progn - ;; first we set some sane defaults - (setq-default - ediff-window-setup-function 'ediff-setup-windows-plain - ;; emacs is evil and decrees that vertical shall henceforth be horizontal - ediff-split-window-function 'split-window-horizontally - ediff-merge-split-window-function 'split-window-horizontally)))) - -(defun spacemacs/init-eldoc () - (use-package eldoc - :defer t - :config - (progn - ;; enable eldoc in `eval-expression' - (add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode) - ;; enable eldoc in IELM - (add-hook 'ielm-mode-hook #'eldoc-mode) - ;; don't display eldoc on modeline - (spacemacs|hide-lighter eldoc-mode)))) - -(defun spacemacs/init-emacs-builtin-process-menu () - (evilify process-menu-mode process-menu-mode-map)) - (defun spacemacs/init-eval-sexp-fu () ;; ignore obsolete function warning generated on startup (let ((byte-compile-not-obsolete-funcs (append byte-compile-not-obsolete-funcs '(preceding-sexp)))) (require 'eval-sexp-fu))) -(defun spacemacs/init-evil () - (use-package evil - :init - (progn - (defvar spacemacs-evil-cursor-colors '((normal . "DarkGoldenrod2") - (insert . "chartreuse3") - (emacs . "SkyBlue2") - (replace . "chocolate") - (evilified . "LightGoldenrod3") - (visual . "gray") - (motion . "plum3") - (lisp . "HotPink1") - (iedit . "firebrick1") - (iedit-insert . "firebrick1")) - "Colors assigned to evil states.") - - ;; put back refresh of the cursor on post-command-hook see status of: - ;; https://bitbucket.org/lyro/evil/issue/502/cursor-is-not-refreshed-in-some-cases - (add-hook 'post-command-hook 'evil-refresh-cursor) - - ;; allow the point to go past the end of line so we can - ;; consisently evaluate expression with eval-last-sexp in - ;; all modes - (setq evil-move-beyond-eol t) - - (defun spacemacs/state-color-face (state) - "Return the symbol of the face for the given STATE." - (intern (format "spacemacs-%s-face" (symbol-name state)))) - - (defun spacemacs/defface-state-color (state color) - "Define a face for the given STATE and background COLOR." - (eval `(defface ,(spacemacs/state-color-face state) '((t ())) - ,(format "%s state face." (symbol-name state)) - :group 'spacemacs)) - (set-face-attribute (spacemacs/state-color-face state) nil - :background color - :foreground (face-background 'mode-line) - :box (face-attribute 'mode-line :box) - :inherit 'mode-line)) - - (defun spacemacs/state-color (state) - "Return the color string associated to STATE." - (face-background (spacemacs/state-color-face state))) - - (defun spacemacs/current-state-color () - "Return the color string associated to the current state." - (face-background (spacemacs/state-color-face evil-state))) - - (defun spacemacs/state-face (state) - "Return the face associated to the STATE." - (spacemacs/state-color-face state)) - - (defun spacemacs/current-state-face () - "Return the face associated to the current state." - (let ((state (if (eq evil-state 'operator) - evil-previous-state - evil-state))) - (spacemacs/state-color-face state))) - - (defun spacemacs/set-state-faces () - "Define or set the state faces." - (mapcar (lambda (x) (spacemacs/defface-state-color (car x) (cdr x))) - spacemacs-evil-cursor-colors)) - (spacemacs/set-state-faces) - - (defun set-default-evil-emacs-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'emacs)))) - (setq evil-emacs-state-cursor `(,c box)))) - (defun set-default-evil-evilified-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'evilified)))) - (setq evil-evilified-state-cursor `(,c box)))) - (defun set-default-evil-normal-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'normal)))) - (setq evil-normal-state-cursor `(,c box)))) - (defun set-default-evil-insert-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'insert)))) - (setq evil-insert-state-cursor `(,c (bar . 2))))) - (defun set-default-evil-visual-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'visual)))) - (setq evil-visual-state-cursor `(,c (hbar . 2))))) - (defun set-default-evil-motion-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'motion)))) - (setq evil-motion-state-cursor `(,c box)))) - (defun set-default-evil-lisp-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'lisp)))) - (setq evil-lisp-state-cursor `(,c box)))) - (defun set-default-evil-iedit-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'iedit)))) - (setq evil-iedit-state-cursor `(,c box)))) - (defun set-default-evil-iedit-insert-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'iedit-insert)))) - (setq evil-iedit-insert-state-cursor `(,c (bar . 2))))) - (defun set-default-evil-replace-state-cursor () - (let ((c (when dotspacemacs-colorize-cursor-according-to-state - (spacemacs/state-color 'replace)))) - (setq evil-replace-state-cursor `(,c (hbar . 2))))) - (defun evil-insert-state-cursor-hide () - (setq evil-insert-state-cursor '((hbar . 0)))) - (set-default-evil-emacs-state-cursor) - (set-default-evil-evilified-state-cursor) - (set-default-evil-normal-state-cursor) - (set-default-evil-insert-state-cursor) - (set-default-evil-visual-state-cursor) - (set-default-evil-motion-state-cursor) - (set-default-evil-lisp-state-cursor) - (set-default-evil-iedit-state-cursor) - (set-default-evil-iedit-insert-state-cursor) - (set-default-evil-replace-state-cursor) - - (evil-mode 1)) - :config - (progn - ;; evil ex-command key - (define-key evil-normal-state-map (kbd dotspacemacs-command-key) 'evil-ex) - (define-key evil-visual-state-map (kbd dotspacemacs-command-key) 'evil-ex) - (define-key evil-motion-state-map (kbd dotspacemacs-command-key) 'evil-ex) - ;; Make the current definition and/or comment visible. - (define-key evil-normal-state-map "zf" 'reposition-window) - ;; toggle maximize buffer - (define-key evil-window-map (kbd "o") 'spacemacs/toggle-maximize-buffer) - (define-key evil-window-map (kbd "C-o") 'spacemacs/toggle-maximize-buffer) - ;; make cursor keys work - (define-key evil-window-map (kbd "") 'evil-window-left) - (define-key evil-window-map (kbd "") 'evil-window-right) - (define-key evil-window-map (kbd "") 'evil-window-up) - (define-key evil-window-map (kbd "") 'evil-window-down) - ;; Make Y equivalent to y$ - (defun spacemacs/evil-yank-to-end-of-line () - "Yank from point to end of line." - (interactive) - (evil-yank (point) (point-at-eol))) - (define-key evil-normal-state-map (kbd "Y") 'spacemacs/evil-yank-to-end-of-line) - (define-key evil-motion-state-map (kbd "Y") 'spacemacs/evil-yank-to-end-of-line) - - (evil-leader/set-key "re" 'evil-show-registers) - - (defmacro evil-map (state key seq) - "Map for a given STATE a KEY to a sequence SEQ of keys. - -Can handle recursive definition only if KEY is the first key of SEQ. -Example: (evil-map visual \"<\" \"" ">gv") - - (defun spacemacs/evil-smart-doc-lookup () - "Version of `evil-lookup' that attempts to use - the mode specific goto-definition binding, - i.e. `SPC m h h`, to lookup the source of the definition, - while falling back to `evil-lookup'" - (interactive) - (condition-case nil - (execute-kbd-macro (kbd (concat dotspacemacs-leader-key " mhh"))) - (error (evil-lookup)))) - (define-key evil-normal-state-map (kbd "K") 'spacemacs/evil-smart-doc-lookup) - - (defun spacemacs/evil-smart-goto-definition () - "Version of `evil-goto-definition' that attempts to use - the mode specific goto-definition binding, - i.e. `SPC m g g`, to lookup the source of the definition, - while falling back to `evil-goto-definition'" - (interactive) - (condition-case nil - (execute-kbd-macro (kbd (concat dotspacemacs-leader-key " mgg"))) - (error (evil-goto-definition)))) - (define-key evil-normal-state-map - (kbd "gd") 'spacemacs/evil-smart-goto-definition) - - ;; scrolling micro state - (defun spacemacs/scroll-half-page-up () - "Scroll half a page up while keeping cursor in middle of page." - (interactive) - (evil-window-top) - (let ((recenter-redisplay nil)) - (recenter nil))) - (defun spacemacs/scroll-half-page-down () - "Scroll half a page down while keeping cursor in middle of page." - (interactive) - (evil-window-bottom) - ;; required to make repeated presses idempotent - (evil-next-visual-line) - (let ((recenter-redisplay nil)) - (recenter nil))) - (spacemacs|define-micro-state scroll - :doc "[,] page up [.] page down [<] half page up [>] half page down" - :execute-binding-on-enter t - :evil-leader "n." "n," "n<" "n>" - :bindings - ;; page - ("," evil-scroll-page-up) - ("." evil-scroll-page-down) - ;; half page - ("<" spacemacs/scroll-half-page-up) - (">" spacemacs/scroll-half-page-down)) - - ;; support for auto-indentation inhibition on universal argument - (spacemacs|advise-commands - "handle-indent" (evil-paste-before evil-paste-after) around - "Handle the universal prefix argument for auto-indentation." - (let ((prefix (ad-get-arg 0))) - (ad-set-arg 0 (unless (equal '(4) prefix) prefix)) - ad-do-it - (ad-set-arg 0 prefix))) - - ;; pasting micro-state - (spacemacs|advise-commands - "paste-micro-state" - (evil-paste-before evil-paste-after evil-visual-paste) after - "Initate the paste micro-state." - (unless (or (evil-ex-p) - (eq 'evil-paste-from-register this-command)) - (spacemacs/paste-micro-state))) - (defun spacemacs//paste-ms-doc () - "The documentation for the paste micro-state." - (format (concat "[%s/%s] Type [p] or [P] to paste the previous or " - "next copied text, [.] to paste the same text") - (length kill-ring-yank-pointer) (length kill-ring))) - (spacemacs|define-micro-state paste - :doc (spacemacs//paste-ms-doc) - :use-minibuffer t - :bindings - ("p" evil-paste-pop) - ("P" evil-paste-pop-next)) - (unless dotspacemacs-enable-paste-micro-state - (ad-disable-advice 'evil-paste-before 'after - 'evil-paste-before-paste-micro-state) - (ad-activate 'evil-paste-before) - (ad-disable-advice 'evil-paste-after 'after - 'evil-paste-after-paste-micro-state) - (ad-activate 'evil-paste-after) - (ad-disable-advice 'evil-visual-paste 'after - 'evil-visual-paste-paste-micro-state) - (ad-activate 'evil-visual-paste)) - - ;; define text objects - (defmacro spacemacs|define-text-object (key name start end) - (let ((inner-name (make-symbol (concat "evil-inner-" name))) - (outer-name (make-symbol (concat "evil-outer-" name))) - (start-regex (regexp-opt (list start))) - (end-regex (regexp-opt (list end)))) - `(progn - (evil-define-text-object ,inner-name (count &optional beg end type) - (evil-select-paren ,start-regex ,end-regex beg end type count nil)) - (evil-define-text-object ,outer-name (count &optional beg end type) - (evil-select-paren ,start-regex ,end-regex beg end type count t)) - (define-key evil-inner-text-objects-map ,key (quote ,inner-name)) - (define-key evil-outer-text-objects-map ,key (quote ,outer-name)) - (when (configuration-layer/package-usedp 'evil-surround) - (push (cons (string-to-char ,key) - (if ,end - (cons ,start ,end) - ,start)) - evil-surround-pairs-alist))))) - - (defun spacemacs//standard-text-objects () - ;; between dollars sign: - (spacemacs|define-text-object "$" "dollar" "$" "$") - ;; define stars - (spacemacs|define-text-object "*" "star" "*" "*") - ;; define block star text object - (spacemacs|define-text-object "8" "block-star" "/*" "*/") - ;; between pipe characters: - (spacemacs|define-text-object "|" "bar" "|" "|") - ;; between percent signs: - (spacemacs|define-text-object "%" "percent" "%" "%")) - - (spacemacs/add-to-hook 'prog-mode-hook '(spacemacs//standard-text-objects)) - - ;; define text-object for entire buffer - (evil-define-text-object evil-inner-buffer (count &optional beg end type) - (evil-select-paren "\\`" "\\'" beg end type count nil)) - (define-key evil-inner-text-objects-map "g" 'evil-inner-buffer) - - ;; support smart 1parens-strict-mode - (when (configuration-layer/package-usedp 'smartparens) - (defadvice evil-delete-backward-char-and-join - (around spacemacs/evil-delete-backward-char-and-join activate) - (defvar smartparens-strict-mode) - ;; defadvice compiles this sexp generating a compiler warning for a - ;; free variable reference. The line above fixes this - (if smartparens-strict-mode - (call-interactively 'sp-backward-delete-char) - ad-do-it)))))) - (defun spacemacs/init-evil-anzu () (use-package evil-anzu :init @@ -950,13 +534,6 @@ Example: (evil-map visual \"<\" \"m" -;; ;; C-M-m in terminal -;; "" -;; "g" -;; "\[" -;; "\]" -;; "z" -;; "C-h") -;; guide-key/recursive-key-sequence-flag t -;; guide-key/popup-window-position 'bottom -;; guide-key/idle-delay dotspacemacs-guide-key-delay -;; guide-key/text-scale-amount 0 -;; ;; use this in your ~/.spacemacs file to enable tool tip in a -;; ;; graphical envrionment -;; ;; guide-key-tip/enabled (if window-system t) -;; guide-key-tip/enabled nil) -;; (setq guide-key/highlight-command-regexp -;; (cons spacemacs/prefix-command-string font-lock-warning-face)) -;; (guide-key-mode 1) -;; (spacemacs|diminish guide-key-mode " Ⓖ" " G")))) - -(defun spacemacs/init-helm () - (use-package helm - :defer 1 - :commands (spacemacs/helm-find-files - spacemacs/helm-find-spacemacs-file - spacemacs/helm-find-contrib-file) - :config - (progn - (when dotspacemacs-helm-resize - (setq helm-autoresize-min-height 1) - (helm-autoresize-mode 1)) - - ;; from https://www.reddit.com/r/emacs/comments/2z7nbv/lean_helm_window/ - (defvar helm-source-header-default-background (face-attribute 'helm-source-header :background)) - (defvar helm-source-header-default-foreground (face-attribute 'helm-source-header :foreground)) - (defvar helm-source-header-default-box (face-attribute 'helm-source-header :box)) - (defvar helm-source-header-default-height (face-attribute 'helm-source-header :height) ) - - (defun helm-toggle-header-line () - "Hide the `helm' header is there is only one source." - (when dotspacemacs-helm-no-header - (if (> (length helm-sources) 1) - (set-face-attribute 'helm-source-header - nil - :foreground helm-source-header-default-foreground - :background helm-source-header-default-background - :box helm-source-header-default-box - :height helm-source-header-default-height) - (set-face-attribute 'helm-source-header - nil - :foreground (face-attribute 'helm-selection :background) - :background (face-attribute 'helm-selection :background) - :box nil - :height 0.1)))) - (add-hook 'helm-before-initialize-hook 'helm-toggle-header-line) - - (defun spacemacs/helm-find-files (arg) - "Custom spacemacs implementation for calling helm-find-files-1. - -Removes the automatic guessing of the initial value based on thing at point. " - (interactive "P") - (let* ((hist (and arg helm-ff-history (helm-find-files-history))) - (default-input hist ) - (input (cond ((and (eq major-mode 'dired-mode) default-input) - (file-name-directory default-input)) - ((and (not (string= default-input "")) - default-input)) - (t (expand-file-name (helm-current-directory)))))) - (set-text-properties 0 (length input) nil input) - (helm-find-files-1 input ))) - ) - :init - (progn - (setq helm-prevent-escaping-from-minibuffer t - helm-bookmark-show-location t - helm-display-header-line nil - helm-split-window-in-side-p t - helm-always-two-windows t - helm-echo-input-in-header-line t - helm-imenu-execute-action-at-once-if-one nil) - - ;; hide minibuffer in Helm session, since we use the header line already - (defun helm-hide-minibuffer-maybe () - (when (with-helm-buffer helm-echo-input-in-header-line) - (let ((ov (make-overlay (point-min) (point-max) nil nil t))) - (overlay-put ov 'window (selected-window)) - (overlay-put ov 'face (let ((bg-color (face-background 'default nil))) - `(:background ,bg-color :foreground ,bg-color))) - (setq-local cursor-type nil)))) - (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe) - - ;; fuzzy matching setting - (setq helm-M-x-fuzzy-match t - helm-apropos-fuzzy-match t - helm-file-cache-fuzzy-match t - helm-imenu-fuzzy-match t - helm-lisp-fuzzy-completion t - helm-recentf-fuzzy-match t - helm-semantic-fuzzy-match t - helm-buffers-fuzzy-matching t) - - ;; helm-locate uses es (from everything on windows, which doesnt like fuzzy) - (setq helm-locate-fuzzy-match (executable-find "locate")) - - (defun spacemacs/helm-find-files-navigate-back (orig-fun &rest args) - ) - (defadvice helm-ff-delete-char-backward - (around spacemacs/helm-find-files-navigate-back activate) - (if (= (length helm-pattern) (length (helm-find-files-initial-input))) - (helm-find-files-up-one-level 1) - ad-do-it)) - - (defun spacemacs//helm-do-grep-region-or-symbol (&optional targs use-region-or-symbol-p) - "Version of `helm-do-grep' with a default input." - (interactive) - (require 'helm) - (cl-letf* - (((symbol-function 'this-fn) (symbol-function 'helm-do-grep-1)) - ((symbol-function 'helm-do-grep-1) - (lambda (targets &optional recurse zgrep exts default-input region-or-symbol-p) - (let* ((new-input (when region-or-symbol-p - (if (region-active-p) - (buffer-substring-no-properties - (region-beginning) (region-end)) - (thing-at-point 'symbol t)))) - (quoted-input (when new-input (rxt-quote-pcre new-input)))) - (this-fn targets recurse zgrep exts default-input quoted-input)))) - (preselection (or (dired-get-filename nil t) - (buffer-file-name (current-buffer)))) - (targets (if targs - targs - (helm-read-file-name - "Search in file(s): " - :marked-candidates t - :preselect (and helm-do-grep-preselect-candidate - (if helm-ff-transformer-show-only-basename - (helm-basename preselection) - preselection)))))) - (helm-do-grep-1 targets nil nil nil nil use-region-or-symbol-p))) - - (defun spacemacs/helm-find-contrib-file () - "Runs helm find files on spacemacs contrib folder" - (interactive) - (require 'helm-files) - (helm-find-files-1 - (expand-file-name (concat user-emacs-directory "contrib/")))) - - (defun spacemacs/helm-find-spacemacs-file () - "Runs helm find files on spacemacs directory" - (interactive) - (require 'helm-files) - (helm-find-files-1 - (expand-file-name (concat user-emacs-directory "spacemacs/")))) - - (defun spacemacs/helm-file-do-grep () - "Search in current file with `grep' using a default input." - (interactive) - (spacemacs//helm-do-grep-region-or-symbol - (list (buffer-file-name (current-buffer))) nil)) - - (defun spacemacs/helm-file-do-grep-region-or-symbol () - "Search in current file with `grep' using a default input." - (interactive) - (spacemacs//helm-do-grep-region-or-symbol - (list (buffer-file-name (current-buffer))) t)) - - (defun spacemacs/helm-files-do-grep () - "Search in files with `grep'." - (interactive) - (spacemacs//helm-do-grep-region-or-symbol nil nil)) - - (defun spacemacs/helm-files-do-grep-region-or-symbol () - "Search in files with `grep' using a default input." - (interactive) - (spacemacs//helm-do-grep-region-or-symbol nil t)) - - (defun spacemacs/helm-buffers-do-grep () - "Search in opened buffers with `grep'." - (interactive) - (let ((buffers (cl-loop for buffer in (buffer-list) - when (buffer-file-name buffer) - collect (buffer-file-name buffer)))) - (spacemacs//helm-do-grep-region-or-symbol buffers nil))) - - (defun spacemacs/helm-buffers-do-grep-region-or-symbol () - "Search in opened buffers with `grep' with a default input." - (interactive) - (let ((buffers (cl-loop for buffer in (buffer-list) - when (buffer-file-name buffer) - collect (buffer-file-name buffer)))) - (spacemacs//helm-do-grep-region-or-symbol buffers t))) - - (defun spacemacs/last-search-buffer () - "open last helm-ag or hgrep buffer." - (interactive) - (if (get-buffer "*helm ag results*") - (switch-to-buffer-other-window "*helm ag results*") - (if (get-buffer "*hgrep*") - (switch-to-buffer-other-window "*hgrep*") - (message "No previous search buffer found")))) - - ;; use helm by default for contrib and spacemacs layers - (unless dotspacemacs-use-ido - (evil-leader/set-key - "fes" 'spacemacs/helm-find-spacemacs-file - "fec" 'spacemacs/helm-find-contrib-file)) - - ;; use helm by default for M-x - (unless (configuration-layer/package-usedp 'smex) - (global-set-key (kbd "M-x") 'helm-M-x)) - - (evil-leader/set-key - "" 'helm-apropos - "bb" 'helm-mini - "Cl" 'helm-colors - "ff" 'spacemacs/helm-find-files - "fF" 'helm-find-files - "fL" 'helm-locate - "fr" 'helm-recentf - "hb" 'helm-filtered-bookmarks - "hi" 'helm-info-at-point - "hl" 'helm-resume - "hm" 'helm-man-woman - "iu" 'helm-ucs - "ry" 'helm-show-kill-ring - "rr" 'helm-register - "rm" 'helm-all-mark-rings - "sL" 'spacemacs/last-search-buffer - "sl" 'spacemacs/jump-in-buffer) - - ;; search with grep - (evil-leader/set-key - "sgb" 'spacemacs/helm-buffers-do-grep - "sgB" 'spacemacs/helm-buffers-do-grep-region-or-symbol - "sgf" 'spacemacs/helm-files-do-grep - "sgF" 'spacemacs/helm-files-do-grep-region-or-symbol - "sgg" 'spacemacs/helm-file-do-grep - "sgG" 'spacemacs/helm-file-do-grep-region-or-symbol) - - ;; define the key binding at the very end in order to allow the user - ;; to overwrite any key binding - (add-hook 'emacs-startup-hook - (lambda () - (unless (configuration-layer/package-usedp 'smex) - (evil-leader/set-key dotspacemacs-command-key 'helm-M-x)))) - - (defvar spacemacs-helm-display-help-buffer-regexp '("*.*Helm.*Help.**")) - (defvar spacemacs-helm-display-buffer-regexp `("*.*helm.**" - (display-buffer-in-side-window) - (inhibit-same-window . t) - (side . ,dotspacemacs-helm-position) - (window-height . 0.4))) - (defvar spacemacs-display-buffer-alist nil) - (defun spacemacs//helm-prepare-display () - "Prepare necessary settings to make Helm display properly." - ;; avoid Helm buffer being diplaye twice when user - ;; sets this variable to some function that pop buffer to - ;; a window. See https://github.com/syl20bnr/spacemacs/issues/1396 - (let ((display-buffer-base-action '(nil))) - (setq spacemacs-display-buffer-alist display-buffer-alist) - ;; the only buffer to display is Helm, nothing else we must set this - ;; otherwise Helm cannot reuse its own windows for copyinng/deleting - ;; etc... because of existing popwin buffers in the alist - (setq display-buffer-alist nil) - (popwin-mode -1))) - - (defun spacemacs//display-helm-window (buffer) - (let ((display-buffer-alist (list spacemacs-helm-display-help-buffer-regexp - ;; this or any specialized case of Helm buffer must be added AFTER - ;; `spacemacs-helm-display-buffer-regexp'. Otherwise, - ;; `spacemacs-helm-display-buffer-regexp' will be used before - ;; `spacemacs-helm-display-help-buffer-regexp' and display - ;; configuration for normal Helm buffer is applied for helm help - ;; buffer, making the help buffer unable to be displayed. - spacemacs-helm-display-buffer-regexp))) - (helm-default-display-buffer buffer))) - - (setq helm-display-function 'spacemacs//display-helm-window) - - (defun spacemacs//restore-previous-display-config () - (popwin-mode 1) - ;; we must enable popwin-mode first then restore `display-buffer-alist' - ;; Otherwise, popwin keeps adding up its own buffers to `display-buffer-alist' - ;; and could slow down Emacs as the list grows - (setq display-buffer-alist spacemacs-display-buffer-alist)) - - (add-hook 'helm-after-initialize-hook 'spacemacs//helm-prepare-display) - ;; Restore popwin-mode after a Helm session finishes. - (add-hook 'helm-cleanup-hook 'spacemacs//restore-previous-display-config) - - ;; Add minibuffer history with `helm-minibuffer-history' - (define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history) - - (defun spacemacs//helm-cleanup () - "Cleanup some helm related states when quitting." - ;; deactivate any running transient map (micro-state) - (setq overriding-terminal-local-map nil)) - (add-hook 'helm-cleanup-hook 'spacemacs//helm-cleanup) - - (defface spacemacs-helm-navigation-ms-face - `((t :background ,(face-attribute 'error :foreground) :foreground "black")) - "Face for helm heder when helm micro-state is activated." - :group 'spacemacs)) - - :config - (progn - (helm-mode +1) - (defun spacemacs//set-dotted-directory () - "Set the face of diretories for `.' and `..'" - (set-face-attribute 'helm-ff-dotted-directory - nil - :foreground nil - :background nil - :inherit 'helm-ff-directory)) - (add-hook 'helm-find-files-before-init-hook 'spacemacs//set-dotted-directory) - - ;; alter helm-bookmark key bindings to be simpler - (defun simpler-helm-bookmark-keybindings () - (define-key helm-bookmark-map (kbd "C-d") 'helm-bookmark-run-delete) - (define-key helm-bookmark-map (kbd "C-e") 'helm-bookmark-run-edit) - (define-key helm-bookmark-map (kbd "C-f") 'helm-bookmark-toggle-filename) - (define-key helm-bookmark-map (kbd "C-o") 'helm-bookmark-run-jump-other-window) - (define-key helm-bookmark-map (kbd "C-/") 'helm-bookmark-help)) - (add-hook 'helm-mode-hook 'simpler-helm-bookmark-keybindings) - - ;; helm navigation on hjkl - (defun spacemacs//helm-hjkl-navigation (&optional arg) - "Set navigation in helm on `jklh'. -ARG non nil means that the editing style is `vim'." - (cond - (arg - (define-key helm-map (kbd "C-j") 'helm-next-line) - (define-key helm-map (kbd "C-k") 'helm-previous-line) - (define-key helm-map (kbd "C-h") 'helm-next-source) - (define-key helm-map (kbd "C-l") 'helm-previous-source)) - (t - (define-key helm-map (kbd "C-j") 'helm-execute-persistent-action) - (define-key helm-map (kbd "C-k") 'helm-delete-minibuffer-contents) - (define-key helm-map (kbd "C-h") nil) - (define-key helm-map (kbd "C-l") 'helm-recenter-top-bottom-other-window)))) - (spacemacs//helm-hjkl-navigation (member dotspacemacs-editing-style '(vim hybrid))) - - (defun spacemacs/helm-edit () - "Switch in edit mode depending on the current helm buffer." - (interactive) - (cond - ((string-equal "*helm-ag*" helm-buffer) - (helm-ag-edit)))) - - (defun spacemacs//helm-navigation-ms-on-enter () - "Initialization of helm micro-state." - ;; faces - (spacemacs//helm-navigation-ms-set-face) - (setq spacemacs--helm-navigation-ms-face-cookie-minibuffer - (face-remap-add-relative - 'minibuffer-prompt - 'spacemacs-helm-navigation-ms-face)) - ;; bind actions on numbers starting from 1 which executes action 0 - (dotimes (n 10) - (define-key helm-map (number-to-string n) - `(lambda () (interactive) (helm-select-nth-action - ,(% (+ n 9) 10)))))) - - (defun spacemacs//helm-navigation-ms-set-face () - "Set the face for helm header in helm navigation micro-state" - (with-helm-window - (setq spacemacs--helm-navigation-ms-face-cookie-header - (face-remap-add-relative - 'helm-header - 'spacemacs-helm-navigation-ms-face)))) - - (defun spacemacs//helm-navigation-ms-on-exit () - "Action to perform when exiting helm micro-state." - ;; restore helm key map - (dotimes (n 10) (define-key helm-map (number-to-string n) nil)) - ;; restore faces - (with-helm-window - (face-remap-remove-relative - spacemacs--helm-navigation-ms-face-cookie-header)) - (face-remap-remove-relative - spacemacs--helm-navigation-ms-face-cookie-minibuffer)) - - (defun spacemacs//helm-navigation-ms-full-doc () - "Full documentation for helm navigation micro-state." - " - [?] display this help - [a] toggle action selection page - [e] edit occurrences if supported - [j] [k] next/previous candidate - [h] [l] previous/next source - [t] toggle visible mark - [T] toggle all mark - [v] persistent action - [q] quit") - - (spacemacs|define-micro-state helm-navigation - :persistent t - :disable-evil-leader t - :define-key (helm-map . "M-SPC") (helm-map . "s-M-SPC") - :on-enter (spacemacs//helm-navigation-ms-on-enter) - :on-exit (spacemacs//helm-navigation-ms-on-exit) - :bindings - ("" helm-select-action :exit t) - ("C-i" helm-select-action :exit t) - ("" helm-maybe-exit-minibuffer :exit t) - ("?" nil :doc (spacemacs//helm-navigation-ms-full-doc)) - ("a" helm-select-action :post (spacemacs//helm-navigation-ms-set-face)) - ("e" spacemacs/helm-edit) - ("h" helm-previous-source) - ("j" helm-next-line) - ("k" helm-previous-line) - ("l" helm-next-source) - ("q" nil :exit t) - ("t" helm-toggle-visible-mark) - ("T" helm-toggle-all-marks) - ("v" helm-execute-persistent-action)) - - ;; Swap default TAB and C-z commands. - ;; For GUI. - (define-key helm-map (kbd "") 'helm-execute-persistent-action) - ;; For terminal. - (define-key helm-map (kbd "TAB") 'helm-execute-persistent-action) - (define-key helm-map (kbd "C-z") 'helm-select-action) - - (eval-after-load "helm-mode" ; required - '(spacemacs|hide-lighter helm-mode))))) - (defun spacemacs/init-helm-ag () (use-package helm-ag :defer t @@ -2175,20 +1214,13 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'." (kbd "RET") 'helm-ag-mode-jump-other-window (kbd "q") 'quit-window)))) -(defun spacemacs/init-helm-descbinds () - (use-package helm-descbinds - :defer t - :init - (progn - (setq helm-descbinds-window-style 'split) - (add-hook 'helm-mode-hook 'helm-descbinds-mode) - (evil-leader/set-key "?" 'helm-descbinds)))) - (defun spacemacs/init-helm-make () (use-package helm-make :defer t :init - (evil-leader/set-key "hk" 'helm-make))) + (evil-leader/set-key + "hk" 'helm-make + "cc" 'helm-make-projectile))) (defun spacemacs/init-helm-mode-manager () (use-package helm-mode-manager @@ -2199,43 +1231,6 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'." ;; "hm" 'helm-disable-minor-mode "h C-m" 'helm-enable-minor-mode))) -(defun spacemacs/init-helm-projectile () - (use-package helm-projectile - :commands (helm-projectile-switch-to-buffer - helm-projectile-find-dir - helm-projectile-dired-find-dir - helm-projectile-recentf - helm-projectile-find-file - helm-projectile-grep - helm-projectile - helm-projectile-switch-project) - :init - (progn - (setq projectile-switch-project-action 'helm-projectile) - - (defconst spacemacs-use-helm-projectile t - "This variable is only defined if helm-projectile is used.") - - ;; needed for smart search if user's default tool is grep - (defalias 'spacemacs/helm-project-do-grep 'helm-projectile-grep) - (defalias 'spacemacs/helm-project-do-grep-region-or-symbol 'helm-projectile-grep) - - (evil-leader/set-key - "pb" 'helm-projectile-switch-to-buffer - "pd" 'helm-projectile-find-dir - "pf" 'helm-projectile-find-file - "ph" 'helm-projectile - "pp" 'helm-projectile-switch-project - "pr" 'helm-projectile-recentf - "pv" 'projectile-vc - "sgp" 'helm-projectile-grep)))) - -(defun spacemacs/init-helm-spacemacs () - (use-package helm-spacemacs - :commands helm-spacemacs - :init - (evil-leader/set-key "feh" 'helm-spacemacs))) - (defun spacemacs/init-helm-swoop () (use-package helm-swoop :defer t @@ -2339,20 +1334,6 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'." "hs" 'hl-save-highlights)) :config (spacemacs|hide-lighter hl-highlight-mode))) -(defun spacemacs/init-holy-mode () - (use-package holy-mode - :commands holy-mode - :init - (progn - (when (eq 'emacs dotspacemacs-editing-style) - (holy-mode)) - (spacemacs|add-toggle holy-mode - :status holy-mode - :on (holy-mode) - :off (holy-mode -1) - :documentation "Globally toggle holy mode." - :evil-leader "E H")))) - (defun spacemacs/init-hungry-delete () (use-package hungry-delete :defer t @@ -2369,35 +1350,6 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'." (define-key hungry-delete-mode-map (kbd "DEL") 'hungry-delete-backward) (define-key hungry-delete-mode-map (kbd "S-DEL") 'delete-backward-char)))) -(defun spacemacs/init-hybrid-mode () - (use-package hybrid-mode - :commands hybrid-mode - :init - (progn - (add-to-list 'spacemacs-evil-cursor-colors - `(hybrid . ,(spacemacs/state-color 'emacs))) - (spacemacs/set-state-faces) - (setq hybrid-mode-insert-state-cursor - (if (and (display-graphic-p) - dotspacemacs-colorize-cursor-according-to-state) - `(,(spacemacs/state-color 'hybrid) (bar . 2)) - 'bar)) - (copy-face 'spacemacs-insert-face 'spacemacs-insert-face-backup) - (add-hook 'hybrid-mode-hook - (lambda () - (copy-face (if hybrid-mode - 'spacemacs-emacs-face - 'spacemacs-insert-face-backup) - 'spacemacs-insert-face))) - (when (eq 'hybrid dotspacemacs-editing-style) - (hybrid-mode)) - (spacemacs|add-toggle hybrid-mode - :status hybrid-mode - :on (hybrid-mode) - :off (hybrid-mode -1) - :documentation "Globally toggle hybrid mode." - :evil-leader "E Y")))) - (defun spacemacs/init-ido-vertical-mode () (use-package ido-vertical-mode :init @@ -2455,6 +1407,52 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'." ) (add-hook 'ido-setup-hook 'spacemacs//ido-setup) + (defun spacemacs/ido-invoke-in-other-window () + "signals ido mode to switch to (or create) another window after exiting" + (interactive) + (setq ido-exit-minibuffer-target-window 'other) + (ido-exit-minibuffer)) + + (defun spacemacs/ido-invoke-in-horizontal-split () + "signals ido mode to split horizontally and switch after exiting" + (interactive) + (setq ido-exit-minibuffer-target-window 'horizontal) + (ido-exit-minibuffer)) + + (defun spacemacs/ido-invoke-in-vertical-split () + "signals ido mode to split vertically and switch after exiting" + (interactive) + (setq ido-exit-minibuffer-target-window 'vertical) + (ido-exit-minibuffer)) + + (defun spacemacs/ido-invoke-in-new-frame () + "signals ido mode to create a new frame after exiting" + (interactive) + (setq ido-exit-minibuffer-target-window 'frame) + (ido-exit-minibuffer)) + + (defadvice ido-read-internal + (around ido-read-internal-with-minibuffer-other-window activate) + (let* (ido-exit-minibuffer-target-window + (this-buffer (current-buffer)) + (result ad-do-it)) + (cond + ((equal ido-exit-minibuffer-target-window 'other) + (if (= 1 (count-windows)) + (spacemacs/split-window-horizontally-and-switch) + (other-window 1))) + ((equal ido-exit-minibuffer-target-window 'horizontal) + (spacemacs/split-window-horizontally-and-switch)) + + ((equal ido-exit-minibuffer-target-window 'vertical) + (spacemacs/split-window-vertically-and-switch)) + ((equal ido-exit-minibuffer-target-window 'frame) + (make-frame))) + ;; why? Some ido commands, such as textmate.el's + ;; textmate-goto-symbol don't switch the current buffer + (switch-to-buffer this-buffer) + result)) + (defvar spacemacs--ido-navigation-ms-enabled nil "Flag which is non nil when ido navigation micro-state is enabled.") @@ -2721,12 +1719,6 @@ It will toggle the overlay under point or create an overlay of one character." :config (spacemacs/add-to-hook 'neotree-mode-hook '(spacemacs//neotree-key-bindings)))) -(defun spacemacs/init-page-break-lines () - (use-package page-break-lines - :init - (global-page-break-lines-mode t) - (spacemacs|hide-lighter page-break-lines-mode))) - (defun spacemacs/init-pcre2el () (use-package pcre2el :defer t @@ -2788,39 +1780,6 @@ It will toggle the overlay under point or create an overlay of one character." (evil-leader/set-key "aP" 'spacemacs/paradox-list-packages)))) -(defun spacemacs/init-popup () - (use-package popup - :defer t)) - -(defun spacemacs/init-popwin () - (use-package popwin - :config - (progn - (popwin-mode 1) - (evil-leader/set-key "wpm" 'popwin:messages) - (evil-leader/set-key "wpp" 'popwin:close-popup-window) - - ;; don't use default value but manage it ourselves - (setq popwin:special-display-config nil) - - ;; buffers that we manage - (push '("*Help*" :dedicated t :position bottom :stick t :noselect nil :height 0.4) popwin:special-display-config) - (push '("*compilation*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config) - (push '("*Shell Command Output*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) - (push '("*Async Shell Command*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) - (push '(" *undo-tree*" :dedicated t :position bottom :stick t :noselect nil :height 0.4) popwin:special-display-config) - (push '("*ert*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) - (push '("*grep*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) - (push '("*nosetests*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config) - (push '("^\*WoMan.+\*$" :regexp t :position bottom ) popwin:special-display-config) - - (defun spacemacs/remove-popwin-display-config (str) - "Removes the popwin display configurations that matches the passed STR" - (setq popwin:special-display-config - (-remove (lambda (x) (if (and (listp x) (stringp (car x))) - (string-match str (car x)))) - popwin:special-display-config)))))) - (defun spacemacs/init-powerline () (use-package powerline :init @@ -3374,71 +2333,6 @@ one of `l' or `r'." (add-hook 'emacs-startup-hook 'spacemacs//set-powerline-for-startup-buffers)))) -(defun spacemacs/init-projectile () - (use-package projectile - :commands (projectile-ack - projectile-ag - projectile-compile-project - projectile-dired - projectile-grep - projectile-find-dir - projectile-find-file - projectile-find-tag - projectile-find-test-file - projectile-invalidate-cache - projectile-kill-buffers - projectile-multi-occur - projectile-project-root - projectile-recentf - projectile-regenerate-tags - projectile-replace - projectile-run-async-shell-command-in-root - projectile-run-shell-command-in-root - projectile-switch-project - projectile-switch-to-buffer - projectile-vc) - :init - (progn - ;; note for Windows: GNU find or Cygwin find must be in path - ;; default parameters are not supported on Windows, we default - ;; to simplest call to find. - (when (spacemacs/system-is-mswindows) - (setq projectile-generic-command "find . -type f")) - (setq projectile-enable-caching t - projectile-indexing-method 'alien - projectile-sort-order 'recentf - projectile-cache-file (concat spacemacs-cache-directory - "projectile.cache") - projectile-known-projects-file (concat spacemacs-cache-directory - "projectile-bookmarks.eld")) - (unless (configuration-layer/package-usedp 'helm-projectile) - (evil-leader/set-key - "pb" 'projectile-switch-to-buffer - "pd" 'projectile-find-dir - "pf" 'projectile-find-file - "ph" 'helm-projectile - "pr" 'projectile-recentf - "ps" 'projectile-switch-project)) - (evil-leader/set-key - "p!" 'projectile-run-shell-command-in-root - "p&" 'projectile-run-async-shell-command-in-root - "pa" 'projectile-toggle-between-implementation-and-test - "pc" 'projectile-compile-project - "pD" 'projectile-dired - "pG" 'projectile-regenerate-tags - "pI" 'projectile-invalidate-cache - "pk" 'projectile-kill-buffers - "po" 'projectile-multi-occur - "pR" 'projectile-replace - "pT" 'projectile-find-test-file - "py" 'projectile-find-tag)) - :config - (progn - (projectile-global-mode) - (spacemacs|hide-lighter projectile-mode)))) - -(defun spacemacs/init-quelpa ()) - (defun spacemacs/init-rainbow-delimiters () (use-package rainbow-delimiters :defer t @@ -3448,51 +2342,6 @@ one of `l' or `r'." (when (member dotspacemacs-highlight-delimiters '(any all)) (spacemacs/add-to-hooks 'rainbow-delimiters-mode '(prog-mode-hook)))))) -(defun spacemacs/init-recentf () - (use-package recentf - :defer t - :init - ;; lazy load recentf - (add-hook 'find-file-hook (lambda () (unless recentf-mode - (recentf-mode) - (recentf-track-opened-file)))) - :config - (add-to-list 'recentf-exclude (expand-file-name spacemacs-cache-directory)) - (add-to-list 'recentf-exclude (expand-file-name package-user-dir)) - (add-to-list 'recentf-exclude "COMMIT_EDITMSG\\'") - (setq recentf-save-file (concat spacemacs-cache-directory "recentf")) - (setq recentf-max-saved-items 100) - (setq recentf-auto-cleanup 'never) - (setq recentf-auto-save-timer (run-with-idle-timer 600 t 'recentf-save-list)))) - -(defun spacemacs/init-rfringe () - (use-package rfringe - :defer t)) - -(defun spacemacs/init-savehist () - (use-package savehist - :init - (progn - ;; Minibuffer history - (setq savehist-file (concat spacemacs-cache-directory "savehist") - enable-recursive-minibuffers t ; Allow commands in minibuffers - history-length 1000 - savehist-additional-variables '(mark-ring - global-mark-ring - search-ring - regexp-search-ring - extended-command-history) - savehist-autosave-interval 60) - (savehist-mode t)))) - -(defun spacemacs/init-saveplace () - (use-package saveplace - :init - (progn - ;; Save point position between sessions - (setq save-place t - save-place-file (concat spacemacs-cache-directory "places"))))) - (defun spacemacs/init-smartparens () (use-package smartparens :defer t @@ -3602,56 +2451,6 @@ one of `l' or `r'." (define-key spray-mode-map (kbd "l") 'spray-forward-word) (define-key spray-mode-map (kbd "q") 'spray-quit)))) -(defun spacemacs/init-subword () - (unless (version< emacs-version "24.4") - (use-package subword - :defer t - :init - (progn - (unless (category-docstring ?U) - (define-category ?U "Uppercase") - (define-category ?u "Lowercase")) - (modify-category-entry (cons ?A ?Z) ?U) - (modify-category-entry (cons ?a ?z) ?u) - (make-variable-buffer-local 'evil-cjk-word-separating-categories) - (defun spacemacs//subword-enable-camel-case () - "Add support for camel case to subword." - (if subword-mode - (push '(?u . ?U) evil-cjk-word-separating-categories) - (setq evil-cjk-word-separating-categories - (default-value 'evil-cjk-word-separating-categories)))) - (add-hook 'subword-mode-hook 'spacemacs//subword-enable-camel-case) - (spacemacs|add-toggle camel-case-motion - :status subword-mode - :on (subword-mode +1) - :off (subword-mode -1) - :documentation "Toggle CamelCase motions." - :evil-leader "tc") - (spacemacs|add-toggle camel-case-motion-globally - :status subword-mode - :on (global-subword-mode +1) - :off (global-subword-mode -1) - :documentation "Globally toggle CamelCase motions." - :evil-leader "t C-c")) - :config - (spacemacs|diminish subword-mode " ⓒ" " c")))) - -(defun spacemacs/init-undo-tree () - (use-package undo-tree - :init - (global-undo-tree-mode) - ;; (setq undo-tree-auto-save-history t - ;; undo-tree-history-directory-alist - ;; `(("." . ,(concat spacemacs-cache-directory "undo")))) - ;; (unless (file-exists-p (concat spacemacs-cache-directory "undo")) - ;; (make-directory (concat spacemacs-cache-directory "undo"))) - (setq undo-tree-visualizer-timestamps t) - (setq undo-tree-visualizer-diff t) - :config - (spacemacs|hide-lighter undo-tree-mode))) - -(defun spacemacs/init-use-package ()) - (defun spacemacs/init-vi-tilde-fringe () (use-package vi-tilde-fringe :if window-system @@ -3676,158 +2475,6 @@ one of `l' or `r'." :config (spacemacs|hide-lighter vi-tilde-fringe-mode))) -(defun spacemacs/init-visual-regexp-steroids () - (use-package visual-regexp-steroids - :defer t - ;; no shortcut for now (used by registers) - ;; :init - ;; (evil-leader/set-key - ;; "rR" 'vr/query-replace - ;; "rr" 'vr/replace) - )) - -(defun spacemacs/init-volatile-highlights () - (use-package volatile-highlights - :config - (progn - (volatile-highlights-mode t) - (spacemacs|hide-lighter volatile-highlights-mode)))) - -(defun spacemacs/init-wand () - (use-package wand - :disabled t - :init - (progn - (require 'wand) - (wand:add-rule (wand:create-rule :match "https?://" - :capture :whole - :action message)) - (evil-leader/set-key "RET" 'wand:execute)))) - -(defun spacemacs/init-whitespace () - (use-package whitespace - :defer t - :init - (progn - (spacemacs|add-toggle whitespace - :status whitespace-mode - :on (whitespace-mode) - :off (whitespace-mode -1) - :documentation "Display whitespace." - :evil-leader "tw") - (spacemacs|add-toggle whitespace-globally - :status global-whitespace-mode - :on (global-whitespace-mode) - :off (global-whitespace-mode -1) - :documentation "Display whitespace globally." - :evil-leader "t C-w") - (defun spacemacs//set-whitespace-style-for-diff () - "Whitespace configuration for `diff-mode'" - (setq-local whitespace-style '(face - tabs - tab-mark - spaces - space-mark - trailing - indentation::space - indentation::tab - newline - newline-mark))) - (add-hook 'diff-mode-hook 'whitespace-mode) - (add-hook 'diff-mode-hook 'spacemacs//set-whitespace-style-for-diff)) - :config - (progn - (set-face-attribute 'whitespace-space nil - :background nil - :foreground (face-attribute 'font-lock-warning-face :foreground)) - (set-face-attribute 'whitespace-tab nil - :background nil) - (set-face-attribute 'whitespace-indentation nil - :background nil) - (spacemacs|diminish whitespace-mode " ⓦ" " w") - (spacemacs|diminish global-whitespace-mode " Ⓦ" " W")))) - -(defun spacemacs/init-which-key () - (use-package which-key - :init - (progn - (spacemacs|add-toggle which-key - :status which-key-mode - :on (which-key-mode) - :off (which-key-mode -1) - :documentation - "Display a buffer with available key bindings." - :evil-leader "tK") - ;; (defadvice which-key--update - ;; (around spacemacs/inhibit-which-key-buffer activate) - ;; "Prevent the popup of the which-key buffer in some case." - ;; ;; a micro-state is running - ;; ;; or - ;; ;; bzg-big-fringe-mode is on - ;; (if (or overriding-terminal-local-map - ;; bzg-big-fringe-mode) - ;; (let ((which-key-inhibit t)) ad-do-it) - ;; ad-do-it)) - (let ((new-descriptions - ;; being higher in this list means the replacement is applied later - '( - ("spacemacs/\\(.+\\)" . "\\1") - ("spacemacs/toggle-\\(.+\\)" . "\\1") - ("select-window-\\([0-9]\\)" . "window \\1") - ("spacemacs/alternate-buffer" . "last buffer") - ("avy-goto-word-or-subword-1" . "avy word") - ("shell-command" . "shell cmd") - ("spacemacs/default-pop-shell" . "open shell") - ("spacemacs/helm-project-smart-do-search-region-or-symbol" . "smart search") - ("helm-descbinds" . "show keybindings") - ("sp-split-sexp" . "split sexp") - ("avy-goto-line" . "avy line") - ("universal-argument" . "universal arg") - ("er/expand-region" . "expand region") - ("helm-apropos" . "apropos") - ("evil-lisp-state-\\(.+\\)" . "\\1")))) - (dolist (nd new-descriptions) - ;; ensure the target matches the whole string - (push (cons (concat "\\`" (car nd) "\\'") (cdr nd)) - which-key-description-replacement-alist))) - (dolist (leader-key `(,dotspacemacs-leader-key ,dotspacemacs-emacs-leader-key)) - (which-key-add-key-based-replacements - (concat leader-key " m") "major mode commands" - (concat leader-key " " dotspacemacs-command-key) "M-x")) - (if (fboundp 'which-key-declare-prefixes) - (which-key-declare-prefixes - dotspacemacs-leader-key '("root" . "Spacemacs root") - dotspacemacs-emacs-leader-key '("root" . "Spacemacs root") - (concat dotspacemacs-leader-key " m") - '("major-mode-cmd" . "Major mode commands") - (concat dotspacemacs-emacs-leader-key " m") - '("major-mode-cmd" . "Major mode commands")) - ;; no need to use this after everyone updates which-key - (setq which-key-prefix-title-alist - `((,(listify-key-sequence - (kbd (concat dotspacemacs-leader-key " m"))) . "Major mode commands") - (,(listify-key-sequence - (kbd (concat dotspacemacs-emacs-leader-key " m"))) . "Major mode commands") - (,(listify-key-sequence - (kbd dotspacemacs-leader-key)) . "Spacemacs root") - (,(listify-key-sequence - (kbd dotspacemacs-emacs-leader-key)) . "Spacemacs root"))) - (nconc which-key-prefix-title-alist spacemacs/prefix-titles)) - ;; disable special key handling for spacemacs, since it can be - ;; disorienting if you don't understand it - (pcase dotspacemacs-which-key-position - (`right (which-key-setup-side-window-right)) - (`bottom (which-key-setup-side-window-bottom)) - (`right-then-bottom (which-key-setup-side-window-right-bottom))) - (setq which-key-special-keys nil - which-key-use-C-h-for-paging t - which-key-prevent-C-h-from-cycling t - which-key-echo-keystrokes 0.02 - which-key-max-description-length 32 - which-key-idle-delay dotspacemacs-which-key-delay) - (which-key-mode) - (spacemacs|diminish which-key-mode " Ⓚ" " K")))) - (defun spacemacs/init-window-numbering () (use-package window-numbering :config @@ -3877,24 +2524,12 @@ one of `l' or `r'." (add-hook 'window-numbering-before-hook 'spacemacs//window-numbering-assign) (add-hook 'neo-after-create-hook '(lambda (w) (window-numbering-update))))) -(defun spacemacs/init-winner () - (use-package winner - :init +(defun spacemacs/init-volatile-highlights () + (use-package volatile-highlights + :config (progn - (setq spacemacs/winner-boring-buffers '("*Completions*" - "*Compile-Log*" - "*inferior-lisp*" - "*Fuzzy Completions*" - "*Apropos*" - "*Help*" - "*cvs*" - "*Buffer List*" - "*Ibuffer*" - "*esh command on file*" - )) - (setq winner-boring-buffers - (append winner-boring-buffers spacemacs/winner-boring-buffers)) - (winner-mode t)))) + (volatile-highlights-mode t) + (spacemacs|hide-lighter volatile-highlights-mode)))) (defun spacemacs/init-zoom-frm () (use-package zoom-frm diff --git a/contrib/!email/gnus/README.org b/layers/!email/gnus/README.org similarity index 100% rename from contrib/!email/gnus/README.org rename to layers/!email/gnus/README.org diff --git a/contrib/!email/gnus/img/gnus.gif b/layers/!email/gnus/img/gnus.gif similarity index 100% rename from contrib/!email/gnus/img/gnus.gif rename to layers/!email/gnus/img/gnus.gif diff --git a/contrib/!email/gnus/packages.el b/layers/!email/gnus/packages.el similarity index 100% rename from contrib/!email/gnus/packages.el rename to layers/!email/gnus/packages.el diff --git a/contrib/!frameworks/django/README.org b/layers/!frameworks/django/README.org similarity index 100% rename from contrib/!frameworks/django/README.org rename to layers/!frameworks/django/README.org diff --git a/contrib/!frameworks/django/img/django.png b/layers/!frameworks/django/img/django.png similarity index 100% rename from contrib/!frameworks/django/img/django.png rename to layers/!frameworks/django/img/django.png diff --git a/contrib/!frameworks/django/packages.el b/layers/!frameworks/django/packages.el similarity index 100% rename from contrib/!frameworks/django/packages.el rename to layers/!frameworks/django/packages.el diff --git a/contrib/!frameworks/react/README.org b/layers/!frameworks/react/README.org similarity index 100% rename from contrib/!frameworks/react/README.org rename to layers/!frameworks/react/README.org diff --git a/contrib/!frameworks/react/config.el b/layers/!frameworks/react/config.el similarity index 100% rename from contrib/!frameworks/react/config.el rename to layers/!frameworks/react/config.el diff --git a/contrib/!frameworks/react/img/react.png b/layers/!frameworks/react/img/react.png similarity index 100% rename from contrib/!frameworks/react/img/react.png rename to layers/!frameworks/react/img/react.png diff --git a/contrib/!frameworks/react/packages.el b/layers/!frameworks/react/packages.el similarity index 100% rename from contrib/!frameworks/react/packages.el rename to layers/!frameworks/react/packages.el diff --git a/contrib/!frameworks/ruby-on-rails/README.org b/layers/!frameworks/ruby-on-rails/README.org similarity index 100% rename from contrib/!frameworks/ruby-on-rails/README.org rename to layers/!frameworks/ruby-on-rails/README.org diff --git a/contrib/!frameworks/ruby-on-rails/img/ror.png b/layers/!frameworks/ruby-on-rails/img/ror.png similarity index 100% rename from contrib/!frameworks/ruby-on-rails/img/ror.png rename to layers/!frameworks/ruby-on-rails/img/ror.png diff --git a/contrib/!frameworks/ruby-on-rails/packages.el b/layers/!frameworks/ruby-on-rails/packages.el similarity index 100% rename from contrib/!frameworks/ruby-on-rails/packages.el rename to layers/!frameworks/ruby-on-rails/packages.el diff --git a/contrib/!fun/emoji/README.org b/layers/!fun/emoji/README.org similarity index 100% rename from contrib/!fun/emoji/README.org rename to layers/!fun/emoji/README.org diff --git a/contrib/!fun/emoji/packages.el b/layers/!fun/emoji/packages.el similarity index 100% rename from contrib/!fun/emoji/packages.el rename to layers/!fun/emoji/packages.el diff --git a/contrib/!fun/games/README.org b/layers/!fun/games/README.org similarity index 100% rename from contrib/!fun/games/README.org rename to layers/!fun/games/README.org diff --git a/contrib/!fun/games/config.el b/layers/!fun/games/config.el similarity index 100% rename from contrib/!fun/games/config.el rename to layers/!fun/games/config.el diff --git a/contrib/!fun/games/extensions.el b/layers/!fun/games/extensions.el similarity index 100% rename from contrib/!fun/games/extensions.el rename to layers/!fun/games/extensions.el diff --git a/contrib/!fun/games/extensions/helm-games/helm-games.el b/layers/!fun/games/extensions/helm-games/helm-games.el similarity index 100% rename from contrib/!fun/games/extensions/helm-games/helm-games.el rename to layers/!fun/games/extensions/helm-games/helm-games.el diff --git a/contrib/!fun/games/img/games.png b/layers/!fun/games/img/games.png similarity index 100% rename from contrib/!fun/games/img/games.png rename to layers/!fun/games/img/games.png diff --git a/contrib/!fun/games/packages.el b/layers/!fun/games/packages.el similarity index 100% rename from contrib/!fun/games/packages.el rename to layers/!fun/games/packages.el diff --git a/contrib/!fun/xkcd/README.org b/layers/!fun/xkcd/README.org similarity index 100% rename from contrib/!fun/xkcd/README.org rename to layers/!fun/xkcd/README.org diff --git a/contrib/!fun/xkcd/img/xkcd.png b/layers/!fun/xkcd/img/xkcd.png similarity index 100% rename from contrib/!fun/xkcd/img/xkcd.png rename to layers/!fun/xkcd/img/xkcd.png diff --git a/contrib/!fun/xkcd/packages.el b/layers/!fun/xkcd/packages.el similarity index 100% rename from contrib/!fun/xkcd/packages.el rename to layers/!fun/xkcd/packages.el diff --git a/contrib/!irc/erc/README.org b/layers/!irc/erc/README.org similarity index 100% rename from contrib/!irc/erc/README.org rename to layers/!irc/erc/README.org diff --git a/contrib/!irc/erc/config.el b/layers/!irc/erc/config.el similarity index 100% rename from contrib/!irc/erc/config.el rename to layers/!irc/erc/config.el diff --git a/contrib/!irc/erc/extensions.el b/layers/!irc/erc/extensions.el similarity index 100% rename from contrib/!irc/erc/extensions.el rename to layers/!irc/erc/extensions.el diff --git a/contrib/!irc/erc/extensions/erc-sasl/erc-sasl.el b/layers/!irc/erc/extensions/erc-sasl/erc-sasl.el similarity index 100% rename from contrib/!irc/erc/extensions/erc-sasl/erc-sasl.el rename to layers/!irc/erc/extensions/erc-sasl/erc-sasl.el diff --git a/contrib/!irc/erc/extensions/erc-tex/erc-tex.el b/layers/!irc/erc/extensions/erc-tex/erc-tex.el similarity index 100% rename from contrib/!irc/erc/extensions/erc-tex/erc-tex.el rename to layers/!irc/erc/extensions/erc-tex/erc-tex.el diff --git a/contrib/!irc/erc/extensions/erc-yank/README.md b/layers/!irc/erc/extensions/erc-yank/README.md similarity index 100% rename from contrib/!irc/erc/extensions/erc-yank/README.md rename to layers/!irc/erc/extensions/erc-yank/README.md diff --git a/contrib/!irc/erc/extensions/erc-yank/erc-yank.el b/layers/!irc/erc/extensions/erc-yank/erc-yank.el similarity index 100% rename from contrib/!irc/erc/extensions/erc-yank/erc-yank.el rename to layers/!irc/erc/extensions/erc-yank/erc-yank.el diff --git a/contrib/!irc/erc/packages.el b/layers/!irc/erc/packages.el similarity index 100% rename from contrib/!irc/erc/packages.el rename to layers/!irc/erc/packages.el diff --git a/contrib/!irc/rcirc/README.org b/layers/!irc/rcirc/README.org similarity index 100% rename from contrib/!irc/rcirc/README.org rename to layers/!irc/rcirc/README.org diff --git a/contrib/!irc/rcirc/config.el b/layers/!irc/rcirc/config.el similarity index 100% rename from contrib/!irc/rcirc/config.el rename to layers/!irc/rcirc/config.el diff --git a/contrib/!irc/rcirc/extensions.el b/layers/!irc/rcirc/extensions.el similarity index 100% rename from contrib/!irc/rcirc/extensions.el rename to layers/!irc/rcirc/extensions.el diff --git a/contrib/!irc/rcirc/funcs.el b/layers/!irc/rcirc/funcs.el similarity index 100% rename from contrib/!irc/rcirc/funcs.el rename to layers/!irc/rcirc/funcs.el diff --git a/contrib/!irc/rcirc/img/irc.png b/layers/!irc/rcirc/img/irc.png similarity index 100% rename from contrib/!irc/rcirc/img/irc.png rename to layers/!irc/rcirc/img/irc.png diff --git a/contrib/!irc/rcirc/local/helm-rcirc/README.md b/layers/!irc/rcirc/local/helm-rcirc/README.md similarity index 100% rename from contrib/!irc/rcirc/local/helm-rcirc/README.md rename to layers/!irc/rcirc/local/helm-rcirc/README.md diff --git a/contrib/!irc/rcirc/local/helm-rcirc/helm-rcirc.el b/layers/!irc/rcirc/local/helm-rcirc/helm-rcirc.el similarity index 100% rename from contrib/!irc/rcirc/local/helm-rcirc/helm-rcirc.el rename to layers/!irc/rcirc/local/helm-rcirc/helm-rcirc.el diff --git a/contrib/!irc/rcirc/local/rcirc-late-fix/rcirc-late-fix.el b/layers/!irc/rcirc/local/rcirc-late-fix/rcirc-late-fix.el similarity index 100% rename from contrib/!irc/rcirc/local/rcirc-late-fix/rcirc-late-fix.el rename to layers/!irc/rcirc/local/rcirc-late-fix/rcirc-late-fix.el diff --git a/contrib/!irc/rcirc/local/rcirc-reconnect/rcirc-reconnect.el b/layers/!irc/rcirc/local/rcirc-reconnect/rcirc-reconnect.el similarity index 100% rename from contrib/!irc/rcirc/local/rcirc-reconnect/rcirc-reconnect.el rename to layers/!irc/rcirc/local/rcirc-reconnect/rcirc-reconnect.el diff --git a/contrib/!irc/rcirc/packages.el b/layers/!irc/rcirc/packages.el similarity index 100% rename from contrib/!irc/rcirc/packages.el rename to layers/!irc/rcirc/packages.el diff --git a/contrib/!lang/agda/README.org b/layers/!lang/agda/README.org similarity index 100% rename from contrib/!lang/agda/README.org rename to layers/!lang/agda/README.org diff --git a/contrib/!lang/agda/extensions.el b/layers/!lang/agda/extensions.el similarity index 100% rename from contrib/!lang/agda/extensions.el rename to layers/!lang/agda/extensions.el diff --git a/contrib/!lang/asciidoc/README.org b/layers/!lang/asciidoc/README.org similarity index 100% rename from contrib/!lang/asciidoc/README.org rename to layers/!lang/asciidoc/README.org diff --git a/contrib/!lang/asciidoc/packages.el b/layers/!lang/asciidoc/packages.el similarity index 100% rename from contrib/!lang/asciidoc/packages.el rename to layers/!lang/asciidoc/packages.el diff --git a/contrib/!lang/autohotkey/README.org b/layers/!lang/autohotkey/README.org similarity index 100% rename from contrib/!lang/autohotkey/README.org rename to layers/!lang/autohotkey/README.org diff --git a/contrib/!lang/autohotkey/img/ahk.png b/layers/!lang/autohotkey/img/ahk.png similarity index 100% rename from contrib/!lang/autohotkey/img/ahk.png rename to layers/!lang/autohotkey/img/ahk.png diff --git a/contrib/!lang/autohotkey/packages.el b/layers/!lang/autohotkey/packages.el similarity index 100% rename from contrib/!lang/autohotkey/packages.el rename to layers/!lang/autohotkey/packages.el diff --git a/contrib/!lang/c-c++/README.org b/layers/!lang/c-c++/README.org similarity index 100% rename from contrib/!lang/c-c++/README.org rename to layers/!lang/c-c++/README.org diff --git a/contrib/!lang/c-c++/config.el b/layers/!lang/c-c++/config.el similarity index 100% rename from contrib/!lang/c-c++/config.el rename to layers/!lang/c-c++/config.el diff --git a/contrib/!lang/c-c++/img/ccpp.jpg b/layers/!lang/c-c++/img/ccpp.jpg similarity index 100% rename from contrib/!lang/c-c++/img/ccpp.jpg rename to layers/!lang/c-c++/img/ccpp.jpg diff --git a/contrib/!lang/c-c++/img/cmake.png b/layers/!lang/c-c++/img/cmake.png similarity index 100% rename from contrib/!lang/c-c++/img/cmake.png rename to layers/!lang/c-c++/img/cmake.png diff --git a/contrib/!lang/c-c++/packages.el b/layers/!lang/c-c++/packages.el similarity index 100% rename from contrib/!lang/c-c++/packages.el rename to layers/!lang/c-c++/packages.el diff --git a/contrib/!lang/clojure/README.org b/layers/!lang/clojure/README.org similarity index 100% rename from contrib/!lang/clojure/README.org rename to layers/!lang/clojure/README.org diff --git a/contrib/!lang/clojure/config.el b/layers/!lang/clojure/config.el similarity index 100% rename from contrib/!lang/clojure/config.el rename to layers/!lang/clojure/config.el diff --git a/contrib/!lang/clojure/funcs.el b/layers/!lang/clojure/funcs.el similarity index 100% rename from contrib/!lang/clojure/funcs.el rename to layers/!lang/clojure/funcs.el diff --git a/contrib/!lang/clojure/img/cider.png b/layers/!lang/clojure/img/cider.png similarity index 100% rename from contrib/!lang/clojure/img/cider.png rename to layers/!lang/clojure/img/cider.png diff --git a/contrib/!lang/clojure/img/clojure.png b/layers/!lang/clojure/img/clojure.png similarity index 100% rename from contrib/!lang/clojure/img/clojure.png rename to layers/!lang/clojure/img/clojure.png diff --git a/contrib/!lang/clojure/packages.el b/layers/!lang/clojure/packages.el similarity index 100% rename from contrib/!lang/clojure/packages.el rename to layers/!lang/clojure/packages.el diff --git a/contrib/!lang/common-lisp/README.org b/layers/!lang/common-lisp/README.org similarity index 100% rename from contrib/!lang/common-lisp/README.org rename to layers/!lang/common-lisp/README.org diff --git a/contrib/!lang/common-lisp/img/slime.png b/layers/!lang/common-lisp/img/slime.png similarity index 100% rename from contrib/!lang/common-lisp/img/slime.png rename to layers/!lang/common-lisp/img/slime.png diff --git a/contrib/!lang/common-lisp/packages.el b/layers/!lang/common-lisp/packages.el similarity index 100% rename from contrib/!lang/common-lisp/packages.el rename to layers/!lang/common-lisp/packages.el diff --git a/contrib/!lang/csharp/README.org b/layers/!lang/csharp/README.org similarity index 100% rename from contrib/!lang/csharp/README.org rename to layers/!lang/csharp/README.org diff --git a/contrib/!lang/csharp/config.el b/layers/!lang/csharp/config.el similarity index 100% rename from contrib/!lang/csharp/config.el rename to layers/!lang/csharp/config.el diff --git a/contrib/!lang/csharp/extensions.el b/layers/!lang/csharp/extensions.el similarity index 100% rename from contrib/!lang/csharp/extensions.el rename to layers/!lang/csharp/extensions.el diff --git a/contrib/!lang/csharp/img/csharp.png b/layers/!lang/csharp/img/csharp.png similarity index 100% rename from contrib/!lang/csharp/img/csharp.png rename to layers/!lang/csharp/img/csharp.png diff --git a/contrib/!lang/csharp/img/dotnet.png b/layers/!lang/csharp/img/dotnet.png similarity index 100% rename from contrib/!lang/csharp/img/dotnet.png rename to layers/!lang/csharp/img/dotnet.png diff --git a/contrib/!lang/csharp/packages.el b/layers/!lang/csharp/packages.el similarity index 100% rename from contrib/!lang/csharp/packages.el rename to layers/!lang/csharp/packages.el diff --git a/contrib/!lang/d/README.org b/layers/!lang/d/README.org similarity index 100% rename from contrib/!lang/d/README.org rename to layers/!lang/d/README.org diff --git a/contrib/!lang/d/config.el b/layers/!lang/d/config.el similarity index 100% rename from contrib/!lang/d/config.el rename to layers/!lang/d/config.el diff --git a/contrib/!lang/d/img/dlogo.png b/layers/!lang/d/img/dlogo.png similarity index 100% rename from contrib/!lang/d/img/dlogo.png rename to layers/!lang/d/img/dlogo.png diff --git a/contrib/!lang/d/packages.el b/layers/!lang/d/packages.el similarity index 100% rename from contrib/!lang/d/packages.el rename to layers/!lang/d/packages.el diff --git a/contrib/!lang/elixir/README.org b/layers/!lang/elixir/README.org similarity index 100% rename from contrib/!lang/elixir/README.org rename to layers/!lang/elixir/README.org diff --git a/contrib/!lang/elixir/alchemist-refcard.pdf b/layers/!lang/elixir/alchemist-refcard.pdf similarity index 100% rename from contrib/!lang/elixir/alchemist-refcard.pdf rename to layers/!lang/elixir/alchemist-refcard.pdf diff --git a/contrib/!lang/elixir/alchemist-refcard.tex b/layers/!lang/elixir/alchemist-refcard.tex similarity index 100% rename from contrib/!lang/elixir/alchemist-refcard.tex rename to layers/!lang/elixir/alchemist-refcard.tex diff --git a/contrib/!lang/elixir/config.el b/layers/!lang/elixir/config.el similarity index 100% rename from contrib/!lang/elixir/config.el rename to layers/!lang/elixir/config.el diff --git a/contrib/!lang/elixir/img/alchemist.png b/layers/!lang/elixir/img/alchemist.png similarity index 100% rename from contrib/!lang/elixir/img/alchemist.png rename to layers/!lang/elixir/img/alchemist.png diff --git a/contrib/!lang/elixir/img/elixir.png b/layers/!lang/elixir/img/elixir.png similarity index 100% rename from contrib/!lang/elixir/img/elixir.png rename to layers/!lang/elixir/img/elixir.png diff --git a/contrib/!lang/elixir/packages.el b/layers/!lang/elixir/packages.el similarity index 100% rename from contrib/!lang/elixir/packages.el rename to layers/!lang/elixir/packages.el diff --git a/contrib/!lang/elm/README.org b/layers/!lang/elm/README.org similarity index 100% rename from contrib/!lang/elm/README.org rename to layers/!lang/elm/README.org diff --git a/contrib/!lang/elm/config.el b/layers/!lang/elm/config.el similarity index 100% rename from contrib/!lang/elm/config.el rename to layers/!lang/elm/config.el diff --git a/contrib/!lang/elm/img/elm.png b/layers/!lang/elm/img/elm.png similarity index 100% rename from contrib/!lang/elm/img/elm.png rename to layers/!lang/elm/img/elm.png diff --git a/contrib/!lang/elm/packages.el b/layers/!lang/elm/packages.el similarity index 100% rename from contrib/!lang/elm/packages.el rename to layers/!lang/elm/packages.el diff --git a/contrib/!lang/emacs-lisp/README.org b/layers/!lang/emacs-lisp/README.org similarity index 100% rename from contrib/!lang/emacs-lisp/README.org rename to layers/!lang/emacs-lisp/README.org diff --git a/contrib/!lang/emacs-lisp/config.el b/layers/!lang/emacs-lisp/config.el similarity index 100% rename from contrib/!lang/emacs-lisp/config.el rename to layers/!lang/emacs-lisp/config.el diff --git a/contrib/!lang/emacs-lisp/extensions.el b/layers/!lang/emacs-lisp/extensions.el similarity index 100% rename from contrib/!lang/emacs-lisp/extensions.el rename to layers/!lang/emacs-lisp/extensions.el diff --git a/contrib/!lang/emacs-lisp/img/emacs-lisp.png b/layers/!lang/emacs-lisp/img/emacs-lisp.png similarity index 100% rename from contrib/!lang/emacs-lisp/img/emacs-lisp.png rename to layers/!lang/emacs-lisp/img/emacs-lisp.png diff --git a/contrib/!lang/emacs-lisp/packages.el b/layers/!lang/emacs-lisp/packages.el similarity index 100% rename from contrib/!lang/emacs-lisp/packages.el rename to layers/!lang/emacs-lisp/packages.el diff --git a/contrib/!lang/erlang/README.org b/layers/!lang/erlang/README.org similarity index 100% rename from contrib/!lang/erlang/README.org rename to layers/!lang/erlang/README.org diff --git a/contrib/!lang/erlang/img/erlang.png b/layers/!lang/erlang/img/erlang.png similarity index 100% rename from contrib/!lang/erlang/img/erlang.png rename to layers/!lang/erlang/img/erlang.png diff --git a/contrib/!lang/erlang/packages.el b/layers/!lang/erlang/packages.el similarity index 100% rename from contrib/!lang/erlang/packages.el rename to layers/!lang/erlang/packages.el diff --git a/contrib/!lang/ess/README.org b/layers/!lang/ess/README.org similarity index 100% rename from contrib/!lang/ess/README.org rename to layers/!lang/ess/README.org diff --git a/contrib/!lang/ess/config.el b/layers/!lang/ess/config.el similarity index 100% rename from contrib/!lang/ess/config.el rename to layers/!lang/ess/config.el diff --git a/contrib/!lang/ess/img/r.jpg b/layers/!lang/ess/img/r.jpg similarity index 100% rename from contrib/!lang/ess/img/r.jpg rename to layers/!lang/ess/img/r.jpg diff --git a/contrib/!lang/ess/packages.el b/layers/!lang/ess/packages.el similarity index 100% rename from contrib/!lang/ess/packages.el rename to layers/!lang/ess/packages.el diff --git a/contrib/!lang/extra-langs/README.org b/layers/!lang/extra-langs/README.org similarity index 100% rename from contrib/!lang/extra-langs/README.org rename to layers/!lang/extra-langs/README.org diff --git a/contrib/!lang/extra-langs/packages.el b/layers/!lang/extra-langs/packages.el similarity index 100% rename from contrib/!lang/extra-langs/packages.el rename to layers/!lang/extra-langs/packages.el diff --git a/contrib/!lang/fsharp/README.org b/layers/!lang/fsharp/README.org similarity index 100% rename from contrib/!lang/fsharp/README.org rename to layers/!lang/fsharp/README.org diff --git a/contrib/!lang/fsharp/img/fsharp.png b/layers/!lang/fsharp/img/fsharp.png similarity index 100% rename from contrib/!lang/fsharp/img/fsharp.png rename to layers/!lang/fsharp/img/fsharp.png diff --git a/contrib/!lang/fsharp/packages.el b/layers/!lang/fsharp/packages.el similarity index 100% rename from contrib/!lang/fsharp/packages.el rename to layers/!lang/fsharp/packages.el diff --git a/contrib/!lang/go/README.org b/layers/!lang/go/README.org similarity index 100% rename from contrib/!lang/go/README.org rename to layers/!lang/go/README.org diff --git a/contrib/!lang/go/config.el b/layers/!lang/go/config.el similarity index 100% rename from contrib/!lang/go/config.el rename to layers/!lang/go/config.el diff --git a/contrib/!lang/go/extensions.el b/layers/!lang/go/extensions.el similarity index 100% rename from contrib/!lang/go/extensions.el rename to layers/!lang/go/extensions.el diff --git a/contrib/!lang/go/extensions/go-rename/go-rename.el b/layers/!lang/go/extensions/go-rename/go-rename.el similarity index 100% rename from contrib/!lang/go/extensions/go-rename/go-rename.el rename to layers/!lang/go/extensions/go-rename/go-rename.el diff --git a/contrib/!lang/go/img/go.png b/layers/!lang/go/img/go.png similarity index 100% rename from contrib/!lang/go/img/go.png rename to layers/!lang/go/img/go.png diff --git a/contrib/!lang/go/packages.el b/layers/!lang/go/packages.el similarity index 100% rename from contrib/!lang/go/packages.el rename to layers/!lang/go/packages.el diff --git a/contrib/!lang/haskell/README.org b/layers/!lang/haskell/README.org similarity index 100% rename from contrib/!lang/haskell/README.org rename to layers/!lang/haskell/README.org diff --git a/contrib/!lang/haskell/config.el b/layers/!lang/haskell/config.el similarity index 100% rename from contrib/!lang/haskell/config.el rename to layers/!lang/haskell/config.el diff --git a/contrib/!lang/haskell/img/haskell.png b/layers/!lang/haskell/img/haskell.png similarity index 100% rename from contrib/!lang/haskell/img/haskell.png rename to layers/!lang/haskell/img/haskell.png diff --git a/contrib/!lang/haskell/packages.el b/layers/!lang/haskell/packages.el similarity index 100% rename from contrib/!lang/haskell/packages.el rename to layers/!lang/haskell/packages.el diff --git a/contrib/!lang/html/README.org b/layers/!lang/html/README.org similarity index 100% rename from contrib/!lang/html/README.org rename to layers/!lang/html/README.org diff --git a/contrib/!lang/html/config.el b/layers/!lang/html/config.el similarity index 100% rename from contrib/!lang/html/config.el rename to layers/!lang/html/config.el diff --git a/contrib/!lang/html/img/html.png b/layers/!lang/html/img/html.png similarity index 100% rename from contrib/!lang/html/img/html.png rename to layers/!lang/html/img/html.png diff --git a/contrib/!lang/html/packages.el b/layers/!lang/html/packages.el similarity index 100% rename from contrib/!lang/html/packages.el rename to layers/!lang/html/packages.el diff --git a/contrib/!lang/idris-lang/README.org b/layers/!lang/idris-lang/README.org similarity index 100% rename from contrib/!lang/idris-lang/README.org rename to layers/!lang/idris-lang/README.org diff --git a/contrib/!lang/idris-lang/img/idris.png b/layers/!lang/idris-lang/img/idris.png similarity index 100% rename from contrib/!lang/idris-lang/img/idris.png rename to layers/!lang/idris-lang/img/idris.png diff --git a/contrib/!lang/idris-lang/packages.el b/layers/!lang/idris-lang/packages.el similarity index 100% rename from contrib/!lang/idris-lang/packages.el rename to layers/!lang/idris-lang/packages.el diff --git a/contrib/!lang/ipython-notebook/README.org b/layers/!lang/ipython-notebook/README.org similarity index 100% rename from contrib/!lang/ipython-notebook/README.org rename to layers/!lang/ipython-notebook/README.org diff --git a/contrib/!lang/ipython-notebook/img/dark.png b/layers/!lang/ipython-notebook/img/dark.png similarity index 100% rename from contrib/!lang/ipython-notebook/img/dark.png rename to layers/!lang/ipython-notebook/img/dark.png diff --git a/contrib/!lang/ipython-notebook/img/light.png b/layers/!lang/ipython-notebook/img/light.png similarity index 100% rename from contrib/!lang/ipython-notebook/img/light.png rename to layers/!lang/ipython-notebook/img/light.png diff --git a/contrib/!lang/ipython-notebook/matplotlibrc b/layers/!lang/ipython-notebook/matplotlibrc similarity index 100% rename from contrib/!lang/ipython-notebook/matplotlibrc rename to layers/!lang/ipython-notebook/matplotlibrc diff --git a/contrib/!lang/ipython-notebook/packages.el b/layers/!lang/ipython-notebook/packages.el similarity index 100% rename from contrib/!lang/ipython-notebook/packages.el rename to layers/!lang/ipython-notebook/packages.el diff --git a/contrib/!lang/java/README.org b/layers/!lang/java/README.org similarity index 100% rename from contrib/!lang/java/README.org rename to layers/!lang/java/README.org diff --git a/contrib/!lang/java/config.el b/layers/!lang/java/config.el similarity index 100% rename from contrib/!lang/java/config.el rename to layers/!lang/java/config.el diff --git a/contrib/!lang/java/funcs.el b/layers/!lang/java/funcs.el similarity index 100% rename from contrib/!lang/java/funcs.el rename to layers/!lang/java/funcs.el diff --git a/contrib/!lang/java/img/java.png b/layers/!lang/java/img/java.png similarity index 100% rename from contrib/!lang/java/img/java.png rename to layers/!lang/java/img/java.png diff --git a/contrib/!lang/java/packages.el b/layers/!lang/java/packages.el similarity index 100% rename from contrib/!lang/java/packages.el rename to layers/!lang/java/packages.el diff --git a/contrib/!lang/javascript/README.org b/layers/!lang/javascript/README.org similarity index 100% rename from contrib/!lang/javascript/README.org rename to layers/!lang/javascript/README.org diff --git a/contrib/!lang/javascript/config.el b/layers/!lang/javascript/config.el similarity index 100% rename from contrib/!lang/javascript/config.el rename to layers/!lang/javascript/config.el diff --git a/contrib/!lang/javascript/img/coffee.png b/layers/!lang/javascript/img/coffee.png similarity index 100% rename from contrib/!lang/javascript/img/coffee.png rename to layers/!lang/javascript/img/coffee.png diff --git a/contrib/!lang/javascript/img/javascript.png b/layers/!lang/javascript/img/javascript.png similarity index 100% rename from contrib/!lang/javascript/img/javascript.png rename to layers/!lang/javascript/img/javascript.png diff --git a/contrib/!lang/javascript/packages.el b/layers/!lang/javascript/packages.el similarity index 100% rename from contrib/!lang/javascript/packages.el rename to layers/!lang/javascript/packages.el diff --git a/contrib/!lang/latex/README.org b/layers/!lang/latex/README.org similarity index 100% rename from contrib/!lang/latex/README.org rename to layers/!lang/latex/README.org diff --git a/contrib/!lang/latex/config.el b/layers/!lang/latex/config.el similarity index 100% rename from contrib/!lang/latex/config.el rename to layers/!lang/latex/config.el diff --git a/contrib/!lang/latex/extensions.el b/layers/!lang/latex/extensions.el similarity index 100% rename from contrib/!lang/latex/extensions.el rename to layers/!lang/latex/extensions.el diff --git a/contrib/!lang/latex/funcs.el b/layers/!lang/latex/funcs.el similarity index 100% rename from contrib/!lang/latex/funcs.el rename to layers/!lang/latex/funcs.el diff --git a/contrib/!lang/latex/img/latex.png b/layers/!lang/latex/img/latex.png similarity index 100% rename from contrib/!lang/latex/img/latex.png rename to layers/!lang/latex/img/latex.png diff --git a/contrib/!lang/latex/packages.el b/layers/!lang/latex/packages.el similarity index 100% rename from contrib/!lang/latex/packages.el rename to layers/!lang/latex/packages.el diff --git a/contrib/!lang/lua/README.org b/layers/!lang/lua/README.org similarity index 100% rename from contrib/!lang/lua/README.org rename to layers/!lang/lua/README.org diff --git a/contrib/!lang/lua/img/lua.gif b/layers/!lang/lua/img/lua.gif similarity index 100% rename from contrib/!lang/lua/img/lua.gif rename to layers/!lang/lua/img/lua.gif diff --git a/contrib/!lang/lua/packages.el b/layers/!lang/lua/packages.el similarity index 100% rename from contrib/!lang/lua/packages.el rename to layers/!lang/lua/packages.el diff --git a/contrib/!lang/markdown/README.org b/layers/!lang/markdown/README.org similarity index 100% rename from contrib/!lang/markdown/README.org rename to layers/!lang/markdown/README.org diff --git a/contrib/!lang/markdown/config.el b/layers/!lang/markdown/config.el similarity index 100% rename from contrib/!lang/markdown/config.el rename to layers/!lang/markdown/config.el diff --git a/contrib/!lang/markdown/img/markdown.png b/layers/!lang/markdown/img/markdown.png similarity index 100% rename from contrib/!lang/markdown/img/markdown.png rename to layers/!lang/markdown/img/markdown.png diff --git a/contrib/!lang/markdown/packages.el b/layers/!lang/markdown/packages.el similarity index 100% rename from contrib/!lang/markdown/packages.el rename to layers/!lang/markdown/packages.el diff --git a/contrib/!lang/nim/README.org b/layers/!lang/nim/README.org similarity index 100% rename from contrib/!lang/nim/README.org rename to layers/!lang/nim/README.org diff --git a/contrib/!lang/nim/config.el b/layers/!lang/nim/config.el similarity index 100% rename from contrib/!lang/nim/config.el rename to layers/!lang/nim/config.el diff --git a/contrib/!lang/nim/extensions.el b/layers/!lang/nim/extensions.el similarity index 100% rename from contrib/!lang/nim/extensions.el rename to layers/!lang/nim/extensions.el diff --git a/contrib/!lang/nim/extensions/flycheck-nim/flycheck-nim.el b/layers/!lang/nim/extensions/flycheck-nim/flycheck-nim.el similarity index 100% rename from contrib/!lang/nim/extensions/flycheck-nim/flycheck-nim.el rename to layers/!lang/nim/extensions/flycheck-nim/flycheck-nim.el diff --git a/contrib/!lang/nim/img/logo.png b/layers/!lang/nim/img/logo.png similarity index 100% rename from contrib/!lang/nim/img/logo.png rename to layers/!lang/nim/img/logo.png diff --git a/contrib/!lang/nim/packages.el b/layers/!lang/nim/packages.el similarity index 100% rename from contrib/!lang/nim/packages.el rename to layers/!lang/nim/packages.el diff --git a/contrib/!lang/ocaml/README.org b/layers/!lang/ocaml/README.org similarity index 100% rename from contrib/!lang/ocaml/README.org rename to layers/!lang/ocaml/README.org diff --git a/contrib/!lang/ocaml/config.el b/layers/!lang/ocaml/config.el similarity index 100% rename from contrib/!lang/ocaml/config.el rename to layers/!lang/ocaml/config.el diff --git a/contrib/!lang/ocaml/funcs.el b/layers/!lang/ocaml/funcs.el similarity index 100% rename from contrib/!lang/ocaml/funcs.el rename to layers/!lang/ocaml/funcs.el diff --git a/contrib/!lang/ocaml/img/ocaml.png b/layers/!lang/ocaml/img/ocaml.png similarity index 100% rename from contrib/!lang/ocaml/img/ocaml.png rename to layers/!lang/ocaml/img/ocaml.png diff --git a/contrib/!lang/ocaml/packages.el b/layers/!lang/ocaml/packages.el similarity index 100% rename from contrib/!lang/ocaml/packages.el rename to layers/!lang/ocaml/packages.el diff --git a/contrib/!lang/php/README.org b/layers/!lang/php/README.org similarity index 100% rename from contrib/!lang/php/README.org rename to layers/!lang/php/README.org diff --git a/contrib/!lang/php/config.el b/layers/!lang/php/config.el similarity index 100% rename from contrib/!lang/php/config.el rename to layers/!lang/php/config.el diff --git a/contrib/!lang/php/img/php.png b/layers/!lang/php/img/php.png similarity index 100% rename from contrib/!lang/php/img/php.png rename to layers/!lang/php/img/php.png diff --git a/contrib/!lang/php/packages.el b/layers/!lang/php/packages.el similarity index 100% rename from contrib/!lang/php/packages.el rename to layers/!lang/php/packages.el diff --git a/contrib/!lang/purescript/README.org b/layers/!lang/purescript/README.org similarity index 100% rename from contrib/!lang/purescript/README.org rename to layers/!lang/purescript/README.org diff --git a/contrib/!lang/purescript/config.el b/layers/!lang/purescript/config.el similarity index 100% rename from contrib/!lang/purescript/config.el rename to layers/!lang/purescript/config.el diff --git a/contrib/!lang/purescript/img/purescript-logo.png b/layers/!lang/purescript/img/purescript-logo.png similarity index 100% rename from contrib/!lang/purescript/img/purescript-logo.png rename to layers/!lang/purescript/img/purescript-logo.png diff --git a/contrib/!lang/purescript/packages.el b/layers/!lang/purescript/packages.el similarity index 100% rename from contrib/!lang/purescript/packages.el rename to layers/!lang/purescript/packages.el diff --git a/contrib/!lang/python/README.org b/layers/!lang/python/README.org similarity index 100% rename from contrib/!lang/python/README.org rename to layers/!lang/python/README.org diff --git a/contrib/!lang/python/config.el b/layers/!lang/python/config.el similarity index 100% rename from contrib/!lang/python/config.el rename to layers/!lang/python/config.el diff --git a/contrib/!lang/python/extensions.el b/layers/!lang/python/extensions.el similarity index 100% rename from contrib/!lang/python/extensions.el rename to layers/!lang/python/extensions.el diff --git a/contrib/!lang/python/funcs.el b/layers/!lang/python/funcs.el similarity index 100% rename from contrib/!lang/python/funcs.el rename to layers/!lang/python/funcs.el diff --git a/contrib/!lang/python/img/python.png b/layers/!lang/python/img/python.png similarity index 100% rename from contrib/!lang/python/img/python.png rename to layers/!lang/python/img/python.png diff --git a/contrib/!lang/python/local/nose/README.md b/layers/!lang/python/local/nose/README.md similarity index 100% rename from contrib/!lang/python/local/nose/README.md rename to layers/!lang/python/local/nose/README.md diff --git a/contrib/!lang/python/local/nose/nose.el b/layers/!lang/python/local/nose/nose.el similarity index 100% rename from contrib/!lang/python/local/nose/nose.el rename to layers/!lang/python/local/nose/nose.el diff --git a/contrib/!lang/python/local/py-yapf/README.org b/layers/!lang/python/local/py-yapf/README.org similarity index 100% rename from contrib/!lang/python/local/py-yapf/README.org rename to layers/!lang/python/local/py-yapf/README.org diff --git a/contrib/!lang/python/local/py-yapf/py-yapf.el b/layers/!lang/python/local/py-yapf/py-yapf.el similarity index 100% rename from contrib/!lang/python/local/py-yapf/py-yapf.el rename to layers/!lang/python/local/py-yapf/py-yapf.el diff --git a/contrib/!lang/python/local/pylookup/.gitignore b/layers/!lang/python/local/pylookup/.gitignore similarity index 100% rename from contrib/!lang/python/local/pylookup/.gitignore rename to layers/!lang/python/local/pylookup/.gitignore diff --git a/contrib/!lang/python/local/pylookup/README.md b/layers/!lang/python/local/pylookup/README.md similarity index 100% rename from contrib/!lang/python/local/pylookup/README.md rename to layers/!lang/python/local/pylookup/README.md diff --git a/contrib/!lang/python/local/pylookup/makefile b/layers/!lang/python/local/pylookup/makefile similarity index 100% rename from contrib/!lang/python/local/pylookup/makefile rename to layers/!lang/python/local/pylookup/makefile diff --git a/contrib/!lang/python/local/pylookup/pylookup.el b/layers/!lang/python/local/pylookup/pylookup.el similarity index 100% rename from contrib/!lang/python/local/pylookup/pylookup.el rename to layers/!lang/python/local/pylookup/pylookup.el diff --git a/contrib/!lang/python/local/pylookup/pylookup.py b/layers/!lang/python/local/pylookup/pylookup.py similarity index 100% rename from contrib/!lang/python/local/pylookup/pylookup.py rename to layers/!lang/python/local/pylookup/pylookup.py diff --git a/contrib/!lang/python/packages.el b/layers/!lang/python/packages.el similarity index 100% rename from contrib/!lang/python/packages.el rename to layers/!lang/python/packages.el diff --git a/contrib/!lang/racket/README.org b/layers/!lang/racket/README.org similarity index 100% rename from contrib/!lang/racket/README.org rename to layers/!lang/racket/README.org diff --git a/contrib/!lang/racket/img/racket.png b/layers/!lang/racket/img/racket.png similarity index 100% rename from contrib/!lang/racket/img/racket.png rename to layers/!lang/racket/img/racket.png diff --git a/contrib/!lang/racket/packages.el b/layers/!lang/racket/packages.el similarity index 100% rename from contrib/!lang/racket/packages.el rename to layers/!lang/racket/packages.el diff --git a/contrib/!lang/ruby/README.org b/layers/!lang/ruby/README.org similarity index 100% rename from contrib/!lang/ruby/README.org rename to layers/!lang/ruby/README.org diff --git a/contrib/!lang/ruby/config.el b/layers/!lang/ruby/config.el similarity index 100% rename from contrib/!lang/ruby/config.el rename to layers/!lang/ruby/config.el diff --git a/contrib/!lang/ruby/img/ruby.png b/layers/!lang/ruby/img/ruby.png similarity index 100% rename from contrib/!lang/ruby/img/ruby.png rename to layers/!lang/ruby/img/ruby.png diff --git a/contrib/!lang/ruby/packages.el b/layers/!lang/ruby/packages.el similarity index 100% rename from contrib/!lang/ruby/packages.el rename to layers/!lang/ruby/packages.el diff --git a/contrib/!lang/rust/README.org b/layers/!lang/rust/README.org similarity index 100% rename from contrib/!lang/rust/README.org rename to layers/!lang/rust/README.org diff --git a/contrib/!lang/rust/config.el b/layers/!lang/rust/config.el similarity index 100% rename from contrib/!lang/rust/config.el rename to layers/!lang/rust/config.el diff --git a/contrib/!lang/rust/funcs.el b/layers/!lang/rust/funcs.el similarity index 100% rename from contrib/!lang/rust/funcs.el rename to layers/!lang/rust/funcs.el diff --git a/contrib/!lang/rust/img/rust.png b/layers/!lang/rust/img/rust.png similarity index 100% rename from contrib/!lang/rust/img/rust.png rename to layers/!lang/rust/img/rust.png diff --git a/contrib/!lang/rust/packages.el b/layers/!lang/rust/packages.el similarity index 100% rename from contrib/!lang/rust/packages.el rename to layers/!lang/rust/packages.el diff --git a/contrib/!lang/scala/README.org b/layers/!lang/scala/README.org similarity index 100% rename from contrib/!lang/scala/README.org rename to layers/!lang/scala/README.org diff --git a/contrib/!lang/scala/funcs.el b/layers/!lang/scala/funcs.el similarity index 100% rename from contrib/!lang/scala/funcs.el rename to layers/!lang/scala/funcs.el diff --git a/contrib/!lang/scala/img/ensime.png b/layers/!lang/scala/img/ensime.png similarity index 100% rename from contrib/!lang/scala/img/ensime.png rename to layers/!lang/scala/img/ensime.png diff --git a/contrib/!lang/scala/img/scala.png b/layers/!lang/scala/img/scala.png similarity index 100% rename from contrib/!lang/scala/img/scala.png rename to layers/!lang/scala/img/scala.png diff --git a/contrib/!lang/scala/packages.el b/layers/!lang/scala/packages.el similarity index 100% rename from contrib/!lang/scala/packages.el rename to layers/!lang/scala/packages.el diff --git a/contrib/!lang/scheme/README.org b/layers/!lang/scheme/README.org similarity index 100% rename from contrib/!lang/scheme/README.org rename to layers/!lang/scheme/README.org diff --git a/contrib/!lang/scheme/packages.el b/layers/!lang/scheme/packages.el similarity index 100% rename from contrib/!lang/scheme/packages.el rename to layers/!lang/scheme/packages.el diff --git a/contrib/!lang/shell-scripts/README.org b/layers/!lang/shell-scripts/README.org similarity index 100% rename from contrib/!lang/shell-scripts/README.org rename to layers/!lang/shell-scripts/README.org diff --git a/contrib/!lang/shell-scripts/img/fish.png b/layers/!lang/shell-scripts/img/fish.png similarity index 100% rename from contrib/!lang/shell-scripts/img/fish.png rename to layers/!lang/shell-scripts/img/fish.png diff --git a/contrib/!lang/shell-scripts/packages.el b/layers/!lang/shell-scripts/packages.el similarity index 100% rename from contrib/!lang/shell-scripts/packages.el rename to layers/!lang/shell-scripts/packages.el diff --git a/contrib/!lang/sml/README.org b/layers/!lang/sml/README.org similarity index 100% rename from contrib/!lang/sml/README.org rename to layers/!lang/sml/README.org diff --git a/contrib/!lang/sml/img/sml.png b/layers/!lang/sml/img/sml.png similarity index 100% rename from contrib/!lang/sml/img/sml.png rename to layers/!lang/sml/img/sml.png diff --git a/contrib/!lang/sml/packages.el b/layers/!lang/sml/packages.el similarity index 100% rename from contrib/!lang/sml/packages.el rename to layers/!lang/sml/packages.el diff --git a/contrib/!lang/sql/README.org b/layers/!lang/sql/README.org similarity index 100% rename from contrib/!lang/sql/README.org rename to layers/!lang/sql/README.org diff --git a/contrib/!lang/sql/extensions.el b/layers/!lang/sql/extensions.el similarity index 100% rename from contrib/!lang/sql/extensions.el rename to layers/!lang/sql/extensions.el diff --git a/contrib/!lang/sql/img/sql.png b/layers/!lang/sql/img/sql.png similarity index 100% rename from contrib/!lang/sql/img/sql.png rename to layers/!lang/sql/img/sql.png diff --git a/contrib/!lang/sql/packages.el b/layers/!lang/sql/packages.el similarity index 100% rename from contrib/!lang/sql/packages.el rename to layers/!lang/sql/packages.el diff --git a/contrib/!lang/typescript/README.org b/layers/!lang/typescript/README.org similarity index 100% rename from contrib/!lang/typescript/README.org rename to layers/!lang/typescript/README.org diff --git a/contrib/!lang/typescript/img/TypeScript.png b/layers/!lang/typescript/img/TypeScript.png similarity index 100% rename from contrib/!lang/typescript/img/TypeScript.png rename to layers/!lang/typescript/img/TypeScript.png diff --git a/contrib/!lang/typescript/packages.el b/layers/!lang/typescript/packages.el similarity index 100% rename from contrib/!lang/typescript/packages.el rename to layers/!lang/typescript/packages.el diff --git a/contrib/!lang/windows-scripts/README.org b/layers/!lang/windows-scripts/README.org similarity index 100% rename from contrib/!lang/windows-scripts/README.org rename to layers/!lang/windows-scripts/README.org diff --git a/contrib/!lang/windows-scripts/extensions.el b/layers/!lang/windows-scripts/extensions.el similarity index 100% rename from contrib/!lang/windows-scripts/extensions.el rename to layers/!lang/windows-scripts/extensions.el diff --git a/contrib/!lang/windows-scripts/extensions/dos/dos.el b/layers/!lang/windows-scripts/extensions/dos/dos.el similarity index 100% rename from contrib/!lang/windows-scripts/extensions/dos/dos.el rename to layers/!lang/windows-scripts/extensions/dos/dos.el diff --git a/contrib/!lang/windows-scripts/img/ps.png b/layers/!lang/windows-scripts/img/ps.png similarity index 100% rename from contrib/!lang/windows-scripts/img/ps.png rename to layers/!lang/windows-scripts/img/ps.png diff --git a/contrib/!lang/windows-scripts/packages.el b/layers/!lang/windows-scripts/packages.el similarity index 100% rename from contrib/!lang/windows-scripts/packages.el rename to layers/!lang/windows-scripts/packages.el diff --git a/contrib/!lang/yaml/README.org b/layers/!lang/yaml/README.org similarity index 100% rename from contrib/!lang/yaml/README.org rename to layers/!lang/yaml/README.org diff --git a/contrib/!lang/yaml/packages.el b/layers/!lang/yaml/packages.el similarity index 100% rename from contrib/!lang/yaml/packages.el rename to layers/!lang/yaml/packages.el diff --git a/contrib/!source-control/git/README.org b/layers/!source-control/git/README.org similarity index 100% rename from contrib/!source-control/git/README.org rename to layers/!source-control/git/README.org diff --git a/contrib/!source-control/git/config.el b/layers/!source-control/git/config.el similarity index 100% rename from contrib/!source-control/git/config.el rename to layers/!source-control/git/config.el diff --git a/contrib/!source-control/git/img/git.png b/layers/!source-control/git/img/git.png similarity index 100% rename from contrib/!source-control/git/img/git.png rename to layers/!source-control/git/img/git.png diff --git a/contrib/!source-control/git/packages.el b/layers/!source-control/git/packages.el similarity index 100% rename from contrib/!source-control/git/packages.el rename to layers/!source-control/git/packages.el diff --git a/contrib/!source-control/github/README.org b/layers/!source-control/github/README.org similarity index 100% rename from contrib/!source-control/github/README.org rename to layers/!source-control/github/README.org diff --git a/contrib/!source-control/github/config.el b/layers/!source-control/github/config.el similarity index 100% rename from contrib/!source-control/github/config.el rename to layers/!source-control/github/config.el diff --git a/contrib/!source-control/github/img/github.png b/layers/!source-control/github/img/github.png similarity index 100% rename from contrib/!source-control/github/img/github.png rename to layers/!source-control/github/img/github.png diff --git a/contrib/!source-control/github/packages.el b/layers/!source-control/github/packages.el similarity index 100% rename from contrib/!source-control/github/packages.el rename to layers/!source-control/github/packages.el diff --git a/contrib/!source-control/perforce/README.org b/layers/!source-control/perforce/README.org similarity index 100% rename from contrib/!source-control/perforce/README.org rename to layers/!source-control/perforce/README.org diff --git a/contrib/!source-control/perforce/config.el b/layers/!source-control/perforce/config.el similarity index 100% rename from contrib/!source-control/perforce/config.el rename to layers/!source-control/perforce/config.el diff --git a/contrib/!source-control/perforce/img/p4.png b/layers/!source-control/perforce/img/p4.png similarity index 100% rename from contrib/!source-control/perforce/img/p4.png rename to layers/!source-control/perforce/img/p4.png diff --git a/contrib/!source-control/perforce/packages.el b/layers/!source-control/perforce/packages.el similarity index 100% rename from contrib/!source-control/perforce/packages.el rename to layers/!source-control/perforce/packages.el diff --git a/contrib/!source-control/version-control/README.org b/layers/!source-control/version-control/README.org similarity index 100% rename from contrib/!source-control/version-control/README.org rename to layers/!source-control/version-control/README.org diff --git a/contrib/!source-control/version-control/packages.el b/layers/!source-control/version-control/packages.el similarity index 100% rename from contrib/!source-control/version-control/packages.el rename to layers/!source-control/version-control/packages.el diff --git a/contrib/!tools/dash/README.org b/layers/!tools/dash/README.org similarity index 100% rename from contrib/!tools/dash/README.org rename to layers/!tools/dash/README.org diff --git a/contrib/!tools/dash/config.el b/layers/!tools/dash/config.el similarity index 100% rename from contrib/!tools/dash/config.el rename to layers/!tools/dash/config.el diff --git a/contrib/!tools/dash/img/dash.png b/layers/!tools/dash/img/dash.png similarity index 100% rename from contrib/!tools/dash/img/dash.png rename to layers/!tools/dash/img/dash.png diff --git a/contrib/!tools/dash/img/zeal.png b/layers/!tools/dash/img/zeal.png similarity index 100% rename from contrib/!tools/dash/img/zeal.png rename to layers/!tools/dash/img/zeal.png diff --git a/contrib/!tools/dash/packages.el b/layers/!tools/dash/packages.el similarity index 100% rename from contrib/!tools/dash/packages.el rename to layers/!tools/dash/packages.el diff --git a/contrib/!tools/evernote/README.org b/layers/!tools/evernote/README.org similarity index 100% rename from contrib/!tools/evernote/README.org rename to layers/!tools/evernote/README.org diff --git a/contrib/!tools/evernote/config.el b/layers/!tools/evernote/config.el similarity index 100% rename from contrib/!tools/evernote/config.el rename to layers/!tools/evernote/config.el diff --git a/contrib/!tools/evernote/img/evernote.png b/layers/!tools/evernote/img/evernote.png similarity index 100% rename from contrib/!tools/evernote/img/evernote.png rename to layers/!tools/evernote/img/evernote.png diff --git a/contrib/!tools/evernote/img/geeknote.png b/layers/!tools/evernote/img/geeknote.png similarity index 100% rename from contrib/!tools/evernote/img/geeknote.png rename to layers/!tools/evernote/img/geeknote.png diff --git a/contrib/!tools/evernote/packages.el b/layers/!tools/evernote/packages.el similarity index 100% rename from contrib/!tools/evernote/packages.el rename to layers/!tools/evernote/packages.el diff --git a/contrib/!tools/fasd/README.org b/layers/!tools/fasd/README.org similarity index 100% rename from contrib/!tools/fasd/README.org rename to layers/!tools/fasd/README.org diff --git a/contrib/!tools/fasd/packages.el b/layers/!tools/fasd/packages.el similarity index 100% rename from contrib/!tools/fasd/packages.el rename to layers/!tools/fasd/packages.el diff --git a/contrib/!tools/pandoc/README.org b/layers/!tools/pandoc/README.org similarity index 100% rename from contrib/!tools/pandoc/README.org rename to layers/!tools/pandoc/README.org diff --git a/contrib/!tools/pandoc/packages.el b/layers/!tools/pandoc/packages.el similarity index 100% rename from contrib/!tools/pandoc/packages.el rename to layers/!tools/pandoc/packages.el diff --git a/contrib/!tools/ranger/README.org b/layers/!tools/ranger/README.org similarity index 100% rename from contrib/!tools/ranger/README.org rename to layers/!tools/ranger/README.org diff --git a/contrib/!tools/ranger/packages.el b/layers/!tools/ranger/packages.el similarity index 100% rename from contrib/!tools/ranger/packages.el rename to layers/!tools/ranger/packages.el diff --git a/contrib/!tools/tmux/README.org b/layers/!tools/tmux/README.org similarity index 100% rename from contrib/!tools/tmux/README.org rename to layers/!tools/tmux/README.org diff --git a/contrib/!tools/tmux/extensions.el b/layers/!tools/tmux/extensions.el similarity index 100% rename from contrib/!tools/tmux/extensions.el rename to layers/!tools/tmux/extensions.el diff --git a/contrib/!tools/tmux/extensions/tmux/tmux.el b/layers/!tools/tmux/extensions/tmux/tmux.el similarity index 100% rename from contrib/!tools/tmux/extensions/tmux/tmux.el rename to layers/!tools/tmux/extensions/tmux/tmux.el diff --git a/contrib/!tools/vagrant/README.org b/layers/!tools/vagrant/README.org similarity index 100% rename from contrib/!tools/vagrant/README.org rename to layers/!tools/vagrant/README.org diff --git a/contrib/!tools/vagrant/Vagrantfile b/layers/!tools/vagrant/Vagrantfile similarity index 100% rename from contrib/!tools/vagrant/Vagrantfile rename to layers/!tools/vagrant/Vagrantfile diff --git a/contrib/!tools/vagrant/img/vagrant.png b/layers/!tools/vagrant/img/vagrant.png similarity index 100% rename from contrib/!tools/vagrant/img/vagrant.png rename to layers/!tools/vagrant/img/vagrant.png diff --git a/contrib/!tools/vagrant/packages.el b/layers/!tools/vagrant/packages.el similarity index 100% rename from contrib/!tools/vagrant/packages.el rename to layers/!tools/vagrant/packages.el diff --git a/contrib/!tools/wakatime/README.org b/layers/!tools/wakatime/README.org similarity index 100% rename from contrib/!tools/wakatime/README.org rename to layers/!tools/wakatime/README.org diff --git a/contrib/!tools/wakatime/img/wakatime.png b/layers/!tools/wakatime/img/wakatime.png similarity index 100% rename from contrib/!tools/wakatime/img/wakatime.png rename to layers/!tools/wakatime/img/wakatime.png diff --git a/contrib/!tools/wakatime/packages.el b/layers/!tools/wakatime/packages.el similarity index 100% rename from contrib/!tools/wakatime/packages.el rename to layers/!tools/wakatime/packages.el diff --git a/contrib/!tools/ycmd/README.org b/layers/!tools/ycmd/README.org similarity index 100% rename from contrib/!tools/ycmd/README.org rename to layers/!tools/ycmd/README.org diff --git a/contrib/!tools/ycmd/global_conf.py b/layers/!tools/ycmd/global_conf.py similarity index 100% rename from contrib/!tools/ycmd/global_conf.py rename to layers/!tools/ycmd/global_conf.py diff --git a/contrib/!tools/ycmd/packages.el b/layers/!tools/ycmd/packages.el similarity index 100% rename from contrib/!tools/ycmd/packages.el rename to layers/!tools/ycmd/packages.el diff --git a/contrib/!vim/evil-commentary/README.org b/layers/!vim/evil-commentary/README.org similarity index 100% rename from contrib/!vim/evil-commentary/README.org rename to layers/!vim/evil-commentary/README.org diff --git a/contrib/!vim/evil-commentary/packages.el b/layers/!vim/evil-commentary/packages.el similarity index 100% rename from contrib/!vim/evil-commentary/packages.el rename to layers/!vim/evil-commentary/packages.el diff --git a/contrib/!vim/evil-snipe/README.org b/layers/!vim/evil-snipe/README.org similarity index 100% rename from contrib/!vim/evil-snipe/README.org rename to layers/!vim/evil-snipe/README.org diff --git a/contrib/!vim/evil-snipe/config.el b/layers/!vim/evil-snipe/config.el similarity index 100% rename from contrib/!vim/evil-snipe/config.el rename to layers/!vim/evil-snipe/config.el diff --git a/contrib/!vim/evil-snipe/img/Cat_With_Rifle.jpg b/layers/!vim/evil-snipe/img/Cat_With_Rifle.jpg similarity index 100% rename from contrib/!vim/evil-snipe/img/Cat_With_Rifle.jpg rename to layers/!vim/evil-snipe/img/Cat_With_Rifle.jpg diff --git a/contrib/!vim/evil-snipe/packages.el b/layers/!vim/evil-snipe/packages.el similarity index 100% rename from contrib/!vim/evil-snipe/packages.el rename to layers/!vim/evil-snipe/packages.el diff --git a/contrib/!vim/unimpaired/README.org b/layers/!vim/unimpaired/README.org similarity index 100% rename from contrib/!vim/unimpaired/README.org rename to layers/!vim/unimpaired/README.org diff --git a/contrib/!vim/unimpaired/funcs.el b/layers/!vim/unimpaired/funcs.el similarity index 100% rename from contrib/!vim/unimpaired/funcs.el rename to layers/!vim/unimpaired/funcs.el diff --git a/contrib/!vim/unimpaired/keybindings.el b/layers/!vim/unimpaired/keybindings.el similarity index 100% rename from contrib/!vim/unimpaired/keybindings.el rename to layers/!vim/unimpaired/keybindings.el diff --git a/contrib/!vim/vim-empty-lines/README.org b/layers/!vim/vim-empty-lines/README.org similarity index 100% rename from contrib/!vim/vim-empty-lines/README.org rename to layers/!vim/vim-empty-lines/README.org diff --git a/contrib/!vim/vim-empty-lines/extensions.el b/layers/!vim/vim-empty-lines/extensions.el similarity index 100% rename from contrib/!vim/vim-empty-lines/extensions.el rename to layers/!vim/vim-empty-lines/extensions.el diff --git a/contrib/!vim/vim-empty-lines/extensions/vim-empty-lines-mode/vim-empty-lines-mode.el b/layers/!vim/vim-empty-lines/extensions/vim-empty-lines-mode/vim-empty-lines-mode.el similarity index 100% rename from contrib/!vim/vim-empty-lines/extensions/vim-empty-lines-mode/vim-empty-lines-mode.el rename to layers/!vim/vim-empty-lines/extensions/vim-empty-lines-mode/vim-empty-lines-mode.el diff --git a/contrib/!vim/vim-empty-lines/packages.el b/layers/!vim/vim-empty-lines/packages.el similarity index 100% rename from contrib/!vim/vim-empty-lines/packages.el rename to layers/!vim/vim-empty-lines/packages.el diff --git a/contrib/!vim/vim-powerline/extensions.el b/layers/!vim/vim-powerline/extensions.el similarity index 100% rename from contrib/!vim/vim-powerline/extensions.el rename to layers/!vim/vim-powerline/extensions.el diff --git a/contrib/!vim/vim-powerline/extensions/vim-powerline/README.md b/layers/!vim/vim-powerline/extensions/vim-powerline/README.md similarity index 100% rename from contrib/!vim/vim-powerline/extensions/vim-powerline/README.md rename to layers/!vim/vim-powerline/extensions/vim-powerline/README.md diff --git a/contrib/!vim/vim-powerline/extensions/vim-powerline/powerline-separators.el b/layers/!vim/vim-powerline/extensions/vim-powerline/powerline-separators.el similarity index 100% rename from contrib/!vim/vim-powerline/extensions/vim-powerline/powerline-separators.el rename to layers/!vim/vim-powerline/extensions/vim-powerline/powerline-separators.el diff --git a/contrib/!vim/vim-powerline/extensions/vim-powerline/powerline-themes.el b/layers/!vim/vim-powerline/extensions/vim-powerline/powerline-themes.el similarity index 100% rename from contrib/!vim/vim-powerline/extensions/vim-powerline/powerline-themes.el rename to layers/!vim/vim-powerline/extensions/vim-powerline/powerline-themes.el diff --git a/contrib/!vim/vim-powerline/extensions/vim-powerline/powerline.el b/layers/!vim/vim-powerline/extensions/vim-powerline/powerline.el similarity index 100% rename from contrib/!vim/vim-powerline/extensions/vim-powerline/powerline.el rename to layers/!vim/vim-powerline/extensions/vim-powerline/powerline.el diff --git a/contrib/!vim/vim-powerline/extensions/vim-powerline/vim-colors.el b/layers/!vim/vim-powerline/extensions/vim-powerline/vim-colors.el similarity index 100% rename from contrib/!vim/vim-powerline/extensions/vim-powerline/vim-colors.el rename to layers/!vim/vim-powerline/extensions/vim-powerline/vim-colors.el diff --git a/contrib/!vim/vim-powerline/packages.el b/layers/!vim/vim-powerline/packages.el similarity index 100% rename from contrib/!vim/vim-powerline/packages.el rename to layers/!vim/vim-powerline/packages.el diff --git a/contrib/!vim/vinegar/README.org b/layers/!vim/vinegar/README.org similarity index 100% rename from contrib/!vim/vinegar/README.org rename to layers/!vim/vinegar/README.org diff --git a/contrib/!vim/vinegar/config.el b/layers/!vim/vinegar/config.el similarity index 100% rename from contrib/!vim/vinegar/config.el rename to layers/!vim/vinegar/config.el diff --git a/contrib/!vim/vinegar/funcs.el b/layers/!vim/vinegar/funcs.el similarity index 100% rename from contrib/!vim/vinegar/funcs.el rename to layers/!vim/vinegar/funcs.el diff --git a/contrib/!vim/vinegar/keybindings.el b/layers/!vim/vinegar/keybindings.el similarity index 100% rename from contrib/!vim/vinegar/keybindings.el rename to layers/!vim/vinegar/keybindings.el diff --git a/contrib/!vim/vinegar/packages.el b/layers/!vim/vinegar/packages.el similarity index 100% rename from contrib/!vim/vinegar/packages.el rename to layers/!vim/vinegar/packages.el diff --git a/contrib/!window-management/eyebrowse/README.org b/layers/!window-management/eyebrowse/README.org similarity index 100% rename from contrib/!window-management/eyebrowse/README.org rename to layers/!window-management/eyebrowse/README.org diff --git a/contrib/!window-management/eyebrowse/config.el b/layers/!window-management/eyebrowse/config.el similarity index 100% rename from contrib/!window-management/eyebrowse/config.el rename to layers/!window-management/eyebrowse/config.el diff --git a/contrib/!window-management/eyebrowse/img/eyebrowse.gif b/layers/!window-management/eyebrowse/img/eyebrowse.gif similarity index 100% rename from contrib/!window-management/eyebrowse/img/eyebrowse.gif rename to layers/!window-management/eyebrowse/img/eyebrowse.gif diff --git a/contrib/!window-management/eyebrowse/img/i3wm.png b/layers/!window-management/eyebrowse/img/i3wm.png similarity index 100% rename from contrib/!window-management/eyebrowse/img/i3wm.png rename to layers/!window-management/eyebrowse/img/i3wm.png diff --git a/contrib/!window-management/eyebrowse/packages.el b/layers/!window-management/eyebrowse/packages.el similarity index 100% rename from contrib/!window-management/eyebrowse/packages.el rename to layers/!window-management/eyebrowse/packages.el diff --git a/contrib/!window-management/perspectives/README.org b/layers/!window-management/perspectives/README.org similarity index 100% rename from contrib/!window-management/perspectives/README.org rename to layers/!window-management/perspectives/README.org diff --git a/contrib/!window-management/perspectives/config.el b/layers/!window-management/perspectives/config.el similarity index 100% rename from contrib/!window-management/perspectives/config.el rename to layers/!window-management/perspectives/config.el diff --git a/contrib/!window-management/perspectives/packages.el b/layers/!window-management/perspectives/packages.el similarity index 100% rename from contrib/!window-management/perspectives/packages.el rename to layers/!window-management/perspectives/packages.el diff --git a/contrib/auto-completion/README.org b/layers/auto-completion/README.org similarity index 100% rename from contrib/auto-completion/README.org rename to layers/auto-completion/README.org diff --git a/contrib/auto-completion/config.el b/layers/auto-completion/config.el similarity index 100% rename from contrib/auto-completion/config.el rename to layers/auto-completion/config.el diff --git a/contrib/auto-completion/funcs.el b/layers/auto-completion/funcs.el similarity index 100% rename from contrib/auto-completion/funcs.el rename to layers/auto-completion/funcs.el diff --git a/contrib/auto-completion/packages.el b/layers/auto-completion/packages.el similarity index 100% rename from contrib/auto-completion/packages.el rename to layers/auto-completion/packages.el diff --git a/contrib/auto-completion/snippets/emacs-lisp-mode/.yas-parents b/layers/auto-completion/snippets/emacs-lisp-mode/.yas-parents similarity index 100% rename from contrib/auto-completion/snippets/emacs-lisp-mode/.yas-parents rename to layers/auto-completion/snippets/emacs-lisp-mode/.yas-parents diff --git a/contrib/auto-completion/snippets/emacs-lisp-mode/.yas-setup.el b/layers/auto-completion/snippets/emacs-lisp-mode/.yas-setup.el similarity index 100% rename from contrib/auto-completion/snippets/emacs-lisp-mode/.yas-setup.el rename to layers/auto-completion/snippets/emacs-lisp-mode/.yas-setup.el diff --git a/contrib/auto-completion/snippets/emacs-lisp-mode/micro-state b/layers/auto-completion/snippets/emacs-lisp-mode/micro-state similarity index 100% rename from contrib/auto-completion/snippets/emacs-lisp-mode/micro-state rename to layers/auto-completion/snippets/emacs-lisp-mode/micro-state diff --git a/contrib/auto-completion/snippets/emacs-lisp-mode/new-package b/layers/auto-completion/snippets/emacs-lisp-mode/new-package similarity index 100% rename from contrib/auto-completion/snippets/emacs-lisp-mode/new-package rename to layers/auto-completion/snippets/emacs-lisp-mode/new-package diff --git a/contrib/better-defaults/README.org b/layers/better-defaults/README.org similarity index 100% rename from contrib/better-defaults/README.org rename to layers/better-defaults/README.org diff --git a/contrib/better-defaults/funcs.el b/layers/better-defaults/funcs.el similarity index 100% rename from contrib/better-defaults/funcs.el rename to layers/better-defaults/funcs.el diff --git a/contrib/better-defaults/img/emacs.png b/layers/better-defaults/img/emacs.png similarity index 100% rename from contrib/better-defaults/img/emacs.png rename to layers/better-defaults/img/emacs.png diff --git a/contrib/better-defaults/keybindings.el b/layers/better-defaults/keybindings.el similarity index 100% rename from contrib/better-defaults/keybindings.el rename to layers/better-defaults/keybindings.el diff --git a/contrib/chinese/README.org b/layers/chinese/README.org similarity index 100% rename from contrib/chinese/README.org rename to layers/chinese/README.org diff --git a/contrib/chinese/config.el b/layers/chinese/config.el similarity index 100% rename from contrib/chinese/config.el rename to layers/chinese/config.el diff --git a/contrib/chinese/img/China.png b/layers/chinese/img/China.png similarity index 100% rename from contrib/chinese/img/China.png rename to layers/chinese/img/China.png diff --git a/contrib/chinese/img/Chinese.png b/layers/chinese/img/Chinese.png similarity index 100% rename from contrib/chinese/img/Chinese.png rename to layers/chinese/img/Chinese.png diff --git a/contrib/chinese/packages.el b/layers/chinese/packages.el similarity index 100% rename from contrib/chinese/packages.el rename to layers/chinese/packages.el diff --git a/contrib/chrome/README.org b/layers/chrome/README.org similarity index 100% rename from contrib/chrome/README.org rename to layers/chrome/README.org diff --git a/contrib/chrome/img/chrome.png b/layers/chrome/img/chrome.png similarity index 100% rename from contrib/chrome/img/chrome.png rename to layers/chrome/img/chrome.png diff --git a/contrib/chrome/packages.el b/layers/chrome/packages.el similarity index 100% rename from contrib/chrome/packages.el rename to layers/chrome/packages.el diff --git a/contrib/colors/README.org b/layers/colors/README.org similarity index 100% rename from contrib/colors/README.org rename to layers/colors/README.org diff --git a/contrib/colors/config.el b/layers/colors/config.el similarity index 100% rename from contrib/colors/config.el rename to layers/colors/config.el diff --git a/contrib/colors/extensions.el b/layers/colors/extensions.el similarity index 100% rename from contrib/colors/extensions.el rename to layers/colors/extensions.el diff --git a/contrib/colors/extensions/nyan-mode/README.org b/layers/colors/extensions/nyan-mode/README.org similarity index 100% rename from contrib/colors/extensions/nyan-mode/README.org rename to layers/colors/extensions/nyan-mode/README.org diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-1.xpm b/layers/colors/extensions/nyan-mode/img/nyan-frame-1.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/nyan-frame-1.xpm rename to layers/colors/extensions/nyan-mode/img/nyan-frame-1.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-2.xpm b/layers/colors/extensions/nyan-mode/img/nyan-frame-2.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/nyan-frame-2.xpm rename to layers/colors/extensions/nyan-mode/img/nyan-frame-2.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-3.xpm b/layers/colors/extensions/nyan-mode/img/nyan-frame-3.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/nyan-frame-3.xpm rename to layers/colors/extensions/nyan-mode/img/nyan-frame-3.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-4.xpm b/layers/colors/extensions/nyan-mode/img/nyan-frame-4.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/nyan-frame-4.xpm rename to layers/colors/extensions/nyan-mode/img/nyan-frame-4.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-5.xpm b/layers/colors/extensions/nyan-mode/img/nyan-frame-5.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/nyan-frame-5.xpm rename to layers/colors/extensions/nyan-mode/img/nyan-frame-5.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-6.xpm b/layers/colors/extensions/nyan-mode/img/nyan-frame-6.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/nyan-frame-6.xpm rename to layers/colors/extensions/nyan-mode/img/nyan-frame-6.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-start.xpm b/layers/colors/extensions/nyan-mode/img/nyan-start.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/nyan-start.xpm rename to layers/colors/extensions/nyan-mode/img/nyan-start.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/nyan.xpm b/layers/colors/extensions/nyan-mode/img/nyan.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/nyan.xpm rename to layers/colors/extensions/nyan-mode/img/nyan.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/outerspace.xpm b/layers/colors/extensions/nyan-mode/img/outerspace.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/outerspace.xpm rename to layers/colors/extensions/nyan-mode/img/outerspace.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/rainbow-start.xpm b/layers/colors/extensions/nyan-mode/img/rainbow-start.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/rainbow-start.xpm rename to layers/colors/extensions/nyan-mode/img/rainbow-start.xpm diff --git a/contrib/colors/extensions/nyan-mode/img/rainbow.xpm b/layers/colors/extensions/nyan-mode/img/rainbow.xpm similarity index 100% rename from contrib/colors/extensions/nyan-mode/img/rainbow.xpm rename to layers/colors/extensions/nyan-mode/img/rainbow.xpm diff --git a/contrib/colors/extensions/nyan-mode/mus/nyanlooped.mp3 b/layers/colors/extensions/nyan-mode/mus/nyanlooped.mp3 similarity index 100% rename from contrib/colors/extensions/nyan-mode/mus/nyanlooped.mp3 rename to layers/colors/extensions/nyan-mode/mus/nyanlooped.mp3 diff --git a/contrib/colors/extensions/nyan-mode/nyan-mode.el b/layers/colors/extensions/nyan-mode/nyan-mode.el similarity index 100% rename from contrib/colors/extensions/nyan-mode/nyan-mode.el rename to layers/colors/extensions/nyan-mode/nyan-mode.el diff --git a/contrib/colors/img/rainbow-mode.png b/layers/colors/img/rainbow-mode.png similarity index 100% rename from contrib/colors/img/rainbow-mode.png rename to layers/colors/img/rainbow-mode.png diff --git a/contrib/colors/img/rainbow_dash.png b/layers/colors/img/rainbow_dash.png similarity index 100% rename from contrib/colors/img/rainbow_dash.png rename to layers/colors/img/rainbow_dash.png diff --git a/contrib/colors/img/theme-tweaks-python.png b/layers/colors/img/theme-tweaks-python.png similarity index 100% rename from contrib/colors/img/theme-tweaks-python.png rename to layers/colors/img/theme-tweaks-python.png diff --git a/contrib/colors/packages.el b/layers/colors/packages.el similarity index 100% rename from contrib/colors/packages.el rename to layers/colors/packages.el diff --git a/contrib/cscope/README.org b/layers/cscope/README.org similarity index 100% rename from contrib/cscope/README.org rename to layers/cscope/README.org diff --git a/contrib/cscope/img/cscope.jpg b/layers/cscope/img/cscope.jpg similarity index 100% rename from contrib/cscope/img/cscope.jpg rename to layers/cscope/img/cscope.jpg diff --git a/contrib/cscope/packages.el b/layers/cscope/packages.el similarity index 100% rename from contrib/cscope/packages.el rename to layers/cscope/packages.el diff --git a/contrib/deft/README.org b/layers/deft/README.org similarity index 100% rename from contrib/deft/README.org rename to layers/deft/README.org diff --git a/contrib/deft/packages.el b/layers/deft/packages.el similarity index 100% rename from contrib/deft/packages.el rename to layers/deft/packages.el diff --git a/contrib/finance/README.org b/layers/finance/README.org similarity index 100% rename from contrib/finance/README.org rename to layers/finance/README.org diff --git a/contrib/finance/config.el b/layers/finance/config.el similarity index 100% rename from contrib/finance/config.el rename to layers/finance/config.el diff --git a/contrib/finance/img/ledger.png b/layers/finance/img/ledger.png similarity index 100% rename from contrib/finance/img/ledger.png rename to layers/finance/img/ledger.png diff --git a/contrib/finance/packages.el b/layers/finance/packages.el similarity index 100% rename from contrib/finance/packages.el rename to layers/finance/packages.el diff --git a/contrib/floobits/README.org b/layers/floobits/README.org similarity index 100% rename from contrib/floobits/README.org rename to layers/floobits/README.org diff --git a/contrib/floobits/img/floobits.png b/layers/floobits/img/floobits.png similarity index 100% rename from contrib/floobits/img/floobits.png rename to layers/floobits/img/floobits.png diff --git a/contrib/floobits/packages.el b/layers/floobits/packages.el similarity index 100% rename from contrib/floobits/packages.el rename to layers/floobits/packages.el diff --git a/contrib/gtags/README.org b/layers/gtags/README.org similarity index 100% rename from contrib/gtags/README.org rename to layers/gtags/README.org diff --git a/contrib/gtags/extensions.el b/layers/gtags/extensions.el similarity index 100% rename from contrib/gtags/extensions.el rename to layers/gtags/extensions.el diff --git a/contrib/gtags/funcs.el b/layers/gtags/funcs.el similarity index 100% rename from contrib/gtags/funcs.el rename to layers/gtags/funcs.el diff --git a/contrib/gtags/packages.el b/layers/gtags/packages.el similarity index 100% rename from contrib/gtags/packages.el rename to layers/gtags/packages.el diff --git a/contrib/ibuffer/README.org b/layers/ibuffer/README.org similarity index 100% rename from contrib/ibuffer/README.org rename to layers/ibuffer/README.org diff --git a/contrib/ibuffer/config.el b/layers/ibuffer/config.el similarity index 100% rename from contrib/ibuffer/config.el rename to layers/ibuffer/config.el diff --git a/contrib/ibuffer/funcs.el b/layers/ibuffer/funcs.el similarity index 100% rename from contrib/ibuffer/funcs.el rename to layers/ibuffer/funcs.el diff --git a/contrib/ibuffer/packages.el b/layers/ibuffer/packages.el similarity index 100% rename from contrib/ibuffer/packages.el rename to layers/ibuffer/packages.el diff --git a/contrib/jabber/README.org b/layers/jabber/README.org similarity index 100% rename from contrib/jabber/README.org rename to layers/jabber/README.org diff --git a/contrib/jabber/img/attribution.md b/layers/jabber/img/attribution.md similarity index 100% rename from contrib/jabber/img/attribution.md rename to layers/jabber/img/attribution.md diff --git a/contrib/jabber/img/jabber-logo.gif b/layers/jabber/img/jabber-logo.gif similarity index 100% rename from contrib/jabber/img/jabber-logo.gif rename to layers/jabber/img/jabber-logo.gif diff --git a/contrib/jabber/packages.el b/layers/jabber/packages.el similarity index 100% rename from contrib/jabber/packages.el rename to layers/jabber/packages.el diff --git a/contrib/nixos/README.org b/layers/nixos/README.org similarity index 100% rename from contrib/nixos/README.org rename to layers/nixos/README.org diff --git a/contrib/nixos/config.el b/layers/nixos/config.el similarity index 100% rename from contrib/nixos/config.el rename to layers/nixos/config.el diff --git a/contrib/nixos/img/nixos.jpg b/layers/nixos/img/nixos.jpg similarity index 100% rename from contrib/nixos/img/nixos.jpg rename to layers/nixos/img/nixos.jpg diff --git a/contrib/nixos/packages.el b/layers/nixos/packages.el similarity index 100% rename from contrib/nixos/packages.el rename to layers/nixos/packages.el diff --git a/contrib/org/README.org b/layers/org/README.org similarity index 100% rename from contrib/org/README.org rename to layers/org/README.org diff --git a/contrib/org/config.el b/layers/org/config.el similarity index 100% rename from contrib/org/config.el rename to layers/org/config.el diff --git a/contrib/org/extensions.el b/layers/org/extensions.el similarity index 100% rename from contrib/org/extensions.el rename to layers/org/extensions.el diff --git a/contrib/org/extensions/ox-gfm/ox-gfm.el b/layers/org/extensions/ox-gfm/ox-gfm.el similarity index 100% rename from contrib/org/extensions/ox-gfm/ox-gfm.el rename to layers/org/extensions/ox-gfm/ox-gfm.el diff --git a/contrib/org/img/org.png b/layers/org/img/org.png similarity index 100% rename from contrib/org/img/org.png rename to layers/org/img/org.png diff --git a/contrib/org/org-async-init.el b/layers/org/org-async-init.el similarity index 100% rename from contrib/org/org-async-init.el rename to layers/org/org-async-init.el diff --git a/contrib/org/packages.el b/layers/org/packages.el similarity index 100% rename from contrib/org/packages.el rename to layers/org/packages.el diff --git a/contrib/osx/README.org b/layers/osx/README.org similarity index 100% rename from contrib/osx/README.org rename to layers/osx/README.org diff --git a/contrib/osx/config.el b/layers/osx/config.el similarity index 100% rename from contrib/osx/config.el rename to layers/osx/config.el diff --git a/contrib/osx/img/apple.png b/layers/osx/img/apple.png similarity index 100% rename from contrib/osx/img/apple.png rename to layers/osx/img/apple.png diff --git a/contrib/osx/img/osx.png b/layers/osx/img/osx.png similarity index 100% rename from contrib/osx/img/osx.png rename to layers/osx/img/osx.png diff --git a/contrib/osx/keybindings.el b/layers/osx/keybindings.el similarity index 100% rename from contrib/osx/keybindings.el rename to layers/osx/keybindings.el diff --git a/contrib/osx/packages.el b/layers/osx/packages.el similarity index 100% rename from contrib/osx/packages.el rename to layers/osx/packages.el diff --git a/contrib/prodigy/README.org b/layers/prodigy/README.org similarity index 100% rename from contrib/prodigy/README.org rename to layers/prodigy/README.org diff --git a/contrib/prodigy/img/prodigy.png b/layers/prodigy/img/prodigy.png similarity index 100% rename from contrib/prodigy/img/prodigy.png rename to layers/prodigy/img/prodigy.png diff --git a/contrib/prodigy/packages.el b/layers/prodigy/packages.el similarity index 100% rename from contrib/prodigy/packages.el rename to layers/prodigy/packages.el diff --git a/contrib/restclient/README.org b/layers/restclient/README.org similarity index 100% rename from contrib/restclient/README.org rename to layers/restclient/README.org diff --git a/contrib/restclient/packages.el b/layers/restclient/packages.el similarity index 100% rename from contrib/restclient/packages.el rename to layers/restclient/packages.el diff --git a/contrib/search-engine/README.org b/layers/search-engine/README.org similarity index 100% rename from contrib/search-engine/README.org rename to layers/search-engine/README.org diff --git a/contrib/search-engine/img/searchengine.jpg b/layers/search-engine/img/searchengine.jpg similarity index 100% rename from contrib/search-engine/img/searchengine.jpg rename to layers/search-engine/img/searchengine.jpg diff --git a/contrib/search-engine/packages.el b/layers/search-engine/packages.el similarity index 100% rename from contrib/search-engine/packages.el rename to layers/search-engine/packages.el diff --git a/contrib/semantic/README.org b/layers/semantic/README.org similarity index 100% rename from contrib/semantic/README.org rename to layers/semantic/README.org diff --git a/contrib/semantic/extensions.el b/layers/semantic/extensions.el similarity index 100% rename from contrib/semantic/extensions.el rename to layers/semantic/extensions.el diff --git a/contrib/semantic/packages.el b/layers/semantic/packages.el similarity index 100% rename from contrib/semantic/packages.el rename to layers/semantic/packages.el diff --git a/contrib/shell/README.org b/layers/shell/README.org similarity index 100% rename from contrib/shell/README.org rename to layers/shell/README.org diff --git a/contrib/shell/config.el b/layers/shell/config.el similarity index 100% rename from contrib/shell/config.el rename to layers/shell/config.el diff --git a/contrib/shell/img/shell.png b/layers/shell/img/shell.png similarity index 100% rename from contrib/shell/img/shell.png rename to layers/shell/img/shell.png diff --git a/contrib/shell/packages.el b/layers/shell/packages.el similarity index 100% rename from contrib/shell/packages.el rename to layers/shell/packages.el diff --git a/contrib/smex/README.org b/layers/smex/README.org similarity index 100% rename from contrib/smex/README.org rename to layers/smex/README.org diff --git a/contrib/smex/img/smex.png b/layers/smex/img/smex.png similarity index 100% rename from contrib/smex/img/smex.png rename to layers/smex/img/smex.png diff --git a/contrib/smex/packages.el b/layers/smex/packages.el similarity index 100% rename from contrib/smex/packages.el rename to layers/smex/packages.el diff --git a/contrib/spell-checking/README.org b/layers/spell-checking/README.org similarity index 100% rename from contrib/spell-checking/README.org rename to layers/spell-checking/README.org diff --git a/contrib/spell-checking/config.el b/layers/spell-checking/config.el similarity index 100% rename from contrib/spell-checking/config.el rename to layers/spell-checking/config.el diff --git a/contrib/spell-checking/packages.el b/layers/spell-checking/packages.el similarity index 89% rename from contrib/spell-checking/packages.el rename to layers/spell-checking/packages.el index fb325cf1374c..57cda2dac235 100644 --- a/contrib/spell-checking/packages.el +++ b/layers/spell-checking/packages.el @@ -29,7 +29,10 @@ :off (flyspell-mode -1) :documentation "Enable automatic spell checking." - :evil-leader "tS")) + :evil-leader "tS") + (evil-leader/set-key + "Sd" 'ispell-change-dictionary + "Sn" 'flyspell-goto-next-error)) :config (progn (flyspell-prog-mode) diff --git a/contrib/spotify/README.org b/layers/spotify/README.org similarity index 100% rename from contrib/spotify/README.org rename to layers/spotify/README.org diff --git a/contrib/spotify/config.el b/layers/spotify/config.el similarity index 100% rename from contrib/spotify/config.el rename to layers/spotify/config.el diff --git a/contrib/spotify/extensions.el b/layers/spotify/extensions.el similarity index 100% rename from contrib/spotify/extensions.el rename to layers/spotify/extensions.el diff --git a/contrib/spotify/img/spotify.png b/layers/spotify/img/spotify.png similarity index 100% rename from contrib/spotify/img/spotify.png rename to layers/spotify/img/spotify.png diff --git a/contrib/spotify/packages.el b/layers/spotify/packages.el similarity index 100% rename from contrib/spotify/packages.el rename to layers/spotify/packages.el diff --git a/contrib/syntax-checking/README.org b/layers/syntax-checking/README.org similarity index 100% rename from contrib/syntax-checking/README.org rename to layers/syntax-checking/README.org diff --git a/contrib/syntax-checking/config.el b/layers/syntax-checking/config.el similarity index 100% rename from contrib/syntax-checking/config.el rename to layers/syntax-checking/config.el diff --git a/contrib/syntax-checking/img/flycheck.png b/layers/syntax-checking/img/flycheck.png similarity index 100% rename from contrib/syntax-checking/img/flycheck.png rename to layers/syntax-checking/img/flycheck.png diff --git a/contrib/syntax-checking/packages.el b/layers/syntax-checking/packages.el similarity index 100% rename from contrib/syntax-checking/packages.el rename to layers/syntax-checking/packages.el diff --git a/contrib/themes-megapack/README.org b/layers/themes-megapack/README.org similarity index 100% rename from contrib/themes-megapack/README.org rename to layers/themes-megapack/README.org diff --git a/contrib/themes-megapack/packages.el b/layers/themes-megapack/packages.el similarity index 100% rename from contrib/themes-megapack/packages.el rename to layers/themes-megapack/packages.el diff --git a/tests/core/core-configuration-layer-ftest.el b/tests/core/core-configuration-layer-ftest.el index 55d8c456517f..0f2b38bf9812 100644 --- a/tests/core/core-configuration-layer-ftest.el +++ b/tests/core/core-configuration-layer-ftest.el @@ -16,7 +16,9 @@ ;; --------------------------------------------------------------------------- (ert-deftest test-declare-layers--spacemacs-layer-always-first () - (let ((dotspacemacs-configuration-layers '(emacs-lisp git))) + (let ((dotspacemacs-configuration-layers '(spacemacs + emacs-lisp + (git :variables foo 'bar)))) (configuration-layer//declare-layers) (should (eq 'spacemacs (oref (first configuration-layer--layers) :name))))) diff --git a/tests/core/core-configuration-layer-utest.el b/tests/core/core-configuration-layer-utest.el index c68716a45268..044fc69b9519 100644 --- a/tests/core/core-configuration-layer-utest.el +++ b/tests/core/core-configuration-layer-utest.el @@ -772,7 +772,7 @@ (should (null (configuration-layer//directory-type input)))))) (ert-deftest test-directory-type--category () - (let ((input (concat configuration-layer-contrib-directory "!vim/"))) + (let ((input (concat configuration-layer-directory "!vim/"))) (mocker-let ((file-directory-p (f) ((:record-cls 'mocker-stub-record :output t :occur 1))))