adding rust compilation pieces to compile errors

This commit is contained in:
Chris Cochrun 2024-04-17 10:08:58 -05:00
parent b759b18c8b
commit a05cc4363b
3 changed files with 47 additions and 20 deletions

View file

@ -3429,15 +3429,16 @@ I'd like to start learning and using rust if I can.
rustic-lsp-client 'eglot rustic-lsp-client 'eglot
rustic-clippy-arguments "-- -W clippy::pedantic") rustic-clippy-arguments "-- -W clippy::pedantic")
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster) (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
(add-to-list 'compilation-error-regexp-alist rustic-compilation-error)
(add-to-list 'compilation-error-regexp-alist rustic-compilation-warning)
:general :general
(general-def 'normal rustic-mode-map (general-def 'normal rustic-mode-map
"!" 'rustic-run-shell-command "!" 'rustic-run-shell-command
"gC" 'rustic-cargo-clippy "gC" 'rustic-cargo-clippy
"gA" 'rustic-cargo-add "gA" 'rustic-cargo-add
"gt" 'rustic-cargo-test) "gt" 'rustic-cargo-test
(chris/leader-keys "gT" 'rustic-cargo-current-test)
:states 'normal (chris/leader-keys 'normal rustic-mode-map
:keymaps '(rustic-mode)
"gc" 'rustic-compile "gc" 'rustic-compile
"gr" 'projectile-run-project "gr" 'projectile-run-project
"si" 'consult-imenu-multi)) "si" 'consult-imenu-multi))

View file

@ -2546,15 +2546,16 @@ targets."
rustic-lsp-client 'eglot rustic-lsp-client 'eglot
rustic-clippy-arguments "-- -W clippy::pedantic") rustic-clippy-arguments "-- -W clippy::pedantic")
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster) (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
(add-to-list 'compilation-error-regexp-alist rustic-compilation-error)
(add-to-list 'compilation-error-regexp-alist rustic-compilation-warning)
:general :general
(general-def 'normal rustic-mode-map (general-def 'normal rustic-mode-map
"!" 'rustic-run-shell-command "!" 'rustic-run-shell-command
"gC" 'rustic-cargo-clippy "gC" 'rustic-cargo-clippy
"gA" 'rustic-cargo-add "gA" 'rustic-cargo-add
"gt" 'rustic-cargo-test) "gt" 'rustic-cargo-test
(chris/leader-keys "gT" 'rustic-cargo-current-test)
:states 'normal (chris/leader-keys 'normal rustic-mode-map
:keymaps '(rustic-mode)
"gc" 'rustic-compile "gc" 'rustic-compile
"gr" 'projectile-run-project "gr" 'projectile-run-project
"si" 'consult-imenu-multi)) "si" 'consult-imenu-multi))

View file

@ -13,7 +13,16 @@
(define-derived-mode lumina-mode tabulated-list-mode "lumina:songs" (define-derived-mode lumina-mode tabulated-list-mode "lumina:songs"
"A mode for working with the lumina database and updating and adding songs" "A mode for working with the lumina database and updating and adding songs"
(setf tabulated-list-format ['("Title" 10 t) '("Lyrics" 30 nil) '("Author" 10 t) '("CCLI" 7 nil) '("B" 1 nil) '("BT" 10 nil) '("h" 1 nil) '("v" 1 nil) '("f" 10 nil) '("fs" 2 nil)])) (setf tabulated-list-format ['("Title" 10 t)
'("Lyrics" 30 nil)
'("Author" 10 t)
'("CCLI" 7 nil)
'("B" 1 nil)
'("BT" 10 nil)
'("h" 1 nil)
'("v" 1 nil)
'("f" 10 nil)
'("fs" 2 nil)]))
(defun lumina-get-ids () (defun lumina-get-ids ()
"Gets the ids of all songs in the sql result" "Gets the ids of all songs in the sql result"
@ -36,7 +45,8 @@
(setf lumina-buffer (get-buffer-create "*lumina*")) (setf lumina-buffer (get-buffer-create "*lumina*"))
(with-current-buffer lumina-buffer (with-current-buffer lumina-buffer
(lumina-mode) (lumina-mode)
(setf tabulated-list-entries (cl-mapcar #'list (lumina-get-ids) (lumina-get-songs))) (setf tabulated-list-entries
(cl-mapcar #'list (lumina-get-ids) (lumina-get-songs)))
(tabulated-list-print t t)) (tabulated-list-print t t))
(switch-to-buffer lumina-buffer)) (switch-to-buffer lumina-buffer))
@ -109,29 +119,44 @@
(search-forward "#+VERSE_ORDER: ") (search-forward "#+VERSE_ORDER: ")
(buffer-substring-no-properties (point) nil))) (buffer-substring-no-properties (point) nil)))
(defvar lumina-lyrics-update-query (concat "update songs set lyrics = \"?" (lumina-grab-lyrics) "\" where title = " lumina-current-song)) (defvar lumina-lyrics-update-query
(concat "update songs set lyrics = \"?"
(lumina-grab-lyrics)
"\" where title = "
lumina-current-song))
(defun lumina-update-lyrics () (defun lumina-update-lyrics ()
"Update the lyrics in the db" "Update the lyrics in the db"
(interactive) (interactive)
(sqlite-execute lumina-db "update songs set lyrics = ? where title = ?" `(,(lumina-grab-lyrics) ,lumina-current-song)) (sqlite-execute lumina-db
"update songs set lyrics = ? where title = ?"
`(,(lumina-grab-lyrics) ,lumina-current-song))
(setf lumina-songs (sqlite-select lumina-db "select * from songs;"))) (setf lumina-songs (sqlite-select lumina-db "select * from songs;")))
(defun lumina-get-lyrics-genius (song) (defun lumina-get-lyrics-genius (song)
"retrieve lyrics to a song from genius lyrics" "retrieve lyrics to a song from genius lyrics"
(let* ((url (concat "https://api.genius.com/search?" "access_token=" "R0Y0ZW50Il9LSh5su3LKfdyfmQRx41NpVvLFJ0VxMo-hQ_4H1OVg_IE0Q-UUoFQx" "&q=" song)) (let* ((url (concat "https://api.genius.com/search?"
"access_token="
"R0Y0ZW50Il9LSh5su3LKfdyfmQRx41NpVvLFJ0VxMo-hQ_4H1OVg_IE0Q-UUoFQx"
"&q="
song))
(songs (songs
(cl-loop for song across (cl-loop for song across
(cdr (cadadr (plz 'get (url-encode-url url) :as #'json-read))) (cdr (cadadr
collect `(,(concat (cdr (elt (elt song 3) 19)) " by " (plz 'get (url-encode-url url) :as #'json-read)))
collect `(,(concat
(cdr (elt (elt song 3) 19)) " by "
(cdr (elt (elt (elt song 3) 23) 7)) (cdr (elt (elt (elt song 3) 23) 7))
" with id " " with id "
(number-to-string (number-to-string
(cdr (elt (elt song 3) 7))))))) (cdr (elt (elt song 3) 7)))))))
(selected-song (completing-read "song? " songs)) (selected-song (completing-read "song? " songs))
(id (replace-regexp-in-string "[^0-9]" "" selected-song))) (id (replace-regexp-in-string "[^0-9]" "" selected-song)))
(plz 'get (url-encode-url (concat "https://api.genius.com/songs/" id "?access_token=R0Y0ZW50Il9LSh5su3LKfdyfmQRx41NpVvLFJ0VxMo-hQ_4H1OVg_IE0Q-UUoFQx"))))) (plz 'get
(url-encode-url
(concat "https://api.genius.com/songs/" id
"?access_token=R0Y0ZW50Il9LSh5su3LKfdyfmQRx41NpVvLFJ0VxMo-hQ_4H1OVg_IE0Q-UUoFQx")))))
(cdr (elt (elt (elt (lumina-get-lyrics-genius "Death Was Arrested") 0) 3) 7)) (cdr (elt (elt (elt (lumina-get-lyrics-genius "Death Was Arrested") 0) 3) 7))