Created
April 25, 2026 23:36
-
-
Save sogaiu/3f9c11e808a696efd05bce9603b34318 to your computer and use it in GitHub Desktop.
emacs gdb auto-center source buffer around current line
This file contains hidden or 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
| ;; references: | |
| ;; | |
| ;; * https://superuser.com/a/118138 | |
| ;; * https://superuser.com/a/1680006 | |
| ;; * http://kousik.blogspot.com/2005/10/highlight-current-line-in-gdbemacs.html | |
| (defadvice gud-display-line (after my-gud-display-line-center activate) | |
| ;; true-file is an argument to the original function | |
| (let* ((buffer (gud-find-file true-file))) | |
| (save-excursion | |
| (with-selected-window (get-buffer-window buffer) | |
| (save-restriction | |
| ;; line is an argument to the original function | |
| (goto-line line) | |
| (recenter)))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment