From 03591ce77dc5af0e82109268abf4d56cb7cb6187 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 6 Sep 2017 01:33:08 +0200 Subject: [PATCH 01/20] org: restore checkbox TODO keywords --- modules/org/org/config.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/org/org/config.el b/modules/org/org/config.el index 89592b9da..de0ed06c3 100644 --- a/modules/org/org/config.el +++ b/modules/org/org/config.el @@ -117,6 +117,9 @@ org-startup-indented t org-startup-with-inline-images nil org-tags-column 0 + org-todo-keywords '((sequence "[ ](t)" "[-](p)" "[?](m)" "|" "[X](d)") + (sequence "TODO(T)" "|" "DONE(D)") + (sequence "IDEA(i)" "NEXT(n)" "ACTIVE(a)" "WAITING(w)" "LATER(l)" "|" "CANCELLED(c)")) org-use-sub-superscripts '{} outline-blank-line t From caf23e239a44bfd5f976d17a73f2f3cf8ecac307 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 7 Sep 2017 13:27:26 +0200 Subject: [PATCH 02/20] Add task entry to org-capture-templates --- modules/org/org-capture/config.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/org/org-capture/config.el b/modules/org/org-capture/config.el index 2d8b8764a..a4baf2f96 100644 --- a/modules/org/org-capture/config.el +++ b/modules/org/org-capture/config.el @@ -17,8 +17,11 @@ (setq org-default-notes-file (concat +org-dir "notes.org") ;; FIXME This is incomplete! org-capture-templates - '(;; TODO: New Task (todo) - ;; TODO: New vocabulary word + '(;; TODO: New vocabulary word + + ("t" "Todo" entry + (file+headline (expand-file-name "todo.org" +org-dir) "Inbox") + "* [ ] %?") ("c" "Changelog" entry (file+headline (expand-file-name "CHANGELOG.org" (doom-project-root)) "Unreleased") From e40d991cee3e918da5aa3ebe4f6aefb1af6da93e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 7 Sep 2017 17:25:38 +0200 Subject: [PATCH 03/20] Refactor org/org-attach --- modules/org/org-attach/autoload/evil.el | 37 ++---- modules/org/org-attach/autoload/org-attach.el | 119 +++++++++++++----- modules/org/org-attach/config.el | 63 +++++++--- 3 files changed, 140 insertions(+), 79 deletions(-) diff --git a/modules/org/org-attach/autoload/evil.el b/modules/org/org-attach/autoload/evil.el index 67ffe1b9a..7570f465b 100644 --- a/modules/org/org-attach/autoload/evil.el +++ b/modules/org/org-attach/autoload/evil.el @@ -1,33 +1,10 @@ ;;; org/org-attach/autoload/evil.el -*- lexical-binding: t; -*- -;;;###autoload (autoload '+org-attach:dwim "org/org-attach/autoload/evil" nil t) -(evil-define-command +org-attach:dwim (&optional uri) - "An evil ex interface to `+org-attach/dwim'." - (interactive "") - (unless (eq major-mode 'org-mode) - (user-error "Not in an org-mode buffer")) - (if uri - (let* ((rel-path (org-download--fullname uri)) - (new-path (expand-file-name rel-path)) - (image-p (image-type-from-file-name uri))) - (cond ((string-match-p (concat "^" (regexp-opt '("http" "https" "nfs" "ftp" "file")) ":/") uri) - (url-copy-file uri new-path)) - (t (copy-file uri new-path))) - (unless new-path - (user-error "No file was provided")) - (if (evil-visual-state-p) - (org-insert-link nil (format "./%s" rel-path) - (concat (buffer-substring-no-properties (region-beginning) (region-end)) - " " (org-attach--icon rel-path))) +;; TODO +org-attach:find + +;;;###autoload (autoload '+org-attach:uri "org/org-attach/autoload/evil" nil t) +(evil-define-command +org-attach:uri (uri) + "Downloads the file at URL and places an org link to it at the cursor." + (interactive "") + (+org-attach/uri uri)) - (insert (if image-p - (format "[[./%s]] " rel-path) - (format "%s [[./%s][%s]] " - (org-attach--icon rel-path) - rel-path (file-name-nondirectory (directory-file-name rel-path)))))) - (when (string-match-p (regexp-opt '("jpg" "jpeg" "gif" "png")) (file-name-extension rel-path)) - (org-redisplay-inline-images))) - (let ((default-directory ".attach/")) - (if (file-exists-p default-directory) - (call-interactively 'find-file) - (user-error "No attachments"))))) diff --git a/modules/org/org-attach/autoload/org-attach.el b/modules/org/org-attach/autoload/org-attach.el index 19189cd13..c5972c8c8 100644 --- a/modules/org/org-attach/autoload/org-attach.el +++ b/modules/org/org-attach/autoload/org-attach.el @@ -13,43 +13,104 @@ ((or "zip" "gz" "tar" "7z" "rar") ?) (_ ?)))) -;;;###autoload -(defun +org-attach-cleanup () - ;; "Deletes any attachments that are no longer present in the org-mode buffer." - (let* ((attachments-local (+org-attachments)) - (attachments (directory-files org-attach-directory t "^[^.]" t)) - (to-delete (cl-set-difference attachments-local attachments))) - ;; TODO - to-delete)) +;; (defun +org-attach-cleanup () +;; ;; "Deletes any attachments that are no longer present in the org-mode buffer." +;; (let* ((attachments-local (+org-attachments)) +;; (attachments (directory-files org-attach-directory t "^[^.]" t)) +;; (to-delete (cl-set-difference attachments-local attachments))) +;; ;; TODO +;; to-delete)) -(defun +org-attachments () - "List all attachments in the current buffer." +;; (defun +org-attachments () +;; "List all attachments in the current buffer." +;; (unless (eq major-mode 'org-mode) +;; (user-error "Not an org buffer")) +;; (org-save-outline-visibility nil +;; (let ((attachments '()) +;; element) +;; (when (and (file-directory-p org-attach-directory) +;; (> (length (file-expand-wildcards (expand-file-name "*" org-attach-directory))) 0)) +;; (save-excursion +;; (goto-char (point-min)) +;; (while (progn (org-next-link) (not org-link-search-failed)) +;; (setq element (org-element-context)) +;; (when-let (file (and (eq (org-element-type element) 'link) +;; (expand-file-name (org-element-property :path element)))) +;; (when (and (string= (org-element-property :type element) "file") +;; (string= (concat (file-name-base (directory-file-name (file-name-directory file))) "/") +;; org-attach-directory) +;; (file-exists-p file)) +;; (push file attachments)))))) +;; (cl-remove-duplicates attachments)))) + +;;;###autoload +(defun +org-attach/file (path) + "Copies the file at PATH to `+org-attach-dir' and places an org link to it at +the cursor." + (interactive "fAttach file: ") + (+org-attach/uri path)) + +;;;###autoload +(defun +org-attach/uri (uri) + "Downloads the file at URL and place an org link to it at the cursor." + (interactive "sUri/file: ") (unless (eq major-mode 'org-mode) - (user-error "Not an org buffer")) - (org-save-outline-visibility nil - (let ((attachments '()) - element) - (when (and (file-directory-p org-attach-directory) - (> (length (file-expand-wildcards (expand-file-name "*" org-attach-directory))) 0)) - (save-excursion - (goto-char (point-min)) - (while (progn (org-next-link) (not org-link-search-failed)) - (setq element (org-element-context)) - (when-let (file (and (eq (org-element-type element) 'link) - (expand-file-name (org-element-property :path element)))) - (when (and (string= (org-element-property :type element) "file") - (string= (concat (file-name-base (directory-file-name (file-name-directory file))) "/") - org-attach-directory) - (file-exists-p file)) - (push file attachments)))))) - (cl-remove-duplicates attachments)))) + (user-error "Not in an org buffer")) + (require 'org-download) + (condition-case ex + (cond ((string-match-p "^data:image/png;base64," uri) + (org-download-dnd-base64 uri nil)) + ((and (image-type-from-file-name uri) (not arg)) + (org-download-image uri)) + (t + (let ((new-path (expand-file-name (org-download--fullname uri)))) + ;; Download the file + (if (string-match-p (concat "^" (regexp-opt '("http" "https" "nfs" "ftp" "file")) ":/") uri) + (url-copy-file uri new-path) + (copy-file uri new-path)) + ;; insert the link + (org-download-insert-link uri new-path)))) + (error + (user-error "Failed to attach file: %s" (error-message-string ex))))) ;;;###autoload (defun +org-attach-download-dnd (uri action) + "TODO" (if (eq major-mode 'org-mode) - (doom:org-attach uri) ;; FIXME + (+org-attach:url uri) (let ((dnd-protocol-alist (rassq-delete-all '+org-attach-download-dnd (copy-alist dnd-protocol-alist)))) (dnd-handle-one-url nil action uri)))) +;;;###autoload +(defun +org-attach*link-format (filename &optional ext) + (format "%s%s.%s" + (file-name-sans-extension filename) + (format-time-string org-download-timestamp) + (or ext (file-name-extension filename)))) + +;;;###autoload +(defun +org-attach*insert-link (link filename) + "TODO" + (if (looking-back "^[ \t]+" (line-beginning-position)) + (delete-region (match-beginning 0) (match-end 0)) + (newline)) + (cond ((image-type-from-file-name filename) + (insert + (concat (if (= org-download-image-html-width 0) + "" + (format "#+attr_html: :width %dpx\n" org-download-image-html-width)) + (if (= org-download-image-latex-width 0) + "" + (format "#+attr_latex: :width %dcm\n" org-download-image-latex-width)) + (format org-download-link-format + (file-relative-name filename (file-name-directory buffer-file-name))))) + (org-display-inline-images)) + (t + (insert + (format "%s [[./%s][%s]] " + (org-attach--icon filename) + (file-relative-name filename buffer-file-name) + (file-name-nondirectory (directory-file-name rel-path))))))) + diff --git a/modules/org/org-attach/config.el b/modules/org/org-attach/config.el index 61d489bb9..6f5dda9c5 100644 --- a/modules/org/org-attach/config.el +++ b/modules/org/org-attach/config.el @@ -4,46 +4,69 @@ "Where to store attachments (relative to current org file).") -(add-hook '+org-init-hook #'+org|init-attach t) +(add-hook 'org-load-hook #'+org-attach|init t) -;; FIXME This module is broken and needs to be rewritten. -;; ;; I believe Org's native attachment system is over-complicated and litters -;; files with metadata I don't want. +;; files with metadata I don't want. So I wrote my own, which: ;; -;; This installs my own attachment system. It: -;; -;; + Centralizes attachment in a global location, -;; + Adds drag-and-drop file support -;; + TODO ...with attachment icons, and +;; + Causes attachments to be placed in a centralized location, +;; + Adds drag-and-drop support for images (with inline image preview) +;; + Adds drag-and-drop support for media files (pdfs, zips, etc) with a +;; filetype icon and short link. ;; + TODO Offers an attachment management system. +;; Some commands of interest: +;; + `org-download-screenshot' +;; + `+org-attach/file' +;; + `+org-attach/url' +;; + :org [FILE/URL] + (def-package! org-download + :commands (org-download-dnd org-download-dnd-base64) + :init + ;; Add these myself, so that org-download is lazy-loaded... + (setq dnd-protocol-alist + `(("^\\(https?\\|ftp\\|file\\|nfs\\):" . +org-attach-download-dnd) + ("^data:" . org-download-dnd-base64) + ,@dnd-protocol-alist)) + + (advice-add #'org-download-enable :override #'ignore) :config (setq-default org-download-image-dir +org-attach-dir org-download-heading-lvl nil org-download-timestamp "_%Y%m%d_%H%M%S") + (setq org-download-screenshot-method - (cond (IS-MAC "screencapture -i %s") - (IS-LINUX "maim --opengl -s %s"))) + (cond (IS-MAC "screencapture -i %s") + (IS-LINUX + (cond ((executable-find "maim") + "maim -s %s") + ((executable-find "scrot") + "scrot -s %s"))))) + + ;; Handle non-image files a little differently. Images should be inserted + ;; as-is, as image previews. Other files, like pdfs or zips, should be linked + ;; to, with an icon indicating the type of file. + (advice-add #'org-download-insert-link :override #'+org-attach*insert-link) + + (defun +org-attach*download-subdir () + (when (file-in-directory-p buffer-file-name +org-dir) + (file-relative-name buffer-file-name +org-dir))) ;; Write download paths relative to current file (defun +org-attach*download-fullname (path) - (file-relative-name path (file-name-directory (buffer-file-name)))) + (file-relative-name path (file-name-directory buffer-file-name))) (advice-add #'org-download--dir-2 :override #'ignore) (advice-add #'org-download--fullname :filter-return #'+org-attach*download-fullname)) ;; (defun +org-attach|init () - (setq org-attach-directory +org-attach-directory) + (setq org-attach-directory +org-attach-dir) + + (push +org-attach-dir projectile-globally-ignored-directories) - (push ".attach" projectile-globally-ignored-file-suffixes) (after! recentf - (push (format "/%s.+$" (regexp-quote +org-attach-dir)) - recentf-exclude)) + (push (format "%s.+$" (regexp-quote +org-attach-dir)) + recentf-exclude))) - (require 'org-download) - - ;; Add another drag-and-drop handler that will handle anything but image files - (push '("^\\(https?\\|ftp\\|file\\|nfs\\):\\(//\\)?" . +org-attach-download-dnd) dnd-protocol-alist)) From 5cdc495a9f8fc26b87796383ced59bb143634b19 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 7 Sep 2017 17:35:09 +0200 Subject: [PATCH 04/20] Refactor +org/dwim-at-point --- modules/org/org/autoload/org.el | 97 +++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 35 deletions(-) diff --git a/modules/org/org/autoload/org.el b/modules/org/org/autoload/org.el index e712813f0..24beefd81 100644 --- a/modules/org/org/autoload/org.el +++ b/modules/org/org/autoload/org.el @@ -26,55 +26,82 @@ ;;;###autoload (defun +org/dwim-at-point () - "Do-what-I-mean at point. This includes following timestamp links, aligning -tables, toggling checkboxes/todos, executing babel blocks, previewing latex -fragments, opening links, or refreshing images." + "Do-what-I-mean at point. + +If on a: +- checkbox list item or todo heading: toggle it. +- clock: update its time. +- headline: toggle latex fragments and inline images underneath. +- footnote definition: jump to the footnote +- table-row or a TBLFM: recalculate the table's formulas +- table-cell: clear it and go into insert mode. If this is a formula cell, + recaluclate it instead. +- babel-call: execute the source block +- statistics-cookie: update it. +- latex fragment: toggle it. +- link: follow it +- otherwise, refresh all inline images in current tree." (interactive) (let* ((scroll-pt (window-start)) (context (org-element-context)) (type (org-element-type context))) - (cond - ((memq type '(planning timestamp)) - (org-follow-timestamp-link)) + (pcase type + ((guard (org-element-property :checkbox (org-element-lineage context '(item) t))) + (let ((match (and (org-at-item-checkbox-p) (match-string 1)))) + (org-toggle-checkbox (if (equal match "[ ]") '(16))))) - ((memq type '(table table-row)) - (if (org-element-property :tblfm (org-element-property :parent context)) - (org-table-recalculate t) - (org-table-align))) + (`headline + (cond ((org-element-property :todo-type context) + (org-todo + (if (eq (org-element-property :todo-type context) 'done) 'todo 'done))) + ((string= "ARCHIVE" (car-safe (org-get-tags))) + (org-force-cycle-archived)) + (t + (org-remove-latex-fragment-image-overlays) + (org-toggle-latex-fragment '(4))))) - ((org-element-property :checkbox (org-element-lineage context '(item) t)) - (let ((match (and (org-at-item-checkbox-p) (match-string 1)))) - (org-toggle-checkbox (if (equal match "[ ]") '(16))))) + (`clock (org-clock-update-time-maybe)) - ((and (eq type 'headline) - (org-element-property :todo-type context)) - (org-todo - (if (eq (org-element-property :todo-type context) 'done) 'todo 'done))) + (`footnote-definition + (goto-char (org-element-property :post-affiliated context)) + (call-interactively #'org-footnote-action)) - ((and (eq type 'headline) - (string= "ARCHIVE" (car-safe (org-get-tags)))) - (org-force-cycle-archived)) + ((or `planning `timestamp) (org-follow-timestamp-link)) - ((eq type 'headline) - (org-remove-latex-fragment-image-overlays) - (org-toggle-latex-fragment '(4))) + ((or `table `table-row) + (if (org-at-TBLFM-p) + (org-table-calc-current-TBLFM) + (ignore-errors + (save-excursion + (goto-char (org-element-property :contents-begin context)) + (org-call-with-arg 'org-table-recalculate (or arg t)))))) - ((eq type 'babel-call) - (org-babel-lob-execute-maybe)) + (`table-cell + (org-table-blank-field) + (org-table-recalculate) + (when (and (string-empty-p (string-trim (org-table-get-field))) + (bound-and-true-p evil-mode)) + (evil-change-state 'insert))) - ((memq type '(src-block inline-src-block)) - (org-babel-execute-src-block)) + (`babel-call + (org-babel-lob-execute-maybe)) - ((memq type '(latex-fragment latex-environment)) - (org-toggle-latex-fragment)) + (`statistics-cookie + (save-excursion (org-update-statistics-cookies nil))) - ((eq type 'link) - (let ((path (org-element-property :path (org-element-lineage context '(link) t)))) - (if (and path (image-type-from-file-name path)) - (+org/refresh-inline-images) - (org-open-at-point)))) + ((or `src-block `inline-src-block) + (org-babel-execute-src-block)) - (t (+org/refresh-inline-images))) + ((or `latex-fragment `latex-environment) + (org-toggle-latex-fragment)) + + (`link + (let ((path (org-element-property :path (org-element-lineage context '(link) t)))) + (if (and path (image-type-from-file-name path)) + (+org/refresh-inline-images) + (org-open-at-point)))) + + (_ (+org/refresh-inline-images))) (set-window-start nil scroll-pt))) ;;;###autoload From 649f3eaf914eafb903a0fa9820ac6625155d1fcd Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 7 Sep 2017 17:36:18 +0200 Subject: [PATCH 05/20] +org/toggle-fold: realign tables --- modules/org/org/autoload/org.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/org/org/autoload/org.el b/modules/org/org/autoload/org.el index 24beefd81..94437e8c3 100644 --- a/modules/org/org/autoload/org.el +++ b/modules/org/org/autoload/org.el @@ -259,11 +259,16 @@ wrong places)." ;;;###autoload (defun +org/toggle-fold () "Toggle the local fold at the point (as opposed to cycling through all levels -with `org-cycle'). Also removes babel result blocks, if run from a code block." +with `org-cycle'). Also: + + + If in a babel block, removes result blocks. + + If in a table, realign it, if necessary." (interactive) (save-excursion (org-beginning-of-line) - (cond ((org-in-src-block-p) + (cond ((org-table-p) + (org-table-align)) + ((org-in-src-block-p) (org-babel-remove-result)) ((org-at-heading-p) (outline-toggle-children)) From 1f13aa5d701ffb961fce203fbb111d7cfa051843 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 7 Sep 2017 17:36:33 +0200 Subject: [PATCH 06/20] +org|realign-table-maybe: now recalculates table formulas too --- modules/org/org/autoload/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/org/org/autoload/org.el b/modules/org/org/autoload/org.el index 94437e8c3..18a1c6df5 100644 --- a/modules/org/org/autoload/org.el +++ b/modules/org/org/autoload/org.el @@ -13,10 +13,10 @@ ;;;###autoload (defun +org|realign-table-maybe () - "Auto-align table under cursor." + "Auto-align table under cursor and re-calculate formulas." (when (org-at-table-p) (save-excursion - (org-table-align)))) + (quiet! (org-table-recalculate))))) ;;;###autoload (defun +org|update-cookies () From 6327c9688629d8efa397fa348cf794735ecc83ce Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 7 Sep 2017 17:37:31 +0200 Subject: [PATCH 07/20] Add org-attach to init.example.el --- init.example.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.example.el b/init.example.el index cd34691e3..a9039bc16 100644 --- a/init.example.el +++ b/init.example.el @@ -110,7 +110,7 @@ :org org ; organize your plain life in plain text org-babel ; executable code snippets in org-mode - ;org-attach ; FIXME my own, simpler attachment system + org-attach ; a simpler attachment system org-capture ; a better org-capture, in or outside of Emacs org-export ; a custom, centralized export system org-notebook ; org-mode as a notebook From 806ee96416337d86b5d926861ac109ab9c42a8d3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 7 Sep 2017 17:55:01 +0200 Subject: [PATCH 08/20] org-attach: remove vestigial reference to variable --- modules/org/org-attach/autoload/org-attach.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/org/org-attach/autoload/org-attach.el b/modules/org/org-attach/autoload/org-attach.el index c5972c8c8..2d6a670bc 100644 --- a/modules/org/org-attach/autoload/org-attach.el +++ b/modules/org/org-attach/autoload/org-attach.el @@ -60,7 +60,7 @@ the cursor." (condition-case ex (cond ((string-match-p "^data:image/png;base64," uri) (org-download-dnd-base64 uri nil)) - ((and (image-type-from-file-name uri) (not arg)) + ((image-type-from-file-name uri) (org-download-image uri)) (t (let ((new-path (expand-file-name (org-download--fullname uri)))) From 781f29dea1d381df279e89c15fcf8657bde5c43b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 8 Sep 2017 21:49:12 +0200 Subject: [PATCH 09/20] Add lang/ledger #194 --- modules/lang/ledger/config.el | 19 +++++++++++++++++++ modules/lang/ledger/packages.el | 10 ++++++++++ 2 files changed, 29 insertions(+) create mode 100644 modules/lang/ledger/config.el create mode 100644 modules/lang/ledger/packages.el diff --git a/modules/lang/ledger/config.el b/modules/lang/ledger/config.el new file mode 100644 index 000000000..07e823130 --- /dev/null +++ b/modules/lang/ledger/config.el @@ -0,0 +1,19 @@ +;;; lang/ledger/config.el -*- lexical-binding: t; -*- + +(def-package! ledger-mode + :mode "\\.ledger$" + :commands ledger-mode + :config + (setq ledger-clear-whole-transactions 1)) + + +(def-package! evil-ledger + :when (featurep! :feature evil) + :after ledger-mode + :config + (add-hook 'ledger-mode-hook #'evil-ledger-mode)) + + +(def-package! flycheck-ledger + :when (featurep! :feature syntax-checker) + :init (add-hook 'ledger-mode-hook #'flycheck-mode)) diff --git a/modules/lang/ledger/packages.el b/modules/lang/ledger/packages.el new file mode 100644 index 000000000..b58a40382 --- /dev/null +++ b/modules/lang/ledger/packages.el @@ -0,0 +1,10 @@ +;; -*- no-byte-compile: t; -*- +;;; lang/ledger/packages.el + +(package! ledger-mode) + +(when (featurep! :feature evil) + (package! evil-ledger)) + +(when (featurep! :feature syntax-checker) + (package! flycheck-ledger)) From c4ea986f5a021e9f7ba835805e15096463130f5f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 8 Sep 2017 21:50:01 +0200 Subject: [PATCH 10/20] init.example.el: disable :lang modules by default --- init.example.el | 61 +++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/init.example.el b/init.example.el index a9039bc16..da78ac985 100644 --- a/init.example.el +++ b/init.example.el @@ -75,37 +75,38 @@ upload ; map local to remote projects via ssh/ftp :lang - assembly ; assembly for fun or debugging - cc ; C/C++/Obj-C madness - crystal ; ruby at the speed of c - csharp ; unity, .NET, and mono shenanigans - data ; config/data formats - elixir ; erlang done right - elm ; care for a cup of TEA? + ;assembly ; assembly for fun or debugging + ;cc ; C/C++/Obj-C madness + ;crystal ; ruby at the speed of c + ;csharp ; unity, .NET, and mono shenanigans + ;data ; config/data formats + ;elixir ; erlang done right + ;elm ; care for a cup of TEA? emacs-lisp ; drown in parentheses - go ; the hipster dialect - haskell ; a language that's lazier than I am - hy ; readability of scheme w/ speed of python - java ; the poster child for carpal tunnel syndrome - javascript ; all(hope(abandon(ye(who(enter(here)))))) - julia ; a better, faster MATLAB - latex ; writing papers in Emacs has never been so fun - lua ; one-based indices? one-based indices - markdown ; writing docs for people to ignore - ocaml ; an objective camel - perl ; write code no one else can comprehend - php ; make php less awful to work with - plantuml ; diagrams for confusing people more - purescript ; javascript, but functional - python ; beautiful is better than ugly - rest ; Emacs as a REST client - ruby ; 1.step do {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} - rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() - scala ; java, but good - sh ; she sells (ba|z)sh shells on the C xor - swift ; who asked for emoji variables? - typescript ; javascript, but better - web ; the tubes + ;go ; the hipster dialect + ;haskell ; a language that's lazier than I am + ;hy ; readability of scheme w/ speed of python + ;java ; the poster child for carpal tunnel syndrome + ;javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;julia ; a better, faster MATLAB + ;latex ; writing papers in Emacs has never been so fun + ;ledger ; an accounting system in Emacs + ;lua ; one-based indices? one-based indices + ;markdown ; writing docs for people to ignore + ;ocaml ; an objective camel + ;perl ; write code no one else can comprehend + ;php ; make php less awful to work with + ;plantuml ; diagrams for confusing people more + ;purescript ; javascript, but functional + ;python ; beautiful is better than ugly + ;rest ; Emacs as a REST client + ;ruby ; 1.step do {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + ;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;scala ; java, but good + ;sh ; she sells (ba|z)sh shells on the C xor + ;swift ; who asked for emoji variables? + ;typescript ; javascript, but better + ;web ; the tubes :org org ; organize your plain life in plain text From a6199b1ed24cbb6ecdc288c09e5230ae2ef39200 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 9 Sep 2017 18:38:55 +0200 Subject: [PATCH 11/20] Use left-margin to center dashboard elements #192 --- modules/ui/doom-dashboard/config.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/ui/doom-dashboard/config.el b/modules/ui/doom-dashboard/config.el index 5a59bfc4e..565724ea5 100644 --- a/modules/ui/doom-dashboard/config.el +++ b/modules/ui/doom-dashboard/config.el @@ -116,15 +116,20 @@ whose dimensions may not be fully initialized by the time this is run." (or (and (featurep! :ui doom-modeline) (doom-modeline 'project)) mode-line-format))) - (let ((old-pwd (or dir default-directory))) - (with-current-buffer (doom-fallback-buffer) + (let ((+doom-dashboard--width 80) + (old-pwd (or dir default-directory)) + (fallback-buffer (doom-fallback-buffer))) + (dolist (win (get-buffer-window-list fallback-buffer nil t)) + (set-window-fringes win 0 0) + (set-window-margins + win (max 0 (/ (- (window-total-width win) +doom-dashboard--width) 2)))) + (with-current-buffer fallback-buffer (with-silent-modifications (unless (eq major-mode '+doom-dashboard-mode) (+doom-dashboard-mode)) (erase-buffer) (setq default-directory old-pwd) - (let ((+doom-dashboard--width (window-width)) - (+doom-dashboard--height (window-height))) + (let ((+doom-dashboard--height (window-height))) (insert (make-string (max 0 (- (truncate (/ +doom-dashboard--height 2)) 16)) ?\n)) (dolist (widget-name +doom-dashboard-widgets) (funcall (intern (format "doom-dashboard-widget--%s" widget-name))) From 5137888bd98278783d9fd6193ec67586d1ad8f7f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 11 Sep 2017 16:38:29 +0200 Subject: [PATCH 12/20] feature/hydra: lv-use-separator = t --- modules/feature/hydra/config.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/feature/hydra/config.el b/modules/feature/hydra/config.el index 03fb4d08e..f2b83baef 100644 --- a/modules/feature/hydra/config.el +++ b/modules/feature/hydra/config.el @@ -3,6 +3,8 @@ (def-package! hydra :commands (+hydra-zoom/body +hydra-window/body defhydra) :config + (setq lv-use-separator t) + (defhydra +hydra-zoom (:hint t :color red) "zoom" ("j" text-scale-increase "in") From 5bee4a156e0a5feca5c50ae1a0617090e42e8bc9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 11 Sep 2017 17:01:59 +0200 Subject: [PATCH 13/20] Remove dead wiki link from README --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index bb586a7f6..9990e3699 100644 --- a/README.md +++ b/README.md @@ -98,8 +98,7 @@ a resource for others. If you'd like to support my efforts, I welcome contributions of any kind: -+ I love pull requests and bug reports (read the [contribution - guidelines][wiki-contribute] first though!), and elisp pointers are especially ++ I love pull requests and bug reports, and elisp pointers are especially welcome. Seriously, don't hesitate to [tell me my Elisp-fu sucks][doom-new-issue]! + I'm happy to discuss Emacs workflow, ideas or tooling. If you think I, Doom or @@ -108,7 +107,6 @@ If you'd like to support my efforts, I welcome contributions of any kind: [wiki]: /../../wiki -[wiki-contribute]: /../../wiki/Contribute [wiki-conventions]: /../../wiki/Conventions [wiki-modules]: /../../wiki/Modules [wiki-customization]: /../../wiki/Customization From bb959c635be3b82c348eca81841f2cd16d0cf8d3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 11 Sep 2017 23:14:35 +0200 Subject: [PATCH 14/20] Prevent/delay hash-table rehashing This is *definitely* premature optimization. --- core/core-packages.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/core-packages.el b/core/core-packages.el index 53645f5b9..d03916593 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -228,7 +228,9 @@ This aggressively reloads core autoload files." e.g '(:feature evil :lang emacs-lisp javascript java)" (unless doom-modules - (setq doom-modules (make-hash-table :test #'equal :size (+ 5 (length modules))))) + (setq doom-modules (make-hash-table :test #'equal + :size (+ 5 (length modules)) + :rehash-threshold 1.0))) (let (mode) (dolist (m modules) (cond ((keywordp m) From 48bbdbaf22b2183258303a0e5128d8350986e169 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 12 Sep 2017 02:44:55 +0200 Subject: [PATCH 15/20] Update changelog --- CHANGELOG.org | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index 2df246501..e84a62ab0 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -11,7 +11,6 @@ * Todo + *Potential plugins:* - + =completion/ivy= [[https://github.com/yevgnen/ivy-rich][ivy-rich]], possible replacement for ~+ivy/switch-buffer~ + =app/present= [[https://github.com/larstvei/Focus][focus]], for presenting code + [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]], client for MS Language Server Protocol, keep an eye on this + =lang/javascript= [[https://github.com/NicolasPetton/Indium][indium]] (IDE), keep an eye on this @@ -26,10 +25,9 @@ + =lang/python= [[https://github.com/Wilfred/pyimport][pyimport]] or [[https://github.com/anachronic/importmagic.el][importmagic]] + [[https://github.com/mhayashi1120/Emacs-imagex][emacs-imagex]], for manipulating images at point (zooming?) + =tools/term= [[https://github.com/riscy/shx-for-emacs][shx]], an extension for the shell in Emacs - + =app/crm= [[https://github.com/skeeto/emacsql][emacsql]], a sqlite backend; which would be useful for CRM storage. - + =core= [[https://github.com/Wilfred/helpful][helpful]], a better help buffer; possible replacement for ~describe-function~. + + =app/crm= [[https://github.com/skeeto/emacsql][emacsql]], a sqlite backend; possibly useful for CRM storage. + + =core= [[https://github.com/Wilfred/helpful][helpful]], a better help buffer; replacement for ~describe-function~? + *Planned modules:* - + =app/finance= -- ledger + org-mode. + =app/crm= -- Customer Relations Management, in Emacs, using org-mode. + =app/write= -- Make Emacs into a focused plaintext word processor (using markdown, org and rst) for writing papers and stories. + =app/regex= -- PCRE IDE, with live buffer matching, search/replace support, and an export-to-code feature for various languages. @@ -45,9 +43,9 @@ + C++ (~regex reg(regexp, ...)~) + Syntax highlighter for ~+regex-mode~ (plus make it a major mode) + Optimize: communicate with perl process (with ~make-process~ instead of ~call-process~) - + =lang/alda= -- Language support for [[https://github.com/alda-lang/alda][Alda]], the music programming language, using [[https://github.com/jgkamat/alda-mode][alda-mode]]. + =org/org-publish= -- publishing org files to HTML (thanks to [[https://github.com/matthewgraybosch][matthewgraybosch]]) + =org/org-attach= -- my own, simpler attachment system with drag-drop image attachment support and centralized storage. + + =app/torrents= -- Emacs as a torrent client (powered by transmission.el) + =core-ui= Replace or fix ~winner-mode~ unreliability (will close windows trying to revive killed buffers). Perhaps make ~doom/kill-this-buffer~ only disassociate buffer from persp-mode or bury buffer if persp-mode is inactive. + =org= + Better shackle + org-agenda integration @@ -67,6 +65,16 @@ + =core-popups= Add support for moving popup windows to the ~+evil/window-move-*~ commands #171 * Unreleased (master) ++ =doom= + + Added new module: ~lang/ledger~, for editing ledger files. + + Fixed ~make update~ to work even if Doom is installed somewhere other than ~\~/.emacs.d~ (see [[https://github.com/hlissner/doom-emacs/issues/190][#190]]). ++ =feature= + + =hydra= Display a separator along the bottom of hydra windows for extra contrast. ++ =ui= + + =doom-dashboard= Elements are now centered using window-local margins, which fixes discrepancies when multiple dashboards are visible in different sized windows and/or frames (see [[https://github.com/hlissner/doom-emacs/issues/192][#192]]). ++ =org= + + If a table is under point when ~+org/toggle-fold~ is invoked, the table is realigned. + + =org-capture= Fix a vestigial reference to a long-since-renamed function: ~doom/project-root~. * 2.0.5 (Sep 03, 2017) + =doom= @@ -84,7 +92,7 @@ + Added new function: ~doom|disable-vi-tilde-fringe~ for turning off vi-tilde-fringe in select buffers. + Added support for relative line numbers (see ~doom-line-numbers-style~), using nlinum-relative on Emacs <26, and display-line-numbers on Emacs 26+. + =feature= - + =File Templates= Added a file template for: + + =file-templates= Added a file template for: + *.org files + Module README.org files. + =jump= @@ -92,6 +100,7 @@ + Rewrote ~+jump/online~ to: + Use the current selection, if active, or prompt for a query otherwise (with the thing at point as the initial input). + Prompts for the provider (search engine) on first use, and reuses the last provider on consecutive uses. If the universal argument is supplied, force ~+jump/online~ to prompt for the provider anyway. + + =workspaces= Fix interactive renaming of workspaces, as well as the ability to save and load workspaces from files (see [[https://github.com/hlissner/doom-emacs/pull/200][#200]]). + =completion= + Added all-the-icons support to ~ivy-switch-buffer~ and ~+ivy/switch-workspace-buffer~. Enable this with ~(setq +ivy-buffer-icons t)~. + =ui= From be0e23686b582392d4fe4fe012913be5a873a286 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 12 Sep 2017 14:52:32 +0200 Subject: [PATCH 16/20] org/org: resolve +rss-elfeed-files later This gives the user more time to change +org-dir. --- modules/app/rss/config.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/app/rss/config.el b/modules/app/rss/config.el index ea424d7d8..64a513fbc 100644 --- a/modules/app/rss/config.el +++ b/modules/app/rss/config.el @@ -4,10 +4,7 @@ ;; by apps Reeder and Readkit. It can be invoked via `=rss'. Otherwise, if you ;; don't care for the UI you can invoke elfeed directly with `elfeed'. -(defvar +rss-org-dir (concat +org-dir "/rss/") - "Where RSS org files are located.") - -(defvar +rss-elfeed-files (list "elfeed.org") +(defvar +rss-elfeed-files (list "rss/elfeed.org") "The files that configure `elfeed's rss feeds.") (defvar +rss-split-direction 'below @@ -62,6 +59,6 @@ :after elfeed :config (setq rmh-elfeed-org-files - (let ((default-directory +rss-org-dir)) + (let ((default-directory +org-dir)) (mapcar #'expand-file-name +rss-elfeed-files))) (elfeed-org)) From f6f335ee14acccc1b6ce9b4b810dba24ebb2e71c Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 12 Sep 2017 14:53:40 +0200 Subject: [PATCH 17/20] doom-modeline: minor refactor --- modules/ui/doom-modeline/config.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ui/doom-modeline/config.el b/modules/ui/doom-modeline/config.el index 9b8be9e9d..90ade36f6 100644 --- a/modules/ui/doom-modeline/config.el +++ b/modules/ui/doom-modeline/config.el @@ -255,9 +255,9 @@ If TRUNCATE-TAIL is t also truncate the parent directory of the file." (basename (cdr dirs)) (dir-faces (or modified-faces (if active 'doom-modeline-project-root-dir))) (file-faces (or modified-faces (if active 'doom-modeline-buffer-file)))) - (concat (propertize dirname - 'face (if dir-faces `(:inherit ,dir-faces))) - (propertize (concat (if truncate-tail (substring basename 0 1) basename) "/") + (concat (propertize (concat dirname + (if truncate-tail (substring basename 0 1) basename) + "/") 'face (if dir-faces `(:inherit ,dir-faces))) (propertize (file-name-nondirectory buffer-file-name) 'face (if file-faces `(:inherit ,file-faces))))))))) From 5f26399ff2d38c0f02b83fc0214309fe1535585b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 12 Sep 2017 23:55:34 +0200 Subject: [PATCH 18/20] Fix evil-mc not whitelisting custom commands --- modules/feature/evil/config.el | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index dc284783c..0584d24af 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -295,16 +295,15 @@ the new algorithm is confusing, like in python or ruby." :config (global-evil-mc-mode +1) - (unless doom-init-p - ;; Add custom commands to whitelisted commands - (dolist (fn '(doom/deflate-space-maybe doom/inflate-space-maybe - doom/backward-to-bol-or-indent doom/forward-to-last-non-comment-or-eol - doom/backward-kill-to-bol-and-indent doom/newline-and-indent)) - (push (cons fn '((:default . evil-mc-execute-default-call))) - evil-mc-custom-known-commands)) + ;; Add custom commands to whitelisted commands + (dolist (fn '(doom/deflate-space-maybe doom/inflate-space-maybe + doom/backward-to-bol-or-indent doom/forward-to-last-non-comment-or-eol + doom/backward-kill-to-bol-and-indent doom/newline-and-indent)) + (push (cons fn '((:default . evil-mc-execute-default-call))) + evil-mc-custom-known-commands)) - ;; disable evil-escape in evil-mc; causes unwanted text on invocation - (push 'evil-escape-mode evil-mc-incompatible-minor-modes)) + ;; disable evil-escape in evil-mc; causes unwanted text on invocation + (push 'evil-escape-mode evil-mc-incompatible-minor-modes) (defun +evil|escape-multiple-cursors () "Clear evil-mc cursors and restore state." From 4e7d3c6c0619b73aaa8463a1e7ccc8c56179ee10 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 13 Sep 2017 00:11:02 +0200 Subject: [PATCH 19/20] Add GNUTLS feature detection to doom doctor #175 --- bin/doom-doctor | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/doom-doctor b/bin/doom-doctor index 2172dd3dd..d0892a974 100755 --- a/bin/doom-doctor +++ b/bin/doom-doctor @@ -210,7 +210,19 @@ "or just about anyone who knows more about computers than you do!")))) (log! "test-tls") -(cond ((or (executable-find "gnutls-cli") +(cond ((not (string-match-p "\\_" system-configuration-features)) + (warn! "Warning: You didn't install Emacs with gnutls support") + (explain! + "This may cause 'pecular error' errors with the Doom doctor, and is likely to " + "interfere with package management. Your mileage may vary." + (when (eq system-type 'darwin) + (concat "\nMacOS users are advised to install Emacs via homebrew with one of the following:\n" + " brew install emacs --with-gnutls" + " or" + " brew tap d12frosted/emacs-plus" + " brew install emacs-plus")))) + + ((or (executable-find "gnutls-cli") (executable-find "openssl")) (let ((tls-checktrust t) (gnutls-verify-error t)) @@ -247,6 +259,7 @@ (when (getenv "DEBUG") (success! "Rejected %s (a good thing!)" url) (explain! (pp-to-string ex)))))))) + (t (error! "Nope!"))) From 3345872d7afb955bb4b044ddd0003cb4cf8660eb Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 13 Sep 2017 12:49:36 +0200 Subject: [PATCH 20/20] Switch to fallback buffer on kill-all-buffers --- core/autoload/buffers.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/autoload/buffers.el b/core/autoload/buffers.el index 270953133..2ce241650 100644 --- a/core/autoload/buffers.el +++ b/core/autoload/buffers.el @@ -256,10 +256,9 @@ If PROJECT-P, kill all buffers that belong to the current project." (interactive "P") (let ((buffers (if project-p (doom-project-buffer-list) (doom-buffer-list)))) (mapc #'doom-kill-buffer-and-windows buffers) - (when (called-interactively-p 'interactive) - (unless (doom-real-buffer-p) - (switch-to-buffer (doom-fallback-buffer))) - (message "Killed %s buffers" (length buffers))))) + (unless (doom-real-buffer-p) + (switch-to-buffer (doom-fallback-buffer))) + (message "Killed %s buffers" (length buffers)))) ;;;###autoload (defun doom/kill-other-buffers (&optional project-p)