General refactor & cleanup

This commit is contained in:
Henrik Lissner 2017-06-14 21:03:20 +02:00
parent 633e693cab
commit 816df321a5
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
15 changed files with 34 additions and 41 deletions

View file

@ -212,13 +212,12 @@ Body forms can access the hook's arguments through the let-bound variable
mode modes match files))))))
;; Provides a centralized configuration system that a) won't evaluate its
;; arguments if it doesn't need to (performance), b) won't complain if the
;; setting doesn't exist and c) is more elegant than a bunch of `after!' blocks,
;; which can cause intermittent stuttering in large quantities. I'm a fan of
;; concise, do-what-I-mean front-facing configuration, believe it or not.
;; I'm a fan of concise, hassle-free front-facing configuration. Rather than
;; littering my config with `after!' blocks, these two macros offer a faster and
;; more robust alternative. The motivation: to facilitate concise cross-module
;; configuration.
;;
;; Plus, it can benefit from byte-compilation.
;; It also benefits from byte-compilation.
(defvar doom-settings nil)
(defmacro def-setting! (keyword arglist &optional docstring &rest forms)

View file

@ -260,8 +260,8 @@ include all modules, enabled or otherwise."
(error "doom-modules is uninitialized")))
(defun doom--module-paths (&optional append-file)
"Returns a list of absolute file paths to modules, with APPEND-FILE added, if
the file exists."
"Returns a list of absolute file paths to activated modules, with APPEND-FILE
added, if the file exists."
(let (paths)
(dolist (pair (doom--module-pairs) (nreverse paths))
(let ((path (doom-module-path (car pair) (cdr pair) append-file)))

View file

@ -38,11 +38,9 @@
(fset #'yes-or-no-p #'y-or-n-p) ; y/n instead of yes/no
;; Ask for confirmation when trying to kill emacs or close a frame that has real
;; buffers open in it.
(defun doom-quit-p (&optional prompt)
"Return t if this session should be killed; prompts the user for
confirmation."
"Return t if this session should be killed, but not before it prompts the user
for confirmation."
(interactive)
(if (ignore-errors (doom-real-buffers-list))
(or (yes-or-no-p (format " %s" (or prompt "Quit Emacs?")))
@ -62,7 +60,7 @@ confirmation."
;; A minor mode for toggling the mode-line
(defvar-local doom--modeline-format nil
"The modeline format to use when `doom-hide-modeline-mode' is active. Don't
set this directly. Bind it in `let' instead.")
set this directly. Let-bind it instead.")
(defvar-local doom--old-modeline-format nil
"The old modeline format, so `doom-hide-modeline-mode' can revert when it's
disabled.")
@ -141,10 +139,8 @@ mode is detected.")
;; draw me like one of your French editors
(tooltip-mode -1) ; relegate tooltips to echo area only
(menu-bar-mode -1)
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(when (fboundp 'scroll-bar-mode)
(scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
;; buffer name in frame title
(setq-default frame-title-format '("DOOM Emacs"))

View file

@ -165,7 +165,7 @@ enable multiple minor modes for the same regexp.")
(string-match-p (regexp-quote remote-id) name))
(setq name (substring name (match-end 0))))
(while (and alist (caar alist) (cdar alist))
(if (string-match (caar alist) name)
(if (string-match-p (caar alist) name)
(funcall (cdar alist) 1))
(setq alist (cdr alist))))))

View file

@ -25,7 +25,8 @@
(autoload 'goto-last-change "goto-chg")
(autoload 'goto-last-change-reverse "goto-chg")
(def-package! evil :demand t
(def-package! evil
:demand t
:init
(setq evil-want-C-u-scroll t
evil-want-visual-char-semi-exclusive t

View file

@ -1,16 +1,16 @@
;;; feature/workspaces/config.el -*- lexical-binding: t; -*-
;; `persp-mode' gives me workspaces, a workspace-restricted `buffer-list', and
;; file-based session persistence. I had used workgroups2 before this, but
;; abandoned it because of its instability and impact on performance.
;; `persp-mode' has proven faster and more reliable (and it's still maintained).
;; file-based session persistence. I used workgroups2 before this, but abandoned
;; it because it was unstable and slow; `persp-mode' is neither (and still
;; maintained).
;;
;; By default, sessions are auto-saved, but not auto-loaded. Use :ss or
;; By default, sessions are autosaved, but not autoloaded. Use :ss or
;; `+workspace/save-session' to save, and :sl or `+workspace/load-session' to
;; load the last autosaved session. You can give sessions a custom name so they
;; can be loaded much later.
;; can be loaded later.
;;
;; Note: persp-mode requires `workgroups' for file persistence in Emacs 24.4.
;; FYI persp-mode requires `workgroups' for file persistence in Emacs 24.4.
(defvar +workspaces-load-session-hook nil
"A hook that runs when persp loads a new session.")

View file

@ -26,8 +26,7 @@
(user-error "Not an org buffer"))
(org-save-outline-visibility nil
(let ((attachments '())
element
file)
element)
(when (and (file-directory-p org-attach-directory)
(> (length (file-expand-wildcards (expand-file-name "*" org-attach-directory))) 0))
(save-excursion

View file

@ -1,10 +1,10 @@
;;; lang/org/autoload/evil.el -*- lexical-binding: t; -*-
;;;###autoload (autoload '+org:capture "lang/org/autoload/evil" nil t)
(evil-define-operator +org:capture (&optional beg end bang)
(evil-define-operator +org:capture (&optional beg end)
"Send a selection to `doom/org-capture'."
:move-point nil :type inclusive
(interactive "<r><!>")
(interactive "<r>")
(org-capture-string
(when (and (evil-visual-state-p) beg end)
(buffer-substring beg end))))

View file

@ -155,8 +155,7 @@ fragments, opening links, or refreshing images."
(interactive)
(let* ((scroll-pt (window-start))
(context (org-element-context))
(type (org-element-type context))
(value (org-element-property :value context)))
(type (org-element-type context)))
(cond
((memq type '(planning timestamp))
(org-follow-timestamp-link))

View file

@ -1,7 +1,7 @@
;;; lang/org/autoload/util.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +org-get-property (name &optional file)
(defun +org-get-property (name &optional _file) ; TODO Add FILE
"Get a propery from an org file."
(save-excursion
(goto-char 1)

View file

@ -388,7 +388,7 @@
(IS-LINUX "xdg-open \"%s\"")))))
;; Remove highlights on ESC
(defun +org|remove-occur-highlights (&rest args)
(defun +org|remove-occur-highlights ()
(when (derived-mode-p 'org-mode)
(org-remove-occur-highlights)
t))

View file

@ -631,7 +631,7 @@
:n "SPC" #'vc-annotate-show-log-revision-at-line
:n "]]" #'vc-annotate-next-revision
:n "[[" #'vc-annotate-prev-revision
:n [tab] #'vc-annotate-toggle-annotation-visibility
:n "TAB" #'vc-annotate-toggle-annotation-visibility
:n "RET" #'vc-annotate-find-revision-at-line))

View file

@ -10,7 +10,6 @@
(t
(pass))))
;;;###autoload
(defun +pass-get-field (entry fields)
(if-let (data (if (listp entry) entry (auth-pass-parse-entry entry)))
@ -25,12 +24,11 @@
;;;###autoload
(defun +pass-get-secret (entry)
(password-store-get entry))
(+pass-get-field entry 'secret))
(defun +pass-ivy-action--open-url (entry)
(if-let (url (+pass-get-field entry +pass-url-fields))
(and (or (string-prefix-p "http://" url)
(string-prefix-p "https://" url)
(and (or (string-match-p "https?://" url)
(error "Field for %s doesn't look like an url" item))
(browse-url url))
(error "Username not found.")))

View file

@ -103,7 +103,8 @@ whose dimensions may not be fully initialized by the time this is run."
(with-current-buffer (doom-fallback-buffer)
(read-only-mode +1)
(+doom-dashboard-mode)
(setq fringe-indicator-alist (cl-loop for (car . _cdr) in fringe-indicator-alist
(setq fringe-indicator-alist
(cl-loop for (car . _cdr) in fringe-indicator-alist
collect (cons car nil)))
(erase-buffer)
(let* ((window (get-buffer-window (doom-fallback-buffer)))

View file

@ -71,7 +71,7 @@
"Ensure the fringe settings are maintained on popup restore."
(neo-global--when-window
(doom--neotree-no-fringes)))
(add-hook 'doom-popup-mode-hook #'+doom|neotree-fix-popup nil t)))
(add-hook 'doom-popup-mode-hook #'+doom|neotree-fix-popup)))
(def-package! solaire-mode