Skip to content

Commit

Permalink
New var `py-python-ms-pdb-command'
Browse files Browse the repository at this point in the history
MS-systems might use that
  • Loading branch information
andreas-roehler committed Jul 8, 2015
1 parent 37da2ed commit c03479a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 42 deletions.
41 changes: 0 additions & 41 deletions python-components-intern.el
Original file line number Diff line number Diff line change
Expand Up @@ -2068,47 +2068,6 @@ Returns a list, whose car is beg, cdr - end."
(when (and py-verbose-p (called-interactively-p 'any)) (message "%s" erg))
erg)))

;; from gud.el
;; (defun pdb (command-line)
;; "Run pdb on program FILE in buffer `*gud-FILE*'.
;; The directory containing FILE becomes the initial working directory
;; and source-file directory for your debugger."
;; (interactive
;; (list (gud-query-cmdline 'pdb)))

(defun py--pdb-versioned ()
"Guess existing pdb version from py-shell-name
Return \"pdb[VERSION]\" if executable found, just \"pdb\" otherwise"
(interactive)
(let ((erg (when (string-match "[23]" py-shell-name)
;; versions-part
(substring py-shell-name (string-match "[23]" py-shell-name)))))
(if erg
(cond ((executable-find (concat "pdb" erg))
(concat "pdb" erg))
((and (string-match "\\." erg)
(executable-find (concat "pdb" (substring erg 0 (string-match "\\." erg)))))
(concat "pdb" (substring erg 0 (string-match "\\." erg)))))
"pdb")))

(defun py-pdb (command-line)
"Run pdb on program FILE in buffer `*gud-FILE*'.
The directory containing FILE becomes the initial working directory
and source-file directory for your debugger.
At GNU Linux systems required pdb version should be detected by `py--pdb-version', at Windows configure `py-python-ms-pdb-command'
lp:963253"
(interactive
(list (gud-query-cmdline
(if (or (eq system-type 'ms-dos)(eq system-type 'windows-nt))
(car (read-from-string py-python-ms-pdb-command))
;; sys.version_info[0]
(car (read-from-string (py--pdb-version)))) "asdf")))
(pdb command-line (buffer-file-name)))

;; Section
(defun py-sectionize-region (&optional beg end)
"Markup code in region as section.
Expand Down
3 changes: 3 additions & 0 deletions python-components-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,9 @@ If you ignore the location `M-x py-guess-pdb-path' might display it."
:tag "py-pdb-path"
:group 'python-mode)

(defvar py-python-ms-pdb-command ""
"MS-systems might use that")

(defcustom py-indent-comments t
"When t, comment lines are indented. "
:type 'boolean
Expand Down
19 changes: 18 additions & 1 deletion python-components-pdb.el
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ named for funcname or define a function funcname."
(interactive)
(py-execute-string (concat "import pdb;pdb.break('" stm "')")))


(defun py--pdb-versioned ()
"Guess existing pdb version from py-shell-name
Expand All @@ -265,13 +266,29 @@ Return \"pdb[VERSION]\" if executable found, just \"pdb\" otherwise"
;; versions-part
(substring py-shell-name (string-match "[23]" py-shell-name)))))
(if erg
(2cond ((executable-find (concat "pdb" erg))
(cond ((executable-find (concat "pdb" erg))
(concat "pdb" erg))
((and (string-match "\\." erg)
(executable-find (concat "pdb" (substring erg 0 (string-match "\\." erg)))))
(concat "pdb" (substring erg 0 (string-match "\\." erg)))))
"pdb")))

(defun py-pdb (command-line)
"Run pdb on program FILE in buffer `*gud-FILE*'.
The directory containing FILE becomes the initial working directory
and source-file directory for your debugger.
At GNU Linux systems required pdb version should be detected by `py--pdb-version', at Windows configure `py-python-ms-pdb-command'
lp:963253"
(interactive
(list (gud-query-cmdline
(if (or (eq system-type 'ms-dos)(eq system-type 'windows-nt))
(car (read-from-string py-python-ms-pdb-command))
;; sys.version_info[0]
(car (read-from-string (py--pdb-version)))) "asdf")))
(pdb command-line (buffer-file-name)))

(defun py--pdb-current-executable ()
"When py-pdb-executable is set, return it.
Expand Down

0 comments on commit c03479a

Please sign in to comment.