<commit_before>;;; config-python --- Configuration specific to working with python code.
;;; Commentary:
;; References
;; http://www.saltycrane.com/blog/2010/05/my-emacs-python-environment/
;; http://www.jesshamrick.com/2012/09/18/emacs-as-a-python-ide/
;; http://www.emacswiki.org/emacs/ElDoc


;;; Code:
(require 'ein)

;; Use Jedi for Company auto-completions... need to pip install the following for
;; this to work:
;; jedi, epc, sexpdata
(require 'company-jedi)
(add-to-list 'company-backends 'company-jedi)

(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:environment-root "jedi")
(setq jedi:setup-keys t)
(setq jedi:complete-on-dot t)
(setq jedi:get-in-function-call-delay 10000) ; 10s delay before showing function call sigs

(defun insert-dunder-main ()
  "Insert a python main block."
  (interactive)
  (insert "import argparse\nif __name__ == '__main__':\n    "))

;; From Patrick's config... python3 something
;; (setq jedi:environment-virtualenv
;;       (append python-environment-virtualenv
;;               '("--python" "/usr/bin/python3")))

;; Make function definition is done with λ dammit. This makes me inordinately
;; happy.
(add-hook 'python-mode-hook
          (lambda ()
            (push '("def" . ?λ) prettify-symbols-alist)
            (push '("sum" . ?Σ) prettify-symbols-alist)<commit_msg>Def-bind breakpoint insert<commit_after>;;; config-python --- Configuration specific to working with python code.
;;; Commentary:
;; References
;; http://www.saltycrane.com/blog/2010/05/my-emacs-python-environment/
;; http://www.jesshamrick.com/2012/09/18/emacs-as-a-python-ide/
;; http://www.emacswiki.org/emacs/ElDoc


;;; Code:
(require 'ein)

;; Use Jedi for Company auto-completions... need to pip install the following for
;; this to work:
;; jedi, epc, sexpdata
(require 'company-jedi)
(add-to-list 'company-backends 'company-jedi)

(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:environment-root "jedi")
(setq jedi:setup-keys t)
(setq jedi:complete-on-dot t)
(setq jedi:get-in-function-call-delay 10000) ; 10s delay before showing function call sigs

(defun insert-dunder-main ()
  "Insert a python main block."
  (interactive)
  (insert "import argparse\nif __name__ == '__main__':\n    "))

(global-set-key
 (kbd "s-d")
 (defun insert-breakpoint ()
   "Insert a pdb break."
   (interactive)
   (save-excursion
     (insert "import pdb; pdb.set_trace()")
     )))

;; From Patrick's config... python3 something
;; (setq jedi:environment-virtualenv
;;       (append python-environment-virtualenv
;;               '("--python" "/usr/bin/python3")))

;; Make function definition is done with λ dammit. This makes me inordinately
;; happy.
(add-hook 'python-mode-hook
          (lambda ()
            (push '("def" . ?λ) prettify-symbols-alist)
            (push '("sum" . ?Σ) prettify-symbols-alist)
{'fraction_non_alphanumeric': 0.15913902611150318, 'fraction_numerical': 0.016231474947071278, 'mean_word_length': 3.5725806451612905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2351554', 'n_tokens_mistral': 1027, 'n_tokens_neox': 983, 'n_words': 236}