Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>OK, so I hacked this by myself today. A major part of it is copy-and-paste from <code>py-shell</code> from <code>python-mode.el</code>.</p> <pre class="lang-lisp prettyprint-override"><code>(defun django-shell (&amp;optional argprompt) (interactive "P") ;; Set the default shell if not already set (labels ((read-django-project-dir (prompt dir) (let* ((dir (read-directory-name prompt dir)) (manage (expand-file-name (concat dir "manage.py")))) (if (file-exists-p manage) (expand-file-name dir) (progn (message "%s is not a Django project directory" manage) (sleep-for .5) (read-django-project-dir prompt dir)))))) (let* ((dir (read-django-project-dir "project directory: " default-directory)) (project-name (first (remove-if (lambda (s) (or (string= "src" s) (string= "" s))) (reverse (split-string dir "/"))))) (buffer-name (format "django-%s" project-name)) (manage (concat dir "manage.py"))) (cd dir) (if (not (equal (buffer-name) buffer-name)) (switch-to-buffer-other-window (apply 'make-comint buffer-name manage nil '("shell"))) (apply 'make-comint buffer-name manage nil '("shell"))) (make-local-variable 'comint-prompt-regexp) (setq comint-prompt-regexp (concat py-shell-input-prompt-1-regexp "\\|" py-shell-input-prompt-2-regexp "\\|" "^([Pp]db) ")) (add-hook 'comint-output-filter-functions 'py-comint-output-filter-function) ;; pdbtrack (add-hook 'comint-output-filter-functions 'py-pdbtrack-track-stack-file) (setq py-pdbtrack-do-tracking-p t) (set-syntax-table py-mode-syntax-table) (use-local-map py-shell-map) (run-hooks 'py-shell-hook)))) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload