mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 16:24:18 +00:00
Jump to label in asm
This commit is contained in:
parent
f3a72f7ba1
commit
566af2b009
1 changed files with 14 additions and 0 deletions
|
|
@ -29,6 +29,7 @@
|
||||||
(modify-syntax-entry ?- "-" asm-mode-syntax-table)
|
(modify-syntax-entry ?- "-" asm-mode-syntax-table)
|
||||||
(modify-syntax-entry ?+ "-" asm-mode-syntax-table)
|
(modify-syntax-entry ?+ "-" asm-mode-syntax-table)
|
||||||
(modify-syntax-entry ?. "_" asm-mode-syntax-table)
|
(modify-syntax-entry ?. "_" asm-mode-syntax-table)
|
||||||
|
(modify-syntax-entry ?@ "_" asm-mode-syntax-table)
|
||||||
(modify-syntax-entry ?< "-" asm-mode-syntax-table)
|
(modify-syntax-entry ?< "-" asm-mode-syntax-table)
|
||||||
|
|
||||||
(add-hook 'asm-mode-hook
|
(add-hook 'asm-mode-hook
|
||||||
|
|
@ -119,6 +120,19 @@
|
||||||
(setq end (point)))
|
(setq end (point)))
|
||||||
(narrow-to-region start end)))
|
(narrow-to-region start end)))
|
||||||
|
|
||||||
|
(defun asm-jump-to-label ()
|
||||||
|
(interactive)
|
||||||
|
(xref-push-marker-stack)
|
||||||
|
(let ((addr (symbol-name (symbol-at-point))))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(cond
|
||||||
|
((string-match (rx line-start "@" (group (+ nonl))) addr)
|
||||||
|
(re-search-forward (format "<%s>:" (match-string 1 addr))))
|
||||||
|
(t (re-search-forward
|
||||||
|
(concat "^" addr ":"))))))
|
||||||
|
|
||||||
|
(define-key asm-mode-map (kbd "M-.") #'asm-jump-to-label)
|
||||||
|
|
||||||
(add-hook 'asm-mode-hook
|
(add-hook 'asm-mode-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(set (make-local-variable 'font-lock-multiline) t)
|
(set (make-local-variable 'font-lock-multiline) t)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue