General docstring+idempotency refactor

This commit is contained in:
Henrik Lissner 2017-06-11 00:59:02 +02:00
parent 7c20a43be6
commit 2097498f3e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
7 changed files with 35 additions and 25 deletions

View file

@ -232,8 +232,9 @@ Example
(doom--keymaps (doom--keymaps
(dolist (keymap doom--keymaps) (dolist (keymap doom--keymaps)
(push `(define-key ,keymap ,key ,def) forms))) (push `(define-key ,keymap ,key ,def) forms)))
(t (push `(,(if local 'local-set-key 'global-set-key) ,key ,def) (t
forms)))) (push `(,(if local 'local-set-key 'global-set-key) ,key ,def)
forms))))
(setq states '() (setq states '()
local nil local nil
desc nil))) desc nil)))

View file

@ -334,11 +334,10 @@ ignore any `def-package!' blocks for PACKAGE."
"Loads a file relative to the current module (or PATH). FILESYM is a file path "Loads a file relative to the current module (or PATH). FILESYM is a file path
as a symbol. PATH is a directory to prefix it with. If NOERROR is non-nil, don't as a symbol. PATH is a directory to prefix it with. If NOERROR is non-nil, don't
throw an error if the file doesn't exist." throw an error if the file doesn't exist."
(let ((path (or (and path (let ((path (or (and path (or (and (symbolp path) (symbol-value path))
(cond ((symbolp path) (symbol-value path)) (and (stringp path) path)
((stringp path) path) (and (listp path) (eval path))))
((listp path) (eval path)))) (and load-file-name (file-name-directory load-file-name))
(and load-file-name (file-name-directory load-file-name))
(and (bound-and-true-p byte-compile-current-file) (and (bound-and-true-p byte-compile-current-file)
(file-name-directory byte-compile-current-file)) (file-name-directory byte-compile-current-file))
(and buffer-file-name (file-name-directory buffer-file-name))))) (and buffer-file-name (file-name-directory buffer-file-name)))))

View file

@ -64,7 +64,8 @@ there are problems.")
"Location of the autoloads file generated by `doom/reload-autoloads'.") "Location of the autoloads file generated by `doom/reload-autoloads'.")
(defgroup doom nil (defgroup doom nil
"" "DOOM Emacs, an Emacs configuration for a stubborn, shell-dwelling and
melodramatic ex-vimmer disappointed with the text-editor status quo."
:group 'emacs) :group 'emacs)
@ -113,7 +114,7 @@ there are problems.")
(setq custom-file (concat doom-etc-dir "custom.el")) (setq custom-file (concat doom-etc-dir "custom.el"))
(load custom-file t t) (load custom-file t t)
;; be quiet at startup ;; be quiet at startup; don't load anything unnecessary
(advice-add #'display-startup-echo-area-message :override #'ignore) (advice-add #'display-startup-echo-area-message :override #'ignore)
(setq inhibit-startup-message t (setq inhibit-startup-message t
inhibit-startup-echo-area-message user-login-name inhibit-startup-echo-area-message user-login-name
@ -180,6 +181,9 @@ enable multiple minor modes for the same regexp.")
(load! core-keybinds)) ; centralized keybind system + which-key (load! core-keybinds)) ; centralized keybind system + which-key
(defun doom|init () (defun doom|init ()
;; Don't keep gc-cons-threshold too high. It helps to stave off the GC while
;; Emacs starts up, but afterwards it causes stuttering and random freezes. So
;; reset it to a reasonable default.
(setq gc-cons-threshold 16777216 (setq gc-cons-threshold 16777216
gc-cons-percentage 0.1 gc-cons-percentage 0.1
file-name-handler-alist doom--file-name-handler-alist)) file-name-handler-alist doom--file-name-handler-alist))

View file

@ -96,15 +96,15 @@
("mime:image/*" "Messages with images" ?p))) ("mime:image/*" "Messages with images" ?p)))
;; Add a column to display what email account the email belongs to. ;; Add a column to display what email account the email belongs to.
(cl-pushnew '(:account (add-to-list 'mu4e-header-info-custom
:name "Account" '(:account
:shortname "Account" :name "Account"
:help "Which account this email belongs to" :shortname "Account"
:function :help "Which account this email belongs to"
(lambda (msg) :function
(let ((maildir (mu4e-message-field msg :maildir))) (lambda (msg)
(format "%s" (substring maildir 1 (string-match-p "/" maildir 1)))))) (let ((maildir (mu4e-message-field msg :maildir)))
mu4e-header-info-custom) (format "%s" (substring maildir 1 (string-match-p "/" maildir 1)))))))
;; In my workflow, emails won't be moved at all. Only their flags/labels are ;; In my workflow, emails won't be moved at all. Only their flags/labels are
;; changed. Se we redefine the trash and refile marks not to do any moving. ;; changed. Se we redefine the trash and refile marks not to do any moving.
@ -157,12 +157,12 @@
(imagemagick-register-types)) (imagemagick-register-types))
(after! evil (after! evil
(mapc (lambda (str) (evil-set-initial-state (car str) (cdr str))) (cl-loop for str in '((mu4e-main-mode . normal)
'((mu4e-main-mode . normal) (mu4e-view-mode . normal)
(mu4e-view-mode . normal) (mu4e-headers-mode . normal)
(mu4e-headers-mode . normal) (mu4e-compose-mode . normal)
(mu4e-compose-mode . normal) (mu4e~update-mail-mode . normal))
(mu4e~update-mail-mode . normal))) do (evil-set-initial-state (car str) (cdr str)))
(setq mu4e-view-mode-map (make-sparse-keymap) (setq mu4e-view-mode-map (make-sparse-keymap)
;; mu4e-compose-mode-map (make-sparse-keymap) ;; mu4e-compose-mode-map (make-sparse-keymap)

View file

@ -242,7 +242,7 @@ across windows."
(add-hook 'emacs-startup-hook #'evil-escape-mode) (add-hook 'emacs-startup-hook #'evil-escape-mode)
:config :config
;; no `evil-escape' in minibuffer ;; no `evil-escape' in minibuffer
(push #'minibufferp evil-escape-inhibit-functions) (cl-pushnew #'minibufferp evil-escape-inhibit-functions)
(map! :irvo "C-g" #'evil-escape)) (map! :irvo "C-g" #'evil-escape))

View file

@ -74,10 +74,12 @@
(map! :map bibtex-mode-map "C-c \\" #'bibtex-fill-entry)) (map! :map bibtex-mode-map "C-c \\" #'bibtex-fill-entry))
(def-package! ivy-bibtex (def-package! ivy-bibtex
:when (featurep! :completion ivy) :when (featurep! :completion ivy)
:commands ivy-bibtex) :commands ivy-bibtex)
(def-package! helm-bibtex (def-package! helm-bibtex
:when (featurep! :completion helm) :when (featurep! :completion helm)
:commands helm-bibtex) :commands helm-bibtex)

View file

@ -18,6 +18,8 @@
;;;###autoload ;;;###autoload
(defun +org/browse-notes-for-major-mode () (defun +org/browse-notes-for-major-mode ()
"Browse org notes in `+org-code-notes-dir' in neotree, ido, ivy or helm --
whichever is available."
(interactive) (interactive)
(let ((dir (+org-mode-notes-dir))) (let ((dir (+org-mode-notes-dir)))
(unless (file-in-directory-p dir +org-code-notes-dir) (unless (file-in-directory-p dir +org-code-notes-dir)
@ -28,5 +30,7 @@
;;;###autoload ;;;###autoload
(defun +org/browse-notes-for-project () (defun +org/browse-notes-for-project ()
"Browse org notes in `+org-project-notes-dir' in neotree, ido, ivy or helm --
whichever is available."
(interactive) (interactive)
(+org--explore-notes +org-project-notes-dir)) (+org--explore-notes +org-project-notes-dir))