diff --git a/.config/dwb/settings b/.config/dwb/settings index afae9c5d..de527cd9 100644 --- a/.config/dwb/settings +++ b/.config/dwb/settings @@ -159,3 +159,4 @@ maximum-tabs=0 cookie-expiration=0 tab-width=150 hint-offset-left=0 +block-insecure-content=false diff --git a/.emacs.d/mode-cc.el b/.emacs.d/mode-cc.el index be7e853f..24ee9f10 100644 --- a/.emacs.d/mode-cc.el +++ b/.emacs.d/mode-cc.el @@ -12,7 +12,7 @@ then it shall return the name of FILE in the current directory, suitable for creation" (let ((root (expand-file-name "/"))) ; the win32 builds should translate this correctly (expand-file-name file - (loop + (loop for d = default-directory then (expand-file-name ".." d) if (file-exists-p (expand-file-name file d)) return d diff --git a/.emacs.d/mode-python.el b/.emacs.d/mode-python.el index e5923432..e2ed3b81 100644 --- a/.emacs.d/mode-python.el +++ b/.emacs.d/mode-python.el @@ -2,21 +2,34 @@ ;; Python ;;============================================================================== -(defcustom python-compiler "python" +(defcustom python-compiler "" "Python compiler." :safe 'stringp) +(defun is-python3-p () "Check whether we're running Python 2 or +3. Python is assumed by default." + (let ((firstline (car (split-string (buffer-string) "\n" t)))) + (let ((firstword (car (split-string firstline nil t)))) + (let ((version (if (string-match "/bin/env" firstword) + (car (cdr (split-string firstline nil t))) + firstword))) + (if (string-match "python2" version) nil t))))) + +(defun python-compile () + "Use compile to run python programs." + (interactive) + (let ((py-compiler + (if (equal python-compiler "") + (if (is-python3-p) + "python3" "python2") + python-compiler))) + (compile (concat py-compiler " '" buffer-file-name "'")))) + (add-hook 'python-mode-hook (lambda () - (defun python-compile () - "Use compile to run python programs." - (interactive) - (compile (concat python-compiler " \"" buffer-file-name "\"")) - ) - (setq compilation-scroll-output t) - (local-set-key "\C-c\C-c" 'python-compile) - )) + (set (make-local-variable 'compilation-scroll-output) t) + (local-set-key (kbd "") 'python-compile)) t) ;; Doc lookup. Requires the python.info file to be installed. See ;; https://bitbucket.org/jonwaltman/pydoc-info/.