Added programs

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
2021-03-22 21:27:54 +01:00
parent 5764f9a787
commit c18381a3c6
124 changed files with 18079 additions and 0 deletions

14
.emacs.d/emacs-custom.el Normal file
View File

@ -0,0 +1,14 @@
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
'("2dff5f0b44a9e6c8644b2159414af72261e38686072e063aa66ee98a2faecf0e" default))
'(markdown-command "/usr/bin/pandoc"))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

529
.emacs.d/init.el Normal file
View File

@ -0,0 +1,529 @@
;Packages
;; package archives
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives
'(
("melpa" . "https://melpa.org/packages/")
("ELPA" . "http://tromey.com/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("ORG" . "https://orgmode.org/elpa/")
)
)
(package-initialize)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;; Remove welcome screen
(setq inhibit-startup-screen t)
;; Disable menu
(menu-bar-mode 0)
;; Enable IDO mode
(setq ido-enable-flex-matching t)
;;(setq ido-everywhere t)
;;(ido-mode 1)
(global-set-key (kbd "C-x b") 'ido-switch-buffer)
;; Remove working cl
(require 'cl-lib)
(setq byte-compile-warnings '(cl-functions))
(advice-add 'sh-set-shell :around
(lambda (orig-fun &rest args)
(cl-letf (((symbol-function 'message) #'ignore))
(apply orig-fun args))))
;; install use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package)
)
;; Set path to store "custom-set"
(setq custom-file "~/.emacs.d/emacs-custom.el")
;; Enable awesome-tab-mode
(add-to-list 'load-path (expand-file-name "~/.emacs.d/plugins"))
(require 'awesome-tab)
(awesome-tab-mode t)
(use-package awesome-tab
:load-path "~/.emacs.d/plugins"
:config
(awesome-tab-mode t))
(awesome-tab-mode t)
(global-set-key (kbd "C-x j") 'awesome-tab-backward-tab)
(global-set-key (kbd "C-x k") 'awesome-tab-forward-tab)
;; 80-charaters mode
(add-hook 'text-mode-hook 'auto-fill-mode)
(setq-default fill-column 80)
; Global turn on flycheck
(add-hook 'after-init-hook #'global-flycheck-mode)
; Org Files
(add-hook 'org-mode-hook '(lambda () (setq fill-column 80)))
(add-hook 'org-mode-hook 'auto-fill-mode)
(add-hook 'org-mode-hook 'turn-on-flyspell)
;; Latex files
(add-hook 'latex-mode-hook 'turn-on-flyspell)
(setq ispell-dictionary "pl")
;; Broswer
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "browser-x")
;; Switch-window
(use-package switch-window
:ensure t
:config
(setq
switch-window-increase 4
switch-window-input-style 'minibuffer
switch-window-shortcut-style 'qwerty
switch-window-threshold 2
)
(setq
switch-window-qwerty-shortcuts
'( "a" "s" "d" "f" "g" "h" "j" "k" "l")
)
:bind
([remap other-window] . switch-window)
)
;; Enable japanese
(if (condition-case nil (require 'mozc)(error nil))
(setq ecb-be-more-like-better-yes-p t)
(message "Monz not available; not configuring") )
(setq default-input-method "japanese-mozc")
;; Enable Smex
(use-package smex
:ensure t
:init
(smex-initialize)
:bind
("M-x" . smex)
)
;; reveal dependency
(use-package htmlize
:ensure t
)
(use-package ox-reveal
:ensure t
:config
;; maybe add auto-installer in the future
(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js")
)
;; moveline
(use-package move-text
:ensure t
:config)
(global-set-key (kbd "M-<up>") 'move-text-up)
(global-set-key (kbd "M-<down>") 'move-text-down)
;; company
(use-package company
:ensure t
)
(global-company-mode)
;; Shell - bash
(use-package flymake-shellcheck
:ensure t
)
(use-package flycheck-bashate
:ensure t
)
(require 'bash-completion)
(bash-completion-setup)
(use-package flymake-shell
:ensure t
)
(require 'flymake-shell)
(add-hook 'sh-set-shell-hook 'flymake-shell-load)
;; Default font
(defun rc/get-default-font ()
(cond
((eq system-type 'windows-nt) "Consolas-13")
((eq system-type 'gnu/linux) "xos4 Terminus Bold 16")))
(add-to-list 'default-frame-alist `(font . ,(rc/get-default-font)))
;; Theme
(use-package dracula-theme
:ensure t
:config
(load-theme 'dracula t))
;; Sitebar dirred
(use-package dired-sidebar
:ensure t
:commands (dired-sidebar-toggle-sidebar))
(require 'dired-sidebar)
(global-set-key (kbd "C-x d") 'dired-sidebar-toggle-sidebar)
;; Smex
(require 'smex)
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
;;buffer-move
(require 'buffer-move)
(global-set-key (kbd "<C-S-up>") 'buf-move-up)
(global-set-key (kbd "<C-S-down>") 'buf-move-down)
(global-set-key (kbd "<C-S-left>") 'buf-move-left)
(global-set-key (kbd "<C-S-right>") 'buf-move-right)
;; Multiple-cursors
(use-package multiple-cursors
:ensure t
:config
)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;; Magit
(use-package magit
:ensure t
:config
)
(global-set-key (kbd "C-x g") 'magit-status)
;; Helpers for easily building Emacs flymake checkers.
(use-package flymake-easy
:ensure t
:config
)
;; Error list
(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error)
(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)
;; Ruby
(use-package flymake-ruby
:ensure t
:config
)
;;robe
(use-package robe
:ensure t
:config
)
(require 'robe)
(add-hook 'ruby-mode-hook 'robe-mode)
(add-hook 'robe-mode-hook 'ac-robe-setup)
(eval-after-load 'company
'(push 'company-robe company-backends))
(require 'flymake-ruby)
(add-hook 'ruby-mode-hook 'flymake-ruby-load)
;; Docker
(use-package dockerfile-mode
:ensure t
:defer t)
;; YAML
(require 'flymake-yaml)
(use-package yaml-mode
:ensure t
:config
)
;; Ansible
(use-package ansible
:ensure t
:config
)
(use-package ansible-doc
:ensure t
:config
)
(use-package company-ansible
:ensure t
:config
)
(add-to-list 'company-backends 'company-ansible)
(add-hook 'yaml-mode-hook '(lambda () (ansible 1)))
(add-hook 'yaml-mode-hook #'ansible-doc-mode)
;; Markdown-mode
(custom-set-variables
'(markdown-command "/usr/bin/pandoc"))
(use-package markdown-mode
:ensure t
:config
)
;; C++ C
(use-package auto-complete-clang
:ensure t
:config
)
;; Apache
(use-package apache-mode
:ensure t
:config
)
;; Haskell
(use-package haskell-mode
:ensure t
:config
)
(use-package flycheck-haskell
:ensure t
:config
)
(add-hook 'flycheck-mode-hook #'flycheck-haskell-setup)
;; Java
;; lsp-install-server
;; jdtls
(use-package lsp-java
:ensure t
:config
(global-set-key (kbd "C-.") 'lsp-execute-code-action)
)
(global-set-key (kbd "<f9>") 'dap-breakpoint-toggle)
(global-set-key (kbd "<f10>") 'dap-next)
(global-set-key (kbd "<f11>") 'dap-step-in)
(global-set-key (kbd "<f12>") 'lsp-jt-browser)
(global-set-key (kbd "<C-f12>") 'dap-stop-thread)
(global-set-key (kbd "<C-?>") 'comment-or-uncomment-region)
(add-hook 'dap-stopped-hook
(lambda (arg) (call-interactively #'dap-hydra)))
(setq dap-auto-configure-features '(sessions locals controls tooltip))
(require 'lsp-java)
(add-hook 'java-mode-hook #'lsp)
(require 'dap-java)
;; Treemacs
(use-package treemacs
:ensure t
:defer t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-directory-name-transformer #'identity
treemacs-display-in-side-window t
treemacs-eldoc-display t
treemacs-file-event-delay 5000
treemacs-file-extension-regex treemacs-last-period-regex-value
treemacs-file-follow-delay 0.2
treemacs-file-name-transformer #'identity
treemacs-follow-after-init t
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-move-forward-on-expand nil
treemacs-no-png-images nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch nil
treemacs-silent-refresh nil
treemacs-sorting 'alphabetic-asc
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-width 35
treemacs-workspace-switch-cleanup nil)
;; The default width and height of the icons is 22 pixels. If you are
;; using a Hi-DPI display, uncomment this to double the icon size.
;;(treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(pcase (cons (not (null (executable-find "git")))
(not (null treemacs-python-executable)))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple))))
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag)))
(use-package treemacs-evil
:after treemacs evil
:ensure t)
(use-package treemacs-projectile
:after treemacs projectile
:ensure t)
(use-package treemacs-icons-dired
:after treemacs dired
:ensure t
:config (treemacs-icons-dired-mode))
(use-package treemacs-magit
:after treemacs magit
:ensure t)
(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
:after treemacs persp-mode ;;or perspective vs. persp-mode
:ensure t
:config (treemacs-set-scope-type 'Perspectives))
;;; --- Look & Feel ---
;; Helm
(use-package helm
:ensure t
:config
)
(add-hook 'helm-minibuffer-set-up-hook
'helm-hide-minibuffer-maybe)
(setq helm-autoresize-max-height 0)
(setq helm-autoresize-min-height 20)
(helm-autoresize-mode 1)
(helm-mode 1)
;; Disable scroll bar
;; no toolbar:
(if (display-graphic-p)
(progn
(tool-bar-mode -1)
(scroll-bar-mode -1)))
;; Copy
(setq select-active-regions nil)
(setq mouse-drag-copy-region t)
(global-set-key [mouse-2] 'mouse-yank-at-click)
;; Zoom in/out.
(global-set-key (kbd "M-+") 'text-scale-increase)
(global-set-key (kbd "M--") 'text-scale-decrease)
;; line numbers:
(global-display-line-numbers-mode 1)
;; scrolling:
(setq scroll-conservatively 100)
;; Whitespaces
(global-whitespace-mode 1)
(setq whitespace-display-mappings '((space-mark 32 [])))
(set-face-attribute 'whitespace-space nil :background nil :foreground "gray30")
(setq whitespace-style (quote (face tabs spaces trailing space-before-tab newline indentation empty space-after-tab space-mark tab-mark)))
(add-hook 'before-save-hook (lambda () (delete-trailing-whitespace)))
;; no "bell" (audible notification):
(setq ring-bell-function 'ignore)
;; auto reloading (reverting) buffers
(global-auto-revert-mode 1)
;; disable lock files:
(setq create-lockfiles nil)
;; disable autosave:
(setq auto-save-default nil)
;; disable backups:
(setq make-backup-files nil)
;; Pass "y or n" instead of "yes or no"
(defalias 'yes-or-no-p 'y-or-n-p)
;; Highlight parens
(show-paren-mode 1)
;; Candy
(global-prettify-symbols-mode 1)
;; Modeline
(column-number-mode 1)
(size-indication-mode 1)
;; Horizontal splitting
(defun split-and-follow-horizontally ()
(interactive)
(split-window-below)
(balance-windows)
(other-window 1)
)
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally)
;; Vertical splitting
(defun split-and-follow-vertically ()
(interactive)
(split-window-right)
(balance-windows)
(other-window 1)
)
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically)
;; Kill & remove split
(defun kill-and-remove-split ()
"Kill and remove split."
(interactive)
(kill-buffer)
(delete-window)
(balance-windows)
(other-window 1)
)
(global-set-key (kbd "C-x x") 'kill-and-remove-split)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,138 @@
;;; buffer-move.el ---
;; Copyright (C) 2004-2014 Lucas Bonnet <lucas@rincevent.net.fr>
;; Author: Lucas Bonnet <lucas@rincevent.net>
;; Keywords: lisp,convenience
;; Version: 0.5
;; URL : https://github.com/lukhas/buffer-move
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.
;;; Commentary:
;; This file is for lazy people wanting to swap buffers without
;; typing C-x b on each window. This is useful when you have :
;; +--------------+-------------+
;; | | |
;; | #emacs | #gnus |
;; | | |
;; +--------------+-------------+
;; | |
;; | .emacs |
;; | |
;; +----------------------------+
;; and you want to have :
;; +--------------+-------------+
;; | | |
;; | #gnus | .emacs |
;; | | |
;; +--------------+-------------+
;; | |
;; | #emacs |
;; | |
;; +----------------------------+
;; With buffer-move, just go in #gnus, do buf-move-left, go to #emacs
;; (which now should be on top right) and do buf-move-down.
;; To use it, simply put a (require 'buffer-move) in your ~/.emacs and
;; define some keybindings. For example, i use :
;; (global-set-key (kbd "<C-S-up>") 'buf-move-up)
;; (global-set-key (kbd "<C-S-down>") 'buf-move-down)
;; (global-set-key (kbd "<C-S-left>") 'buf-move-left)
;; (global-set-key (kbd "<C-S-right>") 'buf-move-right)
;;; Code:
(require 'windmove)
;;;###autoload
(defun buf-move-up ()
"Swap the current buffer and the buffer above the split.
If there is no split, ie now window above the current one, an
error is signaled."
;; "Switches between the current buffer, and the buffer above the
;; split, if possible."
(interactive)
(let* ((other-win (windmove-find-other-window 'up))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No window above this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-down ()
"Swap the current buffer and the buffer under the split.
If there is no split, ie now window under the current one, an
error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'down))
(buf-this-buf (window-buffer (selected-window))))
(if (or (null other-win)
(string-match "^ \\*Minibuf" (buffer-name (window-buffer other-win))))
(error "No window under this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-left ()
"Swap the current buffer and the buffer on the left of the split.
If there is no split, ie now window on the left of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'left))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No left split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-right ()
"Swap the current buffer and the buffer on the right of the split.
If there is no split, ie now window on the right of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'right))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No right split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
(provide 'buffer-move)
;;; buffer-move.el ends here

1195
.emacs.d/plugins/dired-sidebar.el Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
;;; flymake-yaml.el --- A flymake handler for YAML
;; Copyright (C) 2013 Yasuyuki Oka
;; Author: Yasuyuki Oka <yasuyk@gmail.com>
;; Version: 0.0.2
;; URL: https://github.com/yasuyk/flymake-yaml
;; Package-Requires: ((flymake-easy "0.1"))
;; Keywords: yaml
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Based in part on http://d.hatena.ne.jp/kitokitoki/20120306/p1
;;
;; Usage:
;;
;; (require 'flymake-yaml) ;; Not necessary if using ELPA package
;; (add-hook 'yaml-mode-hook 'flymake-yaml-load)
;;
;; Uses flymake-easy, from https://github.com/purcell/flymake-easy
;;; Code:
(require 'flymake-easy)
(defconst flymake-yaml-err-line-patterns
;; Syck error message
'(("syntax error on line \\([0-9]+\\), col \\([0-9]+\\): `\\(.*\\)'" nil 1 2 3)
;; Psych error message
(".*: \\(.*\\) at line \\([0-9]+\\) column \\([0-9]+\\)" nil 2 3 1)))
(defun flymake-yaml-command (filename)
"Construct a command that flymake can use to check yaml source.
Argument FILENAME
YAML file name."
(list "ruby" "-ryaml" "-e" "YAML.load(ARGF) rescue warn $!" filename))
;;;###autoload
(defun flymake-yaml-load ()
"Configure flymake mode to check the current buffer's YAML syntax."
(interactive)
(when (eq major-mode 'yaml-mode)
(flymake-easy-load 'flymake-yaml-command
flymake-yaml-err-line-patterns
'tempdir
"yml")))
(provide 'flymake-yaml)
;; Local Variables:
;; coding: utf-8
;; eval: (checkdoc-minor-mode 1)
;; End:
;;; flymake-yaml.el ends here

View File

@ -0,0 +1,27 @@
;;; latexmk-mode.el --- LatexMK minor mode
;;; Commentary:
;;; none
;;; Code:
(define-minor-mode latexmk-mode
"Toggle LatexMK mode."
:init-value nil
:lighter " LatexMK "
)
(defun my/run-latexmk ()
(interactive)
(start-process "latexmk" "latexmk out" "latexmk" "--silent" "--pdf" (buffer-file-name (current-buffer)))
)
(defun my/try-run-latexmk ()
"Try to run latexmk."
(if (bound-and-true-p latexmk-mode)
(my/run-latexmk)
)
)
(add-hook 'after-save-hook 'my/try-run-latexmk)
(add-hook 'latex-mode-hook 'latexmk-mode)
;;; latexmk-mode.el ends here

View File

@ -0,0 +1,75 @@
;;; livedown.el --- Realtime Markdown previews for Emacs.
;; Copyright (C) 2014-2016 Hrvoje Simic
;; Author: Hrvoje Simic <hrvoje@twobucks.co>
;; Version: 1.0.0
;; Keywords: markdown, preview, live
;; URL: https://github.com/shime/emacs-livedown
;;; Commentary:
;; Realtime Markdown previews for Emacs.
;;; Code:
(defgroup livedown nil
"Realtime Markdown previews"
:group 'livedown
:prefix "livedown-")
(defcustom livedown-port 1337
"Port on which livedown server will run."
:type 'integer
:group 'livedown)
(defcustom livedown-open t
"Open browser automatically."
:type 'boolean
:group 'livedown)
(defcustom livedown-browser nil
"Open alternative browser."
:type 'string
:group 'livedown)
(defcustom livedown-autostart nil
"Auto-open previews when opening markdown files."
:type 'boolean
:group 'livedown)
;;;###autoload
(defun livedown-preview ()
"Preview the current file in livedown."
(interactive)
(call-process-shell-command
(format "livedown stop --port %s &"
livedown-port))
(start-process-shell-command
(format "emacs-livedown")
(format "emacs-livedown-buffer")
(format "livedown start %s --port %s %s %s "
buffer-file-name
livedown-port
(if livedown-browser (concat "--browser " livedown-browser) "")
(if livedown-open "--open" "")))
(print (format "%s rendered @ %s" buffer-file-name livedown-port) (get-buffer "emacs-livedown-buffer")))
;;;###autoload
(defun livedown-kill (&optional async)
"Stops the livedown process."
(interactive)
(let ((stop-livedown (if async 'async-shell-command 'call-process-shell-command)))
(funcall stop-livedown
(format "livedown stop --port %s &"
livedown-port))))
(if livedown-autostart
(eval-after-load 'markdown-mode '(livedown-preview)))
(add-hook 'kill-emacs-query-functions (lambda () (livedown-kill t)))
(provide 'livedown)
;;; livedown.el ends here

261
.emacs.d/plugins/org-ac.el Normal file
View File

@ -0,0 +1,261 @@
;;; org-ac.el --- Some auto-complete sources for org-mode
;; Copyright (C) 2014 Hiroaki Otsu
;; Author: Hiroaki Otsu <ootsuhiroaki@gmail.com>
;; Keywords: org, completion
;; URL: https://github.com/aki2o/org-ac
;; Version: 0.0.2
;; Package-Requires: ((auto-complete-pcmp "0.0.1") (log4e "0.2.0") (yaxception "0.1"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; This extension provides auto-complete sources for org-mode.
;;; Dependency:
;;
;; - auto-complete-pcmp.el ( see <https://github.com/aki2o/auto-complete-pcmp> )
;; - yaxception.el ( see <https://github.com/aki2o/yaxception> )
;; - log4e.el ( see <https://github.com/aki2o/log4e> )
;;; Installation:
;;
;; Put this to your load-path.
;; And put the following lines in your .emacs or site-start.el file.
;;
;; (require 'org-ac)
;;; Configuration:
;;
;; ;; Make config suit for you. About the config item, see Customization or eval the following sexp.
;; ;; (customize-group "org-ac")
;;
;; (org-ac/config-default)
;;; Customization:
;;
;; [EVAL] (autodoc-document-lisp-buffer :type 'user-variable :prefix "org-ac/" :docstring t)
;; `org-ac/ac-trigger-command-keys'
;; Keystrokes for doing `ac-start' with self insert.
;;
;; *** END auto-documentation
;;; API:
;;
;; [EVAL] (autodoc-document-lisp-buffer :type 'command :prefix "org-ac/" :docstring t)
;; `org-ac/setup-current-buffer'
;; Do setup for using org-ac in current buffer.
;;
;; *** END auto-documentation
;; [Note] Functions and variables other than listed above, Those specifications may be changed without notice.
;;; Tested On:
;;
;; - Emacs ... GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.4.2) of 2013-08-22 on chindi02, modified by Debian
;; - auto-complete-pcmp.el ... Version 0.0.1
;; - yaxception.el ... Version 0.1
;; - log4e.el ... Version 0.2.0
;; Enjoy!!!
(eval-when-compile (require 'cl))
(require 'org)
(require 'auto-complete-pcmp)
(require 'rx)
(require 'log4e)
(require 'yaxception)
(defgroup org-ac nil
"Auto completion for org-mode."
:group 'org
:prefix "org-ac/")
(defcustom org-ac/ac-trigger-command-keys '("\\" "*" "SPC" ":" "[" "+")
"Keystrokes for doing `ac-start' with self insert."
:type '(repeat string)
:group 'org-ac)
(log4e:deflogger "org-ac" "%t [%l] %m" "%H:%M:%S" '((fatal . "fatal")
(error . "error")
(warn . "warn")
(info . "info")
(debug . "debug")
(trace . "trace")))
(org-ac--log-set-level 'trace)
(defun* org-ac--show-message (msg &rest args)
(apply 'message (concat "[ORG-AC] " msg) args)
nil)
(defun org-ac--complete-close-option-at-current-point ()
(let ((pt (point)))
(yaxception:$
(yaxception:try
(org-ac--trace "start complete close option at current point")
(when (save-excursion
(re-search-backward "#\\+\\(begin\\|BEGIN\\)_\\([a-zA-Z0-9]+\\) *\\=" nil t))
(let* ((opennm (match-string-no-properties 1))
(typenm (match-string-no-properties 2))
(closenm (cond ((string= opennm "begin") "end")
((string= opennm "BEGIN") "END")))
(case-fold-search t))
(if (or (not (re-search-forward "^[ \t]*#\\+" nil t))
(not (re-search-forward (concat "\\=" closenm "_") nil t)))
(progn (goto-char pt)
(insert "\n#+" closenm "_" typenm)
(org-cycle))
(let ((currtypenm (if (re-search-forward "\\=\\([a-zA-Z0-9]+\\)" nil t)
(match-string-no-properties 1)
"")))
(backward-delete-char (+ (length closenm)
1
(length currtypenm)))
(insert closenm "_" typenm)))
(goto-char pt))))
(yaxception:catch 'error e
(org-ac--show-message "Failed complete close option : %s" (yaxception:get-text e))
(org-ac--error "failed complete close option at current point : %s\n%s"
(yaxception:get-text e)
(yaxception:get-stack-trace-string e))
(goto-char pt)))))
(defun org-ac--get-link-head-candidates ()
(append (ac-pcmp/get-ac-candidates)
(mapcar (lambda (x) (concat x ":")) org-link-types)))
(defvar ac-source-org-ac-tex
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "\\\\\\([a-zA-Z0-9_-]*\\)")
(symbol . "t")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-head
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "[^\r\n*]\\*\\([^\t\r\n]*\\)")
(symbol . "h")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-todo
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "^\\*+ \\([a-zA-Z0-9_-]*\\)")
(symbol . "d")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-tag
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "[ \t]:\\([a-zA-Z0-9_-]*\\)")
(symbol . "t")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar org-ac--regexp-link-head (rx-to-string `(and "["
(* (any " \t"))
"["
(group (* (not (any ":*]")))))))
(defvar ac-source-org-ac-link-head
`((candidates . org-ac--get-link-head-candidates)
(prefix . ,org-ac--regexp-link-head)
(symbol . "l")
(requires . 0)
(cache)
(action . (lambda ()
(ac-pcmp/do-ac-action)
(ac-start)))))
(defvar ac-source-org-ac-option
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "^[ \t]*#\\+\\([a-zA-Z0-9_:=-]*\\)")
(symbol . "o")
(requires . 0)
(cache)
(action . (lambda ()
(ac-pcmp/do-ac-action)
(org-ac--complete-close-option-at-current-point)
(auto-complete '(ac-source-org-ac-option-key))))))
(defvar ac-source-org-ac-option-key
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "^[ \t]*#\\+[a-zA-Z0-9_:=-]+ +\\([a-zA-Z0-9_-]*\\)")
(symbol . "k")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-option-options
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "^[ \t]*#\\+\\(?:options\\|OPTIONS\\):.* +\\([a-zA-Z0-9_-]*\\)")
(symbol . "x")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-file
'((init . (setq ac-filename-cache nil))
(candidates . org-ac/file-candidate)
(prefix . "\\[file:\\(.*\\)")
(symbol . "f")
(requires . 0)
(action . ac-start)
(limit . nil)))
;;;###autoload
(defun org-ac/setup-current-buffer ()
"Do setup for using org-ac in current buffer."
(interactive)
(when (eq major-mode 'org-mode)
(loop for stroke in org-ac/ac-trigger-command-keys
do (local-set-key (read-kbd-macro stroke) 'ac-pcmp/self-insert-command-with-ac-start))
(add-to-list 'ac-sources 'ac-source-org-ac-tex)
(add-to-list 'ac-sources 'ac-source-org-ac-head)
(add-to-list 'ac-sources 'ac-source-org-ac-todo)
(add-to-list 'ac-sources 'ac-source-org-ac-tag)
(add-to-list 'ac-sources 'ac-source-org-ac-link-head)
(add-to-list 'ac-sources 'ac-source-org-ac-option)
(add-to-list 'ac-sources 'ac-source-org-ac-option-key)
(add-to-list 'ac-sources 'ac-source-org-ac-option-options)
(add-to-list 'ac-sources 'ac-source-org-ac-file)
(auto-complete-mode t)))
;;;###autoload
(defun org-ac/config-default ()
"Do setting recommemded configuration."
(add-to-list 'ac-modes 'org-mode)
(add-hook 'org-mode-hook 'org-ac/setup-current-buffer t))
(defun org-ac/file-candidate ()
"Adds [file: to the normal file completition, plus allows relative paths"
(if (string-match "^[~./]+" ac-prefix)
(ac-filename-candidate)
(let ((ac-prefix (concat "./" ac-prefix)))
(mapcar (lambda (path) (substring path 2))
(ac-filename-candidate)))))
(provide 'org-ac)
;;; org-ac.el ends here

483
.emacs.d/plugins/smex.el Normal file
View File

@ -0,0 +1,483 @@
;;; smex.el --- M-x interface with Ido-style fuzzy matching. -*- lexical-binding: t; -*-
;; Copyright (C) 2009-2014 Cornelius Mika and contributors
;;
;; Author: Cornelius Mika <cornelius.mika@gmail.com> and contributors
;; URL: http://github.com/nonsequitur/smex/
;; Package-Requires: ((emacs "24"))
;; Version: 3.0
;; Keywords: convenience, usability
;; This file is not part of GNU Emacs.
;;; License:
;; Licensed under the same terms as Emacs.
;;; Commentary:
;; Quick start:
;; run (smex-initialize)
;;
;; Bind the following commands:
;; smex, smex-major-mode-commands
;;
;; For a detailed introduction see:
;; http://github.com/nonsequitur/smex/blob/master/README.markdown
;;; Code:
(require 'ido)
(defgroup smex nil
"M-x interface with Ido-style fuzzy matching and ranking heuristics."
:group 'extensions
:group 'convenience
:link '(emacs-library-link :tag "Lisp File" "smex.el"))
(defcustom smex-auto-update t
"If non-nil, `Smex' checks for new commands each time it is run.
Turn it off for minor speed improvements on older systems."
:type 'boolean
:group 'smex)
(defcustom smex-save-file (locate-user-emacs-file "smex-items" ".smex-items")
"File in which the smex state is saved between Emacs sessions.
Variables stored are: `smex-data', `smex-history'.
Must be set before initializing Smex."
:type 'string
:group 'smex)
(defcustom smex-history-length 7
"Determines on how many recently executed commands
Smex should keep a record.
Must be set before initializing Smex."
:type 'integer
:group 'smex)
(defcustom smex-prompt-string "M-x "
"String to display in the Smex prompt."
:type 'string
:group 'smex)
(defcustom smex-flex-matching t
"Enables Ido flex matching. On by default.
Set this to nil to disable fuzzy matching."
:type 'boolean
:group 'smex)
(defvar smex-initialized-p nil)
(defvar smex-cache)
(defvar smex-ido-cache)
(defvar smex-data)
(defvar smex-history)
(defvar smex-command-count 0)
(defvar smex-custom-action nil)
;; Check if Smex is supported
(when (equal (cons 1 1)
(ignore-errors
(subr-arity (symbol-function 'execute-extended-command))))
(error "Your Emacs has a non-elisp version of `execute-extended-command', which is incompatible with Smex"))
;;--------------------------------------------------------------------------------
;; Smex Interface
;;;###autoload
(defun smex ()
(interactive)
(unless smex-initialized-p
(smex-initialize))
(if (smex-already-running)
(smex-update-and-rerun)
(and smex-auto-update
(smex-detect-new-commands)
(smex-update))
(smex-read-and-run smex-ido-cache)))
(defun smex-already-running ()
(and (boundp 'ido-choice-list)
(eql ido-choice-list smex-ido-cache)
(minibuffer-window-active-p (selected-window))))
(defun smex-update-and-rerun ()
(smex-do-with-selected-item
(lambda (_) (smex-update) (smex-read-and-run smex-ido-cache ido-text))))
(defun smex-read-and-run (commands &optional initial-input)
(let* ((chosen-item-name (smex-completing-read commands initial-input))
(chosen-item (intern chosen-item-name)))
(if smex-custom-action
(let ((action smex-custom-action))
(setq smex-custom-action nil)
(funcall action chosen-item))
(unwind-protect
(with-no-warnings ; Don't warn about interactive use of `execute-extended-command'
(execute-extended-command current-prefix-arg chosen-item-name))
(smex-rank chosen-item)))))
;;;###autoload
(defun smex-major-mode-commands ()
"Like `smex', but limited to commands that are relevant to the active major mode."
(interactive)
(unless smex-initialized-p
(smex-initialize))
(let ((commands (delete-dups (append (smex-extract-commands-from-keymap (current-local-map))
(smex-extract-commands-from-features major-mode)))))
(setq commands (smex-sort-according-to-cache commands))
(setq commands (mapcar #'symbol-name commands))
(smex-read-and-run commands)))
(defun smex-completing-read (choices initial-input)
(let ((ido-completion-map ido-completion-map)
(ido-setup-hook (cons 'smex-prepare-ido-bindings ido-setup-hook))
(ido-enable-prefix nil)
(ido-enable-flex-matching smex-flex-matching)
(ido-max-prospects 10)
(minibuffer-completion-table choices))
(ido-completing-read (smex-prompt-with-prefix-arg) choices nil nil
initial-input 'extended-command-history (car choices))))
(defun smex-prompt-with-prefix-arg ()
(if (not current-prefix-arg)
smex-prompt-string
(concat
(if (eq current-prefix-arg '-)
"- "
(if (integerp current-prefix-arg)
(format "%d " current-prefix-arg)
(if (= (car current-prefix-arg) 4)
"C-u "
(format "%d " (car current-prefix-arg)))))
smex-prompt-string)))
(defun smex-prepare-ido-bindings ()
(define-key ido-completion-map (kbd "TAB") 'minibuffer-complete)
(define-key ido-completion-map (kbd "C-h f") 'smex-describe-function)
(define-key ido-completion-map (kbd "C-h w") 'smex-where-is)
(define-key ido-completion-map (kbd "M-.") 'smex-find-function)
(define-key ido-completion-map (kbd "C-a") 'move-beginning-of-line))
;;--------------------------------------------------------------------------------
;; Cache and Maintenance
(defun smex-rebuild-cache ()
(interactive)
(setq smex-cache nil)
;; Build up list 'new-commands' and later put it at the end of 'smex-cache'.
;; This speeds up sorting.
(let (new-commands)
(mapatoms (lambda (symbol)
(when (commandp symbol)
(let ((known-command (assq symbol smex-data)))
(if known-command
(setq smex-cache (cons known-command smex-cache))
(setq new-commands (cons (list symbol) new-commands)))))))
(if (eq (length smex-cache) 0)
(setq smex-cache new-commands)
(setcdr (last smex-cache) new-commands)))
(setq smex-cache (sort smex-cache 'smex-sorting-rules))
(smex-restore-history)
(setq smex-ido-cache (smex-convert-for-ido smex-cache)))
(defun smex-convert-for-ido (command-items)
(mapcar (lambda (command-item) (symbol-name (car command-item))) command-items))
(defun smex-restore-history ()
"Rearranges `smex-cache' according to `smex-history'"
(if (> (length smex-history) smex-history-length)
(setcdr (nthcdr (- smex-history-length 1) smex-history) nil))
(mapc (lambda (command)
(unless (eq command (caar smex-cache))
(let ((command-cell-position (smex-detect-position
smex-cache
(lambda (cell)
(eq command (caar cell))))))
(when command-cell-position
(let ((command-cell (smex-remove-nth-cell
command-cell-position smex-cache)))
(setcdr command-cell smex-cache)
(setq smex-cache command-cell))))))
(reverse smex-history)))
(defun smex-sort-according-to-cache (list)
"Sorts a list of commands by their order in `smex-cache'"
(let (sorted)
(dolist (command-item smex-cache)
(let ((command (car command-item)))
(when (memq command list)
(setq sorted (cons command sorted))
(setq list (delq command list)))))
(nreverse (append list sorted))))
(defun smex-update ()
(interactive)
(smex-save-history)
(smex-rebuild-cache))
(defun smex-detect-new-commands ()
(let ((i 0))
(mapatoms (lambda (symbol) (if (commandp symbol) (setq i (1+ i)))))
(unless (= i smex-command-count)
(setq smex-command-count i))))
(defun smex-auto-update (&optional idle-time)
"Update Smex when Emacs has been idle for IDLE-TIME."
(unless idle-time (setq idle-time 60))
(run-with-idle-timer idle-time t
'(lambda () (if (smex-detect-new-commands) (smex-update)))))
;;;###autoload
(defun smex-initialize ()
(interactive)
(unless ido-mode (smex-initialize-ido))
(smex-load-save-file)
(smex-detect-new-commands)
(smex-rebuild-cache)
(add-hook 'kill-emacs-hook 'smex-save-to-file)
(setq smex-initialized-p t))
(defun smex-initialize-ido ()
"Sets up a minimal Ido environment for `ido-completing-read'."
(with-no-warnings ; `ido-init-completion-maps' is deprecated in Emacs 25
(ido-init-completion-maps))
(add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup))
(defsubst smex-save-file-not-empty-p ()
(string-match-p "\[^[:space:]\]" (buffer-string)))
(defun smex-load-save-file ()
"Loads `smex-history' and `smex-data' from `smex-save-file'"
(let ((save-file (expand-file-name smex-save-file)))
(if (file-readable-p save-file)
(with-temp-buffer
(insert-file-contents save-file)
(condition-case nil
(setq smex-history (read (current-buffer))
smex-data (read (current-buffer)))
(error (if (smex-save-file-not-empty-p)
(error "Invalid data in smex-save-file (%s). Can't restore history."
smex-save-file)
(unless (boundp 'smex-history) (setq smex-history nil))
(unless (boundp 'smex-data) (setq smex-data nil))))))
(setq smex-history nil smex-data nil))))
(defun smex-save-history ()
"Updates `smex-history'"
(setq smex-history nil)
(let ((cell smex-cache))
(dotimes (_ smex-history-length)
(setq smex-history (cons (caar cell) smex-history))
(setq cell (cdr cell))))
(setq smex-history (nreverse smex-history)))
(defmacro smex-pp (list-var)
`(smex-pp* ,list-var ,(symbol-name list-var)))
(defun smex-save-to-file ()
(interactive)
(smex-save-history)
(with-temp-file (expand-file-name smex-save-file)
(smex-pp smex-history)
(smex-pp smex-data)))
;;--------------------------------------------------------------------------------
;; Ranking
(defun smex-sorting-rules (command-item other-command-item)
"Returns true if COMMAND-ITEM should sort before OTHER-COMMAND-ITEM."
(let* ((count (or (cdr command-item ) 0))
(other-count (or (cdr other-command-item) 0))
(name (car command-item))
(other-name (car other-command-item))
(length (length (symbol-name name)))
(other-length (length (symbol-name other-name))))
(or (> count other-count) ; 1. Frequency of use
(and (= count other-count)
(or (< length other-length) ; 2. Command length
(and (= length other-length)
(string< name other-name))))))) ; 3. Alphabetical order
(defun smex-rank (command)
(let ((command-item (or (assq command smex-cache)
;; Update caches and try again if not found.
(progn (smex-update)
(assq command smex-cache)))))
(when command-item
(smex-update-counter command-item)
;; Don't touch the cache order if the chosen command
;; has just been execucted previously.
(unless (eq command-item (car smex-cache))
(let (command-cell
(pos (smex-detect-position smex-cache (lambda (cell)
(eq command-item (car cell))))))
;; Remove the just executed command.
(setq command-cell (smex-remove-nth-cell pos smex-cache))
;; And put it on top of the cache.
(setcdr command-cell smex-cache)
(setq smex-cache command-cell)
;; Repeat the same for the ido cache. Should this be DRYed?
(setq command-cell (smex-remove-nth-cell pos smex-ido-cache))
(setcdr command-cell smex-ido-cache)
(setq smex-ido-cache command-cell)
;; Now put the last history item back to its normal place.
(smex-sort-item-at smex-history-length))))))
(defun smex-update-counter (command-item)
(let ((count (cdr command-item)))
(setcdr command-item
(if count
(1+ count)
;; Else: Command has just been executed for the first time.
;; Add it to `smex-data'.
(if smex-data
(setcdr (last smex-data) (list command-item))
(setq smex-data (list command-item)))
1))))
(defun smex-sort-item-at (n)
"Sorts item at position N in `smex-cache'."
(let* ((command-cell (nthcdr n smex-cache))
(command-item (car command-cell)))
(let ((insert-at (smex-detect-position
command-cell
(lambda (cell)
(smex-sorting-rules command-item (car cell))))))
;; TODO: Should we handle the case of 'insert-at' being nil?
;; This will never happen in practice.
(when (> insert-at 1)
(setq command-cell (smex-remove-nth-cell n smex-cache))
;; smex-cache just got shorter by one element, so subtract '1' from insert-at.
(setq insert-at (+ n (- insert-at 1)))
(smex-insert-cell command-cell insert-at smex-cache)
;; Repeat the same for the ido cache. DRY?
(setq command-cell (smex-remove-nth-cell n smex-ido-cache))
(smex-insert-cell command-cell insert-at smex-ido-cache)))))
(defun smex-detect-position (cell function)
"Detects, relatively to CELL, the position of the cell
on which FUNCTION returns true.
Only checks cells after CELL, starting with the cell right after CELL.
Returns nil when reaching the end of the list."
(let ((pos 1))
(catch 'break
(while t
(setq cell (cdr cell))
(if (not cell)
(throw 'break nil)
(if (funcall function cell) (throw 'break pos))
(setq pos (1+ pos)))))))
(defun smex-remove-nth-cell (n list)
"Removes and returns the Nth cell in LIST."
(let* ((previous-cell (nthcdr (- n 1) list))
(result (cdr previous-cell)))
(setcdr previous-cell (cdr result))
result))
(defun smex-insert-cell (new-cell n list)
"Inserts cell at position N in LIST."
(let* ((cell (nthcdr (- n 1) list))
(next-cell (cdr cell)))
(setcdr (setcdr cell new-cell) next-cell)))
;;--------------------------------------------------------------------------------
;; Help and Reference
(defun smex-do-with-selected-item (fn)
(setq smex-custom-action fn)
(ido-exit-minibuffer))
(defun smex-describe-function ()
(interactive)
(smex-do-with-selected-item (lambda (chosen)
(describe-function chosen)
(pop-to-buffer "*Help*"))))
(defun smex-where-is ()
(interactive)
(smex-do-with-selected-item 'where-is))
(defun smex-find-function ()
(interactive)
(smex-do-with-selected-item 'find-function))
(defun smex-extract-commands-from-keymap (map)
(let (commands)
(smex-parse-keymap map commands)
commands))
(defun smex-parse-keymap (map commands)
(map-keymap (lambda (_binding element)
(if (and (listp element) (eq 'keymap (car element)))
(smex-parse-keymap element commands)
;; Strings are commands, too. Reject them.
(if (and (symbolp element) (commandp element))
(push element commands))))
map))
(defun smex-extract-commands-from-features (mode)
(let ((library-path (symbol-file mode))
(mode-name (symbol-name mode))
commands)
(string-match "\\(.+?\\)\\(-mode\\)?$" mode-name)
;; 'lisp-mode' -> 'lisp'
(setq mode-name (match-string 1 mode-name))
(if (string= mode-name "c") (setq mode-name "cc"))
(setq mode-name (regexp-quote mode-name))
(dolist (feature load-history)
(let ((feature-path (car feature)))
(when (and feature-path (or (equal feature-path library-path)
(string-match mode-name (file-name-nondirectory
feature-path))))
(dolist (item (cdr feature))
(if (and (listp item) (eq 'defun (car item)))
(let ((function (cdr item)))
(when (commandp function)
(setq commands (append commands (list function))))))))))
commands))
(defun smex-show-unbound-commands ()
"Shows unbound commands in a new buffer,
sorted by frequency of use."
(interactive)
(setq smex-data (sort smex-data 'smex-sorting-rules))
(let ((unbound-commands (delq nil
(mapcar (lambda (command-item)
(unless (where-is-internal (car command-item))
command-item))
smex-data))))
(view-buffer-other-window "*Smex: Unbound Commands*")
(setq buffer-read-only t)
(let ((inhibit-read-only t))
(erase-buffer)
(smex-pp unbound-commands))
(set-buffer-modified-p nil)
(goto-char (point-min))))
;; A copy of `ido-pp' that's compatible with lexical bindings
(defun smex-pp* (list list-name)
(let ((print-level nil) (eval-expression-print-level nil)
(print-length nil) (eval-expression-print-length nil))
(insert "\n;; ----- " list-name " -----\n(\n ")
(while list
(let* ((elt (car list))
(s (if (consp elt) (car elt) elt)))
(if (and (stringp s) (= (length s) 0))
(setq s nil))
(if s
(prin1 elt (current-buffer)))
(if (and (setq list (cdr list)) s)
(insert "\n "))))
(insert "\n)\n")))
(provide 'smex)
;;; smex.el ends here

42
.emacs.d/smex-items Normal file
View File

@ -0,0 +1,42 @@
;; ----- smex-history -----
(
goto-line
overwrite-mode
shell
load-theme
treemacs
inf-ruby-console-auto
compile
)
;; ----- smex-data -----
(
(lsp-install-server . 6)
(treemacs . 17)
(lsp-java-update-server . 1)
(set-frame-font . 1)
(lsp-jt-browser . 6)
(sort-lines . 5)
(lsp-jt-report-open . 17)
(treemacs-edit-workspaces . 2)
(treemacs-refresh . 1)
(treemacs-mode . 3)
(menu-set-font . 2)
(magit-commit . 1)
(column-number-mode . 1)
(set-fill-column . 3)
(dap-java-debug . 7)
(ruby-indent-exp . 1)
(ruby-indent-line . 1)
(ruby-mode-menu . 1)
(inf-ruby-console-auto . 8)
(shell . 4)
(package-install-selected-packages . 1)
(package-install . 1)
(compile . 2)
(lsp-mode . 2)
(load-theme . 14)
(overwrite-mode . 1)
(goto-line . 2)
)

6
.emacs.d/tramp Normal file
View File

@ -0,0 +1,6 @@
;; -*- emacs-lisp -*- <21/03/22 00:03:53 /home/yorune/.emacs.d/tramp>
;; Tramp connection history. Don't change this file.
;; Run `M-x tramp-cleanup-all-connections' instead.
(((tramp-file-name "sudo" "root" nil "Gentoo" nil nil nil)
nil))

View File

@ -0,0 +1,3 @@
((magit-commit nil)
(magit-dispatch nil)
(magit-push nil))