Conform many modules to new conventions
This commit is contained in:
parent
20e2aa0b18
commit
c795a988e6
26 changed files with 161 additions and 165 deletions
|
@ -381,11 +381,11 @@ successfully sets indent_style/indent_size.")
|
|||
`(("." . ,(concat doom-cache-dir "undo-tree-hist/"))))
|
||||
|
||||
(when (executable-find "zstd")
|
||||
(def-advice! doom--undo-tree-make-history-save-file-name-a (file)
|
||||
(def-advice! doom-undo-tree-make-history-save-file-name-a (file)
|
||||
:filter-return #'undo-tree-make-history-save-file-name
|
||||
(concat file ".zst")))
|
||||
|
||||
(def-advice! doom--undo-tree-strip-text-properties-a (&rest _)
|
||||
(def-advice! doom-undo-tree-strip-text-properties-a (&rest _)
|
||||
:before #'undo-list-transfer-to-tree
|
||||
(dolist (item buffer-undo-list)
|
||||
(and (consp item)
|
||||
|
|
|
@ -385,10 +385,10 @@ treat Emacs as a non-application window."
|
|||
(defvar doom--ediff-saved-wconf nil)
|
||||
;; Restore window config after quitting ediff
|
||||
(add-hook 'ediff-before-setup-hook
|
||||
(defun doom--ediff-save-wconf-h ()
|
||||
(defun doom-ediff-save-wconf-h ()
|
||||
(setq doom--ediff-saved-wconf (current-window-configuration))))
|
||||
(add-hook! '(ediff-quit-hook ediff-suspend-hook)
|
||||
(defun doom--ediff-restore-wconf-h ()
|
||||
(defun doom-ediff-restore-wconf-h ()
|
||||
(when (window-configuration-p doom--ediff-saved-wconf)
|
||||
(set-window-configuration doom--ediff-saved-wconf)))
|
||||
'append))
|
||||
|
|
|
@ -361,9 +361,9 @@ intervals."
|
|||
(nconc doom-incremental-packages packages)
|
||||
(when packages
|
||||
(let ((gc-cons-threshold most-positive-fixnum)
|
||||
(reqs (cl-delete-if #'featurep packages))
|
||||
file-name-handler-alist)
|
||||
(when-let (req (if reqs (ignore-errors (pop reqs))))
|
||||
(file-name-handler-alist nil)
|
||||
(reqs (cl-delete-if #'featurep packages)))
|
||||
(when-let (req (if reqs (pop reqs)))
|
||||
(doom-log "Incrementally loading %s" req)
|
||||
(condition-case e
|
||||
(or (while-no-input (require req nil t) t)
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +calendar*cfw:render-button (title command &optional state)
|
||||
(defun +calendar-cfw:render-button-a (title command &optional state)
|
||||
"render-button
|
||||
TITLE
|
||||
COMMAND
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
;; Packages
|
||||
|
||||
(def-package! calfw
|
||||
:commands (cfw:open-calendar-buffer)
|
||||
:commands cfw:open-calendar-buffer
|
||||
:config
|
||||
;; better frame for calendar
|
||||
(setq cfw:face-item-separator-color nil
|
||||
|
@ -27,7 +27,7 @@
|
|||
(add-hook 'cfw:calendar-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
(add-hook 'cfw:calendar-mode-hook 'hide-mode-line-mode)
|
||||
|
||||
(advice-add #'cfw:render-button :override #'+calendar*cfw:render-button))
|
||||
(advice-add #'cfw:render-button :override #'+calendar-cfw:render-button-a))
|
||||
|
||||
|
||||
(def-package! calfw-org
|
||||
|
|
|
@ -47,7 +47,7 @@ playback.")
|
|||
;; Packages
|
||||
|
||||
(def-package! circe
|
||||
:commands (circe circe-server-buffers)
|
||||
:commands circe circe-server-buffers
|
||||
:init (setq circe-network-defaults nil)
|
||||
:config
|
||||
(setq circe-default-quit-message nil
|
||||
|
@ -92,11 +92,12 @@ playback.")
|
|||
|
||||
(add-hook 'circe-channel-mode-hook #'turn-on-visual-line-mode)
|
||||
|
||||
(defun +irc*circe-disconnect-hook (&rest _)
|
||||
(def-advice! +irc-circe-disconnect-hook-a (&rest _)
|
||||
:after #'circe--irc-conn-disconnected
|
||||
(run-hooks '+irc-disconnect-hook))
|
||||
(advice-add 'circe--irc-conn-disconnected :after #'+irc*circe-disconnect-hook)
|
||||
|
||||
(defun +irc*circe-truncate-nicks ()
|
||||
(add-hook 'lui-pre-output-hook
|
||||
(defun +irc-circe-truncate-nicks-h ()
|
||||
"Truncate long nicknames in chat output non-destructively."
|
||||
(when-let (beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick))
|
||||
(goto-char beg)
|
||||
|
@ -105,24 +106,24 @@ playback.")
|
|||
:nick)))
|
||||
(when (> (length nick) +irc-left-padding)
|
||||
(compose-region (+ beg +irc-left-padding -1) end
|
||||
+irc-truncate-nick-char)))))
|
||||
(add-hook 'lui-pre-output-hook #'+irc*circe-truncate-nicks)
|
||||
+irc-truncate-nick-char))))))
|
||||
|
||||
(add-hook 'doom-real-buffer-functions
|
||||
(defun +circe-buffer-p (buf)
|
||||
"Return non-nil if BUF is a `circe-mode' buffer."
|
||||
(with-current-buffer buf
|
||||
(and (derived-mode-p 'circe-mode)
|
||||
(eq (safe-persp-name (get-current-persp))
|
||||
+irc--workspace-name))))
|
||||
(add-hook 'doom-real-buffer-functions #'+circe-buffer-p)
|
||||
+irc--workspace-name)))))
|
||||
|
||||
(defun +irc|circe-message-option-bot (nick &rest ignored)
|
||||
(add-hook 'circe-message-option-functions
|
||||
(defun +irc-circe-message-option-bot-h (nick &rest ignored)
|
||||
"Fontify known bots and mark them to not be tracked."
|
||||
(when (member nick +irc-bot-list)
|
||||
'((text-properties . (face circe-fool-face lui-do-not-track t)))))
|
||||
(add-hook 'circe-message-option-functions #'+irc|circe-message-option-bot)
|
||||
'((text-properties . (face circe-fool-face lui-do-not-track t))))))
|
||||
|
||||
(defun +irc|add-circe-buffer-to-persp ()
|
||||
(add-hook 'circe-mode-hook
|
||||
(defun +irc-add-circe-buffer-to-persp-h ()
|
||||
(let ((persp (get-current-persp))
|
||||
(buf (current-buffer)))
|
||||
;; Add a new circe buffer to irc workspace when we're in another workspace
|
||||
|
@ -130,8 +131,7 @@ playback.")
|
|||
;; Add new circe buffers to the persp containing circe buffers
|
||||
(persp-add-buffer buf (persp-get-by-name +irc--workspace-name))
|
||||
;; Remove new buffer from accidental workspace
|
||||
(persp-remove-buffer buf persp))))
|
||||
(add-hook 'circe-mode-hook #'+irc|add-circe-buffer-to-persp)
|
||||
(persp-remove-buffer buf persp)))))
|
||||
|
||||
;; Let `+irc/quit' and `circe' handle buffer cleanup
|
||||
(define-key circe-mode-map [remap kill-buffer] #'bury-buffer)
|
||||
|
@ -194,20 +194,20 @@ playback.")
|
|||
(setq lui-flyspell-p t))
|
||||
|
||||
(after! evil
|
||||
(defun +irc|evil-insert ()
|
||||
(defun +irc-evil-insert-h ()
|
||||
"Ensure entering insert mode will put us at the prompt, unless editing
|
||||
after prompt marker."
|
||||
(when (> (marker-position lui-input-marker) (point))
|
||||
(goto-char (point-max))))
|
||||
|
||||
(add-hook! 'lui-mode-hook
|
||||
(add-hook 'evil-insert-state-entry-hook #'+irc|evil-insert nil t))
|
||||
(add-hook 'evil-insert-state-entry-hook #'+irc-evil-insert-h nil t))
|
||||
|
||||
(mapc (lambda (cmd) (push cmd +irc-scroll-to-bottom-on-commands))
|
||||
'(evil-paste-after evil-paste-before evil-open-above evil-open-below)))
|
||||
|
||||
|
||||
(defun +irc|preinput-scroll-to-bottom ()
|
||||
(defun +irc-preinput-scroll-to-bottom-h ()
|
||||
"Go to the end of the buffer in all windows showing it.
|
||||
Courtesy of esh-mode.el"
|
||||
(when (memq this-command +irc-scroll-to-bottom-on-commands)
|
||||
|
@ -224,22 +224,20 @@ Courtesy of esh-mode.el"
|
|||
nil t)))))
|
||||
|
||||
(add-hook! 'lui-mode-hook
|
||||
(add-hook 'pre-command-hook #'+irc|preinput-scroll-to-bottom nil t))
|
||||
(add-hook 'pre-command-hook #'+irc-preinput-scroll-to-bottom-h nil t))
|
||||
|
||||
;; enable a horizontal line marking the last read message
|
||||
(add-hook! 'lui-mode-hook #'enable-lui-track-bar)
|
||||
(add-hook 'lui-mode-hook #'enable-lui-track-bar)
|
||||
|
||||
(defun +irc|init-lui-margins ()
|
||||
(add-hook! 'lui-mode-hook
|
||||
(defun +irc-init-lui-margins-h ()
|
||||
(setq lui-time-stamp-position 'right-margin
|
||||
lui-time-stamp-format +irc-time-stamp-format
|
||||
right-margin-width (length (format-time-string lui-time-stamp-format))))
|
||||
|
||||
(defun +irc|init-lui-wrapping ()
|
||||
(defun +irc-init-lui-wrapping-a ()
|
||||
(setq fringes-outside-margins t
|
||||
word-wrap t
|
||||
wrap-prefix (make-string (+ +irc-left-padding 3) ? )))
|
||||
|
||||
(add-hook! 'lui-mode-hook #'(+irc|init-lui-margins +irc|init-lui-wrapping)))
|
||||
wrap-prefix (make-string (+ +irc-left-padding 3) ? )))))
|
||||
|
||||
|
||||
(def-package! lui-logging
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +rss|elfeed-wrap ()
|
||||
(defun +rss-elfeed-wrap-h ()
|
||||
"Enhances an elfeed entry's readability by wrapping it to a width of
|
||||
`fill-column'."
|
||||
(let ((inhibit-read-only t)
|
||||
|
@ -57,7 +57,7 @@
|
|||
(set-buffer-modified-p nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +rss|cleanup ()
|
||||
(defun +rss-cleanup-h ()
|
||||
"Clean up after an elfeed session. Kills all elfeed and elfeed-org files."
|
||||
(interactive)
|
||||
;; `delete-file-projectile-remove-from-cache' slows down `elfeed-db-compact'
|
||||
|
@ -75,7 +75,7 @@
|
|||
(kill-buffer buf)))
|
||||
(dolist (b search-buffers)
|
||||
(with-current-buffer b
|
||||
(remove-hook 'kill-buffer-hook #'+rss|cleanup :local)
|
||||
(remove-hook 'kill-buffer-hook #'+rss-cleanup-h :local)
|
||||
(kill-buffer b)))
|
||||
(mapc #'kill-buffer show-buffers)))
|
||||
|
||||
|
@ -99,7 +99,7 @@
|
|||
collect url)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +rss-put-sliced-image (spec alt &optional flags)
|
||||
(defun +rss-put-sliced-image-fn (spec alt &optional flags)
|
||||
"TODO"
|
||||
(cl-letf (((symbol-function #'insert-image)
|
||||
(lambda (image &optional alt _area _slice)
|
||||
|
@ -108,7 +108,7 @@
|
|||
(shr-put-image spec alt flags)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +rss-render-image-tag-without-underline (dom &optional url)
|
||||
(defun +rss-render-image-tag-without-underline-fn (dom &optional url)
|
||||
"TODO"
|
||||
(let ((start (point)))
|
||||
(shr-tag-img dom url)
|
||||
|
|
|
@ -36,21 +36,21 @@ easier to scroll through.")
|
|||
(make-directory elfeed-db-directory t)
|
||||
|
||||
;; Ensure elfeed buffers are treated as real
|
||||
(add-hook 'doom-real-buffer-functions
|
||||
(defun +rss-buffer-p (buf)
|
||||
(string-match-p "^\\*elfeed" (buffer-name buf)))
|
||||
(add-to-list 'doom-real-buffer-functions #'+rss-buffer-p nil #'eq)
|
||||
(string-match-p "^\\*elfeed" (buffer-name buf))))
|
||||
|
||||
;; Enhance readability of a post
|
||||
(add-hook 'elfeed-show-mode-hook #'+rss|elfeed-wrap)
|
||||
(add-hook 'elfeed-show-mode-hook #'+rss-elfeed-wrap-h)
|
||||
(add-hook! 'elfeed-search-mode-hook
|
||||
(add-hook 'kill-buffer-hook #'+rss|cleanup nil t))
|
||||
(add-hook 'kill-buffer-hook #'+rss-cleanup-h nil t))
|
||||
|
||||
;; Large images are annoying to scroll through, because scrolling follows the
|
||||
;; cursor, so we force shr to insert images in slices.
|
||||
(when +rss-enable-sliced-images
|
||||
(setq-hook! 'elfeed-show-mode-hook
|
||||
shr-put-image-function #'+rss-put-sliced-image
|
||||
shr-external-rendering-functions '((img . +rss-render-image-tag-without-underline))))
|
||||
shr-put-image-function #'+rss-put-sliced-image-fn
|
||||
shr-external-rendering-functions '((img . +rss-render-image-tag-without-underline-fn))))
|
||||
|
||||
;; Keybindings
|
||||
(after! elfeed-show
|
||||
|
@ -68,7 +68,7 @@ easier to scroll through.")
|
|||
:when (featurep! +org)
|
||||
:after elfeed
|
||||
:config
|
||||
(setq rmh-elfeed-org-files
|
||||
(let ((default-directory org-directory))
|
||||
(setq rmh-elfeed-org-files
|
||||
(mapcar #'expand-file-name +rss-elfeed-files)))
|
||||
(elfeed-org))
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"The name to use for the twitter workspace.")
|
||||
|
||||
;;;###autoload
|
||||
(defun +twitter-display-buffer (buf)
|
||||
(defun +twitter-display-buffer-fn (buf)
|
||||
"A replacement display-buffer command for `twittering-pop-to-buffer-function'
|
||||
that works with the feature/popup module."
|
||||
(let ((win (selected-window)))
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
(def-package! twittering-mode
|
||||
:commands twit
|
||||
:config
|
||||
(setq twittering-private-info-file (expand-file-name "twittering-mode.gpg" doom-etc-dir)
|
||||
(setq twittering-private-info-file
|
||||
(expand-file-name "twittering-mode.gpg" doom-etc-dir)
|
||||
twittering-use-master-password t
|
||||
twittering-request-confirmation-on-posting t
|
||||
;; twittering-icon-mode t
|
||||
|
@ -35,24 +36,16 @@
|
|||
|
||||
(add-hook 'doom-real-buffer-functions #'+twitter-buffer-p)
|
||||
(when (featurep! :ui popup)
|
||||
(setq twittering-pop-to-buffer-function #'+twitter-display-buffer))
|
||||
(setq twittering-pop-to-buffer-function #'+twitter-display-buffer-fn))
|
||||
|
||||
(after! solaire-mode
|
||||
(add-hook 'twittering-mode-hook #'solaire-mode))
|
||||
|
||||
;; Custom header-line for twitter buffers
|
||||
(defun +twitter|switch-mode-and-header-line ()
|
||||
(add-hook 'twittering-mode-hook
|
||||
(defun +twitter-switch-mode-and-header-line-h ()
|
||||
(setq header-line-format mode-line-format
|
||||
mode-line-format nil))
|
||||
(add-hook 'twittering-mode-hook #'+twitter|switch-mode-and-header-line)
|
||||
|
||||
(cond ((featurep! :ui doom-modeline +new)
|
||||
(setq-hook! 'twittering-mode-hook mode-line-format-right nil))
|
||||
((featurep! :ui doom-modeline)
|
||||
(def-modeline! 'twitter
|
||||
'(bar matches " %b " selection-info)
|
||||
'())
|
||||
(add-hook! 'twittering-mode-hook (doom-set-modeline 'twitter))))
|
||||
mode-line-format nil)))
|
||||
|
||||
;; `epa--decode-coding-string' isn't defined in later versions of Emacs 27
|
||||
(unless (fboundp 'epa--decode-coding-string)
|
||||
|
|
|
@ -65,15 +65,15 @@ Examples:
|
|||
;;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +company|init-backends ()
|
||||
(defun +company-init-backends-h ()
|
||||
"Set `company-backends' for the current buffer."
|
||||
(if (not company-mode)
|
||||
(remove-hook 'change-major-mode-after-body-hook #'+company|init-backends 'local)
|
||||
(remove-hook 'change-major-mode-after-body-hook #'+company-init-backends-h 'local)
|
||||
(unless (eq major-mode 'fundamental-mode)
|
||||
(setq-local company-backends (+company--backends)))
|
||||
(add-hook 'change-major-mode-after-body-hook #'+company|init-backends nil 'local)))
|
||||
(add-hook 'change-major-mode-after-body-hook #'+company-init-backends-h nil 'local)))
|
||||
|
||||
(put '+company|init-backends 'permanent-local-hook t)
|
||||
(put '+company-init-backends-h 'permanent-local-hook t)
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
;; Allow users to switch between backends on the fly. E.g. C-x C-s followed
|
||||
;; by C-x C-n, will switch from `company-yasnippet' to
|
||||
;; `company-dabbrev-code'.
|
||||
(def-advice! +company--abort-previous-a (&rest _)
|
||||
(def-advice! +company-abort-previous-a (&rest _)
|
||||
:before #'company-begin-backend
|
||||
(company-abort)))
|
||||
|
||||
(add-hook 'company-mode-hook #'+company|init-backends)
|
||||
(add-hook 'company-mode-hook #'+company-init-backends-h)
|
||||
(global-company-mode +1))
|
||||
|
||||
|
||||
|
@ -68,7 +68,10 @@
|
|||
company-box-max-candidates 50
|
||||
company-box-icons-alist 'company-box-icons-all-the-icons
|
||||
company-box-icons-functions
|
||||
'(+company-box-icons--yasnippet company-box-icons--lsp +company-box-icons--elisp company-box-icons--acphp)
|
||||
'(+company-box-icons--yasnippet-fn
|
||||
company-box-icons--lsp
|
||||
+company-box-icons--elisp-fn
|
||||
company-box-icons--acphp)
|
||||
company-box-icons-all-the-icons
|
||||
`((Unknown . ,(all-the-icons-material "find_in_page" :height 0.8 :face 'all-the-icons-purple))
|
||||
(Text . ,(all-the-icons-material "text_fields" :height 0.8 :face 'all-the-icons-green))
|
||||
|
@ -103,11 +106,11 @@
|
|||
(ElispFeature . ,(all-the-icons-material "stars" :height 0.8 :face 'all-the-icons-orange))
|
||||
(ElispFace . ,(all-the-icons-material "format_paint" :height 0.8 :face 'all-the-icons-pink))))
|
||||
|
||||
(defun +company-box-icons--yasnippet (candidate)
|
||||
(defun +company-box-icons--yasnippet-fn (candidate)
|
||||
(when (get-text-property 0 'yas-annotation candidate)
|
||||
'Yasnippet))
|
||||
|
||||
(defun +company-box-icons--elisp (candidate)
|
||||
(defun +company-box-icons--elisp-fn (candidate)
|
||||
(when (derived-mode-p 'emacs-lisp-mode)
|
||||
(let ((sym (intern candidate)))
|
||||
(cond ((fboundp sym) 'ElispFunction)
|
||||
|
@ -121,7 +124,7 @@
|
|||
:config
|
||||
(setq company-dict-dir (expand-file-name "dicts" doom-private-dir))
|
||||
(add-hook 'doom-project-hook
|
||||
(defun +company--enable-project-dicts-h (mode &rest _)
|
||||
(defun +company-enable-project-dicts-h (mode &rest _)
|
||||
"Enable per-project dictionaries."
|
||||
(if (symbol-value mode)
|
||||
(add-to-list 'company-dict-minor-mode-list mode nil #'eq)
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
(insert "~/")
|
||||
(call-interactively #'self-insert-command))))
|
||||
|
||||
(defun +ido--sort-mtime-a ()
|
||||
(def-advice! +ido-sort-mtime-a ()
|
||||
"Sort ido filelist by mtime instead of alphabetically."
|
||||
:override #'ido-sort-mtime
|
||||
(setq ido-temp-list
|
||||
(sort ido-temp-list
|
||||
(lambda (a b)
|
||||
|
@ -40,7 +41,6 @@
|
|||
(cl-loop for x in ido-temp-list
|
||||
if (char-equal (string-to-char x) ?.)
|
||||
collect x)))
|
||||
(advice-add #'ido-sort-mtime :override #'+ido--sort-mtime-a)
|
||||
(add-hook! (ido-make-file-list ido-make-dir-list) #'ido-sort-mtime)
|
||||
|
||||
;;
|
||||
|
|
|
@ -114,7 +114,7 @@ information.")
|
|||
(or (file-in-directory-p file doom-private-dir)
|
||||
(file-in-directory-p file doom-emacs-dir)))
|
||||
|
||||
(defun +file-templates|check ()
|
||||
(defun +file-templates-check-h ()
|
||||
"Check if the current buffer is a candidate for file template expansion. It
|
||||
must be non-read-only, empty, and there must be a rule in
|
||||
`+file-templates-alist' that applies to it."
|
||||
|
@ -143,4 +143,4 @@ must be non-read-only, empty, and there must be a rule in
|
|||
(yas-reload-all)))
|
||||
|
||||
;;
|
||||
(add-hook 'find-file-hook #'+file-templates|check)
|
||||
(add-hook 'find-file-hook #'+file-templates-check-h)
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
:group 'doom-themes)
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold-hideshow-haml-forward-sexp (arg)
|
||||
(defun +fold-hideshow-haml-forward-sexp-fn (arg)
|
||||
(haml-forward-sexp arg)
|
||||
(move-beginning-of-line 1))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold-hideshow-forward-block-by-indent (_arg)
|
||||
(defun +fold-hideshow-forward-block-by-indent-fn (_arg)
|
||||
(let ((start (current-indentation)))
|
||||
(forward-line)
|
||||
(unless (= start (current-indentation))
|
||||
|
@ -20,7 +20,7 @@
|
|||
(end-of-line)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold-hideshow-set-up-overlay (ov)
|
||||
(defun +fold-hideshow-set-up-overlay-fn (ov)
|
||||
(when (eq 'code (overlay-get ov 'hs))
|
||||
(when (featurep 'vimish-fold)
|
||||
(overlay-put
|
||||
|
|
|
@ -18,13 +18,17 @@
|
|||
;; Packages
|
||||
|
||||
(def-package! hideshow ; built-in
|
||||
:commands (hs-toggle-hiding hs-hide-block hs-hide-level hs-show-all hs-hide-all)
|
||||
:commands (hs-toggle-hiding
|
||||
hs-hide-block
|
||||
hs-hide-level
|
||||
hs-show-all
|
||||
hs-hide-all)
|
||||
:config
|
||||
(setq hs-hide-comments-when-hiding-all nil
|
||||
;; Nicer code-folding overlays (with fringe indicators)
|
||||
hs-set-up-overlay #'+fold-hideshow-set-up-overlay)
|
||||
hs-set-up-overlay #'+fold-hideshow-set-up-overlay-fn)
|
||||
|
||||
(def-advice! +fold-hideshow*ensure-mode (&rest _)
|
||||
(def-advice! +fold-hideshow-ensure-mode-a (&rest _)
|
||||
"Ensure `hs-minor-mode' is enabled."
|
||||
:before '(hs-toggle-hiding hs-hide-block hs-hide-level hs-show-all hs-hide-all)
|
||||
(unless (bound-and-true-p hs-minor-mode)
|
||||
|
@ -38,8 +42,8 @@
|
|||
(yaml-mode "\\s-*\\_<\\(?:[^:]+\\)\\_>"
|
||||
""
|
||||
"#"
|
||||
+fold-hideshow-forward-block-by-indent nil)
|
||||
(haml-mode "[#.%]" "\n" "/" +fold-hideshow-haml-forward-sexp nil)
|
||||
+fold-hideshow-forward-block-by-indent-fn nil)
|
||||
(haml-mode "[#.%]" "\n" "/" +fold-hideshow-haml-forward-sexp-fn nil)
|
||||
(ruby-mode "class\\|d\\(?:ef\\|o\\)\\|module\\|[[{]"
|
||||
"end\\|[]}]"
|
||||
"#\\|=begin"
|
||||
|
|
|
@ -98,7 +98,7 @@ Stolen shamelessly from go-mode"
|
|||
(if fmt (cons (intern fmt) t))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +format*probe (orig-fn)
|
||||
(defun +format-probe-a (orig-fn)
|
||||
"Use `+format-with' instead, if it is set."
|
||||
(if +format-with
|
||||
(list +format-with t)
|
||||
|
@ -119,7 +119,7 @@ formatted text, ERRORS are any errors in string format, and FIRST-DIFF is the
|
|||
position of the first change in the buffer.
|
||||
|
||||
See `+format/buffer' for the interactive version of this function, and
|
||||
`+format|buffer' to use as a `before-save-hook' hook."
|
||||
`+format-buffer-h' to use as a `before-save-hook' hook."
|
||||
(if (not formatter)
|
||||
'no-formatter
|
||||
(let ((f-function (gethash formatter format-all--format-table))
|
||||
|
@ -228,12 +228,12 @@ is selected)."
|
|||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +format|enable-on-save ()
|
||||
(defun +format-enable-on-save-h ()
|
||||
"Enables formatting on save."
|
||||
(add-hook 'before-save-hook #'+format|buffer nil t))
|
||||
(add-hook 'before-save-hook #'+format-buffer-h nil t))
|
||||
|
||||
;;;###autoload
|
||||
(defalias '+format|buffer #'+format/buffer
|
||||
(defalias '+format-buffer-h #'+format/buffer
|
||||
"Format the source code in the current buffer with minimal feedback.
|
||||
|
||||
Meant for `before-save-hook'.")
|
||||
|
|
|
@ -25,7 +25,7 @@ Indentation is always preserved when formatting regions.")
|
|||
;;
|
||||
;;; Bootstrap
|
||||
|
||||
(defun +format|enable-on-save-maybe ()
|
||||
(defun +format-enable-on-save-maybe-h ()
|
||||
"Enable formatting on save in certain major modes.
|
||||
|
||||
This is controlled by `+format-on-save-enabled-modes'."
|
||||
|
@ -39,7 +39,7 @@ This is controlled by `+format-on-save-enabled-modes'."
|
|||
(format-all-mode +1)))
|
||||
|
||||
(when (featurep! +onsave)
|
||||
(add-hook 'after-change-major-mode-hook #'+format|enable-on-save-maybe))
|
||||
(add-hook 'after-change-major-mode-hook #'+format-enable-on-save-maybe-h))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -47,7 +47,7 @@ This is controlled by `+format-on-save-enabled-modes'."
|
|||
|
||||
;; Allow a specific formatter to be used by setting `+format-with', either
|
||||
;; buffer-locally or let-bound.
|
||||
(advice-add #'format-all--probe :around #'+format*probe)
|
||||
(advice-add #'format-all--probe :around #'+format-probe-a)
|
||||
|
||||
;; Doom uses a modded `format-all-buffer', which
|
||||
;; 1. Enables partial reformatting (while preserving leading indentation),
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
(def-package! objed
|
||||
:after-call pre-command-hook
|
||||
:config
|
||||
|
||||
;; Prevent undo actions from exiting edit state
|
||||
(add-to-list 'objed-keeper-commands 'undo-tree-undo)
|
||||
(add-to-list 'objed-keeper-commands 'undo-tree-redo)
|
||||
|
@ -11,21 +10,20 @@
|
|||
|
||||
(defvar +objed--extra-face-remaps nil)
|
||||
|
||||
(defun +objed*add-face-remaps (&rest _)
|
||||
(def-advice! +objed-add-face-remaps-a (&rest _)
|
||||
"Add extra face remaps when objed activates."
|
||||
:after 'objed--init
|
||||
(when (memq 'objed-hl (assq 'hl-line face-remapping-alist))
|
||||
(push (face-remap-add-relative 'solaire-hl-line-face 'objed-hl)
|
||||
+objed--extra-face-remaps)))
|
||||
|
||||
(defun +objed*remove-face-remaps (&rest _)
|
||||
(def-advice! +objed-remove-face-remaps-a (&rest _)
|
||||
"Remove extra face remaps when objed de-activates."
|
||||
:after 'objed--reset
|
||||
(unless (memq 'objed-hl (assq 'hl-line face-remapping-alist))
|
||||
(dolist (remap +objed--extra-face-remaps)
|
||||
(face-remap-remove-relative remap))
|
||||
(setq +objed--extra-face-remaps nil)))
|
||||
|
||||
(advice-add 'objed--init :after #'+objed*add-face-remaps)
|
||||
(advice-add 'objed--reset :after #'+objed*remove-face-remaps)
|
||||
|
||||
(unless (featurep! +manual)
|
||||
(objed-mode +1)))
|
||||
|
|
|
@ -56,19 +56,19 @@
|
|||
;; confusing than helpful.
|
||||
(advice-add #'dired-k--highlight-by-file-attribyte :override #'ignore)
|
||||
|
||||
(defun +dired*interrupt-process (orig-fn &rest args)
|
||||
(def-advice! +dired-interrupt-process-a (orig-fn &rest args)
|
||||
"Fixes dired-k killing git processes too abruptly, leaving behind disruptive
|
||||
.git/index.lock files."
|
||||
:around #'dired-k--start-git-status
|
||||
(cl-letf (((symbol-function #'kill-process)
|
||||
(symbol-function #'interrupt-process)))
|
||||
(apply orig-fn args)))
|
||||
(advice-add #'dired-k--start-git-status :around #'+dired*interrupt-process)
|
||||
|
||||
(defun +dired*dired-k-highlight (orig-fn &rest args)
|
||||
(def-advice! +dired-dired-k-highlight-a (orig-fn &rest args)
|
||||
"Butt out if the requested directory is remote (i.e. through tramp)."
|
||||
:around #'dired-k--highlight
|
||||
(unless (file-remote-p default-directory)
|
||||
(apply orig-fn args)))
|
||||
(advice-add #'dired-k--highlight :around #'+dired*dired-k-highlight))
|
||||
(apply orig-fn args))))
|
||||
|
||||
|
||||
(def-package! ranger
|
||||
|
@ -84,24 +84,24 @@
|
|||
|
||||
(set-popup-rule! "^\\*ranger" :ignore t)
|
||||
|
||||
(defun +dired*cleanup-header-line ()
|
||||
(def-advice! +dired-cleanup-header-line-a ()
|
||||
"Ranger fails to clean up `header-line-format' when it is closed, so..."
|
||||
:before #'ranger-revert
|
||||
(dolist (buffer (buffer-list))
|
||||
(when (buffer-live-p buffer)
|
||||
(with-current-buffer buffer
|
||||
(when (equal header-line-format '(:eval (ranger-header-line)))
|
||||
(setq header-line-format nil))))))
|
||||
(advice-add #'ranger-revert :before #'+dired*cleanup-header-line)
|
||||
|
||||
(defun +dired*cleanup-mouse1-bind ()
|
||||
(def-advice! +dired-cleanup-mouse1-bind-a ()
|
||||
"Ranger binds an anonymous function to mouse-1 after previewing a buffer
|
||||
that prevents the user from escaping the window with the mouse. This command is
|
||||
never cleaned up if the buffer already existed before ranger was initialized, so
|
||||
we have to clean it up ourselves."
|
||||
:after #'ranger-setup-preview
|
||||
(when (window-live-p ranger-preview-window)
|
||||
(with-current-buffer (window-buffer ranger-preview-window)
|
||||
(local-unset-key [mouse-1]))))
|
||||
(advice-add #'ranger-setup-preview :after #'+dired*cleanup-mouse1-bind)
|
||||
|
||||
(setq ranger-cleanup-on-disable t
|
||||
ranger-excluded-extensions '("mkv" "iso" "mp4")
|
||||
|
|
|
@ -10,10 +10,9 @@ current line.")
|
|||
(after! electric
|
||||
(setq-default electric-indent-chars '(?\n ?\^?))
|
||||
|
||||
(defun +electric-indent|char (_c)
|
||||
(add-hook 'electric-indent-functions
|
||||
(defun +electric-indent-char-fn (_c)
|
||||
(when (and (eolp) +electric-indent-words)
|
||||
(save-excursion
|
||||
(backward-word)
|
||||
(looking-at-p (concat "\\<" (regexp-opt +electric-indent-words))))))
|
||||
(add-to-list 'electric-indent-functions #'+electric-indent|char nil #'eq))
|
||||
|
||||
(looking-at-p (concat "\\<" (regexp-opt +electric-indent-words))))))))
|
||||
|
|
|
@ -26,7 +26,7 @@ repository root."
|
|||
(git-link (git-link--select-remote) beg end)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +vc*update-header-line (revision)
|
||||
(defun +vc-update-header-line-a (revision)
|
||||
"Show revision details in the header-line, instead of the minibuffer.
|
||||
|
||||
Sometimes I forget `git-timemachine' is enabled in a buffer. Putting revision
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
(after! git-timemachine
|
||||
;; HACK Waiting for https://gitlab.com/pidu/git-timemachine/issues/77
|
||||
(def-advice! +vc--git-timemachine-show-commit-a ()
|
||||
(def-advice! +vc-git-timemachine-show-commit-a ()
|
||||
"Fix `git-timemachine-show-commit'."
|
||||
:override #'git-timemachine-show-commit
|
||||
(interactive)
|
||||
|
@ -29,7 +29,8 @@
|
|||
;; showing revision details in the minibuffer, show them in
|
||||
;; `header-line-format', which has better visibility.
|
||||
(setq git-timemachine-show-minibuffer-details t)
|
||||
(advice-add #'git-timemachine--show-minibuffer-details :override #'+vc*update-header-line)
|
||||
(advice-add #'git-timemachine--show-minibuffer-details
|
||||
:override #'+vc-update-header-line-a)
|
||||
|
||||
(after! evil
|
||||
;; rehash evil keybindings so they are recognized
|
||||
|
@ -50,14 +51,14 @@
|
|||
(set-yas-minor-mode! 'git-commit-mode)
|
||||
|
||||
(add-hook 'git-commit-mode-hook
|
||||
(defun +vc--enforce-git-commit-conventions-h ()
|
||||
(defun +vc-enforce-git-commit-conventions-h ()
|
||||
"See https://chris.beams.io/posts/git-commit/"
|
||||
(setq fill-column 72
|
||||
git-commit-summary-max-length 50
|
||||
git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line))))
|
||||
|
||||
(add-hook 'git-commit-setup-hook
|
||||
(defun +vc--start-in-insert-state-maybe ()
|
||||
(defun +vc-start-in-insert-state-maybe ()
|
||||
"Start git-commit-mode in insert state if in a blank commit message,
|
||||
otherwise in default state."
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
|
|
|
@ -45,7 +45,7 @@ default/fallback account."
|
|||
(defvar +mu4e-workspace-name "*mu4e*"
|
||||
"TODO")
|
||||
|
||||
(add-hook 'mu4e-main-mode-hook #'+mu4e|init)
|
||||
(add-hook 'mu4e-main-mode-hook #'+mu4e-init-h)
|
||||
|
||||
;;;###autoload
|
||||
(defun =mu4e ()
|
||||
|
@ -69,10 +69,10 @@ default/fallback account."
|
|||
;;
|
||||
;; Hooks
|
||||
|
||||
(defun +mu4e|init ()
|
||||
(add-hook 'kill-buffer-hook #'+mu4e|kill-mu4e nil t))
|
||||
(defun +mu4e-init-h ()
|
||||
(add-hook 'kill-buffer-hook #'+mu4e-kill-mu4e-h nil t))
|
||||
|
||||
(defun +mu4e|kill-mu4e ()
|
||||
(defun +mu4e-kill-mu4e-h ()
|
||||
;; (prolusion-mail-hide)
|
||||
(when (+workspace-exists-p +mu4e-workspace-name)
|
||||
(+workspace/delete +mu4e-workspace-name)))
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
|
||||
(def-package! mu4e
|
||||
:commands (mu4e mu4e-compose-new)
|
||||
:commands mu4e mu4e-compose-new
|
||||
:init
|
||||
(provide 'html2text) ; disable obsolete package
|
||||
(setq mu4e-maildir "~/.mail"
|
||||
|
@ -89,8 +89,8 @@
|
|||
(format "%s" (substring maildir 1 (string-match-p "/" maildir 1)))))))
|
||||
|
||||
;; Refresh the current view after marks are executed
|
||||
(defun +mu4e*refresh (&rest _) (mu4e-headers-rerun-search))
|
||||
(advice-add #'mu4e-mark-execute-all :after #'+mu4e*refresh)
|
||||
(def-advice! +mu4e-refresh-a (&rest _) :after #'mu4e-mark-execute-all
|
||||
(mu4e-headers-rerun-search))
|
||||
|
||||
(when (featurep! :tools flyspell)
|
||||
(add-hook 'mu4e-compose-mode-hook #'flyspell-mode))
|
||||
|
@ -152,7 +152,7 @@
|
|||
(defun +mu4e--mark-seen (docid _msg target)
|
||||
(mu4e~proc-move docid (mu4e~mark-check-target target) "+S-u-N"))
|
||||
|
||||
(delq (assq 'delete mu4e-marks) mu4e-marks)
|
||||
(delq! 'delete mu4e-marks #'assq)
|
||||
(setf (alist-get 'trash mu4e-marks)
|
||||
(list :char '("d" . "▼")
|
||||
:prompt "dtrash"
|
||||
|
@ -169,10 +169,10 @@
|
|||
;; Without it, refiling (archiving), trashing, and flagging (starring) email
|
||||
;; won't properly result in the corresponding gmail action, since the marks
|
||||
;; are ineffectual otherwise.
|
||||
(defun +mu4e|gmail-fix-flags (mark msg)
|
||||
(add-hook 'mu4e-mark-execute-pre-hook
|
||||
(defun +mu4e-gmail-fix-flags-h (mark msg)
|
||||
(pcase mark
|
||||
(`trash (mu4e-action-retag-message msg "-\\Inbox,+\\Trash,-\\Draft"))
|
||||
(`refile (mu4e-action-retag-message msg "-\\Inbox"))
|
||||
(`flag (mu4e-action-retag-message msg "+\\Starred"))
|
||||
(`unflag (mu4e-action-retag-message msg "-\\Starred"))))
|
||||
(add-hook 'mu4e-mark-execute-pre-hook #'+mu4e|gmail-fix-flags)))
|
||||
(`unflag (mu4e-action-retag-message msg "-\\Starred")))))))
|
||||
|
|
|
@ -47,11 +47,11 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
|
||||
;; Special indentation behavior for `add-hook'; indent like a defun block if
|
||||
;; it contains `defun' forms and like normal otherwise.
|
||||
(defun +emacs-lisp--indent-add-hook-fn (indent-point state)
|
||||
(defun +emacs-lisp-indent-add-hook-fn (indent-point state)
|
||||
(goto-char indent-point)
|
||||
(when (looking-at-p "\\s-*(defun ")
|
||||
(lisp-indent-defform state indent-point)))
|
||||
(put 'add-hook 'lisp-indent-function #'+emacs-lisp--indent-add-hook-fn)
|
||||
(put 'add-hook 'lisp-indent-function #'+emacs-lisp-indent-add-hook-fn)
|
||||
|
||||
;; Use helpful instead of describe-* from `company'
|
||||
(advice-add #'elisp--company-doc-buffer :around #'doom-use-helpful-a)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue