Browse Source

Fix wrong argument type error, vc-registered doesn't accept nil

It's also good practice not to use lambdas inside hooks, for readability.
master
Riyyi 3 years ago
parent
commit
6d54572740
  1. 14
      .config/emacs/config.org

14
.config/emacs/config.org

@ -72,6 +72,7 @@
- [[#centaur-tabs-functions][Centaur Tabs Functions]] - [[#centaur-tabs-functions][Centaur Tabs Functions]]
- [[#dap-functions][DAP Functions]] - [[#dap-functions][DAP Functions]]
- [[#dashboard-functions][Dashboard Functions]] - [[#dashboard-functions][Dashboard Functions]]
- [[#diff-hl-functions][Diff-hl Functions]]
- [[#evil-functions][Evil functions]] - [[#evil-functions][Evil functions]]
- [[#lsp-functions][LSP Functions]] - [[#lsp-functions][LSP Functions]]
- [[#neotree-functions][Neotree Functions]] - [[#neotree-functions][Neotree Functions]]
@ -760,7 +761,7 @@ Debug Adapter Protocol.
(use-package diff-hl (use-package diff-hl
:demand :demand
:hook (prog-mode . turn-on-diff-hl-mode) :hook (prog-mode . turn-on-diff-hl-mode)
:hook (prog-mode . (lambda () (when (vc-registered buffer-file-name) (diff-hl-flydiff-mode) (dot/toggle-fringe 1))))) :hook (prog-mode . dot/diff-hl-enable-flydiff-and-fringe))
(use-package transient (use-package transient
:defer t :defer t
@ -1379,6 +1380,17 @@ Fix keybinds..
(funcall (local-key-binding "r"))) (funcall (local-key-binding "r")))
#+END_SRC #+END_SRC
*** Diff-hl Functions
#+BEGIN_SRC emacs-lisp
(defun dot/diff-hl-enable-flydiff-and-fringe ()
"Enable on the fly diff checking if file is under version control."
(let ((buffer buffer-file-name))
(when (and buffer (vc-registered buffer))
(diff-hl-flydiff-mode)
(dot/toggle-fringe 1))))
#+END_SRC
*** Evil functions *** Evil functions
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp

Loading…
Cancel
Save