First commit.
This commit is contained in:
162
lisp/modes/c-c++.el
Normal file
162
lisp/modes/c-c++.el
Normal file
@@ -0,0 +1,162 @@
|
||||
;;; c-c++.el --- initializes C/C++ modes -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(require 'cl)
|
||||
(require 'lsp)
|
||||
|
||||
(defun user--c-format-before-save ()
|
||||
"C/C++ cleanup and format before save buffer."
|
||||
(delete-trailing-whitespace)
|
||||
;; Format buffer.
|
||||
(indent-region (point-min) (point-max) nil)
|
||||
)
|
||||
|
||||
;; From https://www.emacswiki.org/emacs/CompileCommand
|
||||
(defun* user--c-get-closest-pathname (&optional (file "Makefile"))
|
||||
"Determine the pathname of the first instance of FILE starting from the current directory towards root.
|
||||
This may not do the correct thing in presence of links. If it does not find FILE, then it shall return the name
|
||||
of FILE in the current directory, suitable for creation"
|
||||
(let ((root (expand-file-name "/"))) ; the win32 builds should translate this correctly
|
||||
(expand-file-name file
|
||||
(loop
|
||||
for d = default-directory then (expand-file-name ".." d)
|
||||
if (file-exists-p (expand-file-name file d))
|
||||
return d
|
||||
if (equal d root)
|
||||
return nil))))
|
||||
|
||||
(defun user--c-lsp-set-priority (server priority)
|
||||
(setf (lsp--client-priority (gethash server lsp-clients)) priority))
|
||||
|
||||
(defun user--c-mode-common-hook ()
|
||||
"C-like languages mode hook."
|
||||
(add-many-to-list 'c-default-style '(c-mode . "bsd") '(c++-mode . "bsd"))
|
||||
|
||||
(setq tab-width 4)
|
||||
|
||||
;; Propertize "#if 0" regions as comments.
|
||||
(font-lock-add-keywords
|
||||
nil
|
||||
'((user/c-mode-font-lock-if0 (0 font-lock-comment-face prepend)))
|
||||
'add-to-end)
|
||||
|
||||
;; Change compile-command.
|
||||
(set
|
||||
(make-local-variable 'compile-command)
|
||||
(format "make -C %s" (directory-file-name (file-name-directory (user--c-get-closest-pathname)))))
|
||||
;; Avoid to hit enter after compile-command to build.
|
||||
(setq compilation-read-command nil)
|
||||
|
||||
;; Separate camel-case into separate words.
|
||||
(subword-mode t)
|
||||
|
||||
(when (feature-p 'mic-paren)
|
||||
;; Match context to open parentheses.
|
||||
(paren-toggle-open-paren-context t))
|
||||
|
||||
(setq flycheck-checker-error-threshold 1000)
|
||||
|
||||
(setq flycheck-local-checkers '((lsp . ((next-checkers . (flawfinder))))))
|
||||
;; (flycheck-add-next-checker 'clang-analyzer 'flawfinder)
|
||||
|
||||
(user/smartparens-enable))
|
||||
|
||||
(defun user/c-mode-font-lock-if0 (limit)
|
||||
"Propertize '#if 0' regions, up to LIMIT in size, as comments."
|
||||
(save-restriction
|
||||
(widen)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let ((depth 0) str start start-depth)
|
||||
(while (re-search-forward "^\\s-*#\\s-*\\(if\\|else\\|endif\\)" limit 'move)
|
||||
(setq str (match-string 1))
|
||||
(if (string= str "if")
|
||||
(progn
|
||||
(setq depth (1+ depth))
|
||||
(when (and (null start) (looking-at "\\s-+0"))
|
||||
(setq start (match-end 0)
|
||||
start-depth depth)))
|
||||
(when (and start (= depth start-depth))
|
||||
(c-put-font-lock-face start (match-beginning 0) 'font-lock-comment-face)
|
||||
(setq start nil))
|
||||
(when (string= str "endif")
|
||||
(setq depth (1- depth)))))
|
||||
(when (and start (> depth 0))
|
||||
(c-put-font-lock-face start (point) 'font-lock-comment-face)))))
|
||||
nil)
|
||||
|
||||
|
||||
(defun user/c++-header-file-p ()
|
||||
"Return non-nil if in a C++ header."
|
||||
(and (string-match "\\.h$" (or (buffer-file-name) (buffer-name)))
|
||||
(save-excursion (re-search-forward "\\_<class\\_>" nil t))))
|
||||
|
||||
;; https://www.gnu.org/software/emacs/manual/html_mono/ccmode.html
|
||||
(use-package cc-mode
|
||||
:defer
|
||||
:hook
|
||||
(c-mode-common-hook . user--c-mode-common-hook)
|
||||
(c-mode-common-hook . hs-minor-mode)
|
||||
(c-mode-common-hook . lsp-deferred)
|
||||
(c-mode-common-hook . (lambda ()
|
||||
(add-hook 'before-save-hook #'user--c-format-before-save nil t)))
|
||||
:init
|
||||
;; Detect if inside a C++ header file.
|
||||
(add-magic-mode 'c++-mode 'user/c++-header-file-p)
|
||||
:config
|
||||
(add-many-to-list 'c-default-style '(c-mode . "bsd") '(c++-mode . "bsd")
|
||||
)
|
||||
|
||||
;;; (Packages) ;;;
|
||||
;; https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/cc-vars.el
|
||||
;; user customization variables for CC Mod
|
||||
(use-package cc-vars
|
||||
:disabled
|
||||
:ensure cc-mode
|
||||
:config
|
||||
(validate-setq
|
||||
;; Support completion using tab.
|
||||
c-tab-always-indent nil
|
||||
c-insert-tab-function 'indent-for-tab-command)
|
||||
)
|
||||
|
||||
;; https://github.com/randomphrase/company-c-headers
|
||||
;; Auto-completion for C/C++ headers using Company
|
||||
(use-package company-c-headers
|
||||
:after (company))
|
||||
|
||||
;; https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-clangd.el
|
||||
;; LSP clients for the C Languages Family
|
||||
(use-package lsp-clangd
|
||||
:after (company lsp)
|
||||
;; :defer t
|
||||
:config
|
||||
;; set priority to ensure the use of clangd
|
||||
(setq company-backends '(company-capf))
|
||||
(user--c-lsp-set-priority 'clangd 1))
|
||||
|
||||
;; https://github.com/MaskRay/emacs-ccls
|
||||
;; Emacs client for ccls, a C/C++ language server
|
||||
(use-package ccls
|
||||
:if (executable-find "ccls")
|
||||
:after lsp
|
||||
:config
|
||||
(user--c-lsp-set-priority 'ccls -1)
|
||||
(validate-setq
|
||||
ccls-initialization-options
|
||||
'(:index (:comments 1) :cacheFormat "msgpack")))
|
||||
|
||||
;; https://github.com/alexmurray/flycheck-flawfinder
|
||||
;; Integrate flawfinder with flycheck to automatically check for possible security weaknesses
|
||||
;; within your C/C++ code on the fly.
|
||||
(use-package flycheck-flawfinder
|
||||
:disabled
|
||||
:ensure t
|
||||
:if (executable-find "flawfinder")
|
||||
:config
|
||||
(flycheck-flawfinder-setup))
|
||||
)
|
||||
|
||||
(provide 'modes/c-c++)
|
||||
;;; c-c++.el ends here
|
15
lisp/modes/dot.el
Normal file
15
lisp/modes/dot.el
Normal file
@@ -0,0 +1,15 @@
|
||||
;;; markdown --- initializes Dot modes -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
;; https://github.com/ppareit/graphviz-dot-mode
|
||||
;; Emacs mode for the DOT language, used by graphviz.
|
||||
(use-package graphviz-dot-mode
|
||||
:init
|
||||
(use-package company-graphviz-dot)
|
||||
:config
|
||||
(setq graphviz-dot-preview-extension "svg")
|
||||
(setq graphviz-dot-indent-width 2))
|
||||
|
||||
(provide 'modes/dot)
|
||||
;;; dot.el ends here
|
76
lisp/modes/fundamental.el
Normal file
76
lisp/modes/fundamental.el
Normal file
@@ -0,0 +1,76 @@
|
||||
;;; fundamental.el --- Base mode of all other major modes -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun user--fundamental-mode-hook ()
|
||||
"Fundamental mode hook."
|
||||
|
||||
(with-feature 'undo-tree
|
||||
(undo-tree-mode t))
|
||||
|
||||
(auto-fill-mode t)
|
||||
|
||||
;; Enable whitespace mode globally.
|
||||
;;(whitespace-mode t)
|
||||
|
||||
(with-feature 'rainbow-delimiters
|
||||
(rainbow-delimiters-mode t))
|
||||
|
||||
;; Enable dtrt-indent to attempt to identify the indentation rules used.
|
||||
(with-eval-after-load 'dtrt-indent
|
||||
(dtrt-indent-mode t))
|
||||
|
||||
;;; (Bindings) ;;;
|
||||
(user/bind-key-local :code :align 'align-current)
|
||||
(when (feature-p 'helm)
|
||||
(user/bind-key-local :nav :functions/toc 'helm-imenu)))
|
||||
|
||||
|
||||
(defun user--fundamental-mode-config ()
|
||||
"Initialize Emacs fundamental mode."
|
||||
(validate-setq
|
||||
;; When using fill-paragraph or auto-fill-mode break lines at 80 characters by
|
||||
;; default.
|
||||
fill-column 120)
|
||||
|
||||
;;; (Packages) ;;;
|
||||
;;; https://github.com/Fanael/rainbow-delimiters
|
||||
(use-package rainbow-delimiters
|
||||
:ensure t)
|
||||
;; https://www.emacswiki.org/emacs/MicParen
|
||||
(use-package mic-paren
|
||||
:ensure t
|
||||
:config
|
||||
(paren-activate))
|
||||
;; https://github.com/Lindydancer/dynamic-spaces
|
||||
(use-package dynamic-spaces
|
||||
:disabled
|
||||
:config
|
||||
(dynamic-spaces-global-mode t))
|
||||
;; https://github.com/terlar/indent-info.el
|
||||
(use-package indent-info
|
||||
:ensure t
|
||||
:config
|
||||
(global-indent-info-mode t))
|
||||
;; https://github.com/shawcm/goldendict-emacs
|
||||
(use-package goldendict
|
||||
:disabled
|
||||
:if (executable-find "goldendict")
|
||||
:bind-wrap
|
||||
((:key :doc :dictionary) . goldendict-dwim))
|
||||
;; https://www.emacswiki.org/emacs/FillAdapt
|
||||
(use-package filladapt
|
||||
:disabled)
|
||||
|
||||
;; https://github.com/fritzgrabo/cascading-dir-locals
|
||||
;; Emacs: Apply all (!) .dir-locals.el from root to current directory.
|
||||
(use-package cascading-dir-locals
|
||||
:ensure t
|
||||
:config
|
||||
(cascading-dir-locals-mode 1)))
|
||||
|
||||
(user--fundamental-mode-config)
|
||||
|
||||
|
||||
(provide 'modes/fundamental)
|
||||
;;; fundamental.el ends here
|
112
lisp/modes/javascript.el
Normal file
112
lisp/modes/javascript.el
Normal file
@@ -0,0 +1,112 @@
|
||||
;;; javascript.el --- initializes JavaScript modes -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun user--javascript-mode-common-hook ()
|
||||
"JavaScript common mode hook."
|
||||
;; ;; Load CEDET
|
||||
;; (user--javascript-mode-cedet-hook)
|
||||
|
||||
;; (user/gnu-global-enable)
|
||||
|
||||
(flycheck-mode t)
|
||||
|
||||
;; (tern-mode t)
|
||||
)
|
||||
|
||||
|
||||
(defun user--javascript-mode-hook ()
|
||||
"JavaScript mode hook."
|
||||
(user--javascript-mode-common-hook))
|
||||
|
||||
|
||||
(defun user--inferior-js-mode-hook ()
|
||||
"Inferior JavaScript mode hook."
|
||||
;; Support ANSI colors.
|
||||
(ansi-color-for-comint-mode-on))
|
||||
|
||||
|
||||
(defun user--js2-mode-hook ()
|
||||
"JS2 mode hook."
|
||||
(user--javascript-mode-common-hook)
|
||||
;; Enable smart indentation
|
||||
(smart-tabs-mode t)
|
||||
;; Enable Flycheck
|
||||
(flycheck-mode t))
|
||||
|
||||
|
||||
;; (defun user--javascript-mode-cedet-hook ()
|
||||
;; "JavaScript CEDET support hook."
|
||||
;; (with-feature 'semantic/wisent/javascript
|
||||
;; (wisent-javascript-setup-parser)
|
||||
;; ;; (user--cedet-hook)
|
||||
;; ))
|
||||
|
||||
;;
|
||||
;;
|
||||
(use-package js
|
||||
:defer
|
||||
:hook ((javascript-mode-hook . user--javascript-mode-hook)
|
||||
(inferior-js-mode-hook . user--inferior-javascript-mode-hook)))
|
||||
|
||||
;; https://github.com/mooz/js2-mode
|
||||
;; Improved JavaScript editing mode for GNU Emacs
|
||||
(use-package js2-mode
|
||||
:defer
|
||||
:mode "\.[m]js$"
|
||||
;; :mode "\.ts$"
|
||||
:magic "#!/usr/bin/env node"
|
||||
:hook (js2-mode-hook . user--js2-mode-hook)
|
||||
:config
|
||||
(validate-setq
|
||||
;; ;; Configure indentation
|
||||
;; (setq js2-enter-indents-newline t)
|
||||
;; (setq js2-auto-indent-p t)
|
||||
;; Idle timeout before reparsing buffer
|
||||
js2-idle-timer-delay 0.5
|
||||
;; Disable error parsing in favor of Flycheck
|
||||
js2-strict-missing-semi-warning nil)
|
||||
|
||||
;; https://github.com/redguardtoo/js-comint
|
||||
;; js-comint will send the code from Emacs into node.js or rhino
|
||||
(use-package js-comint
|
||||
:disabled
|
||||
:config
|
||||
(validate-setq
|
||||
;; Set JavaScript inferior.
|
||||
inferior-js-program-command
|
||||
(cond
|
||||
((executable-find "js") (executable-find "js"))
|
||||
((executable-find "node")
|
||||
(concat (executable-find "node") " --interactive"))
|
||||
(t "java org.mozilla.javascript.tools.shell.Main")))
|
||||
|
||||
;; Workaround for Node.js prompt.
|
||||
(setenv "NODE_NO_READLINE" "1"))
|
||||
|
||||
;; https://github.com/prettier/prettier-emacs
|
||||
;; Minor mode to format JS code on file save
|
||||
(use-package prettier-js
|
||||
:disabled)
|
||||
|
||||
;; https://emacs-lsp.github.io/lsp-mode/page/lsp-typescript-javascript/
|
||||
(use-package lsp-javascript-typescript
|
||||
:disabled
|
||||
:if (executable-find "javascript-typescript-langserver")
|
||||
:hook (js2-mode-hook . lsp-javascript-typescript-enable))
|
||||
|
||||
;; https://github.com/torgeir/helm-js-codemod.el
|
||||
;; A helm interface for running js-codemod.el
|
||||
(use-package helm-js-codemod
|
||||
:disabled
|
||||
:if (executable-find "jscodeshift"))
|
||||
|
||||
;; https://github.com/js-emacs/xref-js2
|
||||
;; Jump to references/definitions using ag & js2-mode's AST in Emacs
|
||||
(use-package xref-js2
|
||||
:init
|
||||
(add-hook 'xref-backend-functions #'xref-js2-xref-backend nil t)))
|
||||
|
||||
|
||||
(provide 'modes/javascript)
|
||||
;;; javascript.el ends here
|
32
lisp/modes/makefile.el
Normal file
32
lisp/modes/makefile.el
Normal file
@@ -0,0 +1,32 @@
|
||||
;;; makefile.el --- Initializes Makefile mode -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
;; Sets some decent defaults for makefile-mode
|
||||
(defun user--makefile-mode-hook ()
|
||||
"Initialize makefile mode."
|
||||
(setq
|
||||
;; Use tabs for indent.
|
||||
indent-tabs-mode t)
|
||||
;; Disable whitespace mode settings that don't make sense in makefiles.
|
||||
(user/whitespace-disable-style '(indentation space-after-tab))
|
||||
;; Separate camel-case into separate words.
|
||||
(subword-mode t)
|
||||
;; Support for documentation in Doxygen format.
|
||||
;; (with-feature 'doxymacs
|
||||
;; (doxymacs-mode t))
|
||||
|
||||
(with-feature 'makefile-executor
|
||||
(makefile-executor-mode t)))
|
||||
|
||||
(use-package make-mode
|
||||
:defer
|
||||
:mode ("\.\(mak\|mif\|wat\)$" . makefile-mode)
|
||||
:init
|
||||
(add-hook 'makefile-mode-hook 'user--makefile-mode-hook)
|
||||
:config
|
||||
(use-package makefile-executor))
|
||||
|
||||
|
||||
(provide 'modes/makefile)
|
||||
;;; makefile.el ends here
|
91
lisp/modes/markdown.el
Normal file
91
lisp/modes/markdown.el
Normal file
@@ -0,0 +1,91 @@
|
||||
;;; markdown --- initializes Markdown modes -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defconst *user-flymd-cache-directory*
|
||||
(path-join *user-cache-directory* "flymd")
|
||||
"Path to user's FLYMD cache store.")
|
||||
|
||||
|
||||
(defun user--markdown-mode-hook ()
|
||||
"Markdown mode hook."
|
||||
(user/smartparens-enable)
|
||||
|
||||
;; org-mode table editing tools.
|
||||
(orgtbl-mode t))
|
||||
|
||||
;; https://github.com/jrblevin/markdown-mode
|
||||
;; Emacs Markdown Mode
|
||||
(use-package markdown-mode
|
||||
:defer
|
||||
:hook (markdown-mode-hook . user--markdown-mode-hook)
|
||||
:mode (("README\\.md\\'" . gfm-mode)
|
||||
("\\.md\\'" . markdown-mode)
|
||||
("\\.markdown\\'" . markdown-mode))
|
||||
:config
|
||||
(setq markdown-fontify-code-blocks-natively t)
|
||||
(setq markdown-command "pandoc -f gfm --highlight-style kate")
|
||||
(setq markdown-css-paths (list (path-join user-emacs-directory "markdown_style.css")))
|
||||
(setq markdown-xhtml-body-preamble "\<article class=\"markdown-body\">")
|
||||
|
||||
;; Thanks to https://gist.github.com/yryozo/5807243
|
||||
;; Orgtbl Translator function for the GitHub-Flavored-Markdown(GFM)
|
||||
;; Usage Example:
|
||||
;;
|
||||
;; <!-- BEGIN RECEIVE ORGTBL ${1:YOUR_TABLE_NAME} -->
|
||||
;; <!-- END RECEIVE ORGTBL $1 -->
|
||||
;;
|
||||
;; <!--
|
||||
;; #+ORGTBL: SEND $1 orgtbl-to-gfm
|
||||
;; | $0 |
|
||||
;; -->
|
||||
(defun orgtbl-to-gfm (table params)
|
||||
"Convert the Orgtbl mode TABLE to GitHub Flavored Markdown."
|
||||
(let* ((alignment (mapconcat (lambda (x) (if x "|--:" "|---"))
|
||||
org-table-last-alignment ""))
|
||||
(params2
|
||||
(list
|
||||
:splice t
|
||||
:hline (concat alignment "|")
|
||||
:lstart "| " :lend " |" :sep " | ")))
|
||||
(orgtbl-to-generic table (org-combine-plists params2 params))))
|
||||
|
||||
;; https://github.com/mmark-md/flycheck-mmark
|
||||
;; Flycheck checker for the MMark markdown processor
|
||||
(use-package flycheck-mmark
|
||||
:disabled
|
||||
:if (executable-find "mmark")
|
||||
:hook (flycheck-mode-hook . flycheck-mmark-setup))
|
||||
|
||||
;; https://github.com/polymode/poly-markdown
|
||||
;; Polymode for markdown-mode
|
||||
(use-package poly-markdown
|
||||
:after polymode
|
||||
:hook (markdown-mode-hook . poly-markdown-mode))
|
||||
|
||||
;; https://github.com/niku/markdown-preview-eww
|
||||
;; Realtime markdown preview by eww
|
||||
(use-package markdown-preview-eww)
|
||||
|
||||
;; https://github.com/ajtulloch/mkdown.el
|
||||
;; A small library that improves the look of Markdown previews from Emacs, using the style of mkdown.com.
|
||||
(use-package mkdown
|
||||
:disabled
|
||||
:config
|
||||
(add-to-list 'markdown-css-paths mkdown-css-file-name))
|
||||
|
||||
|
||||
;; https://github.com/shime/emacs-livedown
|
||||
;; Emacs plugin for Livedown.
|
||||
(use-package livedown
|
||||
:disabled
|
||||
:if (executable-find "livedown")
|
||||
:quelpa (livedown
|
||||
:fetcher github
|
||||
:repo "shime/emacs-livedown")
|
||||
:init
|
||||
(require 'livedown)))
|
||||
|
||||
|
||||
(provide 'modes/markdown)
|
||||
;;; markdown.el ends here
|
954
lisp/modes/org.el
Normal file
954
lisp/modes/org.el
Normal file
@@ -0,0 +1,954 @@
|
||||
;;; org.el --- Org mode support -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defconst *user-org-data-directory*
|
||||
(path-join *user-data-directory* "org")
|
||||
"Path to user's org data store.")
|
||||
|
||||
(defconst *user-org-cache-directory*
|
||||
(path-join *user-cache-directory* "org")
|
||||
"Path to user's org cache store.")
|
||||
|
||||
(defvar user/org-mobile-sync-timer nil
|
||||
"Timer used for syncing OrgMobile.")
|
||||
|
||||
(defvar user/org-mobile-sync-secs (* 60 20)
|
||||
"Interval of OrgMobile sync in seconds.")
|
||||
|
||||
|
||||
(defun user--org-mode-hook ()
|
||||
"Org mode hook."
|
||||
(unless (derived-mode-p 'text-mode)
|
||||
(user--text-mode-hook))
|
||||
|
||||
(with-feature 'org-sticky-header
|
||||
;; Enable sticky org mode header.
|
||||
(org-sticky-header-mode t))
|
||||
|
||||
;; Highlighting lines that are too long since it often causes false
|
||||
;; positives on URLs.
|
||||
(user/whitespace-disable-style '(lines lines-tail))
|
||||
|
||||
(rainbow-delimiters-mode-disable)
|
||||
|
||||
(setq
|
||||
;; Proper filling of org-mode text, form:
|
||||
;; * http://lists.gnu.org/archive/html/emacs-orgmode/2008-01/msg00375.html
|
||||
paragraph-separate
|
||||
"\f\\|\\*+ \\|[ ]*$\\| [ \t]*[:|]\\|^[ \t]+\\[[0-9]\\{4\\}-"
|
||||
paragraph-start
|
||||
(concat "\f\\|[ ]*$\\|\\*+ \\|\f\\|[ \t]*\\([-+*][ \t]+\\|"
|
||||
"[0-9]+[.)][ \t] +\\)\\|[ \t]*[:|]\\|"
|
||||
"^[ \t]+\\[[0-9]\\{4\\}-"))
|
||||
|
||||
(with-feature 'org-table-sticky-header
|
||||
;; Enable sticky headers for tables.
|
||||
(org-table-sticky-header-mode t))
|
||||
|
||||
(user/smartparens-enable)
|
||||
|
||||
(org-bullets-mode t)
|
||||
|
||||
;;; (Bindings) ;;;
|
||||
(user/bind-key-local :basic :open-buffer-context 'org-iswitchb)
|
||||
(user/bind-key-local :basic :narrow-to-page 'org-narrow-to-subtree)
|
||||
(user/bind-key-local :basic :narrow-to-region 'org-narrow-to-block)
|
||||
(user/bind-key-local :basic :narrow-to-function 'org-narrow-to-element)
|
||||
(user/bind-key-local :code :context-promote 'org-shiftup)
|
||||
(user/bind-key-local :code :context-demote 'org-shiftdown))
|
||||
|
||||
|
||||
(defun user--org-agenda-finalize-hook ()
|
||||
"Org agenda display hook."
|
||||
;; Enable appointment notifications.
|
||||
(org-agenda-to-appt t))
|
||||
|
||||
|
||||
(defun user--org-load-hook ()
|
||||
"Org-mode loaded hook."
|
||||
(when (not noninteractive)
|
||||
;; Resume clocking tasks when Emacs is restarted.
|
||||
(org-clock-persistence-insinuate))
|
||||
|
||||
;; Load modules.
|
||||
(when org-modules-loaded
|
||||
(org-load-modules-maybe 'force))
|
||||
|
||||
;; ;; Load Babel languages.
|
||||
;; (org-babel-do-load-languages 'org-babel-load-languages
|
||||
;; org-babel-load-languages))
|
||||
)
|
||||
|
||||
|
||||
(defun user/org-open-at-point (&optional arg)
|
||||
"Like `org-open-at-point' but will use external browser with prefix ARG."
|
||||
(interactive "P")
|
||||
(if (not arg)
|
||||
(org-open-at-point)
|
||||
(let ((browse-url-browser-function #'browse-url-default-browser))
|
||||
(org-open-at-point))))
|
||||
|
||||
|
||||
(defun user/org-annotate-file-storage-file ()
|
||||
"Get the path to the annotation storage file."
|
||||
(or (with-project-root project-root (path-abs-buffer)
|
||||
(path-join project-root (concat (user/proj-name project) ".org")))
|
||||
org-annotate-file-storage-file))
|
||||
|
||||
|
||||
(defun user/org-annotate-file ()
|
||||
"Annotate the current buffer."
|
||||
(interactive)
|
||||
(with-feature 'org-annotate-file
|
||||
(let ((storage-file (user/org-annotate-file-storage-file))
|
||||
(popwin-config '(:position :bottom)))
|
||||
(popwin:display-buffer-1 (org-annotate-file-show-section storage-file)
|
||||
:default-config-keywords popwin-config))))
|
||||
|
||||
|
||||
;; (defun user/org-mobile-sync-pull-and-push ()
|
||||
;; "Sync OrgMobile directory."
|
||||
;; (org-mobile-pull)
|
||||
;; (org-mobile-push)
|
||||
;; (with-eval-after-load 'sauron
|
||||
;; (sauron-add-event 'my 3 "Called org-mobile-pull and org-mobile-push")))
|
||||
|
||||
|
||||
;; (defun user/org-mobile-sync-start ()
|
||||
;; "Start automated `org-mobile-push'."
|
||||
;; (interactive)
|
||||
;; (setq user/org-mobile-sync-timer
|
||||
;; (run-with-idle-timer user/org-mobile-sync-secs t
|
||||
;; 'user/org-mobile-sync-pull-and-push)))
|
||||
|
||||
|
||||
;; (defun user/org-mobile-sync-stop ()
|
||||
;; "Stop automated `org-mobile-push'."
|
||||
;; (interactive)
|
||||
;; (cancel-timer user/org-mobile-sync-timer))
|
||||
|
||||
|
||||
(use-package org
|
||||
:init
|
||||
;; Create data and cache stores.
|
||||
(make-directory *user-org-data-directory* t)
|
||||
(make-directory *user-org-cache-directory* t)
|
||||
;; Fix for EIN if org hasn't been setup yet.
|
||||
(autoload 'org-add-link-type "org" "" t)
|
||||
:hook
|
||||
((org-load-hook . user--org-load-hook)
|
||||
(org-mode-hook . user--org-mode-hook))
|
||||
:bind
|
||||
(:map org-mode-map
|
||||
("C-c C-o" . user/org-open-at-point))
|
||||
:config
|
||||
;; https://github.com/sabof/org-bullets
|
||||
;; utf-8 bullets for org-mode
|
||||
(use-package org-bullets)
|
||||
|
||||
;; (use-package org-plus-contrib
|
||||
;; :ensure t
|
||||
;; :no-require t)
|
||||
|
||||
(validate-setq
|
||||
;; Org data store.
|
||||
org-directory *user-org-data-directory*
|
||||
;; Notes data store.
|
||||
;; org-default-notes-file (path-join *user-org-data-directory* "refile.org")
|
||||
;; Pressing return on a link follows it.
|
||||
org-return-follows-link t
|
||||
;; Log time for TODO state changes.
|
||||
;; org-log-done 'time
|
||||
;; Log time when rescheduling an entry.
|
||||
;; org-log-reschedule 'time
|
||||
;; org-log-redeadline 'time
|
||||
;; Round clock times to 15 minute increments.
|
||||
;; org-time-stamp-rounding-minutes (quote (1 15))
|
||||
;; Log drawer state changes.
|
||||
;; org-log-into-drawer t
|
||||
;; Allow single letter commands at beginning of headlines.
|
||||
;; org-use-speed-commands t
|
||||
|
||||
;; Don't use the image width when inlining
|
||||
org-image-actual-width nil
|
||||
;; Fontify code blocks by default.
|
||||
org-src-fontify-natively t
|
||||
;; Tab should operate according to local mode.
|
||||
org-src-tab-acts-natively t
|
||||
;; Disable the indentation increases by one space in a demotion command
|
||||
org-adapt-indentation nil
|
||||
;; Don't preserve source code indentation so it can be adapted to document.
|
||||
org-src-preserve-indentation nil
|
||||
org-edit-src-content-indentation 0
|
||||
;; Prevent editing of invisible regions.
|
||||
org-catch-invisible-edits 'error
|
||||
;; Allow fast state transitions.
|
||||
;; org-use-fast-todo-selection 'auto
|
||||
;; Do not record timestamp when using S-cursor to change state.
|
||||
;; org-treat-S-cursor-todo-selection-as-state-change nil
|
||||
;; Start in folded view.
|
||||
org-startup-folded t
|
||||
;; Enable speed commands.
|
||||
org-use-speed-commands t
|
||||
org-speed-commands-user
|
||||
'(("0" . 'delete-window)
|
||||
("1" . 'delete-other-windows)
|
||||
("2" . 'split-window-vertically)
|
||||
("3" . 'split-window-horizontally)
|
||||
("h" . 'hide-other)
|
||||
("s" . 'org-save-all-org-buffers)
|
||||
("z" . 'org-add-note)
|
||||
("N" . 'org-narrow-to-subtree)
|
||||
("W" . 'widen)
|
||||
("m" . 'org-mark-subtree)))
|
||||
|
||||
(when (eq default-terminal-coding-system 'utf-8)
|
||||
(validate-setq
|
||||
;; Prettify content using UTF-8.
|
||||
org-pretty-entities t))
|
||||
|
||||
;; (setq org-todo-keyword-faces
|
||||
;; (quote (("DONE" :foreground "red" :weight bold))))
|
||||
|
||||
;; TODO
|
||||
;; Incompatible with validate-setq.
|
||||
;; (setq
|
||||
;; State transitions (http://doc.norang.ca/org-mode.html).
|
||||
;; org-todo-keywords
|
||||
;; (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
|
||||
;; (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE"
|
||||
;; "MEETING")))
|
||||
;; Triggered state changes.
|
||||
;; org-todo-state-tags-triggers
|
||||
;; (quote (("CANCELLED" ("CANCELLED" . t))
|
||||
;; ("WAITING" ("WAITING" . t))
|
||||
;; ("HOLD" ("WAITING") ("HOLD" . t))
|
||||
;; (done ("WAITING") ("HOLD"))
|
||||
;; ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
|
||||
;; ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
|
||||
;; ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
|
||||
|
||||
;; (add-many-to-list
|
||||
;; 'org-modules
|
||||
;; ;; File attachment manager.
|
||||
;; 'org-attach
|
||||
;; ;; Link to BibTeX entries.
|
||||
;; 'org-bibtex
|
||||
;; ;; Link to tags.
|
||||
;; 'org-ctags
|
||||
;; ;; Link to articles and messages in Gnus.
|
||||
;; 'org-gnus
|
||||
;; ;; Habit tracking.
|
||||
;; 'org-habit
|
||||
;; ;; Support links to info pages.
|
||||
;; 'org-info
|
||||
;; ;; Support links to man pages.
|
||||
;; 'org-man
|
||||
;; ;; Export org buffer to MIME email message.
|
||||
;; 'org-mime
|
||||
;; ;; Allow external applications to talk to org.
|
||||
;; 'org-protocol
|
||||
;; ;; Embed source code in org-mode.
|
||||
;; 'org-src)
|
||||
|
||||
;; (when (feature-p 'bbdb)
|
||||
;; (add-to-list 'org-modules 'org-bbdb))
|
||||
;; (when (feature-p 'emacs-w3m)
|
||||
;; (add-to-list 'org-modules 'org-w3m))
|
||||
;; (when (feature-p 'wanderlust)
|
||||
;; (add-to-list 'org-modules 'org-wl))
|
||||
;; (with-executable 'git
|
||||
;; (add-to-list 'org-modules 'org-git-link))
|
||||
|
||||
;; (setq org-agenda-files '("~/org/GPE_OBIF.org"))
|
||||
;; (setq org-default-notes-file "~/org/GPE_OBIF.org" initial-buffer-choice org-default-notes-file)
|
||||
(setq org-duration-format (quote h:mm))
|
||||
(setq org-hierarchical-todo-statistics nil)
|
||||
(setq org-startup-folded "folded")
|
||||
(setq org-todo-keywords '((sequence "TODO" "|" "DONE" "REJECTED")))
|
||||
|
||||
(when (display-graphic-p)
|
||||
(validate-setq
|
||||
;; Display inline images when starting up.
|
||||
org-startup-with-inline-images t))
|
||||
|
||||
;; https://orgmode.org/manual/Refile-and-Copy.html
|
||||
(use-package org-refile
|
||||
:ensure nil
|
||||
:config
|
||||
(validate-setq
|
||||
;; Allow refile to create parent tasks, with confirmation.
|
||||
org-refile-allow-creating-parent-nodes 'confirm
|
||||
;; Cache refile operations for performance.
|
||||
org-refile-use-cache t))
|
||||
|
||||
;; https://www.gnu.org/software/emacs/manual/html_node/org/Tables.html
|
||||
(use-package org-table
|
||||
:ensure nil
|
||||
:config
|
||||
;; https://github.com/cute-jumper/org-table-sticky-header
|
||||
;; A minor mode to show the sticky header for org-mode tables.
|
||||
(use-package org-table-sticky-header))
|
||||
|
||||
;; https://orgmode.org/manual/Capture.html
|
||||
;; https://www.labri.fr/perso/nrougier/GTD/index.html
|
||||
(use-package org-capture
|
||||
:ensure nil
|
||||
:init
|
||||
(user/bind-key-global :apps :capture-task 'org-capture)
|
||||
:config
|
||||
;; Incompatible with validate-setq.
|
||||
;; TODO
|
||||
;; (setq
|
||||
;; Capture templates.
|
||||
;; org-capture-templates
|
||||
;; (quote (("t" "todo" entry (file org-default-notes-file)
|
||||
;; "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
|
||||
;; ("r" "respond" entry (file org-default-notes-file)
|
||||
;; "* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n"
|
||||
;; :clock-in t :clock-resume t :immediate-finish t)
|
||||
;; ("n" "note" entry (file org-default-notes-file)
|
||||
;; "* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
|
||||
;; ("j" "Journal" entry
|
||||
;; (file+datetree (path-join *user-org-data-directory* "diary.org"))
|
||||
;; "* %?\n%U\n" :clock-in t :clock-resume t)
|
||||
;; ("w" "org-protocol" entry (file org-default-notes-file)
|
||||
;; "* TODO Review %c\n%U\n" :immediate-finish t)
|
||||
;; ("m" "Meeting" entry (file org-default-notes-file)
|
||||
;; "* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
|
||||
;; ("p" "Phone call" entry (file "~/git/org/refile.org")
|
||||
;; "* PHONE %? :PHONE:\n%U" :clock-in t :clock-resume t)
|
||||
;; ("h" "Habit" entry (file org-default-notes-file)
|
||||
;; (concat "* NEXT %?\n%U\n%a\n"
|
||||
;; "SCHEDULED: "
|
||||
;; "%(format-time-string \"<%Y-%m-%d %a .+1d/3d>\")\n:"
|
||||
;; "PROPERTIES:\n:STYLE: habit\n"
|
||||
;; ":REPEAT_TO_STATE: NEXT\n:END:\n")))))
|
||||
|
||||
;; https://github.com/tkf/org-mode/blob/master/lisp/org-id.el
|
||||
;; Global identifiers for Org-mode entries
|
||||
(use-package org-id
|
||||
:disabled
|
||||
:ensure nil
|
||||
:config
|
||||
(validate-setq
|
||||
org-id-locations-file
|
||||
(path-join *user-org-data-directory* "org-id-locations")))
|
||||
|
||||
;; https://github.com/grugrut/helm-books/tree/625aadec1541a5ca36951e4ce1301f4b6fe2bf3f
|
||||
;; Book search interface for emacs helm.
|
||||
(use-package helm-books
|
||||
:disabled
|
||||
:config
|
||||
(add-to-list
|
||||
'org-capture-templates
|
||||
'("b" "book memo" entry
|
||||
(file (concat org-directory "book.org"))
|
||||
"* %(helm-books)")))
|
||||
|
||||
;; https://github.com/Chobbes/org-chef
|
||||
;; A package for making a cookbook and managing recipes with org-mode.
|
||||
(use-package org-chef
|
||||
:disabled
|
||||
:config
|
||||
(add-to-list
|
||||
'org-capture-templates
|
||||
`("c" "Cookbook" entry
|
||||
(file ,(path-join *user-org-data-directory* "cookbook.org"))
|
||||
"%(org-chef-get-recipe-from-url)"
|
||||
:empty-lines 1)))
|
||||
|
||||
;; https://github.com/waymondo/org-repo-todo
|
||||
;; Simple repository todo management with org-mode
|
||||
(use-package org-repo-todo))
|
||||
|
||||
;; https://github.com/emacs-mirror/emacs/blob/master/lisp/org/ob-core.el
|
||||
;; Working with Code Blocks
|
||||
(use-package ob-core
|
||||
:ensure nil
|
||||
:config
|
||||
(validate-setq
|
||||
;; Don't ask for validation.
|
||||
org-confirm-babel-evaluate nil)
|
||||
|
||||
(add-many-to-list
|
||||
'org-babel-load-languages
|
||||
;; Emacs Lisp
|
||||
'(emacs-lisp . t)
|
||||
;; Shell script
|
||||
'(shell . t))
|
||||
|
||||
(let ((to-load '((emacs-lisp . t) (shell . t))))
|
||||
(with-executable 'g++
|
||||
(push '(C . t) to-load)
|
||||
;; Use of lsp-clangd for C/C++
|
||||
(setq org-babel-C++-compiler "bear g++"))
|
||||
(with-executable 'dot
|
||||
(push '(dot . t) to-load))
|
||||
(with-executable 'ghc
|
||||
(push '(haskell . t) to-load))
|
||||
(with-executable 'gnuplot
|
||||
(push '(gnuplot . t) to-load))
|
||||
(with-executable 'latex
|
||||
(push '(latex . t) to-load))
|
||||
(with-executable 'perl
|
||||
(push '(perl . t) to-load))
|
||||
(with-executable 'python
|
||||
(push '(python . t) to-load))
|
||||
(with-executable 'R
|
||||
(push '(R . t) to-load))
|
||||
(with-executable 'ruby
|
||||
(push '(ruby . t) to-load))
|
||||
|
||||
(when (feature-p 'plantuml-mode)
|
||||
;; https://github.com/skuro/plantuml-mode
|
||||
;; A major mode for editing PlantUML sources in Emacs
|
||||
(use-package ob-plantuml
|
||||
:ensure nil
|
||||
:after modes/plantuml
|
||||
:config
|
||||
(validate-setq
|
||||
org-plantuml-jar-path *user-plantuml-jar-path*))
|
||||
(push '(plantuml . t) to-load))
|
||||
|
||||
(org-babel-do-load-languages 'org-babel-load-languages to-load))
|
||||
|
||||
;; https://github.com/dfeich/helm-lib-babel/tree/41bc0cdea8a604c6c8dc83ed5066644d33688fad
|
||||
;; Emacs helm extension for inserting a reference to an org source block function
|
||||
(use-package helm-lib-babel)
|
||||
;; https://github.com/astahlman/ob-async
|
||||
;; Asynchronous src_block execution for org-babel
|
||||
(use-package ob-async
|
||||
:defer
|
||||
:config
|
||||
(add-to-list
|
||||
;; Execute org-babel asynchronously.
|
||||
'org-ctrl-c-ctrl-c-hook 'ob-async-org-babel-execute-src-block))
|
||||
|
||||
;; https://github.com/pope/ob-go
|
||||
;; Org-Babel support for evaluating go code
|
||||
(use-package ob-go
|
||||
:if (executable-find "go")
|
||||
:init (add-to-list 'org-babel-load-languages '(go . t)))
|
||||
|
||||
;; https://github.com/zweifisch/ob-http
|
||||
;; Org-Babel support for evaluating http
|
||||
(use-package ob-http
|
||||
:init (add-to-list 'org-babel-load-languages '(http . t)))
|
||||
|
||||
;; https://github.com/micanzhang/ob-rust
|
||||
;; Org-Babel support for evaluating Rust code
|
||||
(use-package ob-rust
|
||||
:if (executable-find "rustc")
|
||||
:init (add-to-list 'org-babel-load-languages '(rust . t)))
|
||||
|
||||
;; https://github.com/krisajenkins/ob-translate
|
||||
;; Allows you to translate blocks of text within org-mode
|
||||
(use-package ob-translate
|
||||
:disabled
|
||||
:init (add-to-list 'org-babel-load-languages '(translate . t)))
|
||||
|
||||
;; https://github.com/andrmuel/ob-uart
|
||||
;; Org babel support for UART communication
|
||||
(use-package ob-uart
|
||||
:disabled
|
||||
:init (add-to-list 'org-babel-load-languages '(uart . t)))
|
||||
|
||||
;; https://github.com/ahendriksen/ob-tmux
|
||||
;; Ob-tmux is an Emacs library that allows org mode to evaluate code blocks in a tmux session.
|
||||
(use-package ob-tmux
|
||||
:if (executable-find "tmux")
|
||||
:init (add-to-list 'org-babel-load-languages '(tmux . t))))
|
||||
|
||||
;; https://github.com/emacs-mirror/emacs/blob/master/lisp/org/ox-org.el
|
||||
;; Org Back-End for Org Export Engine
|
||||
(use-package ox
|
||||
:ensure nil
|
||||
:config
|
||||
(validate-setq
|
||||
;; Export as UTF-8.
|
||||
org-export-coding-system 'utf-8)
|
||||
|
||||
;; Org export modules to load by default.
|
||||
(add-many-to-list
|
||||
'org-export-backends
|
||||
;; Ascii support.
|
||||
'ascii
|
||||
;; HTML.
|
||||
'html
|
||||
;; OpenDocument Text support.
|
||||
'odt)
|
||||
|
||||
(with-executable 'latex
|
||||
(add-many-to-list
|
||||
'org-export-backends
|
||||
;; Beamer presentation export.
|
||||
'beamer
|
||||
;; Plain LaTeX export.
|
||||
'latex))
|
||||
|
||||
;; https://github.com/tomalexander/orgmode-mediawiki/tree/a9327150293e370e500ba55bddfe5fc435c6bf9b
|
||||
;; A mediawiki export for Emacs org-mode
|
||||
(use-package ox-mediawiki
|
||||
:config (add-to-list 'org-export-backends 'mediawiki))
|
||||
;; https://github.com/larstvei/ox-gfm
|
||||
;; Github Flavored Markdown Back-End for Org Export Engine
|
||||
(use-package ox-gfm
|
||||
:config (add-to-list 'org-export-backends 'gfm))
|
||||
;; https://github.com/stig/ox-jira.el
|
||||
;; Org-mode export backend for JIRA markup
|
||||
(use-package ox-jira
|
||||
:disabled
|
||||
:config (add-to-list 'org-export-backends 'jira))
|
||||
;; https://github.com/kawabata/ox-pandoc
|
||||
;; Another org-mode exporter via pandoc
|
||||
(use-package ox-pandoc
|
||||
:if (executable-find "pandoc")
|
||||
:pin "MELPA"
|
||||
:config (add-to-list 'org-export-backends 'pandoc))
|
||||
;; https://github.com/choppsv1/org-rfc-export/tree/1a49535cf927cd52ffa05c815b890888c4addf86
|
||||
;; Org-mode export back-end for creating internet-drafts and RFCs using xml2rfc.
|
||||
(use-package ox-rfc
|
||||
:disabled
|
||||
:config (add-to-list 'org-export-backends 'rfc)))
|
||||
|
||||
;; Load org agenda.
|
||||
(add-to-list 'org-modules 'org-agenda)
|
||||
|
||||
(add-to-list 'org-modules 'org)
|
||||
|
||||
;; https://orgmode.org/manual/Org-Mobile.html
|
||||
(use-package org-mobile
|
||||
:disabled
|
||||
:ensure nil
|
||||
:config
|
||||
(validate-setq
|
||||
;; Location of TODO items to sync.
|
||||
org-mobile-inbox-for-pull org-default-notes-file
|
||||
;; MobileOrg sync directory.
|
||||
org-mobile-directory (path-join *user-org-data-directory* "mobile")
|
||||
;; Custom agenda view.
|
||||
org-mobile-force-id-on-agenda-items nil))
|
||||
|
||||
;; https://github.com/ifree/org-onenote
|
||||
;; Post org file to onenote
|
||||
(use-package org-onenote
|
||||
:disabled)
|
||||
|
||||
;;; (Packages) ;;;
|
||||
;; https://github.com/unhammer/org-rich-yank
|
||||
;; Rich text clipboard for org-mode: Paste into a #+BEGIN_SRC block of correct mode, with link to where it came from
|
||||
(use-package org-rich-yank
|
||||
:bind-wrap
|
||||
(:map org-mode-map
|
||||
((:key :basic :alternate-paste) . org-rich-yank)))
|
||||
|
||||
;; https://github.com/tkf/org-mode/blob/master/lisp/org-clock.el
|
||||
;; The time clocking code for Org-mode
|
||||
(use-package org-clock
|
||||
:ensure nil
|
||||
:config
|
||||
(validate-setq
|
||||
;; Clock data store.
|
||||
org-clock-persist-file (path-join *user-org-cache-directory*
|
||||
"org-clock-save.el"))
|
||||
|
||||
(when (not noninteractive)
|
||||
;; When running in batch, don't setup time tracking.
|
||||
(validate-setq
|
||||
;; Resume clocking task on clock-in if the clock is open.
|
||||
org-clock-in-resume t
|
||||
;; Save clock data and state changes and notes in the LOGBOOK drawer.
|
||||
org-clock-into-drawer t
|
||||
;; Remove clock line if time is zero.
|
||||
org-clock-out-remove-zero-time-clocks t
|
||||
;; Stop clock when entry is marked as DONE.
|
||||
org-clock-out-when-done t
|
||||
;; Show the amount of time spent on the current task today.
|
||||
org-clock-mode-line-total 'today
|
||||
;; Resume clock when reopening Emacs.
|
||||
org-clock-persist t
|
||||
;; Enable auto clock resolution for finding open clocks.
|
||||
org-clock-auto-clock-resolution 'when-no-clock-is-running
|
||||
;; Include current clocking task in clock reports.
|
||||
org-clock-report-include-clocking-task t)))
|
||||
|
||||
;; https://github.com/alphapapa/org-sticky-header
|
||||
;; Show off-screen Org heading at top of window
|
||||
(use-package org-sticky-header)
|
||||
|
||||
;; https://github.com/daimrod/org-sync
|
||||
;; Synchronize Org documents with external services
|
||||
(use-package org-sync
|
||||
:disabled
|
||||
:config
|
||||
(validate-setq
|
||||
;; Org sync cache store.
|
||||
org-sync-cache-file (path-join *user-org-cache-directory* "org-sync-cache"))
|
||||
|
||||
;; Redmine module.
|
||||
(load "org-sync-redmine")
|
||||
;; GitHub module.
|
||||
(load "org-sync-github"))
|
||||
|
||||
;; https://github.com/dengste/org-caldav
|
||||
;; Caldav sync for Emacs orgmode
|
||||
(use-package org-caldav
|
||||
:disabled
|
||||
:config
|
||||
(validate-setq
|
||||
;; Path to state synchronization file.
|
||||
org-caldav-save-directory (path-join *user-org-cache-directory* "org-caldav")
|
||||
;; Path to inbox file.
|
||||
org-caldav-inbox (path-join *user-org-data-directory* "org-caldav-inbox.org")
|
||||
;; Path to backup file.
|
||||
org-caldav-backup-file (path-join *user-org-data-directory* "org-caldav-backup.org")
|
||||
;; Link to org agenda.
|
||||
org-caldav-files org-agenda-files
|
||||
;; Ask before deleting entries on server.
|
||||
org-caldav-delete-calendar-entries 'ask)
|
||||
|
||||
;; Ensure that state synchronization directory exists.
|
||||
(make-directory org-caldav-save-directory t))
|
||||
|
||||
;; https://github.com/alphapapa/org-web-tools
|
||||
;; View, capture, and archive Web pages in Org-mode
|
||||
(use-package org-web-tools)
|
||||
;; https://github.com/facetframer/orgnav
|
||||
;; Quickly navigate and search your emacs org trees; use this navigation to capture and organize
|
||||
(use-package orgnav)
|
||||
;; https://github.com/rlister/org-present
|
||||
;; Ultra-minimalist presentation minor-mode for Emacs org-mode
|
||||
(use-package org-present
|
||||
:disabled
|
||||
:config
|
||||
(with-eval-after-load 'org-present
|
||||
(add-hook 'org-present-mode-hook
|
||||
(lambda ()
|
||||
(org-present-big)
|
||||
(org-display-inline-images)
|
||||
(org-present-hide-cursor)
|
||||
(org-present-read-only)))
|
||||
(add-hook 'org-present-mode-quit-hook
|
||||
(lambda ()
|
||||
(org-present-small)
|
||||
(org-remove-inline-images)
|
||||
(org-present-show-cursor)
|
||||
(org-present-read-write)))))
|
||||
|
||||
;; https://github.com/alphapapa/org-rifle
|
||||
;; Rifle through your Org-mode buffers and acquire your target
|
||||
(use-package helm-org-rifle)
|
||||
;; https://github.com/weirdNox/org-noter
|
||||
;; Emacs document annotator, using Org-mode
|
||||
(use-package org-noter
|
||||
:disabled)
|
||||
;; https://github.com/louietan/anki-editor
|
||||
;; Emacs minor mode for making Anki cards with Org
|
||||
(use-package anki-editor)
|
||||
;; https://github.com/dfeich/org-screenshot
|
||||
;; screenshots integrated with emacs org mode attachments
|
||||
(use-package org-attach-screenshot
|
||||
:disabled)
|
||||
;; https://github.com/harrybournis/org-fancy-priorities
|
||||
;; Display Org Mode priorities as custom strings
|
||||
(use-package org-fancy-priorities
|
||||
:hook (org-mode-hook . org-fancy-priorities-mode))
|
||||
;; https://github.com/calvinwyoung/org-autolist
|
||||
;; Making it even easier to edit lists in org-mode!
|
||||
(use-package org-autolist
|
||||
:hook (org-mode-hook . org-autolist-mode))
|
||||
;; https://github.com/abo-abo/org-download
|
||||
;; Drag and drop images to Emacs org-mode
|
||||
(use-package org-download)
|
||||
;; https://github.com/tarsius/org-elisp-help
|
||||
;; Org links to emacs-lisp documentation
|
||||
(use-package org-elisp-help)
|
||||
;; https://github.com/emacsjanitors/org-fstree
|
||||
;; Include a filesystem subtree into an org file
|
||||
(use-package org-fstree
|
||||
:disabled)
|
||||
;; https://github.com/flexibeast/org-vcard
|
||||
;; Export and import vCards from within GNU Emacs' Org mode.
|
||||
(use-package org-vcard
|
||||
:disabled
|
||||
:config
|
||||
(validate-setq
|
||||
org-vcard-custom-styles-dir (path-join *user-org-data-directory* "org-vcard-styles")))
|
||||
|
||||
;; https://github.com/gizmomogwai/org-kanban
|
||||
;; Kanban table for org-mode
|
||||
;; Enables `#+BEGIN: kanban' for producing a kanban table.
|
||||
(use-package org-kanban
|
||||
:disabled))
|
||||
|
||||
;; https://orgmode.org/manual/Agenda-Commands.html
|
||||
(use-package org-agenda
|
||||
:ensure org-plus-contrib
|
||||
:defer
|
||||
:hook (org-agenda-finalize-hook . user--org-agenda-finalize-hook)
|
||||
:bind-wrap
|
||||
(((:key :apps :agenda) . org-agenda)
|
||||
((:key :apps :todo) . org-todo-list))
|
||||
:config
|
||||
(let ((agenda-data-store (path-join *user-org-data-directory* "agendas")))
|
||||
(validate-setq
|
||||
;; Agenda data store.
|
||||
org-agenda-files `(,agenda-data-store))
|
||||
;; Ensure that agenda data store exists.
|
||||
(make-directory agenda-data-store t))
|
||||
|
||||
(validate-setq
|
||||
org-agenda-breadcrumbs-separator " ❱ "
|
||||
;; Ignore agenda files that are unavailable.
|
||||
org-agenda-skip-unavailable-files t
|
||||
;; Restore window configuration when done with the agenda.
|
||||
org-agenda-restore-windows-after-quit t
|
||||
;; Start on Monday.
|
||||
org-agenda-start-on-weekday 1
|
||||
;; Show month by default.
|
||||
;; org-agenda-span 'month
|
||||
;; Don't display scheduled todos.
|
||||
;; org-agenda-todo-ignore-scheduled 'future
|
||||
;; Don't show nested todos.
|
||||
;; org-agenda-todo-list-sublevels nil
|
||||
;; Don't dim blocked tasks.
|
||||
org-agenda-dim-blocked-tasks nil
|
||||
;; Compact block agenda view.
|
||||
;; org-agenda-compact-blocks t
|
||||
;; Include Emacs' Diary in org-agenda.
|
||||
org-agenda-include-diary t
|
||||
;; Switch window when opening org-agenda.
|
||||
;; org-agenda-window-setup 'other-window
|
||||
;; Display indirect buffers in the "current" window.
|
||||
org-indirect-buffer-display 'current-window
|
||||
;; Reset all custom commands.
|
||||
org-agenda-custom-commands nil)
|
||||
|
||||
(add-many-to-list
|
||||
'org-agenda-custom-commands
|
||||
;; `("T", "Daily Timesheet"
|
||||
;; (my-org-timeline)
|
||||
;; ))
|
||||
`("a" "Agenda"
|
||||
((agenda ""
|
||||
((org-agenda-prefix-format "%-12:c%?-12t% b% s")
|
||||
(org-genda-list))))))
|
||||
;; (
|
||||
;; (org-agenda-repeating-timestamp-show-all nil)
|
||||
;; (org-agenda-remove-tags t)
|
||||
;; (org-agenda-overriding-header "⚡ Calendar")
|
||||
;; ;; (org-agenda-prefix-format "%?-12t% s")
|
||||
;; (org-agenda-prefix-format " %?-12t% s")
|
||||
;; (org-agenda-todo-keyword-format "")
|
||||
;; (my-org-timeline)
|
||||
;; )))))
|
||||
;; '("a" "Agenda" org-agenda-list)
|
||||
;; '("c" . "COLLECT...")
|
||||
;; '("cb" "CollectBox" ((alltodo "")))
|
||||
;; '("f" . "FOCUS...")
|
||||
;; '("f." "Today"
|
||||
;; ((agenda ""
|
||||
;; ((org-agenda-entry-types '(:timestamp :sexp))
|
||||
;; (org-agenda-overriding-header
|
||||
;; (concat "CALENDAR Today"
|
||||
;; (format-time-string "%a %d" (current-time))))
|
||||
;; (org-agenda-span 'day)))
|
||||
;; (tags-todo "LEVEL=1+REFILE"
|
||||
;; ((org-agenda-overriding-header "COLLECTBOX (Unscheduled)")))
|
||||
;; (tags-todo "DEADLINE=\"<+0d>\""
|
||||
;; ((org-agenda-overriding-header "DUE TODAY")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'notedeadline))
|
||||
;; (org-agenda-sorting-strategy '(priority-down))))
|
||||
;; (tags-todo "DEADLINE<\"<+0d>\""
|
||||
;; ((org-agenda-overriding-header "OVERDUE")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'notedeadline))
|
||||
;; (org-agenda-sorting-strategy '(priority-down))))
|
||||
;; (agenda ""
|
||||
;; ((org-agenda-entry-types '(:scheduled))
|
||||
;; (org-agenda-overriding-header "SCHEDULED")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'todo 'done))
|
||||
;; (org-agenda-sorting-strategy
|
||||
;; '(priority-down time-down))
|
||||
;; (org-agenda-span 'day)
|
||||
;; (org-agenda-start-on-weekday nil)
|
||||
;; (org-agenda-time-grid nil)))
|
||||
;; (todo "DONE"
|
||||
;; ((org-agenda-overriding-header "COMPLETED"))))
|
||||
;; ((org-agenda-format-date "")
|
||||
;; (org-agenda-start-with-clockreport-mode nil)))
|
||||
;; '("fh" "Hotlist"
|
||||
;; ((tags-todo "DEADLINE<\"<+0d>\""
|
||||
;; ((org-agenda-overriding-header "OVERDUE")))
|
||||
;; (tags-todo "DEADLINE>=\"<+0d>\"+DEADLINE<=\"<+1w>\""
|
||||
;; ((org-agenda-overriding-header "DUE IN NEXT 7 DAYS")))
|
||||
;; (tags-todo "DEADLINE=\"\"+FLAGGED|DEADLINE>\"<+1w>\"+FLAGGED"
|
||||
;; ((org-agenda-overriding-header "FLAGGED"))))
|
||||
;; ((org-agenda-todo-ignore-scheduled 'future)))
|
||||
;; '("r" . "REVIEW...")
|
||||
;; '("ra" . "All Tasks...")
|
||||
;; '("rad" "All Tasks (grouped by Due Date)"
|
||||
;; ((tags-todo "DEADLINE<\"<+0d>\""
|
||||
;; ((org-agenda-overriding-header "OVERDUE")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'notdeadline))))
|
||||
;; (tags-todo "DEADLINE=\"<+0d>\""
|
||||
;; ((org-agenda-overriding-header "DUE TODAY")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'notdeadline))))
|
||||
;; (tags-todo "DEADLINE=\"<+1d>\""
|
||||
;; ((org-agenda-overriding-header "DUE TOMORROW")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'notdeadline))))
|
||||
;; (tags-todo "DEADLINE>\"<+1d>\"+DEADLINE<=\"<+7d>\""
|
||||
;; ((org-agenda-overriding-header "DUE WITHIN A WEEK")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'notdeadline))))
|
||||
;; (tags-todo "DEADLINE>\"<+7d>\"+DEADLINE<=\"<+28d>\""
|
||||
;; ((org-agenda-overriding-header "DUE WITHIN A MONTH")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'notdeadline))))
|
||||
;; (tags-todo "DEADLINE>\"<+28d>\""
|
||||
;; ((org-agenda-overriding-header "DUE LATER")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'notdeadline))) )
|
||||
;; (tags-todo "TODO={WAIT}"
|
||||
;; ((org-agenda-overriding-header "WAITING FOR")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'deadline))))
|
||||
;; (todo ""
|
||||
;; ((org-agenda-overriding-header "WAITING FOR")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'deadline)))))
|
||||
;; ((org-agenda-sorting-strategy '(priority-down))
|
||||
;; (org-agenda-write-buffer-name "All Tasks (grouped by Due Date)"))
|
||||
;; "~/Documents/Org/all-tasks-by-due-date.pdf")
|
||||
;; '("ra1" "All Tasks with a due date"
|
||||
;; ((alltodo ""))
|
||||
;; ((org-agenda-overriding-header "All Tasks (sorted by Due Date)")
|
||||
;; (org-agenda-skip-function
|
||||
;; '(org-agenda-skip-entry-if 'notdeadline))
|
||||
;; (org-agenda-sorting-strategy '(deadline-up))))
|
||||
;; '("rt" . "Timesheet...")
|
||||
;; '("rtw" "Weekly Timesheet"
|
||||
;; ((agenda ""))
|
||||
;; (
|
||||
;; ;; (org-agenda-format-date "")
|
||||
;; (org-agenda-overriding-header "WEEKLY TIMESHEET")
|
||||
;; (org-agenda-skip-function '(org-agenda-skip-entry-if 'timestamp))
|
||||
;; (org-agenda-span 'week)
|
||||
;; (org-agenda-start-on-weekday 1)
|
||||
;; (org-agenda-start-with-clockreport-mode t)
|
||||
;; (org-agenda-time-grid nil)))
|
||||
;; '("rc" . "Calendar...")
|
||||
;; '("rc7" "Events and appointments for 7 days"
|
||||
;; ((agenda ""))
|
||||
;; ((org-agenda-entry-types '(:timestamp :sexp))
|
||||
;; ;; (org-agenda-overriding-header "Calendar for 7 days")
|
||||
;; ;; (org-agenda-repeating-timestamp-show-all t)
|
||||
;; (org-agenda-span 'week)
|
||||
;; (org-agenda-format-date "\n%a %d")
|
||||
;; ;; (org-agenda-date-weekend ... new face ...)
|
||||
;; (org-agenda-time-grid nil)))
|
||||
;; '("rw" "Weekly review"
|
||||
;; ((tags "CATEGORY={@REFILE}&LEVEL<=2"
|
||||
;; ((org-agenda-overriding-header "NEW TASKS")))
|
||||
;; (agenda ""
|
||||
;; ((org-agenda-clockreport-mode t)
|
||||
;; (org-agenda-format-date
|
||||
;; (concat "\n"
|
||||
;; "%Y-%m-%d" " %a "
|
||||
;; (make-string (window-width) ?_)))
|
||||
;; (org-agenda-overriding-header "PAST WEEK")
|
||||
;; (org-agenda-prefix-format " %?-11t %i %-12:c% s")
|
||||
;; (org-agenda-show-log 'clockcheck)
|
||||
;; (org-agenda-span 7)
|
||||
;; (org-agenda-start-day "-1w")
|
||||
;; (org-deadline-warning-days 0)))
|
||||
;; (agenda ""
|
||||
;; ((org-agenda-overriding-header "NEXT MONTH")
|
||||
;; (org-agenda-span 'month)
|
||||
;; (org-agenda-start-day "+0d")
|
||||
;; (org-deadline-warning-days 0)))
|
||||
;; (todo "PROJECT"
|
||||
;; ((org-agenda-overriding-header "PROJECT LIST")))
|
||||
;; (todo "DONE|PROJECTDONE"
|
||||
;; ((org-agenda-overriding-header
|
||||
;; "Candidates to be archived"))))))
|
||||
|
||||
;; (when (not noninteractive)
|
||||
;; ;; When running in batch, don't setup windows.
|
||||
;; (validate-setq
|
||||
;; ;; Show agenda in current window.
|
||||
;; org-agenda-window-setup 'current-window))
|
||||
)
|
||||
;; https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-habit.el
|
||||
;; The habit tracking code for Org
|
||||
(use-package org-habit
|
||||
:ensure nil
|
||||
:config
|
||||
(validate-setq
|
||||
;; Position the habit graph to the right.
|
||||
org-habit-graph-column 50))
|
||||
|
||||
;; https://github.com/alphapapa/org-super-agenda
|
||||
;; Supercharge your Org daily/weekly agenda by grouping items
|
||||
(use-package org-super-agenda
|
||||
:disabled
|
||||
:config
|
||||
(add-to-list
|
||||
'org-agenda-custom-commands
|
||||
'("u" "Super view"
|
||||
((agenda "" ((org-super-agenda-groups
|
||||
'((:name "Today"
|
||||
:time-grid t)))))
|
||||
(todo "" ((org-agenda-overriding-header "")
|
||||
(org-super-agenda-groups
|
||||
'((:name "Projects"
|
||||
:children todo)
|
||||
(:discard (:anything t)))))))))
|
||||
|
||||
(org-super-agenda-mode))
|
||||
|
||||
;; https://github.com/spegoraro/org-alert
|
||||
;; System notifications of org agenda items
|
||||
(use-package org-alert
|
||||
:after alert
|
||||
:config
|
||||
(org-alert-enable))
|
||||
|
||||
;; https://github.com/Malabarba/org-agenda-property
|
||||
;; Display org properties in the agenda buffer
|
||||
(use-package org-agenda-property)
|
||||
|
||||
;; https://github.com/Fuco1/org-timeline
|
||||
;; Add graphical view of agenda to agenda buffer
|
||||
(use-package org-timeline
|
||||
:disabled
|
||||
:hook (org-agenda-finalize-hook . org-timeline-insert-timeline))
|
||||
|
||||
;; https://github.com/tkf/org-mode/blob/master/contrib/lisp/org-annotate-file.el
|
||||
;; Annotate a file with org syntax
|
||||
(use-package org-annotate-file
|
||||
:disabled
|
||||
:ensure org-plus-contrib
|
||||
:defer
|
||||
:init
|
||||
(autoload 'org-annotate-file "org-annotate-file" nil t)
|
||||
:bind-wrap
|
||||
((:key :util :annotate-buffer) . user/org-annotate-file)
|
||||
:config
|
||||
(validate-setq
|
||||
;; Annotations data store.
|
||||
org-annotate-file-storage-file (path-join *user-org-data-directory*
|
||||
"annotations.org")
|
||||
;; Add link to current line number.
|
||||
org-annotate-file-add-search t))
|
||||
|
||||
|
||||
(provide 'modes/org)
|
||||
;;; org.el ends here
|
73
lisp/modes/prog.el
Normal file
73
lisp/modes/prog.el
Normal file
@@ -0,0 +1,73 @@
|
||||
;;; prog.el --- setup shared defaults for programming modes -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun user--prog-mode-hook ()
|
||||
"Programming mode hook."
|
||||
(user--fundamental-mode-hook)
|
||||
|
||||
(when (user-flyspell-p)
|
||||
;; Protect against missing dictionary.
|
||||
(try-eval
|
||||
;; Run spell-checker in programming mode.
|
||||
(flyspell-prog-mode)))
|
||||
|
||||
;; Buttonize links.
|
||||
;;(goto-address-prog-mode t)
|
||||
|
||||
;;(outline-minor-mode t)
|
||||
|
||||
(validate-setq
|
||||
;; When using fill-paragraph or auto-fill-mode break lines at 80 characters by
|
||||
;; default.
|
||||
fill-column 120)
|
||||
|
||||
;; Try to enable completion system.
|
||||
(cond
|
||||
;; ((user/auto-complete-p) (auto-complete-mode t))
|
||||
((user/company-mode-p) (company-mode t)))
|
||||
|
||||
;;; (Bindings) ;;;
|
||||
(user/bind-key-local :code :comment (if (feature-p 'comment-dwim-2)
|
||||
'comment-dwim-2
|
||||
'comment-dwim)))
|
||||
|
||||
|
||||
(use-package prog-mode
|
||||
:ensure nil
|
||||
:hook (prog-mode-hook . user--prog-mode-hook)
|
||||
:config
|
||||
;;; (Packages) ;;;
|
||||
;; https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/subword.el
|
||||
;; Handling capitalized subwords in a nomenclature
|
||||
(use-package subword
|
||||
:disabled
|
||||
:ensure nil
|
||||
:diminish subword-mode)
|
||||
;; https://github.com/remyferre/comment-dwim-2
|
||||
;; A replacement for the emacs' built-in command `comment-dwim'
|
||||
(use-package comment-dwim-2)
|
||||
;; https://github.com/emacsorphanage/quickrun
|
||||
;; Run command quickly. This packages is inspired quickrun.vim
|
||||
(use-package quickrun
|
||||
:bind-wrap
|
||||
(:map prog-mode-map
|
||||
((:key :code :eval-buffer) . quickrun)
|
||||
((:key :code :eval-selection) . quickrun-region)))
|
||||
;; https://github.com/vincekd/comment-tags
|
||||
;; Emacs package to highlight and manage comment tags like TODO, BUG, FIXME, etc.
|
||||
(use-package comment-tags
|
||||
:diminish comment-tags-mode
|
||||
:hook (prog-mode-hook . comment-tags-mode)
|
||||
:config
|
||||
(setq
|
||||
comment-tags/keymap-prefix (user/get-key :nav :find-todos)))
|
||||
;; https://github.com/ignacy/idle-highlight-in-visible-buffers-mode
|
||||
;; An Emacs minor mode that highlights current word in all visible buffers
|
||||
(use-package idle-highlight-in-visible-buffers-mode
|
||||
:disabled
|
||||
:hook (prog-mode-hook . idle-highlight-in-visible-buffers-mode)))
|
||||
|
||||
|
||||
(provide 'modes/prog)
|
||||
;;; prog.el ends here
|
163
lisp/modes/python.el
Normal file
163
lisp/modes/python.el
Normal file
@@ -0,0 +1,163 @@
|
||||
;;; python.el --- initializes Python modes -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'lsp-pylsp)
|
||||
|
||||
(defun user--python-format-before-save ()
|
||||
"Python cleanup and format before save buffer."
|
||||
(lsp-format-buffer)
|
||||
(delete-trailing-whitespace)
|
||||
)
|
||||
|
||||
(defun user--python-mode-hook ()
|
||||
"Python mode hook."
|
||||
|
||||
;; lsp python customization
|
||||
(lsp-register-custom-settings
|
||||
'(("pylsp.plugins.pyls_mypy.enabled" t t)
|
||||
;; ("pylsp.plugins.flake8.maxLineLength" 120)
|
||||
;; ("pylsp.plugins.pycodestyle.maxLineLength" 120)
|
||||
("pylsp.plugins.yapf.enabled" t t)
|
||||
("pylsp.plugins.pylint.enabled" t t)))
|
||||
;; ("pyls.plugins.pyls_mypy.live_mode" nil t)
|
||||
;; ("pyls.plugins.pyls_black.enabled" t t)
|
||||
;; ("pyls.plugins.pyls_isort.enabled" t t)
|
||||
;; ("pyls.plugins.flake8.enabled" t t)))
|
||||
|
||||
(setq lsp-pylsp-plugins-flake8-max-line-length 120)
|
||||
(setq lsp-pylsp-plugins-pycodestyle-max-line-length 120)
|
||||
|
||||
;; Enable virtualenv support.
|
||||
(when(feature-p 'pyvenv)
|
||||
(pyvenv-mode t))
|
||||
|
||||
(when(feature-p 'anaconda-mode)
|
||||
(anaconda-mode t))
|
||||
|
||||
;; Enable smart parenthesis handling.
|
||||
(user/smartparens-enable)
|
||||
|
||||
;; Separate camel-case into separate words
|
||||
(subword-mode t)
|
||||
|
||||
;; ElDoc shows function documentation as you type
|
||||
(eldoc-mode t)
|
||||
|
||||
;; Select pylint for ckecing
|
||||
;; (setq flycheck-checker nil)
|
||||
;; (setq-default flycheck-disabled-checkers '(lsp))
|
||||
;; (flycheck-add-mode 'python-flake8 'python-mode)
|
||||
;; (flycheck-select-checker 'python-pycheckers)
|
||||
|
||||
;; (flycheck-add-next-checker 'lsp 'python-pycheckers)
|
||||
|
||||
;; (setq-local lsp-pylsp-plugins-pylint-enabled nil)
|
||||
|
||||
;; (with-eval-after-load "lsp-mode"
|
||||
;; (add-to-list 'lsp-disabled-clients 'pyls)
|
||||
;; (add-to-list 'lsp-enabled-clients 'pylsp))
|
||||
|
||||
;; (Bindings) ;;
|
||||
;; (when(feature-p 'nose)
|
||||
;; (user/bind-key-local: code: test 'nosetests-all))
|
||||
;; (when(feature-p 'pyvenv)
|
||||
;; (user/bind-key-local: code: virtual 'pyvenv-workon))
|
||||
;; (when(feature-p 'lsp-pyright)
|
||||
;; (require 'lsp-pyright)))
|
||||
)
|
||||
|
||||
(use-package python
|
||||
:if (executable-find "python")
|
||||
:defer
|
||||
:mode ("SCon\(struct\|script\)$" . python-mode)
|
||||
:interpreter ("python[0-9.]*" . python-mode)
|
||||
:hook
|
||||
(python-mode-hook . lsp)
|
||||
(python-mode-hook . user--python-mode-hook)
|
||||
(python-mode-hook . (lambda ()
|
||||
(add-hook 'before-save-hook #'user--python-format-before-save nil t)))
|
||||
|
||||
:config
|
||||
(validate-setq
|
||||
;; Don't try to guess the indentation.
|
||||
python-indent-guess-indent-offset nil)
|
||||
|
||||
(with-executable 'ipython3
|
||||
(validate-setq
|
||||
;; Set IPython as default interpreter.
|
||||
python-shell-interpreter "ipython3"
|
||||
python-shell-interpreter-args ""
|
||||
python-shell-prompt-regexp "In \\[[0-9]+\\]: "
|
||||
python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
|
||||
python-shell-completion-setup-code "from IPython.core.completerlib import module_completion"
|
||||
python-shell-completion-module-string-code "';'.join(module_completion('''%s'''))\n"
|
||||
python-shell-completion-string-code "';'.join(get_ipython().Completer.all_completions('''%s'''))\n"))
|
||||
|
||||
(with-executable 'bpython
|
||||
(defun user/bpython-term()
|
||||
"Launch or switch to a `bpython' buffer."
|
||||
(interactive)
|
||||
(if (not (get-buffer "*bpython*"))
|
||||
(progn
|
||||
(ansi-term "bpython" "bpython"))
|
||||
(switch-to-buffer "*bpython*"))))
|
||||
|
||||
;; (Packages) ;;
|
||||
;; https://github.com/pythonic-emacs/anaconda-mode
|
||||
;; Code navigation, documentation lookup and completion for Python.
|
||||
(use-package anaconda-mode)
|
||||
;; https://github.com/tsgates/pylookup
|
||||
;; Emacs mode for searching python documents with convenience
|
||||
(use-package pylookup
|
||||
:disabled
|
||||
:quelpa(pylookup
|
||||
:fetcher github
|
||||
:repo "tsgates/pylookup"))
|
||||
;; https://github.com/syl20bnr/nose.el
|
||||
;; This gives a bunch of functions that handle running nosetests on a particular buffer or part of a buffer.
|
||||
(use-package nose
|
||||
:disabled)
|
||||
;; https://github.com/tkf/emacs-python-environment
|
||||
;; Python virtualenv API for Emacs Lisp
|
||||
(use-package python-environment
|
||||
:disabled
|
||||
:config
|
||||
(validate-setq
|
||||
;; Locate of Python environment store.
|
||||
python-environment-directory(path-join *user-cache-directory*
|
||||
"python-environment")))
|
||||
;; https://github.com/pwalsh/pipenv.el
|
||||
;; A Pipenv porcelain inside Emacs.
|
||||
(use-package pipenv
|
||||
:disabled
|
||||
:if (executable-find "pipenv")
|
||||
:hook(python-mode-hook . pipenv-mode))
|
||||
|
||||
;; https://github.com/msherry/flycheck-pycheckers
|
||||
;; Multiple syntax checker for Python in Emacs, using Flycheck
|
||||
(use-package flycheck-pycheckers
|
||||
:disabled
|
||||
:after flycheck
|
||||
:hook (flycheck-mode-hook . flycheck-pycheckers-setup)
|
||||
:config (setq flycheck-pycheckers-checkers (remove 'mypy2 flycheck-pycheckers-checkers))
|
||||
)
|
||||
;; https://github.com/chocoelho/flycheck-prospector
|
||||
;; flycheck support for prospector
|
||||
(use-package flycheck-prospector
|
||||
:disabled
|
||||
:if (executable-find "prospector")
|
||||
:hook(flycheck-mode-hook . flycheck-prospector-setup))
|
||||
;; https://github.com/jgosmann/pylint-venv
|
||||
;; Make pylint respect virtualenvs.
|
||||
(use-package pyvenv
|
||||
:ensure t
|
||||
:config
|
||||
(pyvenv-mode 1))
|
||||
|
||||
;; https://github.com/emacsorphanage/helm-pydoc
|
||||
;; helm-pydoc.el is pydoc helm interface
|
||||
(use-package helm-pydoc
|
||||
:pin "MELPA"))
|
||||
|
||||
(provide 'modes/python)
|
||||
;;; python.el ends here
|
74
lisp/modes/shell.el
Normal file
74
lisp/modes/shell.el
Normal file
@@ -0,0 +1,74 @@
|
||||
;;; shell.el --- initializes shell modes -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun user--sh-mode-hook ()
|
||||
"Initialize mode for shell script editing."
|
||||
(validate-setq
|
||||
;; Indent with four spaces.
|
||||
sh-basic-offset 4
|
||||
sh-indentation 4))
|
||||
|
||||
|
||||
(defun user--shell-mode-common-hook ()
|
||||
"Shell mode common hook."
|
||||
(with-feature 'ansi-color
|
||||
;; Enable ANSI colors for comint.
|
||||
(ansi-color-for-comint-mode-on))
|
||||
|
||||
(with-feature 'shelldoc
|
||||
(shelldoc-minor-mode-on)))
|
||||
|
||||
|
||||
(defun user--shell-mode-hook ()
|
||||
"Initialize mode for interactive shell."
|
||||
(user--shell-mode-common-hook)
|
||||
|
||||
(validate-setq
|
||||
;; Set up to use Bash with input echoing.
|
||||
explicit-shell-file-name "bash"
|
||||
explicit-bash-args '("-c" "export EMACS=; stty echo; bash")
|
||||
comint-process-echoes t))
|
||||
|
||||
(use-package shell
|
||||
:defer
|
||||
:hook ((sh-mode-hook . user--sh-mode-hook)
|
||||
(shell-mode-hook . user--shell-mode-hook))
|
||||
:config
|
||||
;;; (Packages) ;;;
|
||||
;; https://github.com/wilkystyle/lsp-sh
|
||||
;; Bash support for lsp-mode using Mads Hartmann's bash-language-server
|
||||
(use-package lsp-sh
|
||||
:if (executable-find "bash-language-server")
|
||||
:hook (sh-mode-hook . lsp-sh-enable))
|
||||
;; https://github.com/szermatt/emacs-bash-completion
|
||||
;; Add programmable bash completion to Emacs shell-mode
|
||||
(use-package bash-completion)
|
||||
;; https://github.com/Alexander-Miller/company-shell
|
||||
;; Company mode completion backends for your shell scripting
|
||||
(use-package company-shell
|
||||
:after (company)
|
||||
:config
|
||||
(add-to-list 'company-backends '(company-shell company-shell-env)))
|
||||
;; https://github.com/charlesdaniels/shelldoc
|
||||
;; A tool for generating ReST documentation from shell scripts
|
||||
(use-package shelldoc
|
||||
:disabled)
|
||||
;; (use-package shell-command)
|
||||
;; https://github.com/cuonglm/flycheck-checkbashisms
|
||||
;; Flycheck linter for checkbashisms
|
||||
(use-package flycheck-checkbashisms
|
||||
:if (executable-find "checkbashisms")
|
||||
:config
|
||||
(flycheck-checkbashisms-setup))
|
||||
;; https://github.com/alexmurray/flycheck-bashate
|
||||
;; Integrate bashate with flycheck to automatically check the style of your bash scripts on the fly.
|
||||
(use-package flycheck-bashate
|
||||
:disabled
|
||||
:if (executable-find "bashate")
|
||||
:config
|
||||
(flycheck-bashate-setup)))
|
||||
|
||||
|
||||
(provide 'modes/shell)
|
||||
;;; shell.el ends here
|
69
lisp/modes/text.el
Normal file
69
lisp/modes/text.el
Normal file
@@ -0,0 +1,69 @@
|
||||
;;; text.el --- text mode support -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun user--text-mode-hook ()
|
||||
"Text mode hook."
|
||||
(user--fundamental-mode-hook)
|
||||
|
||||
(user/smartparens-enable)
|
||||
|
||||
(rainbow-delimiters-mode-disable)
|
||||
|
||||
(validate-setq
|
||||
;; Colons are followed by two spaces.
|
||||
colon-double-space t
|
||||
;; Sentences end after two spaces.
|
||||
sentence-end-double-space t
|
||||
;; When using fill-paragraph or auto-fill-mode break lines at 120 characters
|
||||
;; by default.
|
||||
fill-column 120
|
||||
;; Indent using spaces.
|
||||
indent-tabs-mode nil)
|
||||
|
||||
(when (user-flyspell-p)
|
||||
;; Protect against missing dictionary.
|
||||
(try-eval
|
||||
;; Run spell-checker in programming mode.
|
||||
(flyspell-prog-mode)))
|
||||
|
||||
(when (and (feature-p 'flycheck-vale)
|
||||
(executable-find "vale"))
|
||||
(flycheck-vale-setup))
|
||||
|
||||
;; TODO
|
||||
;; (with-feature 'pandoc-mode
|
||||
;; (pandoc-mode t))
|
||||
|
||||
;; Nicely wrap long lines.
|
||||
(visual-line-mode t)
|
||||
|
||||
;;; (Bindings) ;;;
|
||||
(user/bind-key-local :code :fill-paragraph 'fill-paragraph))
|
||||
|
||||
(use-package text-mode
|
||||
:ensure nil
|
||||
:defer
|
||||
:hook (text-mode-hook . user--text-mode-hook)
|
||||
:config
|
||||
;; https://github.com/abingham/flycheck-vale
|
||||
;; Flycheck integration for the vale natural language linter
|
||||
(use-package flycheck-vale
|
||||
:if (executable-find "vale")
|
||||
:config
|
||||
;; TODO
|
||||
;; (add-to-list 'flycheck-vale-modes 'org-mode)
|
||||
)
|
||||
|
||||
;; https://github.com/zzkt/smog
|
||||
;; Analyse the writing style, word use and readability of prose in Emacs.
|
||||
(use-package smog
|
||||
:if (executable-find "style"))
|
||||
|
||||
;; https://github.com/emacs-straight/ftable
|
||||
;; This package provides some convenient commands for filling a table.
|
||||
(use-package ftable))
|
||||
|
||||
|
||||
(provide 'modes/text)
|
||||
;;; text.el ends here
|
40
lisp/modes/typescript.el
Normal file
40
lisp/modes/typescript.el
Normal file
@@ -0,0 +1,40 @@
|
||||
;;; typescript.el --- Initializes TypeScript mode -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun typescript-use-eslint-from-node-modules ()
|
||||
"Use local eslint from node_modules before global."
|
||||
(let* ((root (locate-dominating-file
|
||||
(or (buffer-file-name) default-directory)
|
||||
"node_modules"))
|
||||
(eslint (and root
|
||||
(expand-file-name "node_modules/eslint/bin/eslint.js"
|
||||
root))))
|
||||
(when (and eslint (file-executable-p eslint))
|
||||
(setq-local flycheck-javascript-eslint-executable eslint))))
|
||||
|
||||
(defun user--tide-mode-hook ()
|
||||
"."
|
||||
(interactive)
|
||||
(message "user--tide-mode-hook BEG")
|
||||
(comment-tags-mode t)
|
||||
(tide-setup)
|
||||
(flycheck-mode +1)
|
||||
(setq flycheck-check-syntax-automatically '(save mode-enabled))
|
||||
(eldoc-mode +1)
|
||||
(company-mode +1)
|
||||
(typescript-use-eslint-from-node-modules)
|
||||
(message "user--tide-mode-hook END")
|
||||
)
|
||||
|
||||
(use-package tide
|
||||
:ensure t
|
||||
:after (typescript-mode company flycheck)
|
||||
:hook (
|
||||
(typescript-mode . user--tide-mode-hook)
|
||||
(typescript-mode . tide-hl-identifier-mode)
|
||||
(before-save . tide-format-before-save))
|
||||
:config (setq tide-completion-enable-autoimport-suggestions t))
|
||||
|
||||
(provide 'modes/typescript)
|
||||
;; typescript.el ends here
|
51
lisp/modes/vuejs.el
Normal file
51
lisp/modes/vuejs.el
Normal file
@@ -0,0 +1,51 @@
|
||||
;;; markdown --- initializes VueJs modes -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun user--web-html-hook ()
|
||||
"."
|
||||
(message "user--web-html-hook BEG !!!")
|
||||
(message "user--web-html-hook END !!!")
|
||||
)
|
||||
|
||||
(defun user--web-vue-hook ()
|
||||
"."
|
||||
(message "user--web-vue-hook BEG !!!!")
|
||||
(user--tide-mode-hook)
|
||||
(flycheck-add-mode 'javascript-eslint 'web-mode)
|
||||
(flycheck-select-checker 'javascript-eslint)
|
||||
(add-to-list (make-local-variable 'company-backends)
|
||||
'(comany-tide company-web-html company-css company-files))
|
||||
(message "user--web-vue-hook END !!!!")
|
||||
)
|
||||
|
||||
(defun user--web-format-before-save()
|
||||
"Python cleanup and format before save buffer."
|
||||
(delete-trailing-whitespace)
|
||||
)
|
||||
|
||||
(use-package web-mode
|
||||
:ensure t
|
||||
:mode ("\\.html\\'" "\\.vue\\'")
|
||||
:hook ((web-mode-hook . (lambda()
|
||||
(cond ((equal web-mode-content-type "html")
|
||||
(user--web-html-hook))
|
||||
((member web-mode-content-type '("vue"))
|
||||
(user--web-vue-hook))
|
||||
)))
|
||||
(web-mode-hook . (lambda ()
|
||||
(add-hook 'before-save-hook #'user--web-format-before-save nil t))))
|
||||
:config
|
||||
(setq web-mode-markup-indent-offset 4)
|
||||
(setq web-mode-css-indent-offset 4)
|
||||
(setq web-mode-code-indent-offset 4)
|
||||
(setq web-mode-enable-current-element-highlight t)
|
||||
(setq web-mode-enable-css-colorization t)
|
||||
(setq web-mode-content-types-alist '(("vue" . "\\.vue\\'")))
|
||||
;;
|
||||
;;
|
||||
(use-package company-web
|
||||
:ensure t))
|
||||
|
||||
(provide 'modes/vuejs)
|
||||
;; vuejs.el ends here
|
97
lisp/modes/whitespace.el
Normal file
97
lisp/modes/whitespace.el
Normal file
@@ -0,0 +1,97 @@
|
||||
;;; whitespace.el --- whitespace mode support -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defvar user/whitespace-mode-suppressed nil
|
||||
"Tracks whether `whitespace-mode' is currently being suppressed.")
|
||||
(make-variable-buffer-local 'user/prev-whitespace-mode-suppressed)
|
||||
|
||||
|
||||
(defun user--whitespace-mode-hook ()
|
||||
"Whitespace mode hook."
|
||||
;;; (Bindings) ;;;
|
||||
(user/bind-key-local :code :whitespace-auto-cleanup
|
||||
'user/toggle-whitespace-auto-cleanup))
|
||||
|
||||
|
||||
(defun user/whitespace-mode-suppress (suppress)
|
||||
"If SUPPRESS is non-nil, disable `whitespace-mode' in current mode."
|
||||
(when (boundp 'whitespace-mode)
|
||||
(if suppress
|
||||
(when (and whitespace-mode (not user/whitespace-mode-suppressed))
|
||||
(setq user/whitespace-mode-suppressed t)
|
||||
(whitespace-mode -1))
|
||||
(when user/whitespace-mode-suppressed
|
||||
(setq user/whitespace-mode-suppressed nil)
|
||||
(whitespace-mode 1)))))
|
||||
|
||||
|
||||
(defun user/whitespace-disable-style (styles)
|
||||
"Disable STYLES in current mode."
|
||||
(when (boundp 'whitespace-style)
|
||||
(let ((options (cl-intersection styles whitespace-style)))
|
||||
(when (and (boundp 'global-whitespace-mode) global-whitespace-mode)
|
||||
(global-whitespace-toggle-options options))
|
||||
(when (and (boundp 'whitespace-mode) whitespace-mode)
|
||||
(whitespace-toggle-options options)))))
|
||||
|
||||
|
||||
(defun user/toggle-whitespace-auto-cleanup ()
|
||||
"Toggle the state of automatic whitespace cleanup in current buffer."
|
||||
(interactive)
|
||||
(setq whitespace-action (user/toggle-element whitespace-action 'auto-cleanup))
|
||||
(message
|
||||
(concat "Whitespace cleanup "
|
||||
(if (member 'auto-cleanup whitespace-action) "enabled" "disabled"))))
|
||||
|
||||
;; https://github.com/emacs-mirror/emacs/blob/master/lisp/whitespace.el
|
||||
;; minor mode to visualize TAB, (HARD) SPACE, NEWLINE
|
||||
(use-package whitespace
|
||||
:diminish whitespace-mode
|
||||
:init
|
||||
(add-hook 'whitespace-mode-hook 'user--whitespace-mode-hook)
|
||||
:config
|
||||
(validate-setq
|
||||
;; Maximum allowed line length.
|
||||
whitespace-line-column 120
|
||||
;; Cleanup whitespace errors on save.
|
||||
whitespace-action '(auto-cleanup)
|
||||
;; Kinds of whitespace to visualize.
|
||||
whitespace-style
|
||||
'(;; Visualize using faces.
|
||||
face
|
||||
;; Mark any tabs.
|
||||
tab-mark
|
||||
;; Empty lines at beginning or end of buffer.
|
||||
empty
|
||||
;; Trailing whitespace.
|
||||
trailing
|
||||
;; Lines that extend beyond `whitespace-line-column.'
|
||||
lines
|
||||
;; Wrong kind of indentation (tab when spaces and vice versa.)
|
||||
indentation
|
||||
;; Mixture of space and tab on the same line.
|
||||
space-before-tab space-after-tab))
|
||||
|
||||
(when (eq default-terminal-coding-system 'utf-8)
|
||||
;; Don't use validate-setq due to :inline not being supported.
|
||||
(setq
|
||||
;; Special characters for displaying whitespace.
|
||||
whitespace-display-mappings
|
||||
'(;; 32 SPACE, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」
|
||||
(space-mark ?\s [183] [46])
|
||||
;; 10 LINE FEED, 9166 RETURN SYMBOL 「⏎」, 36 DOLLAR SIGN 「$」
|
||||
(newline-mark ?\n [9166 10] [36 10])
|
||||
;; 9 TAB, 9655 WHITE RIGHT-POINTING TRIANGLE 「▷」, 92 9 CHARACTER TABULATION 「\t」
|
||||
(tab-mark ?\t [9655 9] [92 9]))))
|
||||
|
||||
(defadvice whitespace-cleanup (around whitespace-cleanup-indent-tab
|
||||
activate)
|
||||
"Fix whitespace-cleanup indent-tabs-mode bug."
|
||||
(let ((whitespace-indent-tabs-mode indent-tabs-mode)
|
||||
(whitespace-tab-width tab-width))
|
||||
ad-do-it)))
|
||||
|
||||
|
||||
(provide 'modes/whitespace)
|
||||
;;; whitespace.el ends here
|
Reference in New Issue
Block a user