Created
July 18, 2022 14:49
-
-
Save pelletier/548c2f2eb0a297f0231c9ab0111f1c23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Display the assembly generated by the Go compiler of the code at current line in an emacs buffer. | |
;; | |
;; Navigate to a line of go code, then M-x my/go-show-asm. | |
(defun my/go-show-asm () | |
(interactive) | |
(let* ((p (buffer-file-name)) | |
(out-b "*go-show-asm*") | |
(needle (concat p ":" (number-to-string (line-number-at-pos))))) | |
(if (string-suffix-p ".go" p) | |
(progn | |
(save-buffer) | |
(shell-command "go build -gcflags -S" nil out-b) | |
(switch-to-buffer-other-window out-b) | |
(beginning-of-buffer) | |
(isearch-forward nil t) | |
(isearch-yank-string needle)) | |
(message "Cannot operate on a not .go file.")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment