X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=emacs.el;h=0106abbf852b1da725fe2cfb09480099964eadda;hb=91954b3d9decfff9b53f1c66e1c71f5af0bf9ddc;hp=e21b34f5926e587ba1233f3195632ca49245f9c1;hpb=b3cb2062f306f60c169589500ce92a5b60ff6791;p=elisp.git diff --git a/emacs.el b/emacs.el index e21b34f..0106abb 100644 --- a/emacs.el +++ b/emacs.el @@ -598,6 +598,8 @@ load-warning buffer in case of failure." (define-key global-map [(control c) (control q)] 'ff/delete-trailing-whitespaces-and-indent) +(define-key global-map [(control x) (control o)] 'other-window) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Playing sounds ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1183,6 +1185,15 @@ goback argument, go back where we were." (define-key global-map [(meta G)] (lambda () (interactive) (ff/goto-function-definition t))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; (setq python-indent-offset 4) + +;; (define-key python-mode-map [(shift right)] 'python-indent-shift-right) +;; (define-key python-mode-map [(shift left)] 'python-indent-shift-left) +;; (define-key python-mode-map [(shift right)] 'indent-rigidly-right-to-tab-stop) +;; (define-key python-mode-map [(shift left)] 'indent-rigidly-left-to-tab-stop) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The big stuff (bbdb, mailcrypt, etc.) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1416,7 +1427,7 @@ universal argument starts xfig even if the .fig does not exist" ;; Automagically add the frame numbers in comments in a beamer file -(defun number-beamer-frames () +(defun ff/number-beamer-frames () "Add the frame numbers as comments after each \begin{frame}" (interactive) @@ -1740,17 +1751,34 @@ int main(int argc, char **argv) { require 'torch' require 'nn' -require 'nnx' -require 'optim' require 'image' -require 'pl' -require 'paths' -require 'ffmpeg' +require 'optim' ") (lua-mode) ) +(defun ff/start-python () + "Adds all the stuff to start a new python file" + (interactive) + (goto-char (point-min)) + (insert "#!/usr/bin/env python + +import torch +import math + +from torch import nn +from torch.nn import functional as fn + +from torch import Tensor +from torch.autograd import Variable +from torch.nn.parameter import Parameter +from torch.nn import Module + +") + (python-mode) + ) + (defun ff/start-html () "Adds all that stuff to start a new HTML file." @@ -1964,6 +1992,11 @@ a file in /tmp" (ff/start-lua) ) + (when (string-match "\\.py$" filename) + (python-mode) + (ff/start-python) + ) + (when (string-match "\\.html$" filename) (html-mode) (ff/start-html) @@ -2645,7 +2678,7 @@ with a time tag, and save this file" (define-key ff/map [(control m)] 'woman) (define-key ff/map "b" 'bookmark-jump) (define-key ff/map [(control =)] 'calc) -(define-key ff/map "=" 'number-beamer-frames) +(define-key ff/map "=" 'ff/number-beamer-frames) (define-key ff/map [(control shift b)] (lambda () (interactive) (bookmark-set)