Remove yasnippets

I never use them, why install it then?
This commit is contained in:
Gergely Polonkai 2023-10-21 07:55:55 +02:00
parent 715a53f417
commit a301db6205
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -984,48 +984,6 @@ EDiff and Org-mode files dont play nice together…
(activate-mark)) (activate-mark))
#+END_SRC #+END_SRC
** Turn the cursor to purple if Yasnippets TAB function would fire
Taken from [[http://pages.sachachua.com/.emacs.d/Sacha.html][Sacha Chuas config]].
#+BEGIN_SRC emacs-lisp
;; TODO: 'cursor-color is sometimes nil, but why?
(setq default-cursor-color (or (frame-parameter nil 'cursor-color) "#ffd85c"))
(setq yasnippet-can-fire-cursor-color "purple")
;; It will test whether it can expand, if yes, cursor color -> purple.
(defun yasnippet-can-fire-p (&optional field)
"Check if the word before point can be expanded with yasnippet.
TODO: What is FIELD for?"
(interactive)
(setq yas--condition-cache-timestamp (current-time))
(let (templates-and-pos)
(unless (and yas-expand-only-for-last-commands
(not (member last-command yas-expand-only-for-last-commands)))
(setq templates-and-pos (if field
(save-restriction
(narrow-to-region (yas--field-start field)
(yas--field-end field))
(yas--templates-for-key-at-point))
(yas--templates-for-key-at-point))))
(and templates-and-pos (first templates-and-pos))))
(defun sachachua/change-cursor-color-when-can-expand (&optional field)
"Change cursor color if the text before point can be expanded with yasnippet.
TODO: What is FIELD for?"
(interactive)
(when (eq last-command 'self-insert-command)
(set-cursor-color (if (sachachua/can-expand)
yasnippet-can-fire-cursor-color
default-cursor-color))))
(defun sachachua/can-expand ()
"Return t if right after an expandable thing."
(or (abbrev--before-point) (yasnippet-can-fire-p)))
#+END_SRC
** Org mode stuff ** Org mode stuff
*** Filter out tasks from the Org agenda if they have a specific priority *** Filter out tasks from the Org agenda if they have a specific priority
@ -2676,33 +2634,6 @@ Automatically add spaces around operators.
(python-mode . electric-operator-mode)) (python-mode . electric-operator-mode))
#+END_SRC #+END_SRC
** Yasnippets
#+BEGIN_SRC emacs-lisp
(use-package yasnippet
:demand
:config
(yas-global-mode 1)
:hook
(post-command . sachachua/change-cursor-color-when-can-expand))
#+END_SRC
*** Extra snippets for Vala
#+BEGIN_SRC emacs-lisp
(use-package vala-snippets
:after
yasnippet)
#+END_SRC
*** Miscellanous extra snippets
#+BEGIN_SRC emacs-lisp
(use-package yasnippet-snippets
:after
yasnippet)
#+END_SRC
** Colourful delimiters ** Colourful delimiters
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -3459,16 +3390,6 @@ The new completing system!
(use-package consult-projectile) (use-package consult-projectile)
#+end_src #+end_src
** Yasnippets with Consult
#+begin_src emacs-lisp
(use-package consult-yasnippet
:after
yasnippet
:bind
(("C-c y" . consult-yasnippet)))
#+end_src
* Mode specific ~use-package~ calls * Mode specific ~use-package~ calls
** JavaScript ** JavaScript