weblog

Friday 17 May 2024

title: File restore notes ----

I still have rustup in my dotfiles

Soo..rustup default stable and back up and running with cargo/rustc/pretty much everything I need to get started.

.emacs updates
12345678910111213141516171819202122232425262728293031323334353637394041(add-hook 'rust-mode-hook
          (lambda () (prettify-symbols-mode)))
(use-package rustic
  :ensure
  :bind (:map rustic-mode-map
              ("M-j" . lsp-ui-imenu)
              ("M-?" . lsp-find-references)
              ("C-c C-c l" . flycheck-list-errors)
              ("C-c C-c a" . lsp-execute-code-action)
              ("C-c C-c r" . lsp-rename)
              ("C-c C-c q" . lsp-workspace-restart)
              ("C-c C-c Q" . lsp-workspace-shutdown)
              ("C-c C-c s" . lsp-rust-analyzer-status))
  :config
  ;; uncomment for less flashiness
  ;; (setq lsp-eldoc-hook nil)
  ;; (setq lsp-enable-symbol-highlighting nil)
  ;; (setq lsp-signature-auto-activate nil)

  ;; comment to disable rustfmt on save
  (setq rustic-format-on-save t)
  (add-hook 'rustic-mode-hook 'rk/rustic-mode-hook))

(defun rk/rustic-mode-hook ()

  (when buffer-file-name
    (setq-local buffer-save-without-query t))
  (add-hook 'before-save-hook 'lsp-format-buffer nil t))

;;...
(use-package lsp-mode
  :commands lsp
  :ensure t
  :diminish lsp-mode
;;...
  :hook (rust-mode . lsp))
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))

and I had to remember to update rustfmt to rustfmt-nightly

I haven't written any Rust in ~4 years, but Proxmox VE and Proxmox Backup Server caught my eye as part of my home lab setup.

My biggest pain point so far using both of them has been file restore. So this reverse engineering + dev project is all about that.

$cargo install rustfmt-nightly --force and the rustfmt depreciation errors squawking from (setq rustic-format-on-save t) quiet down.