From 1248af28f215e77a7b7ffdec23bd01f73b336edf Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sun, 19 Feb 2017 09:06:05 +0100 Subject: [PATCH] Update. --- emacs.el | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/emacs.el b/emacs.el index e21b34f..ebc608e 100644 --- a/emacs.el +++ b/emacs.el @@ -1183,6 +1183,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 +1425,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 +1749,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 +1990,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 +2676,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) -- 2.20.1