Personal emacs config
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.7 KiB

  1. ;; Copyright (C) 2015, 2019 Free Software Foundation, Inc
  2. ;; Author: Rocky Bernstein <rocky@gnu.org>
  3. ;; This program is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;; This program is distributed in the hope that it will be useful,
  8. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. ;; GNU General Public License for more details.
  11. ;;; Follows or goto's something
  12. (require 'load-relative)
  13. (declare-function realgud:cmd-frame 'realgud-cmds)
  14. (declare-function realgud-loc-marker 'realgud-loc)
  15. (declare-function realgud-loc-p 'realgud-loc)
  16. (defun realgud:follow-mark(mark)
  17. (when (markerp mark)
  18. (let ((buffer (marker-buffer mark)))
  19. (set-buffer buffer)
  20. (set-window-point (display-buffer buffer) mark)
  21. (goto-char mark)
  22. )))
  23. (defun realgud:follow(pos)
  24. (interactive "%d")
  25. (let* ((mark (get-text-property pos 'mark))
  26. (filename (get-text-property pos 'file))
  27. (frame-num (get-text-property pos 'frame-num))
  28. )
  29. (cond ((markerp mark) (realgud:follow-mark mark) 't)
  30. ((realgud-loc-p mark) (realgud:follow-mark (realgud-loc-marker mark)) 't)
  31. ((stringp filename)
  32. (find-file-other-window filename))
  33. ((numberp frame-num) (realgud:cmd-frame frame-num))
  34. ('t (message "No location property found here")))
  35. ))
  36. (defun realgud:follow-point()
  37. (interactive)
  38. (realgud:follow (point)))
  39. (defun realgud:follow-event(event)
  40. (interactive "e")
  41. (realgud:follow (posn-point (event-end event))))
  42. (provide-me "realgud-")