diff options
| author | Simeon Simeonov | 2026-01-06 21:25:57 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2026-01-06 21:25:57 +0100 |
| commit | 5c2c9a50da3a3f534842ffe95a49fe990000a072 (patch) | |
| tree | 4d798cad751adb7f532d1ad134c87d27cc59931b | |
| parent | 4ccca9a08a613417baf81a55e1b33292cd869b63 (diff) | |
Update markdown, rust and yasnippet
| -rw-r--r-- | .emacs.d/lisp/markdown-mode.el | 95 | ||||
| -rw-r--r-- | .emacs.d/lisp/rust-cargo-tests.el | 17 | ||||
| -rw-r--r-- | .emacs.d/lisp/rust-cargo.el | 13 | ||||
| -rw-r--r-- | .emacs.d/lisp/rust-compile.el | 18 | ||||
| -rw-r--r-- | .emacs.d/lisp/rust-mode-tests.el | 102 | ||||
| -rw-r--r-- | .emacs.d/lisp/rust-rustfmt.el | 6 | ||||
| -rw-r--r-- | .emacs.d/lisp/yasnippet.el | 25 |
7 files changed, 231 insertions, 45 deletions
diff --git a/.emacs.d/lisp/markdown-mode.el b/.emacs.d/lisp/markdown-mode.el index 671210e..77f9bf5 100644 --- a/.emacs.d/lisp/markdown-mode.el +++ b/.emacs.d/lisp/markdown-mode.el | |||
| @@ -187,12 +187,10 @@ fewer than six nested heading levels are used." | |||
| 187 | :safe 'natnump | 187 | :safe 'natnump |
| 188 | :package-version '(markdown-mode . "2.4")) | 188 | :package-version '(markdown-mode . "2.4")) |
| 189 | 189 | ||
| 190 | (defcustom markdown-asymmetric-header nil | 190 | (defcustom markdown-asymmetric-header t |
| 191 | "Determines if atx header style will be asymmetric. | 191 | "Determines if atx header style will be asymmetric. |
| 192 | Set to a non-nil value to use asymmetric header styling, placing | 192 | Set to a non-nil value to use asymmetric header styling, placing |
| 193 | header markup only at the beginning of the line. By default, | 193 | header markup only at the beginning of the line." |
| 194 | balanced markup will be inserted at the beginning and end of the | ||
| 195 | line around the header title." | ||
| 196 | :group 'markdown | 194 | :group 'markdown |
| 197 | :type 'boolean) | 195 | :type 'boolean) |
| 198 | 196 | ||
| @@ -2612,7 +2610,11 @@ Return the point at the end when a list item was found at the | |||
| 2612 | original point. If the point is not in a list item, do nothing." | 2610 | original point. If the point is not in a list item, do nothing." |
| 2613 | (let (indent) | 2611 | (let (indent) |
| 2614 | (forward-line) | 2612 | (forward-line) |
| 2615 | (setq indent (current-indentation)) | 2613 | ;; #904 consider a space indentation and tab indentation case |
| 2614 | (save-excursion | ||
| 2615 | (let ((pos (point))) | ||
| 2616 | (back-to-indentation) | ||
| 2617 | (setq indent (- (point) pos)))) | ||
| 2616 | (while | 2618 | (while |
| 2617 | (cond | 2619 | (cond |
| 2618 | ;; Stop at end of the buffer. | 2620 | ;; Stop at end of the buffer. |
| @@ -2902,7 +2904,8 @@ data. See `markdown-inline-code-at-point-p' for inline code." | |||
| 2902 | (defun markdown-heading-at-point (&optional pos) | 2904 | (defun markdown-heading-at-point (&optional pos) |
| 2903 | "Return non-nil if there is a heading at the POS. | 2905 | "Return non-nil if there is a heading at the POS. |
| 2904 | Set match data for `markdown-regex-header'." | 2906 | Set match data for `markdown-regex-header'." |
| 2905 | (let ((match-data (get-text-property (or pos (point)) 'markdown-heading))) | 2907 | (let* ((p (or pos (if (and (eolp) (>= (point) 2)) (1- (point)) (point)))) |
| 2908 | (match-data (get-text-property p 'markdown-heading))) | ||
| 2906 | (when match-data | 2909 | (when match-data |
| 2907 | (set-match-data match-data) | 2910 | (set-match-data match-data) |
| 2908 | t))) | 2911 | t))) |
| @@ -9321,6 +9324,37 @@ position." | |||
| 9321 | (require 'edit-indirect nil t) | 9324 | (require 'edit-indirect nil t) |
| 9322 | (defvar edit-indirect-guess-mode-function) | 9325 | (defvar edit-indirect-guess-mode-function) |
| 9323 | (defvar edit-indirect-after-commit-functions) | 9326 | (defvar edit-indirect-after-commit-functions) |
| 9327 | (defvar edit-indirect--overlay) | ||
| 9328 | (declare-function edit-indirect-commit "edit-indirect") | ||
| 9329 | (declare-function edit-indirect--commit "edit-indirect") | ||
| 9330 | |||
| 9331 | (defvar-local markdown--edit-indirect-committed-position nil) | ||
| 9332 | |||
| 9333 | (defun markdown--edit-indirect-save-committed-position () | ||
| 9334 | "Save where editing is committed in a local variable in the parent buffer." | ||
| 9335 | (if-let* ((parent-buffer (overlay-buffer edit-indirect--overlay)) | ||
| 9336 | ((with-current-buffer parent-buffer | ||
| 9337 | (derived-mode-p 'markdown-mode))) | ||
| 9338 | (pos (cons (line-number-at-pos) (current-column)))) | ||
| 9339 | (with-current-buffer parent-buffer | ||
| 9340 | (setq markdown--edit-indirect-committed-position pos)))) | ||
| 9341 | |||
| 9342 | (with-eval-after-load 'edit-indirect | ||
| 9343 | (advice-add #'edit-indirect--commit :after #'markdown--edit-indirect-save-committed-position)) | ||
| 9344 | |||
| 9345 | (defun markdown--edit-indirect-move-to-committed-position () | ||
| 9346 | "Move the point in the code block corresponding to the saved committed position." | ||
| 9347 | (when-let* ((pos markdown--edit-indirect-committed-position) | ||
| 9348 | (bounds (markdown-get-enclosing-fenced-block-construct)) | ||
| 9349 | (fence-begin (nth 0 bounds))) | ||
| 9350 | (goto-char fence-begin) | ||
| 9351 | (let ((block-indentation (current-indentation))) | ||
| 9352 | (forward-line (car pos)) | ||
| 9353 | (move-to-column (+ block-indentation (cdr pos))))) | ||
| 9354 | (setq markdown--edit-indirect-committed-position nil)) | ||
| 9355 | |||
| 9356 | (with-eval-after-load 'edit-indirect | ||
| 9357 | (advice-add #'edit-indirect-commit :after #'markdown--edit-indirect-move-to-committed-position)) | ||
| 9324 | 9358 | ||
| 9325 | (defun markdown--edit-indirect-after-commit-function (beg end) | 9359 | (defun markdown--edit-indirect-after-commit-function (beg end) |
| 9326 | "Corrective logic run on code block content from lines BEG to END. | 9360 | "Corrective logic run on code block content from lines BEG to END. |
| @@ -9342,18 +9376,24 @@ at the END of code blocks." | |||
| 9342 | (interactive) | 9376 | (interactive) |
| 9343 | (save-excursion | 9377 | (save-excursion |
| 9344 | (if (fboundp 'edit-indirect-region) | 9378 | (if (fboundp 'edit-indirect-region) |
| 9345 | (let* ((bounds (markdown-get-enclosing-fenced-block-construct)) | 9379 | (if-let* ((bounds (markdown-get-enclosing-fenced-block-construct)) |
| 9346 | (begin (and bounds (not (null (nth 0 bounds))) (goto-char (nth 0 bounds)) (line-beginning-position 2))) | 9380 | (fence-begin (nth 0 bounds)) |
| 9347 | (end (and bounds(not (null (nth 1 bounds))) (goto-char (nth 1 bounds)) (line-beginning-position 1)))) | 9381 | (fence-end (nth 1 bounds))) |
| 9348 | (if (and begin end) | 9382 | (let* ((original-line (line-number-at-pos)) |
| 9349 | (let* ((indentation (and (goto-char (nth 0 bounds)) (current-indentation))) | 9383 | (original-column (current-column)) |
| 9350 | (lang (markdown-code-block-lang)) | 9384 | (begin (progn (goto-char fence-begin) (line-beginning-position 2))) |
| 9351 | (mode (or (and lang (markdown-get-lang-mode lang)) | 9385 | (line (max 0 (- original-line (line-number-at-pos) 1))) |
| 9352 | markdown-edit-code-block-default-mode)) | 9386 | (indentation (current-indentation)) |
| 9353 | (edit-indirect-guess-mode-function | 9387 | (column (max 0 (- original-column indentation))) |
| 9354 | (lambda (_parent-buffer _beg _end) | 9388 | (end (progn (goto-char fence-end) (line-beginning-position 1))) |
| 9355 | (funcall mode))) | 9389 | (lang (markdown-code-block-lang)) |
| 9356 | (indirect-buf (edit-indirect-region begin end 'display-buffer))) | 9390 | (mode (or (and lang (markdown-get-lang-mode lang)) |
| 9391 | markdown-edit-code-block-default-mode)) | ||
| 9392 | (edit-indirect-guess-mode-function | ||
| 9393 | (lambda (_parent-buffer _beg _end) | ||
| 9394 | (funcall mode))) | ||
| 9395 | (indirect-buf (edit-indirect-region begin end 'display-buffer))) | ||
| 9396 | (with-current-buffer indirect-buf | ||
| 9357 | ;; reset `sh-shell' when indirect buffer | 9397 | ;; reset `sh-shell' when indirect buffer |
| 9358 | (when (and (not (member system-type '(ms-dos windows-nt))) | 9398 | (when (and (not (member system-type '(ms-dos windows-nt))) |
| 9359 | (member mode '(shell-script-mode sh-mode)) | 9399 | (member mode '(shell-script-mode sh-mode)) |
| @@ -9361,16 +9401,17 @@ at the END of code blocks." | |||
| 9361 | (mapcar (lambda (e) (symbol-name (car e))) | 9401 | (mapcar (lambda (e) (symbol-name (car e))) |
| 9362 | sh-ancestor-alist) | 9402 | sh-ancestor-alist) |
| 9363 | '("csh" "rc" "sh")))) | 9403 | '("csh" "rc" "sh")))) |
| 9364 | (with-current-buffer indirect-buf | 9404 | (sh-set-shell lang)) |
| 9365 | (sh-set-shell lang))) | ||
| 9366 | (when (> indentation 0) ;; un-indent in edit-indirect buffer | 9405 | (when (> indentation 0) ;; un-indent in edit-indirect buffer |
| 9367 | (with-current-buffer indirect-buf | 9406 | (indent-rigidly (point-min) (point-max) (- indentation))) |
| 9368 | (indent-rigidly (point-min) (point-max) (- indentation))))) | 9407 | (goto-char (point-min)) |
| 9369 | (user-error "Not inside a GFM or tilde fenced code block"))) | 9408 | (forward-line line) |
| 9409 | (move-to-column column))) | ||
| 9410 | (user-error "Not inside a GFM or tilde fenced code block")) | ||
| 9370 | (when (y-or-n-p "Package edit-indirect needed to edit code blocks. Install it now? ") | 9411 | (when (y-or-n-p "Package edit-indirect needed to edit code blocks. Install it now? ") |
| 9371 | (progn (package-refresh-contents) | 9412 | (package-refresh-contents) |
| 9372 | (package-install 'edit-indirect) | 9413 | (package-install 'edit-indirect) |
| 9373 | (markdown-edit-code-block)))))) | 9414 | (markdown-edit-code-block))))) |
| 9374 | 9415 | ||
| 9375 | 9416 | ||
| 9376 | ;;; Table Editing ============================================================= | 9417 | ;;; Table Editing ============================================================= |
| @@ -10522,7 +10563,7 @@ rows and columns and the column alignment." | |||
| 10522 | (define-key map (kbd "SPC") #'scroll-up-command) | 10563 | (define-key map (kbd "SPC") #'scroll-up-command) |
| 10523 | (define-key map (kbd ">") #'end-of-buffer) | 10564 | (define-key map (kbd ">") #'end-of-buffer) |
| 10524 | (define-key map (kbd "<") #'beginning-of-buffer) | 10565 | (define-key map (kbd "<") #'beginning-of-buffer) |
| 10525 | (define-key map (kbd "q") #'kill-this-buffer) | 10566 | (define-key map (kbd "q") #'kill-current-buffer) |
| 10526 | (define-key map (kbd "?") #'describe-mode) | 10567 | (define-key map (kbd "?") #'describe-mode) |
| 10527 | map) | 10568 | map) |
| 10528 | "Keymap for `markdown-view-mode'.") | 10569 | "Keymap for `markdown-view-mode'.") |
diff --git a/.emacs.d/lisp/rust-cargo-tests.el b/.emacs.d/lisp/rust-cargo-tests.el index fe78ac7..1b072ee 100644 --- a/.emacs.d/lisp/rust-cargo-tests.el +++ b/.emacs.d/lisp/rust-cargo-tests.el | |||
| @@ -21,6 +21,13 @@ | |||
| 21 | (find-file main-file) | 21 | (find-file main-file) |
| 22 | ,expr))) | 22 | ,expr))) |
| 23 | 23 | ||
| 24 | (defmacro rust-test--with-snippet-buffer (expr) | ||
| 25 | `(let* ((test-dir (expand-file-name "test-project/" default-directory)) | ||
| 26 | (snippet-file (expand-file-name "src/rustfmt-default.rs" test-dir))) | ||
| 27 | (save-current-buffer | ||
| 28 | (find-file snippet-file) | ||
| 29 | ,expr))) | ||
| 30 | |||
| 24 | (defun rust-test--find-string (string) | 31 | (defun rust-test--find-string (string) |
| 25 | "Find STRING in current buffer." | 32 | "Find STRING in current buffer." |
| 26 | (goto-char (point-min)) | 33 | (goto-char (point-min)) |
| @@ -70,3 +77,13 @@ | |||
| 70 | (should (eq major-mode 'rust-format-mode)) | 77 | (should (eq major-mode 'rust-format-mode)) |
| 71 | (should (rust-test--find-string "error:"))) | 78 | (should (rust-test--find-string "error:"))) |
| 72 | (kill-buffer "*rustfmt*"))) | 79 | (kill-buffer "*rustfmt*"))) |
| 80 | |||
| 81 | (ert-deftest rust-test-respect-rustfmt-defaults () | ||
| 82 | (skip-unless (executable-find "rustfmt")) | ||
| 83 | (rust-test--with-snippet-buffer | ||
| 84 | (let ((old-content (buffer-string)) | ||
| 85 | (ret (rust-format-buffer))) | ||
| 86 | (should (string= old-content (buffer-string)))))) | ||
| 87 | |||
| 88 | (ert-deftest rust-test-ensure-rustfmt-switches-nil () | ||
| 89 | (should (eq rust-rustfmt-switches nil))) | ||
diff --git a/.emacs.d/lisp/rust-cargo.el b/.emacs.d/lisp/rust-cargo.el index d9f1be5..d323b5d 100644 --- a/.emacs.d/lisp/rust-cargo.el +++ b/.emacs.d/lisp/rust-cargo.el | |||
| @@ -31,6 +31,11 @@ worksapce for commands like `cargo check`." | |||
| 31 | :type 'string | 31 | :type 'string |
| 32 | :group 'rust-mode) | 32 | :group 'rust-mode) |
| 33 | 33 | ||
| 34 | (defcustom rust-cargo-clippy-default-arguments '() | ||
| 35 | "Default arguments for running `cargo clippy`." | ||
| 36 | :type '(repeat string) | ||
| 37 | :group 'rust-mode) | ||
| 38 | |||
| 34 | ;;; Buffer Project | 39 | ;;; Buffer Project |
| 35 | 40 | ||
| 36 | (defvar-local rust-buffer-project nil) | 41 | (defvar-local rust-buffer-project nil) |
| @@ -134,11 +139,13 @@ output buffer will be in comint mode, i.e. interactive." | |||
| 134 | (interactive) | 139 | (interactive) |
| 135 | (when (null rust-buffer-project) | 140 | (when (null rust-buffer-project) |
| 136 | (rust-update-buffer-project)) | 141 | (rust-update-buffer-project)) |
| 137 | (let* ((args (list rust-cargo-bin "clippy" | 142 | (let* ((args (append (list rust-cargo-bin "clippy" |
| 138 | (concat "--manifest-path=" rust-buffer-project))) | 143 | (concat "--manifest-path=" rust-buffer-project)) |
| 144 | rust-cargo-clippy-default-arguments)) | ||
| 139 | ;; set `compile-command' temporarily so `compile' doesn't | 145 | ;; set `compile-command' temporarily so `compile' doesn't |
| 140 | ;; clobber the existing value | 146 | ;; clobber the existing value |
| 141 | (compile-command (mapconcat #'shell-quote-argument args " "))) | 147 | (compile-command (concat (mapconcat #'shell-quote-argument args " ") |
| 148 | " " rust-cargo-default-arguments))) | ||
| 142 | (rust--compile nil compile-command))) | 149 | (rust--compile nil compile-command))) |
| 143 | 150 | ||
| 144 | ;;; _ | 151 | ;;; _ |
diff --git a/.emacs.d/lisp/rust-compile.el b/.emacs.d/lisp/rust-compile.el index 04ac6b6..cbdf43a 100644 --- a/.emacs.d/lisp/rust-compile.el +++ b/.emacs.d/lisp/rust-compile.el | |||
| @@ -28,6 +28,12 @@ See `compilation-error-regexp-alist' for help on their format.") | |||
| 28 | "Specifications for matching `:::` hints in rustc invocations. | 28 | "Specifications for matching `:::` hints in rustc invocations. |
| 29 | See `compilation-error-regexp-alist' for help on their format.") | 29 | See `compilation-error-regexp-alist' for help on their format.") |
| 30 | 30 | ||
| 31 | (defvar rustc-backtrace-compilation-regexps | ||
| 32 | (let ((re (concat "^ +at " rustc-compilation-location))) | ||
| 33 | (cons re '(2 3 4 0 1))) | ||
| 34 | "Specifications for matching stack backtraces in rustc invocations. | ||
| 35 | See `compilation-error-regexp-alist' for help on their format.") | ||
| 36 | |||
| 31 | (defvar rustc-refs-compilation-regexps | 37 | (defvar rustc-refs-compilation-regexps |
| 32 | (let ((re "^\\([0-9]+\\)[[:space:]]*|")) | 38 | (let ((re "^\\([0-9]+\\)[[:space:]]*|")) |
| 33 | (cons re '(nil 1 nil 0 1))) | 39 | (cons re '(nil 1 nil 0 1))) |
| @@ -48,6 +54,12 @@ See `compilation-error-regexp-alist' for help on their format.") | |||
| 48 | "Specifications for matching panics in cargo test invocations. | 54 | "Specifications for matching panics in cargo test invocations. |
| 49 | See `compilation-error-regexp-alist' for help on their format.") | 55 | See `compilation-error-regexp-alist' for help on their format.") |
| 50 | 56 | ||
| 57 | (defvar rustc-dbg!-compilation-regexps | ||
| 58 | (let ((re (concat "\\[" rustc-compilation-location "\\]"))) | ||
| 59 | (cons re '(2 3 4 0 1))) | ||
| 60 | "Specifications for matching dbg! output. | ||
| 61 | See `compilation-error-regexp-alist' for help on their format.") | ||
| 62 | |||
| 51 | (defun rustc-scroll-down-after-next-error () | 63 | (defun rustc-scroll-down-after-next-error () |
| 52 | "In the new style error messages, the regular expression | 64 | "In the new style error messages, the regular expression |
| 53 | matches on the file name (which appears after `-->`), but the | 65 | matches on the file name (which appears after `-->`), but the |
| @@ -80,11 +92,17 @@ the compilation window until the top of the error is visible." | |||
| 80 | (cons 'rustc-colon rustc-colon-compilation-regexps)) | 92 | (cons 'rustc-colon rustc-colon-compilation-regexps)) |
| 81 | (add-to-list 'compilation-error-regexp-alist 'rustc-colon) | 93 | (add-to-list 'compilation-error-regexp-alist 'rustc-colon) |
| 82 | (add-to-list 'compilation-error-regexp-alist-alist | 94 | (add-to-list 'compilation-error-regexp-alist-alist |
| 95 | (cons 'rustc-backtrace rustc-backtrace-compilation-regexps)) | ||
| 96 | (add-to-list 'compilation-error-regexp-alist 'rustc-backtrace) | ||
| 97 | (add-to-list 'compilation-error-regexp-alist-alist | ||
| 83 | (cons 'cargo cargo-compilation-regexps)) | 98 | (cons 'cargo cargo-compilation-regexps)) |
| 84 | (add-to-list 'compilation-error-regexp-alist-alist | 99 | (add-to-list 'compilation-error-regexp-alist-alist |
| 85 | (cons 'rustc-panics rustc-panics-compilation-regexps)) | 100 | (cons 'rustc-panics rustc-panics-compilation-regexps)) |
| 86 | (add-to-list 'compilation-error-regexp-alist 'rustc-panics) | 101 | (add-to-list 'compilation-error-regexp-alist 'rustc-panics) |
| 87 | (add-to-list 'compilation-error-regexp-alist 'cargo) | 102 | (add-to-list 'compilation-error-regexp-alist 'cargo) |
| 103 | (add-to-list 'compilation-error-regexp-alist-alist | ||
| 104 | (cons 'rust-dbg! rustc-dbg!-compilation-regexps)) | ||
| 105 | (add-to-list 'compilation-error-regexp-alist 'rust-dbg!) | ||
| 88 | (add-hook 'next-error-hook #'rustc-scroll-down-after-next-error))) | 106 | (add-hook 'next-error-hook #'rustc-scroll-down-after-next-error))) |
| 89 | 107 | ||
| 90 | ;;; _ | 108 | ;;; _ |
diff --git a/.emacs.d/lisp/rust-mode-tests.el b/.emacs.d/lisp/rust-mode-tests.el index 62cd261..259afb2 100644 --- a/.emacs.d/lisp/rust-mode-tests.el +++ b/.emacs.d/lisp/rust-mode-tests.el | |||
| @@ -887,6 +887,98 @@ struct A { | |||
| 887 | " | 887 | " |
| 888 | )) | 888 | )) |
| 889 | 889 | ||
| 890 | ;; When point is inside an example code block, indent-for-tab-command | ||
| 891 | ;; should reindent the example code. | ||
| 892 | (ert-deftest indent-inside-doc-example () | ||
| 893 | (rust-test-manip-code | ||
| 894 | " | ||
| 895 | /// ``` | ||
| 896 | /// if 2 + 2 == 4 { | ||
| 897 | /// success(); | ||
| 898 | /// } | ||
| 899 | /// ``` | ||
| 900 | " | ||
| 901 | 34 | ||
| 902 | #'indent-for-tab-command | ||
| 903 | " | ||
| 904 | /// ``` | ||
| 905 | /// if 2 + 2 == 4 { | ||
| 906 | /// success(); | ||
| 907 | /// } | ||
| 908 | /// ``` | ||
| 909 | " | ||
| 910 | 38)) | ||
| 911 | |||
| 912 | ;; Inside example code blocks, hidden lines starting with "# " should | ||
| 913 | ;; be indented as if the "# " wasn't there. | ||
| 914 | (ert-deftest indent-inside-doc-example-hidden-code () | ||
| 915 | (rust-test-manip-code | ||
| 916 | " | ||
| 917 | /// ``` | ||
| 918 | /// # if 2 + 2 == 4 { | ||
| 919 | /// # success(); | ||
| 920 | /// # } | ||
| 921 | /// ``` | ||
| 922 | " | ||
| 923 | 36 | ||
| 924 | #'indent-for-tab-command | ||
| 925 | " | ||
| 926 | /// ``` | ||
| 927 | /// # if 2 + 2 == 4 { | ||
| 928 | /// # success(); | ||
| 929 | /// # } | ||
| 930 | /// ``` | ||
| 931 | " | ||
| 932 | 42)) | ||
| 933 | |||
| 934 | ;; Inside example code blocks, hidden lines starting with "# " | ||
| 935 | ;; shouldn't affect indentation of non-hidden lines. | ||
| 936 | (ert-deftest indent-inside-doc-example-with-hidden-block () | ||
| 937 | (rust-test-manip-code | ||
| 938 | " | ||
| 939 | /// ``` | ||
| 940 | /// # if 2 + 2 == 4 { | ||
| 941 | /// success(); | ||
| 942 | /// # } | ||
| 943 | /// ``` | ||
| 944 | " | ||
| 945 | 40 | ||
| 946 | #'indent-for-tab-command | ||
| 947 | " | ||
| 948 | /// ``` | ||
| 949 | /// # if 2 + 2 == 4 { | ||
| 950 | /// success(); | ||
| 951 | /// # } | ||
| 952 | /// ``` | ||
| 953 | " | ||
| 954 | 36)) | ||
| 955 | |||
| 956 | ;; When point is outside the comment, indent-for-tab-command should | ||
| 957 | ;; reindent the comment line without affecting its contents. | ||
| 958 | (ert-deftest indent-outside-doc-example () | ||
| 959 | (rust-test-manip-code | ||
| 960 | " | ||
| 961 | impl Foo { | ||
| 962 | /// ``` | ||
| 963 | /// if 2 + 2 == 4 { | ||
| 964 | /// success(); | ||
| 965 | /// } | ||
| 966 | /// ``` | ||
| 967 | } | ||
| 968 | " | ||
| 969 | 49 | ||
| 970 | #'indent-for-tab-command | ||
| 971 | " | ||
| 972 | impl Foo { | ||
| 973 | /// ``` | ||
| 974 | /// if 2 + 2 == 4 { | ||
| 975 | /// success(); | ||
| 976 | /// } | ||
| 977 | /// ``` | ||
| 978 | } | ||
| 979 | " | ||
| 980 | 53)) | ||
| 981 | |||
| 890 | (defconst rust-test-motion-string | 982 | (defconst rust-test-motion-string |
| 891 | " | 983 | " |
| 892 | fn fn1(arg: i32) -> bool { | 984 | fn fn1(arg: i32) -> bool { |
| @@ -3601,6 +3693,8 @@ let b = 1;" | |||
| 3601 | (insert "note: `ZZZ` could also refer to the constant imported here -> b\n --> file4.rs:12:34\n\n") | 3693 | (insert "note: `ZZZ` could also refer to the constant imported here -> b\n --> file4.rs:12:34\n\n") |
| 3602 | (insert " ::: file5.rs:12:34\n\n") | 3694 | (insert " ::: file5.rs:12:34\n\n") |
| 3603 | (insert "thread 'main' panicked at src/file7.rs:12:34:\n\n") | 3695 | (insert "thread 'main' panicked at src/file7.rs:12:34:\n\n") |
| 3696 | (insert "[src/file8.rs:159:5] symbol_value(SOME_VAR) = Some(\n\n") | ||
| 3697 | (insert " at file9.rs:12:34\n\n") | ||
| 3604 | ;; should not match | 3698 | ;; should not match |
| 3605 | (insert "werror found a -> b\n --> no_match.rs:12:34\n\n") | 3699 | (insert "werror found a -> b\n --> no_match.rs:12:34\n\n") |
| 3606 | (insert "error[E0061]: this function takes 1 parameter but 2 parameters were supplied\n --> file6.rs:132:34 | 3700 | (insert "error[E0061]: this function takes 1 parameter but 2 parameters were supplied\n --> file6.rs:132:34 |
| @@ -3620,12 +3714,16 @@ let b = 1;" | |||
| 3620 | (("file5.rs" "12" "34" compilation-info "file5.rs:12:34")) | 3714 | (("file5.rs" "12" "34" compilation-info "file5.rs:12:34")) |
| 3621 | ((like-previous-one "82" back-to-indentation compilation-info "82") | 3715 | ((like-previous-one "82" back-to-indentation compilation-info "82") |
| 3622 | (like-previous-one "132" back-to-indentation compilation-info "132")) | 3716 | (like-previous-one "132" back-to-indentation compilation-info "132")) |
| 3623 | (("src/file7.rs" "12" "34" nil "src/file7.rs:12:34"))) | 3717 | (("src/file7.rs" "12" "34" nil "src/file7.rs:12:34")) |
| 3718 | (("src/file8.rs" "159" "5" compilation-info "src/file8.rs:159:5")) | ||
| 3719 | (("file9.rs" "12" "34" compilation-info "file9.rs:12:34"))) | ||
| 3624 | (mapcar #'rust-collect-matches | 3720 | (mapcar #'rust-collect-matches |
| 3625 | (list rustc-compilation-regexps | 3721 | (list rustc-compilation-regexps |
| 3626 | rustc-colon-compilation-regexps | 3722 | rustc-colon-compilation-regexps |
| 3627 | rustc-refs-compilation-regexps | 3723 | rustc-refs-compilation-regexps |
| 3628 | rustc-panics-compilation-regexps)))))) | 3724 | rustc-panics-compilation-regexps |
| 3725 | rustc-dbg!-compilation-regexps | ||
| 3726 | rustc-backtrace-compilation-regexps)))))) | ||
| 3629 | 3727 | ||
| 3630 | ;; If electric-pair-mode is available, load it and run the tests that use it. If not, | 3728 | ;; If electric-pair-mode is available, load it and run the tests that use it. If not, |
| 3631 | ;; no error--the tests will be skipped. | 3729 | ;; no error--the tests will be skipped. |
diff --git a/.emacs.d/lisp/rust-rustfmt.el b/.emacs.d/lisp/rust-rustfmt.el index 6fb0e87..adaeb0d 100644 --- a/.emacs.d/lisp/rust-rustfmt.el +++ b/.emacs.d/lisp/rust-rustfmt.el | |||
| @@ -33,8 +33,10 @@ | |||
| 33 | :type 'string | 33 | :type 'string |
| 34 | :group 'rust-mode) | 34 | :group 'rust-mode) |
| 35 | 35 | ||
| 36 | (defcustom rust-rustfmt-switches '("--edition" "2024") | 36 | (defcustom rust-rustfmt-switches nil |
| 37 | "Arguments to pass when invoking the `rustfmt' executable." | 37 | "Arguments to pass when invoking the `rustfmt' executable. This variable |
| 38 | will override any user configuration (e.g. rustfmt.toml). Recommendation | ||
| 39 | is to not modify this and rely on declarative configuration instead." | ||
| 38 | :type '(repeat string) | 40 | :type '(repeat string) |
| 39 | :group 'rust-mode) | 41 | :group 'rust-mode) |
| 40 | 42 | ||
diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index 806f2bc..cbeebd1 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; João Távora <joaotavora@gmail.com>, | 5 | ;; João Távora <joaotavora@gmail.com>, |
| 6 | ;; Noam Postavsky <npostavs@gmail.com> | 6 | ;; Noam Postavsky <npostavs@gmail.com> |
| 7 | ;; Maintainer: Noam Postavsky <npostavs@gmail.com> | 7 | ;; Maintainer: Noam Postavsky <npostavs@gmail.com> |
| 8 | ;; Version: 0.14.2 | 8 | ;; Version: 0.14.3 |
| 9 | ;; X-URL: http://github.com/joaotavora/yasnippet | 9 | ;; X-URL: http://github.com/joaotavora/yasnippet |
| 10 | ;; Keywords: convenience, emulation | 10 | ;; Keywords: convenience, emulation |
| 11 | ;; URL: http://github.com/joaotavora/yasnippet | 11 | ;; URL: http://github.com/joaotavora/yasnippet |
| @@ -1933,16 +1933,18 @@ With prefix argument USE-JIT do jit-loading of snippets." | |||
| 1933 | (let ((output-file (expand-file-name ".yas-compiled-snippets.el" | 1933 | (let ((output-file (expand-file-name ".yas-compiled-snippets.el" |
| 1934 | directory))) | 1934 | directory))) |
| 1935 | (with-temp-file output-file | 1935 | (with-temp-file output-file |
| 1936 | (insert (format ";;; Compiled snippets and support files for `%s'\n" | 1936 | (insert (format ";;; \"Compiled\" snippets and support files for `%S' -*- lexical-binding:t -*-\n" |
| 1937 | mode-sym)) | 1937 | mode-sym)) |
| 1938 | (yas--load-directory-2 directory mode-sym) | 1938 | (yas--load-directory-2 directory mode-sym) |
| 1939 | (insert (format ";;; Do not edit! File generated at %s\n" | 1939 | (insert (format ";;; Do not edit! File generated at %s\n" |
| 1940 | (current-time-string))))) | 1940 | (current-time-string))))) |
| 1941 | ;; Normal case. | 1941 | ;; Normal case. |
| 1942 | (unless (file-exists-p (expand-file-name ".yas-skip" directory)) | 1942 | (unless (file-exists-p (expand-file-name ".yas-skip" directory)) |
| 1943 | (unless (and (load (expand-file-name ".yas-compiled-snippets" directory) | 1943 | (if (let ((warning-inhibit-types |
| 1944 | 'noerror (<= yas-verbosity 3)) | 1944 | '((files missing-lexbind-cookie)))) |
| 1945 | (progn (yas--message 4 "Loaded compiled snippets from %s" directory) t)) | 1945 | (load (expand-file-name ".yas-compiled-snippets" directory) |
| 1946 | 'noerror (<= yas-verbosity 3))) | ||
| 1947 | (yas--message 4 "Loaded compiled snippets from %s" directory) | ||
| 1946 | (yas--message 4 "Loading snippet files from %s" directory) | 1948 | (yas--message 4 "Loading snippet files from %s" directory) |
| 1947 | (yas--load-directory-2 directory mode-sym))))) | 1949 | (yas--load-directory-2 directory mode-sym))))) |
| 1948 | 1950 | ||
| @@ -3200,12 +3202,13 @@ ENV is a lisp expression that evaluates to list of elements with | |||
| 3200 | the form (VAR FORM), where VAR is a symbol and FORM is a lisp | 3202 | the form (VAR FORM), where VAR is a symbol and FORM is a lisp |
| 3201 | expression that evaluates to its value." | 3203 | expression that evaluates to its value." |
| 3202 | (declare (debug (form body)) (indent 1)) | 3204 | (declare (debug (form body)) (indent 1)) |
| 3203 | (let ((envvar (make-symbol "envvar"))) | 3205 | `(yas--letenv-f ,env (lambda () ,@body))) |
| 3204 | `(let ((,envvar ,env)) | 3206 | |
| 3205 | (cl-progv | 3207 | (defun yas--letenv-f (env body-fun) |
| 3206 | (mapcar #'car ,envvar) | 3208 | (cl-progv |
| 3207 | (mapcar (lambda (v-f) (eval (cadr v-f) t)) ,envvar) | 3209 | (mapcar #'car env) |
| 3208 | ,@body)))) | 3210 | (mapcar (lambda (v-f) (eval (cadr v-f) t)) env) |
| 3211 | (funcall body-fun))) | ||
| 3209 | 3212 | ||
| 3210 | (defun yas--snippet-map-markers (fun snippet) | 3213 | (defun yas--snippet-map-markers (fun snippet) |
| 3211 | "Apply FUN to all marker (sub)fields in SNIPPET. | 3214 | "Apply FUN to all marker (sub)fields in SNIPPET. |
