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.

90 lines
3.2 KiB

  1. ;; Copyright (C) 2015-2017 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. ;; You should have received a copy of the GNU General Public License
  12. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ;; `remake' Main interface to remake via Emacs
  14. (require 'load-relative)
  15. (require-relative-list '("../../common/helper") "realgud-")
  16. (require-relative-list '("../../common/track") "realgud-")
  17. (require-relative-list '("../../common/run") "realgud:")
  18. (require-relative-list '("core" "track-mode") "realgud:remake-")
  19. ;; This is needed, or at least the docstring part of it is needed to
  20. ;; get the customization menu to work in Emacs 25.
  21. (defgroup realgud:remake nil
  22. "The realgud interface to the GNU Make debugger"
  23. :group 'realgud
  24. :group 'make
  25. :version "25.1")
  26. (eval-when-compile (require 'cl-lib))
  27. (declare-function remake-query-cmdline 'realgud:remake-core)
  28. (declare-function remake-parse-cmd-args 'realgud:remake-core)
  29. (declare-function realgud:run-debugger 'realgud:run)
  30. (declare-function realgud:run-process 'realgud:run)
  31. (defun realgud:remake-run-debugger (&optional opt-command-line
  32. no-reset)
  33. "Invoke the a debugger and start the Emacs user interface.
  34. String OPT-COMMAND-LINE specifies how to run DEBUGGER-NAME. You
  35. will be prompted for a command line using QUERY-CMDLINE-FN is one
  36. isn't supplied.
  37. OPT-COMMAND-LINE is treated like a shell string; arguments are
  38. tokenized by `split-string-and-unquote'. The tokenized string is
  39. parsed by PARSE-CMD-FN and path elements found by that
  40. are expanded using `expand-file-name'.
  41. If successful, The command buffer of the debugger process is returned.
  42. Otherwise nil is returned.
  43. "
  44. (let* ((cmd-str (or opt-command-line (remake-query-cmdline "remake")))
  45. (cmd-args (split-string-and-unquote cmd-str))
  46. (parsed-args (remake-parse-cmd-args cmd-args))
  47. (debugger (car parsed-args))
  48. (script-args (cl-caddr parsed-args))
  49. (script-name (cadr parsed-args))
  50. )
  51. (realgud:run-process debugger script-name cmd-args
  52. realgud:remake-minibuffer-history no-reset)
  53. )
  54. )
  55. ;; -------------------------------------------------------------------
  56. ;; User definable variables
  57. ;;
  58. (defcustom realgud:remake-command-name
  59. ;;"remake --emacs 3"
  60. "remake"
  61. "File name for executing the GNU make debugger, remake, and command options.
  62. This should be an executable on your path, or an absolute file name."
  63. :type 'string
  64. :group 'realgud:remake)
  65. ;;;###autoload
  66. (defun realgud:remake (&optional opt-cmd-line no-reset)
  67. "See `realgud:remake' for details"
  68. (interactive)
  69. (realgud:remake-run-debugger opt-cmd-line no-reset)
  70. )
  71. ;;;###autoload
  72. (defalias 'remake 'realgud:remake)
  73. (provide-me "realgud-")
  74. ;;; remake.el ends here