├── notes.org ├── snippets ├── latex-mode │ ├── math.snippet │ ├── todo.snippet │ ├── multicol.snippet │ ├── figure.snippet │ └── columns.snippet ├── prog-mode │ ├── link.snippet │ ├── comment-date.snippet │ ├── time.snippet │ ├── insert-outline.snippet │ └── insert-top-outline.snippet ├── inferior-ess-mode │ ├── pipe.snippet │ └── methods-help.snippet ├── ess-mode │ ├── geom_line.snippet │ ├── geom_point.snippet │ ├── shebang.snippet │ ├── spin-chunk.snippet │ ├── geom_text.snippet │ ├── sep-chunk.snippet │ ├── geom_smooth.snippet │ ├── histogram.snippet │ ├── fig_save.snippet │ ├── time.snippet │ ├── insert-outline.snippet │ ├── pipe.snippet │ ├── outline-header.snippet │ ├── filter-pipe.snippet │ ├── select.snippet │ ├── geom.snippet │ ├── facet.snippet │ ├── ggplot.snippet │ ├── groupby.snippet │ ├── if.snippet │ ├── facet_wrap.snippet │ ├── mutate.snippet │ ├── scale-log10.snippet │ ├── tplot.snippet │ ├── geom_boxplot.snippet │ ├── summarise.snippet │ ├── filter.snippet │ ├── labs.snippet │ ├── readcsv.snippet │ ├── function.snippet │ ├── method.snippet │ ├── ifelse.snippet │ ├── library.snippet │ ├── knitr-options.snippet │ ├── wip.snippet │ ├── render.snippet │ └── header.snippet ├── org-mode │ ├── bu.snippet │ ├── 10puissance.snippet │ ├── link.snippet │ ├── skim.snippet │ ├── gsc.snippet │ ├── py-chunk.snippet │ └── shell-src.snippet ├── markdown-mode │ ├── hugo-ref.snippet │ ├── new-chunk.snippet │ ├── split-chunk.snippet │ ├── hugo-sidenote.snippet │ ├── hugo-fig.snippet │ ├── hugo-newgthought.snippet │ └── rmd-header.snippet ├── eshell-mode │ └── to-buffer.snippet ├── makefile-mode │ ├── phony.snippet │ ├── bgzip.snippet │ ├── samtools-index.snippet │ ├── target.snippet │ ├── extension.snippet │ ├── ffmpeg-compress.snippet │ ├── bcftools-consensus.snippet │ ├── ebi-fasta.snippet │ ├── efetch.snippet │ └── samtools-filter.snippet ├── fundamental-mode │ ├── link.snippet │ ├── hourstamp.snippet │ ├── timestamp.snippet │ └── cc-by-nc.snippet ├── ess-julia-mode │ ├── doc.snippet │ └── wip.snippet ├── sh-mode │ ├── find-xargs.snippet │ └── template.snippet └── scheme-mode │ ├── header.snippet │ └── gpl.snippet ├── .gitignore ├── autoinsert ├── header.pl ├── header.R └── header.scm ├── eshell └── alias ├── recipes ├── md │ ├── to-org │ │ └── Makefile │ ├── to-html │ │ └── Makefile │ └── to-pdf │ │ └── Makefile ├── ogv │ ├── to-mp4 │ │ └── Makefile │ ├── trim │ │ └── Makefile │ ├── crop │ │ └── Makefile │ └── to-gif │ │ └── Makefile ├── tiff │ └── to-jpg │ │ └── Makefile ├── ape │ └── to-flac │ │ └── Makefile ├── dot │ └── to-png │ │ └── Makefile ├── rtf │ └── to-txt │ │ └── Makefile ├── chm │ └── to-pdf │ │ └── Makefile ├── epub │ └── to-pdf │ │ └── Makefile ├── pdf │ └── to-txt │ │ └── Makefile ├── ipynb │ └── to-md │ │ └── Makefile ├── png │ └── to-gif │ │ └── Makefile ├── txt │ └── encode-utf8 │ │ └── Makefile ├── m4a │ └── to-mp3 │ │ └── Makefile ├── mp4 │ ├── replace-audio │ │ └── Makefile │ ├── to-mp3 │ │ └── Makefile │ └── trim │ │ └── Makefile ├── mix │ └── enca │ │ └── Makefile ├── mp3 │ └── trim │ │ └── Makefile ├── svg │ └── to-png │ │ └── Makefile ├── flac │ └── to-mp3 │ │ └── Makefile ├── gif │ └── gifsicle │ │ └── Makefile ├── tex │ └── to-pdf │ │ └── Makefile ├── org │ └── to-pdf │ │ └── Makefile └── cue │ └── split │ └── Makefile ├── README.md ├── ess-config.el ├── python-config.el ├── latex-config.el ├── keybindings.el ├── elfeed.org ├── org.el ├── functions.el └── LICENSE /notes.org: -------------------------------------------------------------------------------- 1 | * Tasks 2 | -------------------------------------------------------------------------------- /snippets/latex-mode/math.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: math 3 | # key: $ 4 | # -- 5 | \\($0\\) -------------------------------------------------------------------------------- /snippets/prog-mode/link.snippet: -------------------------------------------------------------------------------- 1 | /Users/samuelbarreto/dotfile/emacs/snippets/fundamental-mode/link.snippet -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | emacs.d/ 2 | /.abbrev_defs 3 | elfeed/ 4 | *.elc 5 | /eshell/history 6 | /eshell/lastdir 7 | /ID 8 | -------------------------------------------------------------------------------- /snippets/latex-mode/todo.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: todo 3 | # key: t 4 | # -- 5 | % TODO: $0 -------------------------------------------------------------------------------- /snippets/inferior-ess-mode/pipe.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: pipe 3 | # key: d 4 | # -- 5 | %>% $0 6 | -------------------------------------------------------------------------------- /snippets/ess-mode/geom_line.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: geom_line 3 | # key: gl 4 | # -- 5 | geom_line()$0 -------------------------------------------------------------------------------- /snippets/org-mode/bu.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: bu-lyon 3 | # key: bu 4 | # -- 5 | [[bu:$1][${1:link}]] -------------------------------------------------------------------------------- /snippets/ess-mode/geom_point.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: geom_point 3 | # key: gp 4 | # -- 5 | geom_point($0) -------------------------------------------------------------------------------- /snippets/ess-mode/shebang.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: shebang 3 | # key: ! 4 | # -- 5 | #!/usr/bin/env Rscript -------------------------------------------------------------------------------- /snippets/ess-mode/spin-chunk.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: chunk-name 3 | # key: + 4 | # -- 5 | #+ ${1:chunk-name} -------------------------------------------------------------------------------- /snippets/markdown-mode/hugo-ref.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ref 3 | # key: ref 4 | # -- 5 | {{< ref "#$1" >}} $0 -------------------------------------------------------------------------------- /snippets/org-mode/10puissance.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: 10puissance 3 | # key: 10 4 | # -- 5 | \$10^{$1}\$ $0 -------------------------------------------------------------------------------- /snippets/org-mode/link.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: link 3 | # key: li 4 | # -- 5 | [[${2:}][${1:description}]] $0 -------------------------------------------------------------------------------- /snippets/org-mode/skim.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: skim 3 | # key: skim 4 | # -- 5 | `(grab-mac-link 'skim 'org)` -------------------------------------------------------------------------------- /snippets/org-mode/gsc.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: google-scholar 3 | # key: gsc 4 | # -- 5 | [[gsc:$1][${1:link}]]$0 -------------------------------------------------------------------------------- /snippets/eshell-mode/to-buffer.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: to-buffer 3 | # key: > 4 | # -- 5 | > # -------------------------------------------------------------------------------- /snippets/ess-mode/geom_text.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: geom_text 3 | # key: gt 4 | # -- 5 | geom_text(aes(label = $0)) -------------------------------------------------------------------------------- /snippets/ess-mode/sep-chunk.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: sep-chunk 3 | # key: sep 4 | # -- 5 | \`\`\` 6 | $0 7 | \`\`\`{R} -------------------------------------------------------------------------------- /snippets/prog-mode/comment-date.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: comment-date 3 | # key: c 4 | # -- 5 | `(sam--comment-date)` -------------------------------------------------------------------------------- /autoinsert/header.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | 4 | use strict; 5 | use warnings; 6 | use v5.22; 7 | 8 | 9 | 10 | __END__ 11 | -------------------------------------------------------------------------------- /snippets/makefile-mode/phony.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: phony target 3 | # key: .p 4 | # -- 5 | .PHONY: ${1:target} 6 | $1: $0 -------------------------------------------------------------------------------- /snippets/ess-mode/geom_smooth.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: geom_smooth 3 | # key: gs 4 | # -- 5 | geom_smooth(method = "${1:loess}")$0 -------------------------------------------------------------------------------- /snippets/fundamental-mode/link.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: link 3 | # key: link 4 | # -- 5 | `(grab-mac-link 'firefox 'plain)` 6 | -------------------------------------------------------------------------------- /snippets/markdown-mode/new-chunk.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: new chunk 3 | # key: nc 4 | # -- 5 | \`\`\`{${1:R}} 6 | $0 7 | \`\`\` 8 | -------------------------------------------------------------------------------- /snippets/markdown-mode/split-chunk.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: split-chunk 3 | # key: sc 4 | # -- 5 | \`\`\` 6 | $0 7 | \`\`\`{${1:R}} -------------------------------------------------------------------------------- /snippets/makefile-mode/bgzip.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: bgzip compress 3 | # key: bgzip 4 | # -- 5 | %.vcf.gz: %.vcf 6 | bgzip -c $< > $@ -------------------------------------------------------------------------------- /snippets/markdown-mode/hugo-sidenote.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: sidenote 3 | # key: sn 4 | # -- 5 | {{% sidenote "" %}}$1{{% /sidenote %}}$0 -------------------------------------------------------------------------------- /snippets/markdown-mode/hugo-fig.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: hugo-fig 3 | # key: hf 4 | # -- 5 | {{< figure 6 | src="$1" 7 | caption="$0" 8 | >}} -------------------------------------------------------------------------------- /snippets/ess-julia-mode/doc.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: doc 3 | # key: doc 4 | # -- 5 | """ 6 | # ${1:Function name} 7 | 8 | $0 9 | 10 | """ -------------------------------------------------------------------------------- /snippets/ess-mode/histogram.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: geom_histogram 3 | # key: gh 4 | # -- 5 | geom_histogram(fill = "gray", bins = ${1:30})$0 6 | -------------------------------------------------------------------------------- /snippets/inferior-ess-mode/methods-help.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: methods-help 3 | # key: ?m 4 | # -- 5 | ?${1:as.data.frame},${2:DataFrame}-method -------------------------------------------------------------------------------- /snippets/makefile-mode/samtools-index.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: samtools index 3 | # key: s-index 4 | # -- 5 | %.bam.bai: %.bam 6 | samtools index $< -------------------------------------------------------------------------------- /snippets/markdown-mode/hugo-newgthought.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: hugo-newthought 3 | # key: nt 4 | # -- 5 | {{% newthought %}}$1{{% /newthought %}} $0 -------------------------------------------------------------------------------- /snippets/ess-mode/fig_save.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: fig_save 3 | # key: fig 4 | # -- 5 | #+ ${1:fig-name}, eval=FALSE 6 | fig_save("figures/$1.${2:png}") -------------------------------------------------------------------------------- /snippets/latex-mode/multicol.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: multicol 3 | # key: multicol 4 | # -- 5 | \begin{multicols}{${1:2}} 6 | $0 7 | \end{multicols} -------------------------------------------------------------------------------- /snippets/prog-mode/time.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: time 3 | # key: time 4 | # -- 5 | [`(format "%s" (format-time-string "%Y-%m-%d %H:%M" (current-time)))`] -------------------------------------------------------------------------------- /snippets/sh-mode/find-xargs.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: find-xargs 3 | # key: fx 4 | # -- 5 | find . -name "*.${1:log}" | xargs -I {} sh -c "${2:echo {}}" -------------------------------------------------------------------------------- /snippets/ess-mode/time.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: timestamp 3 | # key: time 4 | # -- 5 | [`(format "%s" (format-time-string "%Y-%m-%d %H:%M" (current-time)))`] -------------------------------------------------------------------------------- /snippets/fundamental-mode/hourstamp.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: hourstamp 3 | # key: hour 4 | # -- 5 | `(format "%s" (format-time-string "%H:%M" (current-time)))` -------------------------------------------------------------------------------- /snippets/ess-julia-mode/wip.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: wip 3 | # key: wip 4 | # -- 5 | 6 | ## /* ----------- WIP ------------- 7 | 8 | $0 9 | 10 | ## */ -------------------------------------------------------------------------------- /snippets/makefile-mode/target.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: target 3 | # key: tar 4 | # -- 5 | # $3 6 | ${1:target}: ${2:requisite} 7 | $(info ${3: description}) 8 | $0 -------------------------------------------------------------------------------- /snippets/fundamental-mode/timestamp.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: timestamp 3 | # key: time 4 | # -- 5 | [`(format "%s" (format-time-string "%Y-%m-%d %H:%M" (current-time)))`] -------------------------------------------------------------------------------- /snippets/org-mode/py-chunk.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: py-chunk 3 | # key:

% 3 | # key: d 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | %>% $0 -------------------------------------------------------------------------------- /snippets/makefile-mode/ffmpeg-compress.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ffmpeg-compress 3 | # key: ffmpeg 4 | # -- 5 | ${1:output.mp4}: ${2:input.mp4} 6 | ffmpeg -i $< -vcodec h264 -acodec mp3 $@ -------------------------------------------------------------------------------- /snippets/ess-mode/outline-header.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: outline-header 3 | # key: h 4 | # -- 5 | ## ${1:*} ${2:outline-header} 6 | #' ${1:$(make-string (string-width yas-text) ?\#)} $2 7 | $0 -------------------------------------------------------------------------------- /snippets/scheme-mode/header.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: header 3 | # key: #! 4 | # -- 5 | #!/usr/bin/env guile \ 6 | -e main -s 7 | !# 8 | 9 | (define (main args) 10 | $0 11 | )) 12 | -------------------------------------------------------------------------------- /snippets/ess-mode/filter-pipe.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: filter-pipe 3 | # key: dft 4 | # binding: direct-keybinding 5 | # -- 6 | %>% filter(${1:by_row} ${2:==} "${3:?}") $0 -------------------------------------------------------------------------------- /snippets/ess-mode/select.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: select 3 | # key: s 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | select(${1:column}) $0 -------------------------------------------------------------------------------- /snippets/ess-mode/geom.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: geom 3 | # key: gm 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | + 8 | geom_${1:geom}($2) $0 -------------------------------------------------------------------------------- /snippets/ess-mode/facet.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: facet_grid 3 | # key: fg 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | facet_grid(${1:column}~.)$0 -------------------------------------------------------------------------------- /snippets/ess-mode/ggplot.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: ggplot... 3 | # key: ggp 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | ggplot(aes($1)) +$0 8 | -------------------------------------------------------------------------------- /snippets/ess-mode/groupby.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: group_by 3 | # key: g 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | group_by(${1:column}) %>%$0 -------------------------------------------------------------------------------- /snippets/ess-mode/if.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: if 3 | # key: if 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | if (${1:condition}) { 8 | $0 9 | } -------------------------------------------------------------------------------- /snippets/makefile-mode/bcftools-consensus.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: bcftools consensus 3 | # key: b-consensus 4 | # -- 5 | %.fasta: %.vcf.gz 6 | bcftools index $< 7 | bcftools consensus -f ${1:\$(REF_BS)} -o $@ $< 8 | -------------------------------------------------------------------------------- /snippets/prog-mode/insert-outline.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: insert-outline 3 | # key: io 4 | # -- 5 | `(concat sp-comment-char sp-comment-char)` ---------- ${1:Title} ${1:$(make-string (- 60 (string-width yas-text)) ?\-)} -------------------------------------------------------------------------------- /snippets/ess-mode/facet_wrap.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: facet_wrap 3 | # key: fw 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | facet_wrap( ~ ${1:col})$0 -------------------------------------------------------------------------------- /snippets/ess-mode/mutate.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: mutate 3 | # key: m 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | mutate(${1:newcol} = ${2:oldcol})$0 -------------------------------------------------------------------------------- /snippets/ess-mode/scale-log10.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: scale-log-10 3 | # key: slog 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | scale_${1:x}_log10()$0 -------------------------------------------------------------------------------- /snippets/ess-mode/tplot.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: tplot 3 | # key: tp 4 | # binding: direct-keybinding 5 | # -- 6 | %T>% 7 | { print( ggplot(., aes($1, ${2:count})) + geom_${3:point}() )} %>% 8 | $0 -------------------------------------------------------------------------------- /snippets/ess-mode/geom_boxplot.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: geom_boxplot 3 | # key: gb 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | geom_boxplot(width = 1/2)$0 -------------------------------------------------------------------------------- /snippets/ess-mode/summarise.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: summarise 3 | # key: u 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | summarise(${1:count} = ${2:n()})$0 -------------------------------------------------------------------------------- /snippets/ess-mode/filter.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: filter 3 | # key: f 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | filter(${1:by_row} ${2:>} ${3:condition}) $0 -------------------------------------------------------------------------------- /snippets/latex-mode/figure.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: figure 3 | # key: f 4 | # -- 5 | \begin{figure}[ht] 6 | \centering 7 | \includegraphics[width=0.75\linewidth]{img/${1:img.pdf}} 8 | \caption{${2:caption}} 9 | \end{figure} 10 | -------------------------------------------------------------------------------- /snippets/ess-mode/labs.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: labs 3 | # key: labs 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | labs(x = "$1", 8 | y = "$2", 9 | title = "$3")$0 -------------------------------------------------------------------------------- /snippets/ess-mode/readcsv.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: read_csv 3 | # key: csv 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | ${1:data} <- readr::read_csv("${2:dataset.csv}") $0 -------------------------------------------------------------------------------- /snippets/latex-mode/columns.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: columns 3 | # key: columns 4 | # -- 5 | \begin{columns} 6 | \begin{column}{0.5\textwidth} 7 | $0 8 | \end{column} 9 | \begin{column}{0.5\textwidth} 10 | 11 | \end{column} 12 | \end{columns} -------------------------------------------------------------------------------- /snippets/makefile-mode/ebi-fasta.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ebi-fasta 3 | # key: ebi 4 | # -- 5 | ${1:ACC} := ${2:ACC_NUMBER} 6 | data/\$($1).fasta.gz: 7 | curl --silent 'https://www.ebi.ac.uk/ena/data/view/\$($1)&display=fasta' \ 8 | | bgzip -c > $@ 9 | -------------------------------------------------------------------------------- /snippets/ess-mode/function.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: function 3 | # key: fun 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | ${1:myfunc} <- function(${2:param}) 8 | { 9 | 10 | } -------------------------------------------------------------------------------- /snippets/ess-mode/method.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: setMethod 3 | # key: method 4 | # -- 5 | 6 | setMethod( 7 | "${1:name}", 8 | signature = c(${2:object} = "${3:class}"), 9 | definition = function($2, ...) { 10 | $0 11 | } 12 | ) 13 | -------------------------------------------------------------------------------- /snippets/markdown-mode/rmd-header.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: Rmd-header 3 | # key: Rmd 4 | # -- 5 | +++ 6 | title = "$1" 7 | author = "${2:Samuel Barreto}" 8 | description = "$3" 9 | date = "`(format-time-string "%Y-%m-%d" (current-time))`" 10 | 11 | +++ 12 | -------------------------------------------------------------------------------- /eshell/alias: -------------------------------------------------------------------------------- 1 | alias ee find-file-other-window $1 2 | alias e find-file $1 3 | alias er ivy-switch-buffer 4 | alias ll gls -alh --group-directories-first 5 | alias ff find-file $1 6 | alias d dired-other-window $1 7 | alias gs magit-status 8 | alias ga magit-stage-file $1 9 | alias b ibuffer -------------------------------------------------------------------------------- /snippets/ess-mode/ifelse.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: if .. else .. 3 | # key: ife 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | if (${1:condition}) { 8 | ${2:TRUE} 9 | } else { 10 | ${0:FALSE} 11 | } -------------------------------------------------------------------------------- /snippets/makefile-mode/efetch.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: efetch 3 | # key: efetch 4 | # -- 5 | ${1:ACC} := ${2:ACC_NUMBER} 6 | data/\$($1).fasta.gz: 7 | esearch -db nuccore -query \$($1) \ 8 | | efetch -format=${3:`(sam--efetch-formats)`} \ 9 | | bgzip -c > $@ 10 | -------------------------------------------------------------------------------- /snippets/makefile-mode/samtools-filter.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: samtools filter unmapped 3 | # key: s-filter 4 | # -- 5 | %.bam: %_1.fastq.gz %_2.fastq.gz 6 | bwa mem -t 4 ${1:\$(REFERENCE)} $^ \ 7 | | samtools view -h -f P -F 4 - \ 8 | | samtools sort -@ 4 -O BAM -o $@ - 9 | -------------------------------------------------------------------------------- /snippets/ess-mode/library.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: loadlibrary 3 | # key: lib 4 | # condition: (string= "S" ess-language) 5 | # binding: direct-keybinding 6 | # -- 7 | library(dplyr) 8 | library(ggplot2) 9 | library(readr) 10 | library(viridis) 11 | 12 | $0 -------------------------------------------------------------------------------- /snippets/ess-mode/knitr-options.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: knitr-options 3 | # key: knitr 4 | # -- 5 | library(knitr) 6 | opts_chunk$set( 7 | cache = FALSE, dev = 'png', include = TRUE, 8 | fig.path = "graphics/", echo = TRUE, warning = FALSE, 9 | error = FALSE, message = FALSE, global.par = TRUE 10 | ) 11 | -------------------------------------------------------------------------------- /snippets/prog-mode/insert-top-outline.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: insert top header 3 | # key: IO 4 | # -- 5 | 6 | `(concat sp-comment-char sp-comment-char)` 7 | `(concat sp-comment-char sp-comment-char)` ========== ${1:Title} ${1:$(make-string (- 60 (string-width yas-text)) ?\=)} 8 | `(concat sp-comment-char sp-comment-char)` -------------------------------------------------------------------------------- /snippets/ess-mode/wip.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: wip 3 | # key: wip 4 | # -- 5 | ## /* `(format "%s" (format-time-string "%Y-%m-%d %H:%M" (current-time)))` 6 | 7 | ## `(format "%s" user-full-name)` 8 | ## ${1:DESCRIPTION} 9 | 10 | $0 11 | 12 | ## `(format "%s" (format-time-string "%Y-%m-%d %H:%M" (current-time)))` */ 13 | -------------------------------------------------------------------------------- /recipes/md/to-org/Makefile: -------------------------------------------------------------------------------- 1 | DIRMD = $(shell dir *.md) 2 | 3 | DIRORG = $(DIRMD:.md=.org) 4 | 5 | all: clean Makefile $(DIRORG) 6 | 7 | %.org: %.md 8 | pandoc $^ -o $@ 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.org provide 13 | 14 | install-tools: 15 | sudo apt-get install pandoc 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /recipes/ogv/to-mp4/Makefile: -------------------------------------------------------------------------------- 1 | DIROGV = $(shell dir *.ogv) 2 | DIRMP4 = $(DIROGV:.ogv=.mp4) 3 | 4 | all: clean Makefile $(DIRMP4) 5 | 6 | %.mp4: %.ogv 7 | avconv -i $^ $@ 8 | echo $@ >> provide 9 | 10 | clean: 11 | rm -f *.mp4 provide 12 | 13 | install-tools: 14 | sudo apt-get install avconv 15 | 16 | .PHONY: all install-tools clean 17 | -------------------------------------------------------------------------------- /recipes/md/to-html/Makefile: -------------------------------------------------------------------------------- 1 | DIRMD = $(shell dir *.md) 2 | DIRHTML = $(DIRMD:.md=.html) 3 | 4 | all: clean Makefile $(DIRHTML) 5 | 6 | %.html: %.md 7 | pandoc -o "$@" "$^" 8 | echo "$@" >> provide 9 | 10 | clean: 11 | rm -f *.html provide 12 | 13 | install-tools: 14 | sudo apt-get install pandoc 15 | 16 | .PHONY: all install-tools clean 17 | -------------------------------------------------------------------------------- /recipes/tiff/to-jpg/Makefile: -------------------------------------------------------------------------------- 1 | DIRTIFF = $(shell dir *.tiff) 2 | 3 | DIRJPG = $(DIRTIFF:.tiff=.jpg) 4 | 5 | all: clean Makefile $(DIRJPG) 6 | 7 | %.jpg: %.tiff 8 | convert $^ $@ 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.jpg provide 13 | 14 | install-tools: 15 | echo "No tools required" 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /recipes/ape/to-flac/Makefile: -------------------------------------------------------------------------------- 1 | DIRAPE = $(shell dir *.ape) 2 | DIRFLAC = $(DIRAPE:.ape=.flac) 3 | 4 | all: clean Makefile $(DIRFLAC) 5 | 6 | %.flac: %.ape 7 | avconv -i '$^' '$@' 8 | echo '$@' >> provide 9 | 10 | clean: 11 | rm -f *.flac provide 12 | 13 | install-tools: 14 | sudo apt-get install avconv 15 | 16 | .PHONY: all install-tools clean 17 | -------------------------------------------------------------------------------- /recipes/dot/to-png/Makefile: -------------------------------------------------------------------------------- 1 | DIRDOT = $(shell dir *.dot) 2 | 3 | DIRPNG = $(DIRDOT:.dot=.png) 4 | 5 | all: clean Makefile $(DIRPNG) 6 | 7 | %.png: %.dot 8 | dot -Tpng "$^" > "$@" 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.png provide 13 | 14 | install-tools: 15 | sudo apt-get install graphviz 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /recipes/rtf/to-txt/Makefile: -------------------------------------------------------------------------------- 1 | DIRRTF = $(shell dir *.rtf) 2 | 3 | DIRTXT = $(DIRRTF:.rtf=.txt) 4 | 5 | all: clean Makefile $(DIRTXT) 6 | 7 | %.txt: %.rtf 8 | textutil -convert txt $< 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.txt provide 13 | 14 | install-tools: 15 | echo "No tools required" 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /recipes/chm/to-pdf/Makefile: -------------------------------------------------------------------------------- 1 | DIRCHM = $(shell dir *.chm) 2 | 3 | DIRPDF = $(DIRCHM:.chm=.pdf) 4 | 5 | all: clean Makefile $(DIRPDF) 6 | 7 | %.pdf: %.chm 8 | chm2pdf --continuous $^ 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.pdf provide 13 | 14 | install-tools: 15 | sudo apt-get install chm2pdf 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /recipes/epub/to-pdf/Makefile: -------------------------------------------------------------------------------- 1 | DIREPUB = $(shell dir *.epub) 2 | 3 | DIRPDF = $(DIREPUB:.epub=.pdf) 4 | 5 | all: clean Makefile $(DIRPDF) 6 | 7 | %.pdf: %.epub 8 | ebook-convert $^ $@ 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.pdf provide 13 | 14 | install-tools: 15 | sudo apt-get install calibre 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /recipes/pdf/to-txt/Makefile: -------------------------------------------------------------------------------- 1 | DIRPDF = $(shell dir *.pdf 2>/dev/null) 2 | 3 | DIRTXT = $(DIRPDF:.pdf=.txt) 4 | 5 | all: clean Makefile $(DIRTXT) 6 | 7 | %.txt: %.pdf 8 | pdftotext $^ 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.txt provide 13 | 14 | install-tools: 15 | sudo apt-get install poppler-utils 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /recipes/ipynb/to-md/Makefile: -------------------------------------------------------------------------------- 1 | DIRIPYNB = $(shell dir *.ipynb) 2 | 3 | DIRMD = $(DIRIPYNB:.ipynb=.md) 4 | 5 | all: clean Makefile $(DIRMD) 6 | 7 | %.md: %.ipynb 8 | jupyter nbconvert --to markdown $^ 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.md provide 13 | 14 | install-tools: 15 | sudo pip install jupyter 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /recipes/png/to-gif/Makefile: -------------------------------------------------------------------------------- 1 | DIRPNG = $(shell dir *.png) 2 | 3 | DIRGIF = $(DIRPNG:.png=.gif) 4 | 5 | all: clean Makefile $(DIRGIF) 6 | 7 | %.gif: %.png 8 | convert $^ -channel Alpha -threshold 80% $@ 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.gif provide 13 | 14 | install-tools: 15 | echo "No tools required" 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /recipes/txt/encode-utf8/Makefile: -------------------------------------------------------------------------------- 1 | DIRTXT = $(shell dir *.txt) 2 | 3 | DIROUT.TXT = $(DIRTXT:.txt=.out.txt) 4 | 5 | all: clean Makefile $(DIROUT.TXT) 6 | 7 | %.out.txt: %.txt 8 | iconv -t UTF-8 $^ > $@ 9 | echo $@ >> provide 10 | 11 | clean: 12 | rm -f *.out.txt provide 13 | 14 | install-tools: 15 | echo "No tools required" 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /snippets/fundamental-mode/cc-by-nc.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: licence cc-by-nc 3 | # key: cc-by-nc 4 | # -- 5 | This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. -------------------------------------------------------------------------------- /recipes/m4a/to-mp3/Makefile: -------------------------------------------------------------------------------- 1 | DIRM4A = $(shell dir *.m4a) 2 | 3 | DIRMP3 = $(DIRM4A:.m4a=.mp3) 4 | 5 | all: clean Makefile $(DIRMP3) 6 | 7 | %.mp3: %.m4a 8 | ffmpeg -v 5 -y -i "$^" -acodec libmp3lame -ac 2 -ab 192k "$@" 9 | echo "$@" >> provide 10 | 11 | clean: 12 | rm -f *.mp3 provide 13 | 14 | install-tools: 15 | sudo apt-get install ffmpeg 16 | 17 | .PHONY: all install-tools clean 18 | -------------------------------------------------------------------------------- /snippets/ess-mode/render.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: render 3 | # key: render 4 | # -- 5 | ## /* 6 | library(knitr) 7 | opts_chunk$set( 8 | cache = FALSE, dev = 'png', include = TRUE, 9 | fig.path = "graphics/", echo = TRUE, warning = FALSE, 10 | error = FALSE, message = FALSE, global.par = TRUE 11 | ) 12 | 13 | rmarkdown::render("`(buffer-file-name)`") 14 | ## */ 15 | -------------------------------------------------------------------------------- /recipes/mp4/replace-audio/Makefile: -------------------------------------------------------------------------------- 1 | DIRMP4 = $(shell dir *.mp4) 2 | DIRMP3 = $(shell dir *.mp3) 3 | 4 | DIROUT.MP4 = $(DIRMP4:.mp4=.out.mp4) 5 | 6 | all: clean Makefile $(DIROUT.MP4) 7 | 8 | %.out.mp4: %.mp4 9 | avconv -i "$^" -i $(DIRMP3) \ 10 | -c:v copy -map 0:0 -map 1:0 \ 11 | -c:a libvo_aacenc -b:a 320k -ar 48000 -async 48000 \ 12 | "$@" 13 | 14 | clean: 15 | rm -f *.out.mp4 provide 16 | 17 | install-tools: 18 | sudo apt-get install libavcodec-extra 19 | 20 | .PHONY: all install-tools clean 21 | -------------------------------------------------------------------------------- /recipes/mix/enca/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | LANGUAGE = zh_CN 3 | ENCODE_TO = utf-8 4 | 5 | # ——— implementation ——————————————————————————————————————————————————————————— 6 | DIRMIX = $(shell dir *.mix) 7 | DIROUT = $(DIRMIX:.mix=.out) 8 | 9 | all: $(DIROUT) 10 | 11 | %.out: %.mix 12 | cp "$^" "$@" 13 | enca -L $(LANGUAGE) -x $(ENCODE_TO) "$@" 14 | echo "$@" >> provide 15 | 16 | install-tools: 17 | sudo apt-get install enca 18 | 19 | .PHONY: all install-tools 20 | -------------------------------------------------------------------------------- /recipes/mp3/trim/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | from = 00:01:15 3 | 4 | # ——— implementation ——————————————————————————————————————————————————————————— 5 | DIRMP3 = $(shell dir *.mp3) 6 | 7 | DIROUT.MP3 = $(DIRMP3:.mp3=.out.mp3) 8 | 9 | all: clean Makefile $(DIROUT.MP3) 10 | 11 | %.out.mp3: %.mp3 12 | avconv -i $< -ss $(from) -acodec copy "$@" 13 | echo $@ >> provide 14 | 15 | clean: 16 | rm -f *.out.mp3 provide 17 | 18 | install-tools: 19 | sudo apt-get install avconv 20 | 21 | .PHONY: all install-tools clean 22 | -------------------------------------------------------------------------------- /recipes/svg/to-png/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | width = 320 3 | height = 320 4 | 5 | # ——— implementation ——————————————————————————————————————————————————————————— 6 | DIRSVG = $(shell dir *.svg) 7 | 8 | DIRPNG = $(DIRSVG:.svg=.png) 9 | 10 | all: clean Makefile $(DIRPNG) 11 | 12 | %.png: %.svg 13 | inkscape -z -e "$@" -w $(width) -h $(height) "$^" 14 | echo "$@" >> provide 15 | 16 | clean: 17 | rm -f *.png provide 18 | 19 | install-tools: 20 | sudo apt-get install inkscape 21 | 22 | .PHONY: all install-tools clean 23 | -------------------------------------------------------------------------------- /recipes/mp4/to-mp3/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | bitrate = 320k 3 | 4 | # ——— implementation ——————————————————————————————————————————————————————————— 5 | DIRMP4 = $(shell dir *.mp4) 6 | DIRMP3 = $(DIRMP4:.mp4=.mp3) 7 | 8 | all: clean Makefile $(DIRMP3) 9 | 10 | %.mp3: %.mp4 11 | AV_LOG_FORCE_NOCOLOR=TRUE avconv -loglevel info -i "$<" -vn -ab $(bitrate) "$@" 12 | echo "$@" >> provide 13 | 14 | clean: 15 | rm -f *.mp3 provide 16 | 17 | install-tools: 18 | sudo apt-get install libav-tools libavcodec-extra 19 | 20 | .PHONY: all install-tools clean 21 | -------------------------------------------------------------------------------- /recipes/flac/to-mp3/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | bitrate = 320k 3 | frequency = 48000 4 | channels = 2 5 | 6 | # ——— implementation ——————————————————————————————————————————————————————————— 7 | DIRFLAC = $(shell dir *.flac) 8 | DIRMP3 = $(DIRFLAC:.flac=.mp3) 9 | 10 | all: clean Makefile $(DIRMP3) 11 | 12 | %.mp3: %.flac 13 | avconv -i "$<" -ab $(bitrate) -ac $(channels) -ar $(frequency) "$@" 14 | echo "$@" >> provide 15 | 16 | clean: 17 | rm -f *.mp3 provide 18 | 19 | install-tools: 20 | sudo apt-get install libav-tools 21 | 22 | .PHONY: all install-tools clean 23 | -------------------------------------------------------------------------------- /recipes/gif/gifsicle/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | 3 | # delay between frames in hundredths of a second 4 | delay = 60 5 | 6 | # ——— implementation ——————————————————————————————————————————————————————————— 7 | DIRGIF = $(shell ls *.gif | grep -v anime.gif) 8 | 9 | all: anime.gif 10 | 11 | anime.gif: Makefile $(DIRGIF) 12 | rm -f anime.gif 13 | gifsicle --delay=$(delay) --colors=256 --loop $(DIRGIF) -o $@ 14 | echo $@ >> provide 15 | 16 | clean: 17 | rm -f anime.gif provide 18 | 19 | install-tools: 20 | sudo apt-get install gifsicle 21 | 22 | .PHONY: all install-tools clean 23 | -------------------------------------------------------------------------------- /recipes/mp4/trim/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | from = 00:00:00 3 | to = 00:00:23 4 | 5 | # ——— implementation ——————————————————————————————————————————————————————————— 6 | DIRMP4 = $(shell find . -maxdepth 1 -name '*.mp4' -type f ! -name '*.out.mp4' | tr '\n' ' ') 7 | DIROUT.MP4 = $(DIRMP4:.mp4=.out.mp4) 8 | 9 | all: Makefile $(DIROUT.MP4) 10 | 11 | %.out.mp4: %.mp4 12 | avconv -i "$^" -vcodec copy -acodec copy -ss $(from) -t $(to) "$@" 13 | echo "$@" >> provide 14 | 15 | clean: 16 | rm -f *.out.mp4 provide 17 | 18 | install-tools: 19 | sudo apt-get install libav-tools 20 | 21 | .PHONY: all install-tools clean 22 | -------------------------------------------------------------------------------- /recipes/ogv/trim/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | from = 00:00:01 3 | to = 00:00:23 4 | 5 | # ——— implementation ——————————————————————————————————————————————————————————— 6 | INOGV = $(shell find . -maxdepth 1 -name '*.ogv' -type f ! -name '*.out.ogv' | tr '\n' ' ') 7 | OUTOGV = $(INOGV:.ogv=.out.ogv) 8 | 9 | all: $(OUTOGV) 10 | 11 | %.out.ogv: %.ogv Makefile 12 | rm -f "$@" 13 | ffmpeg -i $< -ss $(from) -t $(to) -vcodec copy -acodec copy "$@" 14 | echo "$@" >> provide 15 | 16 | clean: 17 | rm -f *.out.ogv provide 18 | 19 | install-tools: 20 | sudo apt-get install ffmpeg 21 | 22 | .PHONY: all install-tools clean 23 | -------------------------------------------------------------------------------- /recipes/tex/to-pdf/Makefile: -------------------------------------------------------------------------------- 1 | # This is a template for the Makefile. 2 | # Parameters should go in the upper half as: 3 | # width = 200 4 | # and be referenced in the command as $(width) 5 | 6 | #______________________________________________________________________________ 7 | 8 | 9 | DIRTEX = $(shell dir *.tex) 10 | 11 | DIRPDF = $(DIRTEX:.tex=.pdf) 12 | 13 | all: clean Makefile $(DIRPDF) 14 | 15 | %.pdf: %.tex 16 | latexmk -f $< 17 | echo $@ >> provide 18 | 19 | clean: 20 | latexmk -C *.tex 21 | rm -f *.pdf provide 22 | 23 | # Insert the install command here. 24 | # e.g. sudo apt-get install ffmpeg 25 | install-tools: 26 | echo "No tools required" 27 | 28 | .PHONY: all install-tools clean 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Emacs repository 2 | 3 | This is my emacs repo, based on `use-package`. 4 | 5 | To install simply link `~/.emacs.d/init.el` to 6 | `~/wherever/you/put/this/repository/init.el`. 7 | 8 | Then edit `~/.emacs.d/init.el` and change the `(load-file )` 9 | declarations to point to the correct `org.el`, `functions.el` and 10 | `keybindings.el`, or place this file into `~/dotfile/emacs/`. 11 | 12 | - functions.el: my own functions, taken from here and there. 13 | - init.el: the init file. use-package declaration and all. 14 | - keybindings.el: I let you guess this one. 15 | - org.el: org-mode setup. 16 | - ess-config.el: configuration related to R and Julia code. 17 | - python-config.el: setup anaconda-mode and all. 18 | - latex-config.el 19 | - elfeed.org: org-mode tree structure of pages I like to check. 20 | -------------------------------------------------------------------------------- /snippets/ess-mode/header.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: template 3 | # key: template 4 | # -- 5 | #' --- 6 | #' title: "${1:Title}" 7 | #' date: "\`r Sys.Date()\`" 8 | #' author: "Samuel Barreto" 9 | #' output: 10 | #' html_document: 11 | #' theme: paper 12 | #' highlight: tango 13 | #' --- 14 | 15 | # ----- r knitr_init, echo=FALSE, cache=FALSE 16 | library(knitr) 17 | 18 | # Global options 19 | opts_chunk\$set(echo=TRUE, cache=FALSE, prompt=FALSE, comment=NA, 20 | fig.path = "figures/", message=FALSE, warning=FALSE, 21 | global.par = TRUE) 22 | 23 | ## /* 24 | rmarkdown::render( 25 | input = "`(concat (file-name-base (buffer-file-name)) ".R")`", 26 | output_file = "`(concat "reports/" (file-name-base (buffer-file-name)) ".html")`", 27 | encoding = "UTF-8" 28 | ) 29 | ## */ 30 | -------------------------------------------------------------------------------- /recipes/org/to-pdf/Makefile: -------------------------------------------------------------------------------- 1 | # This is a template for the Makefile. 2 | # Parameters should go in the upper half as: 3 | # width = 200 4 | # and be referenced in the command as $(width) 5 | 6 | #______________________________________________________________________________ 7 | 8 | 9 | DIRORG = $(shell dir *.org) 10 | DIRPDF = $(DIRORG:.org=.pdf) 11 | 12 | all: clean Makefile $(DIRPDF) 13 | 14 | # compile latex to pdf using default latexmk recipe (lualatex + biber) 15 | %.pdf: %.tex 16 | latexmk -f $< 17 | 18 | # export org file to latex using emacs batch 19 | %.tex: %.org 20 | emacs $< -f org-latex-export-to-latex --kill 21 | echo $@ >> provide 22 | 23 | 24 | clean: 25 | rm -f *.pdf provide 26 | 27 | # Insert the install command here. 28 | # e.g. sudo apt-get install ffmpeg 29 | install-tools: 30 | echo "No tools required" 31 | 32 | .PHONY: all install-tools clean 33 | -------------------------------------------------------------------------------- /snippets/scheme-mode/gpl.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: gpl 3 | # key: gpl 4 | # -- 5 | #| 6 | Copyright (C) 2018 Samuel Barreto 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | |# 22 | $0 -------------------------------------------------------------------------------- /autoinsert/header.R: -------------------------------------------------------------------------------- 1 | #' --- 2 | #' title: "" 3 | #' author: "Samuel BARRETO" 4 | #' date: 5 | #' output: 6 | #' html_document: 7 | #' df_print: paged 8 | #' max.print: 40 9 | #' rows.print: 10 10 | #' cols.print: 10 11 | #' highlight: tango 12 | #' theme: paper 13 | #' code_folding: show 14 | #' toc: true 15 | #' toc_depth: 2 16 | #' toc_float: true 17 | #' fig_width: 10 18 | #' fig_height: 6.18 19 | #' --- 20 | 21 | ### ---------- include = FALSE --------------------------------------------- 22 | library(knitr) 23 | opts_chunk$set( 24 | cache = FALSE, dev = 'png', include = TRUE, 25 | fig.path = "graphics/", echo = TRUE, warning = FALSE, 26 | error = FALSE, message = FALSE, global.par = TRUE 27 | ) 28 | 29 | ## /* 30 | rmarkdown::render((buffer-file-name), encoding = "UTF-8") 31 | ## */ 32 | 33 | ### ---------- Setup ------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /recipes/ogv/crop/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | left = 1 3 | top = 10 4 | width = 220 5 | height = 220 6 | 7 | # ——— implementation ——————————————————————————————————————————————————————————— 8 | INOGV = $(shell find . -maxdepth 1 -type f -name '*.ogv' ! -name '*.out.ogv' | tr '\n' ' ') 9 | OUTOGV = $(INOGV:.ogv=.out.ogv) 10 | 11 | all: clean $(OUTOGV) 12 | 13 | %.out.ogv: %.ogv 14 | rm -f *.out.ogv 15 | ffmpeg -i "$<" -r 24 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1 \ 16 | -y -f ogg -vf "crop=$(width):$(height):$(left):$(top)" /dev/null 17 | ffmpeg -i "$<" -r 24 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 2 \ 18 | -vf "crop=$(width):$(height):$(left):$(top)" "$@" 19 | echo "$@" >> provide 20 | 21 | clean: 22 | rm -f *.out.ogv *.log provide 23 | 24 | install-tools: 25 | sudo apt-get install ffmpeg 26 | 27 | .PHONY: all install-tools clean 28 | -------------------------------------------------------------------------------- /recipes/ogv/to-gif/Makefile: -------------------------------------------------------------------------------- 1 | # ——— comments ————————————————————————————————————————————————————————————————— 2 | # The frames are stored in output/. You can 3 | # - delete frames with e.g. dired 4 | # - edit frames with e.g. GIMP 5 | # Afterwards, call make again to compose the frames in output/ into a gif. 6 | 7 | # ——— implementation ——————————————————————————————————————————————————————————— 8 | OGV = $(shell find . -maxdepth 1 -type f -name '*.ogv' ! -name '*.out.ogv' | tr '\n' ' ') 9 | GIF = $(OGV:.ogv=.gif) 10 | 11 | all: $(GIF) 12 | 13 | %.output: %.ogv 14 | mplayer -ao null $< -vo jpeg:outdir="$@" 15 | 16 | %.unoptimized.gif: %.output 17 | convert "$> provide 22 | 23 | clean: 24 | rm -f *.gif 25 | rm -rf ./*.output 26 | 27 | install-tools: 28 | sudo apt-get install ffmpeg imagemagick 29 | 30 | .PHONY: all install-tools provide clean 31 | -------------------------------------------------------------------------------- /autoinsert/header.scm: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/guile \ 2 | -e main -s 3 | !# 4 | 5 | ;;; Copyright (C) 2017 Samuel Barreto 6 | ;;; 7 | ;;; This program is free software; you can redistribute it and/or modify 8 | ;;; it under the terms of the GNU General Public License as published by 9 | ;;; the Free Software Foundation; either version 2 of the License, or 10 | ;;; (at your option) any later version. 11 | ;;; 12 | ;;; This program is distributed in the hope that it will be useful, 13 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ;;; GNU General Public License for more details. 16 | ;;; 17 | ;;; You should have received a copy of the GNU General Public License 18 | ;;; along with this program; if not, write to the Free Software 19 | ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | ;;; 21 | 22 | (define (main args) 23 | 24 | ) 25 | -------------------------------------------------------------------------------- /recipes/md/to-pdf/Makefile: -------------------------------------------------------------------------------- 1 | # This is a template for the Makefile. 2 | # Parameters should go in the upper half as: 3 | # width = 200 4 | # and be referenced in the command as $(width) 5 | 6 | #______________________________________________________________________________ 7 | TEMPLATE := samartcl.latex 8 | PANDOC_FLAGS := --template=$(TEMPLATE) 9 | 10 | BIB := $(HOME)/Dropbox/bibliography 11 | BIBLIO := $(BIB)/references.bib 12 | STYLE := $(BIB)/styles/nature.csl 13 | 14 | DIRMD = $(shell dir *.md) 15 | 16 | DIRPDF = $(DIRMD:.md=.pdf) 17 | 18 | all: clean Makefile $(DIRPDF) 19 | 20 | %.pdf: %.md 21 | sed 's:figures/:../figures/:g' $< \ 22 | | pandoc \ 23 | $(PANDOC_FLAGS) \ 24 | --filter pandoc-citeproc \ 25 | --bibliography $(BIBLIO) \ 26 | --csl $(STYLE) \ 27 | -o $@ 28 | echo $@ >> provide 29 | 30 | clean: 31 | rm -f *.pdf provide 32 | 33 | # Insert the install command here. 34 | # e.g. sudo apt-get install ffmpeg 35 | install-tools: 36 | echo "No tools required" 37 | 38 | .PHONY: all install-tools clean 39 | -------------------------------------------------------------------------------- /snippets/sh-mode/template.snippet: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: template 3 | # key: template 4 | # -- 5 | #!/usr/bin/env bash 6 | set -euo pipefail 7 | IFS=\$'\n\t' 8 | 9 | readonly LOG_FILE="/tmp/\$(basename "\$0").log" 10 | 11 | info() { echo -e "INFO: \$@" | tee -a "\$LOG_FILE" >&2 ; } 12 | warn() { echo -e "WARN: \$@" | tee -a "\$LOG_FILE" >&2 ; } 13 | error() { echo -e "ERROR: \$@" | tee -a "\$LOG_FILE" >&2 ; } 14 | fatal() { echo -e "FATAL: \$@" | tee -a "\$LOG_FILE" >&2 ; exit 1 ; } 15 | 16 | 17 | usage() { 18 | cat < /dev/null && usage; fi 41 | expr "\$*" : ".*--help" > /dev/null && usage 42 | 43 | cleanup() { 44 | # unset TEMPVAR 45 | echo "" 46 | } 47 | 48 | if [[ "\${BASH_SOURCE[0]}" = "\$0" ]]; then 49 | trap cleanup EXIT 50 | 51 | $0 52 | fi -------------------------------------------------------------------------------- /recipes/cue/split/Makefile: -------------------------------------------------------------------------------- 1 | # ——— parameters ——————————————————————————————————————————————————————————————— 2 | FILEFORMAT = "`printf %02g $$TRACKNUMBER` - $$ARTIST - $$TITLE.flac" 3 | 4 | # ——— implementation ——————————————————————————————————————————————————————————— 5 | remcontents = if [ -f $(1) ]; then cat $(1) | while read f; do rm -f "$$f";done;fi 6 | 7 | CUEFILE = $(shell dir *.cue) 8 | 9 | all: split provide 10 | 11 | split: $(CUEFILE) 12 | make clean 13 | cuebreakpoints "$(CUEFILE)" | shnsplit -o flac *.flac 14 | cuetag "$(CUEFILE)" split-track*.flac 15 | ls split-track*.flac > "$@" 16 | 17 | provide: split Makefile 18 | rm -f "$@" 19 | cat split | while read a; do \ 20 | ARTIST=`metaflac "$$a" --show-tag=ARTIST | sed s/.*=//g`; \ 21 | TITLE=`metaflac "$$a" --show-tag=TITLE | sed s/.*=//g`; \ 22 | TRACKNUMBER=`metaflac "$$a" --show-tag=TRACKNUMBER | sed s/.*=//g`; \ 23 | mv "$$a" $(FILEFORMAT); \ 24 | echo $(FILEFORMAT) >> "$@"; \ 25 | done 26 | cp "$@" split 27 | 28 | clean: 29 | if [ -f output ]; then $(call remcontents,output);rm -f output split;fi 30 | if [ -f split ]; then $(call remcontents,split);rm -f split;fi 31 | rm -f provide 32 | 33 | install-tools: 34 | sudo apt-get install cuetools shntool flac wavpack 35 | 36 | .PHONY: all install-tools clean 37 | -------------------------------------------------------------------------------- /ess-config.el: -------------------------------------------------------------------------------- 1 | ;;; * Licence 2 | 3 | ;; Copyright (C) 2017 Samuel Barreto 4 | ;; 5 | ;; This program is free software; you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation; either version 2 of the License, or 8 | ;; (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program; if not, write to the Free Software 17 | ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | ;; 19 | 20 | ;;; Code 21 | 22 | (use-package ess-site 23 | :ensure ess 24 | :mode 25 | (("\\.sp\\'" . S-mode) 26 | ("/R/.*\\.q\\'" . R-mode) 27 | ("\\.[qsS]\\'" . S-mode) 28 | ("\\.ssc\\'" . S-mode) 29 | ("\\.SSC\\'" . S-mode) 30 | ("\\.[rR]\\'" . R-mode) 31 | ("\\.[rR]nw\\'" . Rnw-mode) 32 | ("\\.[sS]nw\\'" . Snw-mode) 33 | ("\\.[rR]profile\\'" . R-mode) 34 | ("NAMESPACE\\'" . R-mode) 35 | ("CITATION\\'" . R-mode) 36 | ("\\.omg\\'" . omegahat-mode) 37 | ("\\.hat\\'" . omegahat-mode) 38 | ("\\.lsp\\'" . XLS-mode) 39 | ("\\.do\\'" . STA-mode) 40 | ("\\.ado\\'" . STA-mode) 41 | ("\\.[Ss][Aa][Ss]\\'" . SAS-mode) 42 | ("\\.jl\\'" . ess-julia-mode) 43 | ("\\.[Ss]t\\'" . S-transcript-mode) 44 | ("\\.Sout" . S-transcript-mode) 45 | ("\\.[Rr]out" . R-transcript-mode) 46 | ("\\.Rd\\'" . Rd-mode) 47 | ("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode) 48 | ("\\.[Bb][Oo][Gg]\\'" . ess-bugs-mode) 49 | ("\\.[Bb][Mm][Dd]\\'" . ess-bugs-mode) 50 | ("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode) 51 | ("\\.[Jj][Oo][Gg]\\'" . ess-jags-mode) 52 | ("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode)) 53 | :commands (R 54 | stata 55 | julia 56 | SAS) 57 | 58 | :init 59 | (add-hook! 'ess-mode-hook 60 | (smartparens-mode 1) 61 | (lesspy-mode 1) 62 | (run-hooks 'prog-mode-hook 'company-mode-hook)) 63 | 64 | (add-hook! 'inferior-ess-mode-hook 65 | (setq-local outline-regexp "^>") 66 | (rainbow-mode t) 67 | ;; do not truncate line in the R repl: 68 | (toggle-truncate-lines 1)) 69 | 70 | (setq ess-offset-continued 2 ; offset after first statement 71 | ess-expression-offset 2 ; offset for expression 72 | ess-nuke-trailing-whitespace-p t ;delete trailing whitespace 73 | ess-default-style 'RStudio) ; set default style for R source file 74 | (setq ess-indent-with-fancy-comments nil) 75 | (setq ess-swv-plug-into-AUCTeX-p t) 76 | (setq ess-eval-visibly 'nowait) 77 | (setq ess-roxy-insert-prefix-on-newline t) 78 | (setq ess-eldoc-show-on-symbol t) 79 | ;; ess should use default completing-read, either ivy or helm. 80 | (setq ess-use-ido nil) 81 | (setq ess-use-flymake nil) ; flymake does not work with ess right now. 82 | (setq ess-r-package-auto-enable-namespaced-evaluation t) 83 | 84 | :config 85 | (ess-toggle-underscore nil) 86 | 87 | (sp-local-pair 'ess-mode "{" nil 88 | :post-handlers '((sam--create-newline-and-enter-sexp "RET"))) 89 | (sp-local-pair 'ess-mode "(" nil 90 | :post-handlers '((sam--create-newline-and-enter-sexp "RET"))) 91 | (sp-local-pair 'ess-mode "%" "%") 92 | 93 | ;;;; keybindings 94 | 95 | (general-define-key 96 | :keymaps 'ess-mode-map 97 | "RET" 'ess-newline-and-indent 98 | "C-RET" 'ess-eval-region-or-line 99 | "M-RET" 'ess-eval-function-or-paragraph 100 | "M-p" 'sp-backward-up-sexp 101 | "M-n" 'sp-up-sexp 102 | " " 'ess-insert-S-assign ; shift alt space 103 | " " 'ess-insert-S-assign ; shift space 104 | )) 105 | 106 | (use-package ess-rutils 107 | :after ess-site 108 | :config 109 | (ess-rutils-mode) 110 | (setq ess-rutils-keys t)) 111 | -------------------------------------------------------------------------------- /python-config.el: -------------------------------------------------------------------------------- 1 | ;;; * Licence 2 | 3 | ;; Copyright (C) 2017 Samuel Barreto 4 | ;; 5 | ;; This program is free software; you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation; either version 2 of the License, or 8 | ;; (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program; if not, write to the Free Software 17 | ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | ;; 19 | 20 | ;;; * Code 21 | 22 | (use-package elpy 23 | :ensure t 24 | :config 25 | (elpy-enable)) 26 | 27 | ;; (use-package anaconda-mode 28 | ;; :quelpa (anaconda-mode :fetcher github :repo "proofit404/anaconda-mode") 29 | ;; :config 30 | 31 | ;; (add-hook 'python-mode-hook 'anaconda-mode) 32 | ;; (add-hook 'python-mode-hook 'anaconda-eldoc-mode) 33 | 34 | ;; (bind-keys :map python-mode-map 35 | ;; ("C-M-i" . anaconda-mode-complete) 36 | ;; ("M-." . anaconda-mode-find-definitions) 37 | ;; ("M-?" . anaconda-mode-show-doc) 38 | ;; ("M-," . anaconda-mode-go-back) 39 | ;; ("M-*" . anaconda-mode-find-assignments) 40 | ;; ("M-SPC" . hydra-python/body)) 41 | 42 | ;; (use-package company-anaconda 43 | ;; :quelpa (company-anaconda :fetcher github :repo "proofit404/company-anaconda") 44 | ;; :config 45 | ;; (add-to-list 'company-backends '(company-anaconda :with company-capf)))) 46 | 47 | ;; (use-package py-yapf 48 | ;; :quelpa (py-yapf :fetcher github :repo "paetzke/py-yapf.el") 49 | ;; :commands py-yapf-buffer) 50 | 51 | ;; (use-package pyenv-mode :ensure t 52 | ;; :commands pyenv-mode 53 | ;; :init (add-hook 'python-mode-hook 'pyenv-mode)) 54 | 55 | ;; (use-package pyvenv :ensure t 56 | ;; :config 57 | ;; (setenv "WORKON_HOME" "/Users/samuelbarreto/") 58 | ;; (pyvenv-workon "anaconda")) 59 | 60 | ;; (use-package lpy 61 | ;; :disabled t 62 | ;; :quelpa (lpy :fetcher github :repo "abo-abo/lpy") 63 | ;; :init 64 | ;; (use-package function-args 65 | ;; :quelpa (function-args :fetcher github :repo "abo-abo/function-args")) 66 | ;; (use-package soap 67 | ;; :quelpa (soap :fetcher github :repo "abo-abo/soap")) 68 | ;; :config 69 | ;; (add-hook 'python-mode-hook (lambda () (lpy-mode 1) (lispy-mode 1)))) 70 | 71 | ;; (use-package py-isort :ensure t 72 | ;; :commands (py-isort-buffer 73 | ;; py-isort-region)) 74 | 75 | ;; ---------- defaults ---------------------------------------------------- 76 | (setq-default indent-tabs-mode nil) 77 | (setq-default python-indent-offset 4) 78 | (if (executable-find "ipython") 79 | (setq python-shell-interpreter "ipython" 80 | python-shell-interpreter-args "--simple-prompt -i --pprint") 81 | (setq python-shell-interpreter "python3")) 82 | 83 | ;; ---------- Function definitions ---------------------------------------- 84 | (defun python-shell-send-line (&optional vis) 85 | "send the current line to the inferior python process" 86 | (interactive "P") 87 | (save-excursion 88 | (end-of-line) 89 | (let ((end (point))) 90 | (beginning-of-line) 91 | (python-shell-send-region (point) end vis "eval line")))) 92 | 93 | (defun current-line-empty-p () 94 | (save-excursion 95 | (beginning-of-line) 96 | (looking-at "[[:space:]]*$"))) 97 | 98 | (defun python-shell-send-block (&optional vis) 99 | "send the current block of text to inferior python process. 100 | If not in a block, send the upper block. 101 | " 102 | (interactive "P") 103 | (save-excursion 104 | (unless (current-line-empty-p) (python-nav-end-of-block)) 105 | (let ((end (point))) 106 | (python-nav-beginning-of-block) 107 | (python-shell-send-region (point) end vis "eval line")))) 108 | 109 | (defun python-shell-send-block-switch () 110 | (interactive) 111 | (python-shell-send-block) 112 | (python-shell-switch-to-shell)) 113 | 114 | (defun python-shell-send-line-switch () 115 | (interactive) 116 | (python-shell-send-line) 117 | (python-shell-switch-to-shell)) 118 | 119 | ;; from https://github.com/syl20bnr/spacemacs/blob/master/layers/%2Blang/python/packages.el 120 | (defun python-shell-send-buffer-switch () 121 | "Send buffer content to shell and switch to it in insert mode" 122 | (interactive) 123 | (python-shell-send-buffer) 124 | (python-shell-switch-to-shell)) 125 | 126 | (defun python-shell-send-defun-switch () 127 | "send function content to shell and switch to it in insert mode" 128 | (interactive) 129 | (python-shell-send-defun nil) 130 | (python-shell-switch-to-shell)) 131 | 132 | (defun python-shell-send-region-switch (start end) 133 | "Send region content to shell and switch to it in insert mode." 134 | (interactive "r") 135 | (python-shell-send-region start end) 136 | (python-shell-switch-to-shell)) 137 | 138 | 139 | 140 | ;; ---------- Keybindings ------------------------------------------------- 141 | (general-define-key 142 | :keymaps 'python-mode-map 143 | "s-e" 'python-shell-send-defun 144 | "C-" 'python-shell-send-line 145 | "«" 'python-indent-shift-left 146 | "»" 'python-indent-shift-right 147 | (general-chord ",l") 'python-shell-send-line 148 | (general-chord ";L") 'python-shell-send-line-switch 149 | (general-chord ",b") 'python-shell-send-block 150 | (general-chord ";B") 'python-shell-send-block-switch 151 | (general-chord ",t") 'python-shell-send-defun 152 | (general-chord ";T") 'python-shell-send-defun-switch 153 | (general-chord ",r") 'python-shell-send-region 154 | (general-chord ";R") 'python-shell-send-region-switch 155 | (general-chord "xq") 'hydra-python/body) 156 | 157 | (defhydra hydra-python (:hint nil :color teal) 158 | " 159 | ^Send^ ^ ^ ^Navigation^ ^Code^ ^Actions^ 160 | ^----^ ^ ^ ^----------^ ^----^ ^-------^ 161 | _sl_: line _st_: function _._: def _>_: indent _y_: yapf 162 | _SL_: line → _ST_: function → _*_: assign _<_: outdent 163 | _sr_: region _sb_: buffer _,_: back 164 | _SR_: region → _SB_: buffer → ^ ^ 165 | " 166 | ;; shell send 167 | ("sl" python-shell-send-line) 168 | ("SL" python-shell-send-line-switch) 169 | ("sr" python-shell-send-region) 170 | ("SR" python-shell-send-region-switch) 171 | ("st" python-shell-send-defun) 172 | ("ST" python-shell-send-defun-switch) 173 | ("sb" python-shell-send-buffer) 174 | ("SB" python-shell-send-buffer-switch) 175 | ;; code nav 176 | ("." anaconda-mode-find-definitions) 177 | ("," anaconda-mode-find-assignments :color red) 178 | ("*" anaconda-mode-go-back :color red) 179 | ;; code editing 180 | ("<" python-indent-shift-left) 181 | (">" python-indent-shift-right) 182 | ;; test 183 | ;; TODO python test via nose 184 | ;; actions 185 | ("y" py-yapf-buffer) 186 | ("q" nil "quit" :color blue)) 187 | -------------------------------------------------------------------------------- /latex-config.el: -------------------------------------------------------------------------------- 1 | ;;; * Licence 2 | 3 | ;; Copyright (C) 2017 Samuel Barreto 4 | ;; 5 | ;; This program is free software; you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation; either version 2 of the License, or 8 | ;; (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program; if not, write to the Free Software 17 | ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | ;; 19 | 20 | ;;; * Code 21 | 22 | (use-package company-auctex :ensure t 23 | :config 24 | (append-to-list! 'company-backends 25 | '(company-auctex-labels 26 | company-auctex-bibs 27 | company-auctex-environments 28 | company-auctex-macros 29 | company-auctex-symbols))) 30 | 31 | (use-package auctex-latexmk :ensure t 32 | :config 33 | (auctex-latexmk-setup)) 34 | 35 | (defvar latex-nofill-env '("equation" "equation*" "align" "align*" "tabular" "tikzpicture") 36 | "List of environment names in which `auto-fill-mode' will be inhibited.") 37 | 38 | (defvar latex-build-command (if (executable-find "latexmk") "LatexMk" "LaTeX") 39 | "the default command to use to build the document") 40 | 41 | (defun latex--autofill () 42 | "Check whether the pointer is currently inside one of the 43 | environments described in `latex-nofill-env' and if so, inhibits 44 | the automatic filling of the current paragraph." 45 | (let ((do-auto-fill t) 46 | (current-environment "") 47 | (level 0)) 48 | (while (and do-auto-fill (not (string= current-environment "document"))) 49 | (setq level (1+ level) 50 | current-environment (LaTeX-current-environment level) 51 | do-auto-fill (not (member current-environment latex-nofill-env)))) 52 | (when do-auto-fill 53 | (do-auto-fill)))) 54 | 55 | (defun latex-auto-fill-mode () 56 | "Toggle auto-fill-mode using the custom auto-fill function." 57 | (interactive) 58 | (auto-fill-mode) 59 | (setq auto-fill-function 'latex--autofill)) 60 | 61 | ;; from spacemacs 62 | (setq 63 | TeX-command-default latex-build-command 64 | TeX-auto-save t 65 | TeX-parse-self t 66 | TeX-syntactic-comment t 67 | TeX-source-correlate-start-server nil ; synctex support 68 | LaTeX-fill-break-at-separators nil ; Don't insert line-break at inline math 69 | ) 70 | 71 | (setq-default LaTeX-item-indent 2) 72 | 73 | (setq-default 74 | TeX-engine 'default 75 | TeX-PDF-mode t ; pdf output by default 76 | ) 77 | 78 | ;; keybindings 79 | 80 | ;; Rebindings for TeX-font 81 | (defun latex/font-bold () (interactive) (TeX-font nil ?\C-b)) 82 | (defun latex/font-medium () (interactive) (TeX-font nil ?\C-m)) 83 | (defun latex/font-code () (interactive) (TeX-font nil ?\C-t)) 84 | (defun latex/font-emphasis () (interactive) (TeX-font nil ?\C-e)) 85 | (defun latex/font-italic () (interactive) (TeX-font nil ?\C-i)) 86 | (defun latex/font-clear () (interactive) (TeX-font nil ?\C-d)) 87 | (defun latex/font-calligraphic () (interactive) (TeX-font nil ?\C-a)) 88 | (defun latex/font-small-caps () (interactive) (TeX-font nil ?\C-c)) 89 | (defun latex/font-sans-serif () (interactive) (TeX-font nil ?\C-f)) 90 | (defun latex/font-normal () (interactive) (TeX-font nil ?\C-n)) 91 | (defun latex/font-serif () (interactive) (TeX-font nil ?\C-r)) 92 | (defun latex/font-oblique () (interactive) (TeX-font nil ?\C-s)) 93 | (defun latex/font-upright () (interactive) (TeX-font nil ?\C-u)) 94 | 95 | (general-define-key 96 | :keymaps 'LaTeX-mode-map 97 | "C-," 'hydra-latex/body 98 | "M-q" 'fill-paragraph 99 | "M-s-q" 'hydra-latex-fill/body) 100 | 101 | (defhydra hydra-latex (:color blue :hint nil :columns 3) 102 | " 103 | Latex 104 | 105 | ^Insert^ ^Command^ ^ ^ ^Navigate^ 106 | ^---------^ ^-------^-----------------^^ ^--------^ 107 | _e_: env │ _;_: comment _v_: view │ _M-g_: error 108 | _m_: macro │ _c_: command on _M-q_: fill │ _TAB_: outline 109 | _t_: font │ _p_: preview 110 | _s_: section │ 111 | " 112 | ("t" hydra-latex-font/body ) 113 | ("m" TeX-insert-macro ) 114 | ("e" LaTeX-environment ) 115 | ("s" LaTeX-section ) 116 | ("p" hydra-latex-preview/body ) 117 | ("c" hydra-latex-command/body ) 118 | ("\;" hydra-latex-comment/body ) 119 | ("M-g" hydra-latex-error/body ) 120 | ("M-q" hydra-latex-fill/body ) 121 | ("TAB" hydra-outline/body ) 122 | ("v" TeX-view ) 123 | ("q" nil "quit" :color blue)) 124 | 125 | (defhydra hydra-latex-comment (:color amaranth :hint nil :colums 2) 126 | "Comment or uncomment" 127 | ("r" TeX-comment-or-uncomment-region "region") 128 | ("p" TeX-comment-or-uncomment-paragraph "para") 129 | ("." hydra-latex/body "back" :color blue) 130 | ("q" nil "quit" :color blue)) 131 | 132 | (defhydra hydra-latex-command (:color teal :hint nil :columns 3) 133 | "Run Latex Command on" 134 | ("b" TeX-command-buffer "buffer") 135 | ("m" TeX-command-master "master" ) 136 | ("r" TeX-command-region "region" ) 137 | ("a" TeX-command-run-all "all" ) 138 | ("s" LaTeX-command-section "section")) 139 | 140 | (defhydra hydra-latex-fill (:color blue :hint nil :columns 2) 141 | "Latex Fill" 142 | ("r" LaTeX-fill-region "region" ) 143 | ("s" LaTeX-fill-section "section") 144 | ("p" LaTeX-fill-paragraph "para") 145 | ("e" LaTeX-fill-environment "environment") 146 | ("C-r" LaTeX-fill-region-as-paragraph "reg as par") 147 | ("C-p" LaTeX-fill-region-as-para-do "reg as par do") 148 | ("." hydra-latex/body "back" :color blue) 149 | ("q" nil "quit" :color blue)) 150 | 151 | (defhydra hydra-latex-error (:color red :hint nil :columns 2) 152 | "Latex Errors" 153 | ("n" TeX-next-error "next") 154 | ("t" TeX-next-error "next") 155 | ("p" TeX-previous-error "prev") 156 | ("s" TeX-previous-error "prev") 157 | ("." hydra-latex/body "back" :color blue) 158 | ("q" nil "quit" :color blue)) 159 | 160 | (defhydra hydra-latex-font (:color blue :hint nil) 161 | " 162 | ^Latex Font^ 163 | ^----------^ 164 | _b_: bold _M_: small-caps 165 | _m_: medium _S_: sans-serif 166 | _c_: code _s_: serif 167 | _e_: emphasis _n_: normal 168 | _i_: italic _o_: oblique 169 | _C_: clear _u_: upright 170 | _l_: calligraphic 171 | 172 | [_._]: back [_q_]: quit 173 | " 174 | ("b" latex/font-bold) 175 | ("c" latex/font-code) 176 | ("C" latex/font-clear) 177 | ("e" latex/font-emphasis) 178 | ("i" latex/font-italic) 179 | ("l" latex/font-calligraphic) 180 | ("m" latex/font-medium) 181 | ("M" latex/font-small-caps) 182 | ("n" latex/font-normal) 183 | ("o" latex/font-oblique) 184 | ("s" latex/font-serif) 185 | ("S" latex/font-sans-serif) 186 | ("u" latex/font-upright) 187 | ("." hydra-latex/body) 188 | ("q" nil :color blue)) 189 | 190 | (defhydra hydra-latex-preview (:color blue :hint nil) 191 | " 192 | ^Preview^ ^Clear^ 193 | _e_: environment ^ ^ 194 | _b_: buffer _C-b_: buffer 195 | _d_: document _C-d_: document 196 | _p_: at point _C-p_: at point 197 | _r_: region ^^ 198 | _s_: section _C-s_: section 199 | 200 | [_._]: back [_q_]: quit 201 | " 202 | ("e" preview-environment) 203 | ("b" preview-buffer) 204 | ("C-b" preview-clearout-buffer) 205 | ("C-c" preview-clearout) 206 | ("d" preview-document) 207 | ("C-d" preview-clearout-document) 208 | ("p" preview-at-point) 209 | ("r" preview-region) 210 | ("C-p" preview-clearout-at-point) 211 | ("s" preview-section) 212 | ("C-s" preview-clearout-section) 213 | ("." hydra-latex/body) 214 | ("q" nil)) 215 | -------------------------------------------------------------------------------- /keybindings.el: -------------------------------------------------------------------------------- 1 | ;;; * Licence 2 | 3 | ;; Copyright (C) 2017 Samuel Barreto 4 | ;; 5 | ;; This program is free software; you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation; either version 2 of the License, or 8 | ;; (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program; if not, write to the Free Software 17 | ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | ;; 19 | 20 | ;;; * Code 21 | 22 | (use-package key-chord 23 | :ensure t 24 | :config 25 | (key-chord-mode 1) 26 | (setq key-chord-two-keys-delay 0.2)) 27 | 28 | (use-package key-seq 29 | :ensure t 30 | :after key-chord 31 | :config 32 | (key-seq-define-global "qb" #'counsel-bookmark) 33 | (key-seq-define-global "qd" #'kill-this-buffer)) 34 | 35 | (use-package general :ensure t 36 | :config 37 | 38 | ;;; Shift 39 | 40 | 41 | 42 | ;;; Alt- 43 | (general-define-key 44 | "ð" 'kill-word-ap) 45 | 46 | ;;; C- 47 | (general-define-key 48 | "C-S-c" 'sp-splice-sexp 49 | "C-S-z" 'undo-tree-redo 50 | "C-S-k" 'kill-whole-line 51 | "C-é" 'hydra-window/body) 52 | 53 | (bind-keys* 54 | ("C-'" . avy-goto-word-1) 55 | ("C-/" . complete-symbol)) 56 | 57 | 58 | ;;; * C-M- 59 | 60 | 61 | 62 | ;;; * C-c 63 | 64 | (general-define-key 65 | :prefix "C-c" 66 | "v" 'magit-status) 67 | 68 | ;;; * C-x 69 | 70 | (general-define-key 71 | :prefix "C-x" 72 | "d" 'dired-other-window 73 | "n" 'narrow-or-widen-dwim 74 | "=" 'balance-windows 75 | "C-b" 'ibuffer 76 | "M-c" 'compile) 77 | 78 | ;;; M- 79 | (general-define-key 80 | "M-" 'sam|delete-to-sentence-beg 81 | "M-é" 'ace-window 82 | "M-/" 'hippie-expand 83 | "M-«" 'beginning-of-buffer 84 | "M-»" 'end-of-buffer 85 | "M-ê" 'hydra-error/body 86 | 87 | "M-P" 'scroll-other-window 88 | "M-N" 'scroll-other-window-down 89 | 90 | "M-s-n" 'forward-paragraph 91 | "M-s-p" 'backward-paragraph 92 | "M-s-i" 'shell-command-on-buffer 93 | "M-SPC" 'cycle-spacing) 94 | 95 | 96 | 97 | ;;; s- 98 | 99 | (general-define-key 100 | "s-" 'sam|switch-to-other-buffer 101 | "s-c" 'windmove-left 102 | "s-r" 'windmove-right 103 | "s-d" 'kill-buffer-and-window 104 | "s-f" 'projectile-find-file 105 | "s-i" 'sam|indent-paragraph 106 | "s-j" 'sam|join-to-next-line 107 | "s-l" 'sam|comment-or-uncomment-region-or-line 108 | "s-o" 'sam|open-in-external-app 109 | "s-q" 'sam|unfill-paragraph 110 | "s-t" 'ivy-switch-buffer ; don't show font panel with s-t. 111 | "s-u" 'negative-argument 112 | "s-w" 'sam|main-window 113 | "s-n" 'narrow-or-widen-dwim) 114 | 115 | 116 | 117 | ;;; H- 118 | 119 | (general-define-key 120 | "H-" 'hydra-outline/body 121 | "H-w" 'sam|maximize-window 122 | "H-l" 'sam--duplicate-line 123 | "H-n" 'make-frame 124 | "H-s" 'move-text-up 125 | "H-t" 'move-text-down 126 | "H-u" 'revert-buffer 127 | "H-." 'sam|finder-here 128 | "H-'" 'sam|iterm-here 129 | 130 | ;; H-M- 131 | "H-M-p" 'scroll-up-command 132 | "H-M-n" 'scroll-down-command 133 | "H-M-s" 'mark-sexp) 134 | 135 | 136 | 137 | ;;; Mode specific map 138 | 139 | (general-define-key 140 | :keymaps 'compilation-mode-map 141 | "t" 'compilation-next-error 142 | "s" 'compilation-previous-error 143 | "r" 'compile-goto-error)) 144 | 145 | ;;; * Global 146 | 147 | (global-set-key (kbd "C-x C-S-e") #'eval-and-replace) 148 | 149 | (bind-keys* 150 | ("C-c " . hydra-winner/winner-undo) 151 | ("C-c " winner-undo "undo") 261 | ("" winner-redo "redo")) 262 | 263 | ;;; ** MAIN HYDRA 264 | 265 | (general-define-key 266 | :prefix "C-." 267 | "a" '(hydra-transparency/body :wk "alpha") 268 | "i" '(hydra-insert/body :wk "insert") 269 | "t" '(hydra-toggle/body :wk "toggle") 270 | "w" '(hydra-window/body :wk "window") 271 | "z" '(hydra-zoom/body :wk "zoom") 272 | "t" '(hydra-thesis/body :wk "thesis") 273 | "e" '(hydra-errors/body :wk "errors") 274 | "d" '(hydra-define/body :wk "defines")) 275 | 276 | (defhydra hydra-define (:hint nil :color blue) 277 | " 278 | ^At Point^ ^Input^ 279 | defines: _w_ _C-w_ 280 | diction: _d_ _C-d_ 281 | synonym: _s_ _C-s_ 282 | wiki : _W_" 283 | ("w" define-word-at-point) 284 | ("d" osx-dictionary-search-word-at-point) 285 | ("s" powerthesaurus-lookup-word-at-point) 286 | ("W" wiki-summary) 287 | ("C-w" define-word) 288 | ("C-d" osx-dictionary-search-input) 289 | ("C-s" powerthesaurus-lookup-word)) 290 | 291 | (defhydra hydra-ui (:hint nil :color teal :columns 1) 292 | ("a" hydra-transparency/body "alpha") 293 | ("t" hydra-toggle/body "toggle") 294 | ("z" hydra-zoom/body "zoom")) 295 | 296 | (defhydra hydra-yank-pop (:hint nil) 297 | "yank" 298 | ("C-y" yank nil) 299 | ("M-y" yank-pop nil) 300 | ("y" (yank-pop 1) "next") 301 | ("p" (yank-pop 1) "next") 302 | ("n" (yank-pop -1) "prev") 303 | ("l" counsel-yank-pop "list" :color blue)) 304 | 305 | (bind-key* "C-y" #'hydra-yank-pop/yank) 306 | (bind-key* "M-y" #'hydra-yank-pop/yank-pop) 307 | 308 | ;; taken from "http://joaotavora.github.io/yasnippet/snippet-development.html#sec-3-2 309 | ;; useful when resolving merge conflicts 310 | (defhydra hydra-smerge (:color pink 311 | :hint nil 312 | :pre (smerge-mode 1) 313 | ;; Disable `smerge-mode' when quitting hydra if 314 | ;; no merge conflicts remain. 315 | :post (smerge-auto-leave)) 316 | " 317 | ^Move^ ^Keep^ ^Diff^ ^Other^ 318 | ^^-----------^^-------------------^^---------------------^^------- 319 | _n_ext _b_ase _<_: upper/base _C_ombine 320 | _p_rev _u_pper _=_: upper/lower _r_esolve 321 | ^^ _l_ower _>_: base/lower _k_ill current 322 | ^^ _a_ll _R_efine 323 | ^^ _RET_: current _E_diff 324 | " 325 | ("n" smerge-next) 326 | ("p" smerge-prev) 327 | ("b" smerge-keep-base) 328 | ("u" smerge-keep-upper) 329 | ("l" smerge-keep-lower) 330 | ("a" smerge-keep-all) 331 | ("RET" smerge-keep-current) 332 | ("\C-m" smerge-keep-current) 333 | ("<" smerge-diff-base-upper) 334 | ("=" smerge-diff-upper-lower) 335 | (">" smerge-diff-base-lower) 336 | ("R" smerge-refine) 337 | ("E" smerge-ediff) 338 | ("C" smerge-combine-with-next) 339 | ("r" smerge-resolve) 340 | ("k" smerge-kill-current) 341 | ("q" nil "cancel" :color blue)) 342 | 343 | (defhydra hydra-thesis (:color blue) 344 | " 345 | THESIS 346 | " 347 | ("p" sam|thesis-projects "projects") 348 | ("t" sam|thesis-thesis "thesis")) 349 | 350 | (defun sam|thesis-thesis () 351 | "Find file inside thesis folder." 352 | (interactive) 353 | (counsel-find-file "~/these/these")) 354 | 355 | (defhydra hydra-page (:hint nil) 356 | "PAGE" 357 | ("t" forward-page "next") 358 | ("s" backward-page "previous")) 359 | 360 | (bind-keys* 361 | ("C-x [" . hydra-page/backward-page) 362 | ("C-x ]" . hydra-page/forward-page)) 363 | 364 | (provide 'keybindings) 365 | ;;; keybindings.el ends here 366 | -------------------------------------------------------------------------------- /elfeed.org: -------------------------------------------------------------------------------- 1 | * Blogs :elfeed: 2 | ** cs :compsci: 3 | *** rstat :rstat: 4 | **** [[https://rud.is/b/feed/][hrbrmstr]] 5 | **** [[http://blog.jalsalam.com/index.xml][jameel alsalam]] 6 | *** pkg :pkg: 7 | **** [[http://dirk.eddelbuettel.com/cranberries/index.rss][cranberries]] :rstat: 8 | **** [[https://pkgs.racket-lang.org/atom.xml][racket-pkg]] :scheme:racket:lisp: 9 | **** [[http://planet.lisp.org/github.atom][new common lisp repo ]] :cl:lisp: 10 | *** scheme :scheme:lisp: 11 | **** guile :guile: 12 | ***** [[https://wingolog.org/feed/atom][andy wingo]] 13 | ***** [[https://guix-hpc.bordeaux.inria.fr/blog/feed.xml][guix]] 14 | ***** [[http://www.erikedrosa.com/feed.xml][orangeshark]] 15 | *** common lisp :cl:lisp: 16 | **** [[http://lispblog.xach.com/rss][zach beane]] 17 | **** [[http://lispmethods.com/feed.xml][lisp methods]] 18 | *** clojure :clojure: 19 | **** [[https://anmonteiro.com/atom.xml][anmonteiro]] 20 | *** emacs :emacs: 21 | **** [[https://emacs-doctor.com/feed.xml][bastien guerry]] 22 | **** [[http://www.wilfred.me.uk/rss.xml][wilfred hughes]] 23 | **** [[https://oremacs.com/archive/][oremacs]] 24 | **** [[http://nullprogram.com/feed/][nullprogram]] 25 | **** [[http://planet.emacsen.org/atom.xml][planet.emacsen]] 26 | **** [[http://cestlaz.github.io/rss.xml][cestlaz]] 27 | **** [[http://cachestocaches.com/feed/][cachestocaches]] 28 | **** [[https://scripter.co/atom.xml][kaushal modi]] 29 | *** [[https://fedoramagazine.org/feed/][fedora]] :fedora: 30 | *** perl :perl: 31 | **** [[http://perltricks.com/index.xml][perltricks]] 32 | *** c :c: 33 | **** [[https://modelingwithdata.org/modeling.xml][ben klemens]] 34 | ** bio :bio: 35 | *** blogs :blog: 36 | **** [[http://robertlanfear.com/blog/files/rob.lanfear.blog.xml][bob lanfear]] 37 | **** [[https://c2-d2.github.io/hanage-lab/feed.xml][bill hanage lab]] 38 | **** [[https://armchairecology.blog/feed/atom.xml][thimothée poisot]] 39 | **** [[https://brentp.github.io/index.xml][brentp]] 40 | **** [[https://sniadecki.wordpress.com/feed/][et vous n'avez encore rien vu]] 41 | *** papers :papers: 42 | **** [[https://evolbiol.peercommunityin.org/public/rss][PCI Evol Biol]] :ecology:evo: 43 | **** [[https://onlinelibrary.wiley.com/action/showFeed?jc=15585646&type=etoc&feed=rss][wiley evolution ]] :evo: 44 | **** [[http://www.annualreviews.org/action/showFeed?jc=genet&type=etoc&feed=rss][annual rev genet ]] :genet: 45 | **** [[http://feeds.nature.com/nrmicro/rss/current?format=xml][nature reviews microbiology]] :microbio: 46 | **** [[http://feeds.nature.com/nrg/rss/current?format=xml][nature reviews genetics]] :genet: 47 | **** [[http://biorxiv.org/alertsrss][biorxiv]] 48 | **** [[http://onlinelibrary.wiley.com/rss/journal/10.1111/(ISSN)1365-2958][molecular microbiology]] :microbio:biomol: 49 | **** [[http://feeds.feedburner.com/pnas/SMZM][PNAS current issue]] 50 | **** [[http://feeds.feedburner.com/pnas/uSDM][PNAS podcasts]] 51 | **** [[http://feeds.feedburner.com/ProceedingsOfTheNationalAcademyOfSciencesEvolution?format=xml][PNAS Evolution]] :ecology:evo: 52 | **** [[https://www.frontiersin.org/journals/ecology-and-evolution/rss][frontiers in ecology and evolution ]] :ecology: 53 | **** [[https://link.springer.com/search.rss?facet-content-type=Article&facet-journal-id=12064&channel-name=Theory+in+Biosciences][theory in biosciences]] :philo:epistemo: 54 | **** [[https://www.ptpbio.org/longfeed.xml][philosophy, theory and practice in biology]] :philo: 55 | **** [[http://mgen.microbiologyresearch.org/rss/content/journal/mgen/latestfasttrackarticles?fmt=rss][microbial genomics ]] :microbio: 56 | **** [[https://link.springer.com/search.rss?facet-content-type=Article&facet-journal-id=40656&channel-name=History+and+Philosophy+of+the+Life+Sciences][History and Philosophy of the Life Sciences]] :philo:epistemo: 57 | *** bioinfo :bioinfo: 58 | **** [[http://bioinfo-fr.net/feed][bioinfo.fr]] 59 | *** biostat :biostat: 60 | *** [[https://link.springer.com/search.rss?facet-content-type=Article&facet-journal-id=13752&channel-name=Biological+Theory][Biological Theory]] :epistemo: 61 | ** news :news: 62 | *** [[https://www.mediapart.fr/articles/feed][mediapart]] 63 | *** [[https://theconversation.com/fr/articles.atom][the conversation]] 64 | *** [[https://indymedia.org/global.1-0.rss][indymedia]] 65 | *** [[http://www.acrimed.org/spip.php?page=backend][acrimed ]] :media: 66 | *** [[https://www.amnesty.org/fr/rss/][amnesty international]] 67 | *** [[https://www.hrw.org/fr/rss/news][human rights watch]] 68 | *** [[https://knoema.fr/tags/Viz%2520of%2520the%2520Day/rss][knomea viz of the day]] 69 | *** [[https://www.revue-ballast.fr/feed/][ballast]] 70 | ** éditions :éditions: 71 | *** [[http://editionslibertalia.com/spip.php?page=backend][libertalia]] 72 | *** [[TODO ][éditions cnt-rp]] 73 | *** [[http://lafabrique.fr/feed/][la fabrique]] 74 | ** contestations :contestations: 75 | *** [[https://france.attac.org/spip.php?page=backend][attac]] 76 | *** [[http://www.kedistan.net/feed/][kedistan]] 77 | *** [[https://www.laquadrature.net/fr/rss.xml][quadrature du net]] 78 | *** syndicats :syndic: 79 | **** [[http://www.sudeducation.org/spip.php?page=backend][sud éducation]] 80 | ** libertaire :anar: 81 | *** [[http://almtoile.free.fr/data/fr-news.xml][amicale laïque de la montagne]] 82 | *** [[https://robertgraham.wordpress.com/feed/][robert graham]] 83 | *** [[http://www.monde-libertaire.fr/flux_rss.rss][le monde libertaire]] 84 | *** [[https://chomsky.info/feed/][noam chomsky]] 85 | *** [[http://www.zones-subversives.com/rss][zones subversives]] 86 | *** [[https://rebellyon.info/spip.php?page=backend][rebellyon]] 87 | *** [[http://www.desobeir.net/feed/][les désobéissants]] 88 | *** [[http://www.alterjt.tv/feed/][alterjt]] 89 | *** [[http://www.contretemps.eu/feed/][contretemps]] 90 | *** [[http://www.alternativelibertaire.org/spip.php?page=backend&][alternatives libertaires]] 91 | *** [[http://www.lesmutins.org/spip.php?page=backend][les mutins de pangée]] 92 | *** [[http://nbaillargeon.blogspot.com/feeds/posts/default][normand baillargeon]] 93 | *** [[http://cqfd-journal.org/spip.php?page=backend][ce qu'il faut détruire]] 94 | *** [[http://www.autrefutur.net/spip.php?page=backend][autre futur]] 95 | *** [[http://www.hugueslenoir.fr/feed/][hugues lenoir ]] :ecole: 96 | ** pédagogies :ecole: 97 | *** [[http://www.questionsdeclasses.org/reac/spip.php?page=backend][questions de classes]] 98 | ** communisme :communisme: 99 | *** [[http://www.reseau-salariat.info/f5f5e7055e793213f853ccaf95e95e8c.rss][livres réseau salariat]] 100 | ** prof :prof: 101 | *** [[http://adelb.univ-lyon1.fr/direct/index.jsp?projectId=1&ShowPianoWeeks=true&Cas=samuel.barreto&resources=48540&displayConfName=_DirectPlanning&days=0&weeks=&from=edt&ticket=ST-3484471-EPLv2bRVErGP274QGeNY-cas.univ-lyon1.fr][l2 tp rstat]] 102 | ** sciences humaines :humanités: 103 | *** sciences sociales :socio: 104 | **** [[science][revue de la régulation]] 105 | **** [[https://www.erudit.org/fr/rss.xml][érudit]] 106 | **** [[http://www.arss.fr/feed/][arss]] 107 | **** [[http://journals.sagepub.com/action/showFeed?ui=0&mi=ehikzz&ai=2b4&jc=crsb&type=etoc&feed=rss][critical sociology]] 108 | **** [[http://journals.sagepub.com/action/showFeed?ui=0&mi=ehikzz&ai=2b4&jc=sssb&type=etoc&feed=rss][social studies of science]] 109 | **** [[https://www.tandfonline.com/action/showFeed?type=etoc&feed=rss&jc=tsep20][social epistemoloy ]] :epistemo: 110 | **** [[https://www.cambridge.org/core/rss/product/id/5893D44315DDC6A96C30BA24A2B2D6C8][Archives Européennes de Sociologie]] 111 | *** [[http://www.laviedesidees.fr/spip.php?page=backend][la vie des idées]] 112 | Un journal du collège de France. 113 | *** philo :philo: 114 | **** [[http://radiofrance-podcast.net/podcast09/rss_10467.xml][les chemins de la philo ]] :podcast: 115 | **** [[https://link.springer.com/search.rss?facet-content-type=Article&facet-journal-id=13194&channel-name=European+Journal+for+Philosophy+of+Science][European Journal for Philosophy of Science]] :papers: 116 | **** [[http://www.journals.uchicago.edu/action/showFeed?type=etoc&feed=rss&jc=phos][Philosophy of Science Association]] :papers: 117 | **** [[https://link.springer.com/search.rss?facet-content-type=Article&facet-journal-id=10539&channel-name=Biology+%26+Philosophy][Philosophy of Biology ]] :papers:bio: 118 | **** [[https://link.springer.com/search.rss?facet-content-type=Article&facet-journal-id=10838&channel-name=Journal+for+General+Philosophy+of+Science][Journal for General Philosophy of Science]] :papers: 119 | *** [[https://journals.openedition.org/philosophiascientiae/backend?format=rssnumeros][Philosophia Scientiæ ]] :bio: 120 | *** [[https://link.springer.com/search.rss?facet-content-type=Article&facet-journal-id=10441&channel-name=Acta+Biotheoretica][Acta Biotheoretica]] :bio: 121 | *** [[https://link.springer.com/search.rss?facet-content-type=Article&facet-journal-id=11422&channel-name=Cultural+Studies+of+Science+Education][Cultural Studies of Science Education]] 122 | *** [[http://journals.sagepub.com/action/showFeed?ui=0&mi=ehikzz&ai=2b4&jc=sthd&type=etoc&feed=rss][Science, Technology and Human Values ]] :epistemo: 123 | ** podcasts :podcast: 124 | *** [[http://radiofrance-podcast.net/podcast09/rss_13957.xml][conversations scientifiques]] 125 | *** [[http://radiofrance-podcast.net/podcast09/rss_11921.xml][cours du collège de france]] 126 | *** [[http://radiofrance-podcast.net/podcast09/rss_16274.xml][matières à penser]] 127 | -------------------------------------------------------------------------------- /org.el: -------------------------------------------------------------------------------- 1 | ;;; * Licence 2 | 3 | ;; Copyright (C) 2017 Samuel Barreto 4 | ;; 5 | ;; This program is free software; you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation; either version 2 of the License, or 8 | ;; (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program; if not, write to the Free Software 17 | ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | ;; 19 | 20 | ;;; Code 21 | 22 | (use-package org 23 | :defer t 24 | :ensure org-plus-contrib 25 | :commands (org-mode 26 | org-capture 27 | org-store-link) 28 | :mode (("\\.org\\'" . org-mode) 29 | ("README\\'" . org-mode)) 30 | 31 | :bind* 32 | (("C-c C-w" . org-refile) 33 | ("C-c C-l" . org-store-link) 34 | ("C-M-c" . org-capture)) 35 | 36 | :config 37 | 38 | 39 | ;;;; BABEL 40 | 41 | (defun org-babel-tangle-all-block-same-file () 42 | "tangle all blocks which belong to the same file." 43 | (interactive) 44 | (let ((current-prefix-arg '(16))) 45 | (call-interactively #'org-babel-tangle))) 46 | 47 | ;;;; attachment system 48 | 49 | (setq org-attach-method 'lns) ; make symlink instead of hard copy 50 | (setq org-attach-archive-delete t) ; delete attachment when archiving entry 51 | (setq org-attach-directory ".attach/") ; change folder from data/ to .attach/ 52 | 53 | ;;;; gtd with org 54 | 55 | (setq 56 | org-modules '(org-crypt) 57 | org-tags-column 80 ; aligne les tags très loin sur la droite 58 | org-hide-block-startup t ; cache les blocks par défaut. 59 | org-refile-targets '(("~/these/meta/nb/These.org" :level . 2) 60 | ("~/Org/TODO" :level . 2) 61 | ("~/Org/TODO" :level . 1) 62 | ("~/these/meta/nb/maybe.org" :level . 1) 63 | ("~/Org/maybe.org" :level . 1)) 64 | org-default-notes-file "~/Org/notes.org") 65 | 66 | (setq 67 | org-capture-templates 68 | '(("t" "these - Todo" entry (file+headline "~/these/meta/nb/These.org" "InBox" ) "** %?\n%U") 69 | ("l" "these - Lab" entry (file+olp+datetree "~/these/meta/nb/journal.org" ) "* %(hour-minute-timestamp) %?%^g\n") 70 | ("r" "these - tickleR" entry (file+headline "~/these/meta/nb/These.org" "Tickler" ) "** %?\n%T") 71 | ("a" "these - rapport" entry (file+headline "~/these/these/notes-manuscrit.org" "Collecte" ) "** %?\n%U") 72 | ("c" "perso - Collecte" entry (file+headline "~/Org/TODO" "Collecte" ) "** %?\n%U\n") 73 | ("n" "perso - Notes" entry (file+olp+datetree "~/Org/journal.org" ) "* %(hour-minute-timestamp) %?%^g\n"))) 74 | 75 | (setq org-todo-keywords 76 | '((sequence "TODO(t)" "WAIT(w)" "|" "DONE(d)" "CANCELLED(c)"))) 77 | 78 | ;; prevent an item to switch to completed if an item below it is not: 79 | (setq org-enforce-todo-dependencies t) 80 | (defun hour-minute-timestamp () 81 | (format-time-string "%H:%M" (current-time))) 82 | 83 | (add-to-list 'org-modules 'org-mac-iCal) 84 | 85 | ;; (setq org-link-abbrev-alist nil) 86 | (append-to-list! 87 | 'org-link-abbrev-alist 88 | '(("wiki" . "https://en.wikipedia.org/wiki/%h") 89 | ("gsc" . "https://scholar.google.com/scholar?q=%h") 90 | ("sep" . "https://plato.stanford.edu/search/search?query=%h") 91 | ("etym" . "http://www.cnrtl.fr/etymologie/%h") 92 | ("bu" . "http://hola.univ-lyon1.fr/ipac20/ipac.jsp?menu=search&aspect=basic_search&npp=10&ipp=20&spp=20&profile=scd&ri=&index=.GK&term=%h&terms=&valider=Ok"))) 93 | 94 | (setq org-crypt-disable-auto-save t) 95 | 96 | ;;;; src block and babel 97 | 98 | (setq 99 | org-src-preserve-indentation t 100 | 101 | ;;;; footnotes 102 | 103 | org-footnote-auto-adjust t 104 | org-footnote-define-inline nil 105 | org-footnote-fill-after-inline-note-extraction t 106 | org-footnote-section nil 107 | 108 | ;;;; export 109 | 110 | org-export-with-todo-keywords nil 111 | org-export-default-language "fr" 112 | org-export-backends '(ascii html icalendar latex md koma-letter)) 113 | (setq org-export-with-tags nil) 114 | 115 | 116 | (setq org-startup-with-inline-images t) 117 | (setq org-startup-indented t) 118 | 119 | ;; rescale images to 400px if no with attribute is set (see 120 | ;; https://lists.gnu.org/archive/html/emacs-orgmode/2012-08/msg01402.html) 121 | (setq org-image-actual-width '(400)) 122 | 123 | ;;; Keybindings 124 | 125 | (general-define-key 126 | :keymaps 'org-mode-map 127 | "s-e" 'org-babel-tangle-all-block-same-file 128 | "s-l" 'org-latex-export-to-latex 129 | "C-c ." 'org-time-stamp 130 | "C-c M-i" 'org-insert-link 131 | ;; mnémotechnique : iMage (i is for imenu already) 132 | "C-c m" 'hydra-org-image/body 133 | "C-c $" 'hydra-org-archive/body) 134 | 135 | (general-define-key 136 | :keymaps 'org-mode-map 137 | :prefix "C-c e" 138 | "d" 'org-decrypt-entry 139 | "e" 'org-encrypt-entry 140 | "s" 'org-sparse-tree 141 | "t" 'org-tags-sparse-tree) 142 | 143 | (defhydra hydra-org-archive (:color red :columns 1) 144 | ("a" org-archive-subtree "archive") 145 | ("n" org-next-visible-heading "next") 146 | ("t" org-next-visible-heading "next") 147 | ("p" org-previous-visible-heading "previous") 148 | ("s" org-previous-visible-heading "previous")) 149 | 150 | (defhydra hydra-org-image (:color red :hint nil) 151 | " 152 | Display inline images ? 153 | _y_es _n_o _t_oggle 154 | " 155 | ("y" org-display-inline-images) 156 | ("n" org-remove-inline-images) 157 | ("t" org-toggle-inline-images))) 158 | 159 | ;;; Extensions 160 | 161 | (use-package org-agenda 162 | :ensure org-plus-contrib 163 | :bind* (("C-c a" . org-agenda)) 164 | :config 165 | 166 | ;; inspired from http://pages.sachachua.com/.emacs.d/Sacha.html#orgce6f46d 167 | (setq org-agenda-files 168 | (list "~/Org/TODO" 169 | "~/these/meta/nb/These.org")) 170 | 171 | (setq org-capture-use-agenda-date t) ; when press k from agenda, use agenda date. 172 | (setq org-agenda-span 7) 173 | (setq org-agenda-tags-column -100) ; take advantage of the screen width 174 | (setq org-agenda-skip-scheduled-if-done t) 175 | (setq org-agenda-skip-deadline-if-done t) 176 | (setq org-deadline-warning-days 4) 177 | (setq org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled) 178 | 179 | ;; agenda start on mondays 180 | (setq org-agenda-start-on-weekday 1) 181 | 182 | (setq org-agenda-custom-commands 183 | '(("c" "Simple agenda view" 184 | ((agenda "") 185 | (alltodo ""))) 186 | ("l" "Lab" tags-todo "@these" 187 | ((org-agenda-files '("~/these/meta/nb/These.org")) 188 | (org-agenda-sorting-strategy '(timestamp-up priority-up))) 189 | ("~/these/meta/nb/These.html")) 190 | ("p" "perso" tags "@perso" 191 | ((org-agenda-sorting-strategy '(ts-up priority-up)))))) 192 | 193 | (setq org-agenda-include-diary nil)) 194 | 195 | (use-package ob-R 196 | :ensure org-plus-contrib 197 | :commands (org-babel-execute:R)) 198 | 199 | (use-package ob-perl 200 | :ensure org-plus-contrib 201 | :commands (org-babel-execute:perl)) 202 | 203 | (use-package ob-python 204 | :ensure org-plus-contrib 205 | :commands (org-babel-execute:python)) 206 | 207 | (use-package ob-shell 208 | :ensure org-plus-contrib 209 | :commands (org-babel-execute:shell)) 210 | 211 | (use-package ob-emacs-lisp 212 | :ensure org-plus-contrib 213 | :commands (org-babel-execute:emacs-lisp)) 214 | 215 | (use-package ob-dot 216 | :ensure org-plus-contrib 217 | :commands (org-babel-execute:dot)) 218 | 219 | (use-package ob-makefile 220 | :ensure org-plus-contrib 221 | :commands (org-babel-execute:makefile)) 222 | 223 | (use-package ox-latex 224 | :ensure org-plus-contrib 225 | :commands (org-latex-export-as-latex 226 | org-latex-export-to-latex) 227 | :config 228 | 229 | (setq org-latex-listings 'minted) 230 | (add-to-list 'org-latex-packages-alist '("" "listings")) 231 | (add-to-list 'org-latex-packages-alist '("" "color")) 232 | (add-to-list 'org-latex-packages-alist '("newfloat" "minted")) 233 | 234 | (setq 235 | ;; moyen d'export latex 236 | org-latex-pdf-process 237 | (list "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f" 238 | "biber %f" 239 | "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f") 240 | org-latex-image-default-width "1\\linewidth" 241 | org-highlight-latex-and-related '(latex entities) ; colore les macro LaTeX 242 | ;; tufte-handout class by default. 243 | org-latex-default-class "tant" 244 | ;; default package list with sensible options 245 | org-latex-default-packages-alist nil 246 | org-latex-listings-langs 247 | '((emacs-lisp "Lisp") (lisp "Lisp") (clojure "Lisp") (c "C") (cc "C++") (fortran "fortran") 248 | (perl "Perl") (cperl "Perl") (python "Python") (ruby "Ruby") (html "HTML") 249 | (xml "XML") (tex "TeX") (latex "[LaTeX]TeX") (shell-script "bash") (gnuplot "Gnuplot") 250 | (ocaml "Caml") (caml "Caml") (sql "SQL") (sqlite "sql") (makefile "make") 251 | (R "r")) 252 | ;; files extensions that org considers as latex byproducts. 253 | org-latex-logfiles-extensions 254 | '("aux" "bcf" "blg" "fdb_latexmk" "fls" "figlist" "idx" 255 | "log" "nav" "out" "ptc" "run.xml" "snm" "toc" "vrb" "xdv" "bbl") 256 | org-latex-minted-langs '((emacs-lisp "common-lisp") 257 | (cc "c++") 258 | (cperl "perl") 259 | (shell-script "bash") 260 | (caml "ocaml") 261 | (python "python") 262 | (ess "R")) 263 | org-latex-remove-logfiles t 264 | org-src-fontify-natively t 265 | org-latex-table-caption-above nil 266 | org-latex-tables-booktabs t) 267 | 268 | (append-to-list! 269 | 'org-latex-classes 270 | '(("tant" 271 | "\\documentclass[twoside,a4paper,10pt]{tant} 272 | % \\addbibresource{reference.bib} 273 | " 274 | ;; ("\\part{%s}" . "\\part*{%s}") 275 | ;; ("\\chapter{%s}" . "\\chapter*{%s}") 276 | ("\\section{%s}" . "\\section*{%s}") 277 | ("\\subsection{%s}" . "\\subsection*{%s}")) 278 | ("tufte-book" 279 | "\\documentclass[a4paper, sfsidenotes, justified, notitlepage]{tufte-book} 280 | \\input{/Users/samuelbarreto/.templates/tufte-book.tex}" 281 | ("\\part{%s}" . "\\part*{%s}") 282 | ("\\chapter{%s}" . "\\chapter*{%s}") 283 | ("\\section{%s}" . "\\section*{%s}") 284 | ("\\subsection{%s}" . "\\subsection*{%s}")) 285 | ("tufte-handout" 286 | "\\documentclass[a4paper, justified]{tufte-handout} 287 | \\input{/Users/samuelbarreto/.templates/tufte-handout.tex}" 288 | ("\\section{%s}" . "\\section*{%s}") 289 | ("\\subsection{%s}" . "\\subsection*{%s}")) 290 | ("rapport" "\\documentclass[11pt, oneside]{scrartcl}" 291 | ("\\section{%s}" . "\\section*{%s}") 292 | ("\\subsection{%s}" . "\\subsection*{%s}") 293 | ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) 294 | ("beamer" "\\documentclass[presentation]{beamer}" 295 | ("\\section{%s}" . "\\section*{%s}") 296 | ("\\subsection{%s}" . "\\subsection*{%s}") 297 | ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) 298 | ("journal" 299 | "\\documentclass[9pt, oneside, twocolumn]{scrartcl} 300 | \\input{/Users/samuelbarreto/.templates/journal.tex}" 301 | ("\\part{%s}" . "\\section*{%s}") 302 | ("\\section{%s}" . "\\section*{%s}") 303 | ("\\subsection{%s}" . "\\subsection*{%s}") 304 | ("\\subsubsection{%s}" . "\\subsubsection*{%s}") 305 | ("\\paragraph{%s}" . "\\paragraph*{%s}"))))) 306 | 307 | (use-package ox-twbs 308 | :ensure t 309 | :after org 310 | :commands (org-twbs-publish-to-html)) 311 | 312 | (use-package ox-tufte 313 | :ensure t 314 | :after org 315 | :commands (org-tufte-export-to-file)) 316 | 317 | (use-package org-bullets 318 | :ensure t 319 | :hook 320 | (org-mode . org-bullets-mode) 321 | :config 322 | (setq org-bullets-bullet-list '("➡" "➠" "➟" "➝" "↪"))) 323 | 324 | (use-package org-indent 325 | :ensure org-plus-contrib 326 | :diminish "" 327 | :after org) 328 | 329 | (use-package ox-pandoc 330 | :ensure t 331 | :after org 332 | :commands (org-pandoc-export)) 333 | 334 | (use-package ox-gfm 335 | :ensure t 336 | :after org 337 | :commands (org-gfm-export-to-markdown)) 338 | 339 | (use-package org-download 340 | :ensure t 341 | :after org 342 | :config 343 | 344 | (defvar sam|org-download-dir "./img/" 345 | "Default folder to place `org-download' captures in.") 346 | 347 | (defun sam|img-dir () 348 | (let (target sam|org-download-dir) 349 | (cond ((file-directory-p target) target) 350 | (t (make-directory target) target)))) 351 | 352 | (setq-default org-download-heading-lvl nil) 353 | (setq-default org-download-image-dir sam|org-download-dir) 354 | (when (eq system-type 'darwin) 355 | (setq-default org-download-screenshot-method "screencapture -i %s")) 356 | 357 | (general-define-key 358 | :keymaps 'org-mode-map 359 | :prefix "C-c y" 360 | "e" 'org-download-edit 361 | "i" 'org-download-image 362 | "s" 'org-download-screenshot 363 | "y" 'org-download-yank 364 | "k" 'org-download-delete)) 365 | 366 | (use-package org-web-tools 367 | :ensure t 368 | :commands (org-web-tools-insert-link-for-url 369 | org-web-tools-insert-web-page-as-entry 370 | org-web-tools-read-url-as-org 371 | org-web-tools-convert-links-to-page-entries)) 372 | -------------------------------------------------------------------------------- /functions.el: -------------------------------------------------------------------------------- 1 | ;;; Personal Functions 2 | ;; 3 | 4 | ;;; * Licence 5 | 6 | ;; Copyright (C) 2017 Samuel Barreto 7 | ;; 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation; either version 2 of the License, or 11 | ;; (at your option) any later version. 12 | ;; 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | ;; 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program; if not, write to the Free Software 20 | ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | ;; 22 | 23 | 24 | 25 | ;;; * Code 26 | 27 | (defun sam--revert-buffer-no-confirm () 28 | "Revert buffer without confirmation." 29 | (interactive) 30 | (revert-buffer t t)) 31 | 32 | (defun sam--insert-timestamp () 33 | "Insert a quick timestamp." 34 | (interactive) 35 | (insert (format "%s" (format-time-string "%Y-%m-%d" (current-time))))) 36 | 37 | (defun sam--duplicate-line () 38 | "Duplicate the line containing point." 39 | (interactive) 40 | (save-excursion 41 | (let (line-text) 42 | (goto-char (line-beginning-position)) 43 | (let ((beg (point))) 44 | (goto-char (line-end-position)) 45 | (setq line-text (buffer-substring beg (point)))) 46 | (if (eobp) 47 | (insert ?\n) 48 | (forward-line)) 49 | (open-line 1) 50 | (insert line-text)))) 51 | 52 | (defun sam|comment-or-uncomment-region-or-line () 53 | "Comments or uncomments the region or the current line if there's no active region." 54 | (interactive) 55 | (let (beg end) 56 | (if (region-active-p) 57 | (setq beg (region-beginning) end (region-end)) 58 | (setq beg (line-beginning-position) end (line-end-position))) 59 | (comment-or-uncomment-region beg end))) 60 | 61 | (defun sam|switch-to-other-buffer () 62 | "Switch to other buffer" 63 | (interactive) 64 | (switch-to-buffer (other-buffer))) 65 | 66 | (defun sam--eval-current-form-sp (&optional arg) 67 | "Call `eval-last-sexp' after moving out of one level of 68 | parentheses. Will exit any strings and/or comments first. 69 | Requires smartparens because all movement is done using 70 | `sp-up-sexp'. An optional ARG can be used which is passed to 71 | `sp-up-sexp' to move out of more than one sexp." 72 | (interactive "p") 73 | (require 'smartparens) 74 | (save-excursion 75 | (let ((max 10)) 76 | (while (and (> max 0) 77 | (sp-point-in-string-or-comment)) 78 | (decf max) 79 | (sp-up-sexp))) 80 | (sp-up-sexp arg) 81 | (call-interactively 'eval-last-sexp))) 82 | 83 | ;; from https://github.com/syl20bnr/spacemacs/ 84 | (defun sam|open-in-external-app () 85 | "Open current file in external application." 86 | (interactive) 87 | (let ((file-path (if (eq major-mode 'dired-mode) 88 | (dired-get-file-for-visit) 89 | (buffer-file-name)))) 90 | (if file-path 91 | (shell-command (format "open \"%s\"" file-path)) 92 | (message "No file associated to this buffer.")))) 93 | 94 | 95 | ;;; Blog related functions 96 | ;; from https://blog.tohojo.dk/2015/10/integrating-hugo-into-emacs.html 97 | 98 | (setq hugo-base-dir "~/blog/samuel-blog/" 99 | hugo-buffer "*hugo*") 100 | 101 | (defun hugo-new-post () 102 | "This function asks for the title of the new post, generates a 103 | filename for it by lower-casing the title and replacing all 104 | special characters with hyphens, then runs hugo new to create the 105 | posting. Finally, the file is opened and the correct title is 106 | inserted in place of the one Hugo generates from the file name." 107 | (interactive) 108 | (let* ((title (read-from-minibuffer "Title: ")) 109 | (filename 110 | (concat "post/" 111 | (read-from-minibuffer 112 | "Filename: " 113 | (replace-regexp-in-string 114 | "-\\.md" ".md" 115 | (concat (downcase (replace-regexp-in-string "[^a-z0-9]+" "-" title)) ".md"))))) 116 | (path (concat hugo-base-dir "content/" filename))) 117 | (if (file-exists-p path) 118 | (message "File already exists!") 119 | (hugo-command "new" filename) 120 | (find-file path) 121 | (hugo-replace-key "title" title) 122 | (goto-char (point-max)) 123 | (save-buffer)))) 124 | 125 | (defun hugo-command (&rest args) 126 | (let ((default-directory (expand-file-name hugo-base-dir))) 127 | (apply 'call-process "hugo" nil hugo-buffer t args))) 128 | 129 | (defun hugo-replace-key (key val) 130 | (save-excursion 131 | (goto-char (point-min)) 132 | ; quoted value 133 | (if (and (re-search-forward (concat key " = \"") nil t) 134 | (re-search-forward "[^\"]+" (line-end-position) t)) 135 | (or (replace-match val) t) ; ensure we return t 136 | ; unquoted value 137 | (when (and (re-search-forward (concat key " = ") nil t) 138 | (re-search-forward ".+" (line-end-position) t)) 139 | (or (replace-match val) t))))) 140 | 141 | (defun hugo-server (&optional arg) 142 | "This simply spawn the Hugo server process and attaches it to 143 | the defined Hugo buffer – or kills it if it is already 144 | running. The server is run with the --buildDrafts --watch -d dev 145 | command line options, which causes draft posts to also be built, 146 | turns on watch mode, and uses a separate directory for the 147 | compiled files (so as not to interfere with publishing). If run 148 | without a prefix argument, this function will also open a browser 149 | pointing to the Hugo localhost server." 150 | (interactive "P") 151 | (let* ((default-directory (concat (expand-file-name hugo-base-dir) "/")) 152 | (proc (get-buffer-process hugo-buffer))) 153 | (if (and proc (process-live-p proc)) 154 | (progn (interrupt-process proc) 155 | (message "Stopped Hugo server")) 156 | (start-process "hugo" hugo-buffer "hugo" "server" "--buildDrafts" "--watch" "-d" "dev") 157 | (message "Started Hugo server") 158 | (unless arg 159 | (browse-url "http://localhost:1313/"))))) 160 | 161 | (defun hugo-publish () 162 | (interactive) 163 | (let* ((default-directory (concat (expand-file-name hugo-base-dir) "/"))) 164 | (when (call-process "bash" nil hugo-buffer t "./upload.sh") 165 | (message "Blog published")))) 166 | 167 | (defun hugo-undraft () 168 | (interactive) 169 | (when (and (hugo-replace-key "date" (iso-timestamp)) 170 | (hugo-replace-key "draft" "false")) 171 | (save-buffer) 172 | (message "Removed draft status and updated timestamp"))) 173 | 174 | (defun iso-timestamp () 175 | (concat (format-time-string "%Y-%m-%dT%T") 176 | ((lambda (x) (concat (substring x 0 3) ":" (substring x 3 5))) 177 | (format-time-string "%z")))) 178 | 179 | 180 | ;;;; correct indentation with keywords 181 | ;; 182 | ;; A redefinition of lisp-indent-function to make it respect sexp that start with a keyword 183 | ;; (:keymap patate 184 | ;; pamplemousse) 185 | ;; is the default behavior while 186 | ;; (:keymap patate 187 | ;; pamplemousse) 188 | ;; is the expected behavior 189 | ;; see (https://github.com/Fuco1/.emacs.d/blob/af82072196564fa57726bdbabf97f1d35c43b7f7/site-lisp/redef.el#L20-L94) 190 | 191 | (defun Fuco1/lisp-indent-function (indent-point state) 192 | "This function is the normal value of the variable `lisp-indent-function'. 193 | The function `calculate-lisp-indent' calls this to determine 194 | if the arguments of a Lisp function call should be indented specially. 195 | 196 | INDENT-POINT is the position at which the line being indented begins. 197 | Point is located at the point to indent under (for default indentation); 198 | STATE is the `parse-partial-sexp' state for that position. 199 | 200 | If the current line is in a call to a Lisp function that has a non-nil 201 | property `lisp-indent-function' (or the deprecated `lisp-indent-hook'), 202 | it specifies how to indent. The property value can be: 203 | 204 | * `defun', meaning indent `defun'-style 205 | \(this is also the case if there is no property and the function 206 | has a name that begins with \"def\", and three or more arguments); 207 | 208 | * an integer N, meaning indent the first N arguments specially 209 | (like ordinary function arguments), and then indent any further 210 | arguments like a body; 211 | 212 | * a function to call that returns the indentation (or nil). 213 | `lisp-indent-function' calls this function with the same two arguments 214 | that it itself received. 215 | 216 | This function returns either the indentation to use, or nil if the 217 | Lisp function does not specify a special indentation." 218 | (let ((normal-indent (current-column)) 219 | (orig-point (point))) 220 | (goto-char (1+ (elt state 1))) 221 | (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t) 222 | (cond 223 | ;; car of form doesn't seem to be a symbol, or is a keyword 224 | ((and (elt state 2) 225 | (or (not (looking-at "\\sw\\|\\s_")) 226 | (looking-at ":"))) 227 | (if (not (> (save-excursion (forward-line 1) (point)) 228 | calculate-lisp-indent-last-sexp)) 229 | (progn (goto-char calculate-lisp-indent-last-sexp) 230 | (beginning-of-line) 231 | (parse-partial-sexp (point) 232 | calculate-lisp-indent-last-sexp 0 t))) 233 | ;; Indent under the list or under the first sexp on the same 234 | ;; line as calculate-lisp-indent-last-sexp. Note that first 235 | ;; thing on that line has to be complete sexp since we are 236 | ;; inside the innermost containing sexp. 237 | (backward-prefix-chars) 238 | (current-column)) 239 | ((and (save-excursion 240 | (goto-char indent-point) 241 | (skip-syntax-forward " ") 242 | (not (looking-at ":"))) 243 | (save-excursion 244 | (goto-char orig-point) 245 | (looking-at ":"))) 246 | (save-excursion 247 | (goto-char (+ 2 (elt state 1))) 248 | (current-column))) 249 | (t 250 | (let ((function (buffer-substring (point) 251 | (progn (forward-sexp 1) (point)))) 252 | method) 253 | (setq method (or (function-get (intern-soft function) 254 | 'lisp-indent-function) 255 | (get (intern-soft function) 'lisp-indent-hook))) 256 | (cond ((or (eq method 'defun) 257 | (and (null method) 258 | (> (length function) 3) 259 | (string-match "\\`def" function))) 260 | (lisp-indent-defform state indent-point)) 261 | ((integerp method) 262 | (lisp-indent-specform method state 263 | indent-point normal-indent)) 264 | (method 265 | (funcall method indent-point state)))))))) 266 | 267 | (defun sam|iterm-here () 268 | "Go to present working dir and focus iterm" 269 | (interactive) 270 | (let ((dir (shell-quote-argument (expand-file-name default-directory)))) 271 | (do-applescript 272 | (concat 273 | " tell application \"iTerm2\"\n" 274 | " tell the current session of current window\n" 275 | (format " write text \"cd %s\" \n" 276 | ;; string escaping madness for applescript 277 | (replace-regexp-in-string "\\\\" "\\\\\\\\" dir)) 278 | " end tell\n" 279 | " end tell\n" 280 | " do shell script \"open -a iTerm\"\n")))) 281 | 282 | (defun sam|iterm-focus () 283 | (interactive) 284 | (do-applescript 285 | " do shell script \"open -a iTerm\"\n")) 286 | 287 | (defun sam|finder-here () 288 | (interactive) 289 | (let* ((dir default-directory) 290 | (scr (format " do shell script \"open %s\"\n" dir))) 291 | (do-applescript scr))) 292 | 293 | ;; adapted from 294 | ;; http://emacs.stackexchange.com/questions/202/close-all-dired-buffers 295 | (defun kill-diff-buffers () 296 | (interactive) 297 | (mapc (lambda (buffer) 298 | (when (member (buffer-local-value 'major-mode buffer) 299 | '(diff-mode magit-diff-mode magit-process-mode)) 300 | (kill-buffer buffer))) 301 | (buffer-list))) 302 | 303 | ;; syntax highlight hugo src block 304 | (font-lock-add-keywords 305 | 'markdown-mode 306 | '(("src\\|{{< figure\\|caption\\|link\\|>}}" . font-lock-keyword-face))) 307 | 308 | (defvar counsel-colors--solarized-alist 309 | '(("brblack" . "#002b36") 310 | ("black" . "#073642") 311 | ("brgreen" . "#586e75") 312 | ("bryellow" . "#657b83") 313 | ("brblue" . "#839496") 314 | ("brcyan" . "#93a1a1") 315 | ("white" . "#eee8d5") 316 | ("brwhite" . "#fdf6e3") 317 | ("yellow" . "#b58900") 318 | ("brred" . "#cb4b16") 319 | ("red" . "#dc322f") 320 | ("magenta" . "#d33682") 321 | ("brmagenta" . "#6c71c4") 322 | ("blue" . "#268bd2") 323 | ("cyan" . "#2aa198") 324 | ("green" . "#859900")) 325 | "This a list of colors defined by the Solarized color 326 | palette.") 327 | 328 | 329 | (defun counsel-colors-solarized () 330 | "Show a list of all solarized colors. 331 | 332 | You can insert or kill the name or the hexadecimal rgb value of the 333 | selected candidate." 334 | (interactive) 335 | (let ((minibuffer-allow-text-properties t)) 336 | (ivy-read "%d Solarized color: " 337 | (mapcar (lambda (x) 338 | (concat 339 | (propertize 340 | (format "%-25s" (car x))) 341 | (propertize 342 | (format "%8s " (cdr x)) 343 | 'face (list :foreground (car x))) 344 | (propertize 345 | (format "%10s" " ") 346 | 'face (list :background (cdr x))))) 347 | counsel-colors--solarized-alist) 348 | :require-match t 349 | :action (lambda (x) (insert (substring-no-properties x 26 33))) 350 | :caller 'counsel-colors-solarized 351 | :sort t))) 352 | 353 | ;; Stefan Monnier . It is the opposite of fill-paragraph 354 | (defun sam|unfill-paragraph (&optional region) 355 | "Takes a multi-line paragraph and makes it into a single line of text." 356 | (interactive (progn (barf-if-buffer-read-only) '(t))) 357 | (let ((fill-column (point-max)) 358 | ;; This would override `fill-column' if it's an integer. 359 | (emacs-lisp-docstring-fill-column t)) 360 | (fill-paragraph nil region))) 361 | 362 | ;; this function is used to append multiple elements to the list 'ox-latex 363 | (defun append-to-list! (list-var elements) 364 | "Append ELEMENTS to the end of LIST-VAR. The return value is the new value of LIST-VAR." 365 | (unless (consp elements) (error "ELEMENTS must be a list")) 366 | (let ((list (symbol-value list-var))) 367 | (if list 368 | (setcdr (last list) elements) 369 | (set list-var elements))) 370 | (symbol-value list-var)) 371 | 372 | 373 | ;;; lab notebook 374 | (setq journal-base-dir "~/these/meta/journal/") 375 | 376 | (defun journal-command (&rest args) 377 | (let ((default-directory (expand-file-name journal-base-dir))) 378 | (apply 'call-process "hugo" nil hugo-buffer t args))) 379 | 380 | (defun journal-post () 381 | (interactive) 382 | (let* ((filename 383 | (concat "post/" 384 | (format-time-string "%Y-%m-%d" (current-time)) 385 | ".md")) 386 | (path (concat journal-base-dir "content/" filename))) 387 | (if (file-exists-p path) 388 | (find-file path) 389 | (journal-command "new" filename) 390 | (find-file path) 391 | (goto-char (point-min)) 392 | (save-buffer)))) 393 | 394 | (defun sam|delete-to-sentence-beg () 395 | (interactive) 396 | (save-excursion 397 | (let ((end (point))) 398 | (backward-sentence) 399 | (delete-region (point) end)))) 400 | 401 | ;; from http://endlessparentheses.com/ispell-and-abbrev-the-perfect-auto-correct.html 402 | (defun sam--simple-get-word () 403 | (car-safe (save-excursion (ispell-get-word nil)))) 404 | 405 | (defun modi/multi-pop-to-mark (orig-fun &rest args) 406 | "Call ORIG-FUN until the cursor moves. 407 | Try the repeated popping up to 10 times." 408 | (let ((p (point))) 409 | (dotimes (i 10) 410 | (when (= p (point)) 411 | (apply orig-fun args))))) 412 | 413 | (advice-add 'pop-to-mark-command :around 414 | #'modi/multi-pop-to-mark) 415 | 416 | (setq set-mark-command-repeat-pop t) 417 | 418 | ;; http://endlessparentheses.com/emacs-narrow-or-widen-dwim.html 419 | (defun narrow-or-widen-dwim (p) 420 | "Widen if buffer is narrowed, narrow-dwim otherwise. 421 | Dwim means: region, org-src-block, org-subtree, or 422 | defun, whichever applies first. Narrowing to 423 | org-src-block actually calls `org-edit-src-code'. 424 | 425 | With prefix P, don't widen, just narrow even if buffer 426 | is already narrowed." 427 | (interactive "P") 428 | (declare (interactive-only)) 429 | (cond ((and (buffer-narrowed-p) (not p)) (widen)) 430 | ((region-active-p) 431 | (narrow-to-region (region-beginning) 432 | (region-end))) 433 | ((derived-mode-p 'org-mode) 434 | ;; `org-edit-src-code' is not a real narrowing 435 | ;; command. Remove this first conditional if 436 | ;; you don't want it. 437 | (cond ((ignore-errors (org-edit-src-code) t) 438 | (delete-other-windows)) 439 | ((ignore-errors (org-narrow-to-block) t)) 440 | (t (org-narrow-to-subtree)))) 441 | ((looking-at outline-regexp) 442 | (ignore-errors (outline-narrow-to-subtree))) 443 | ((derived-mode-p 'latex-mode) 444 | (LaTeX-narrow-to-environment)) 445 | (t (narrow-to-defun)))) 446 | 447 | (defun mark-line () 448 | "Mark the whole line" 449 | (interactive) 450 | (move-beginning-of-line nil) 451 | (set-mark-command nil) 452 | (next-line) 453 | (setq deactivate-mark nil)) 454 | 455 | (defun ignore-error-wrapper (fn) 456 | "Funtion return new function that ignore errors. 457 | The function wraps a function with `ignore-errors' macro." 458 | (lexical-let ((fn fn)) 459 | (lambda () 460 | (interactive) 461 | (ignore-errors 462 | (funcall fn))))) 463 | 464 | (defun kill-word-ap (arg) 465 | (interactive "P") 466 | (let* ((argp (and arg (= 4 (prefix-numeric-value arg)))) 467 | (beg (beginning-of-thing (if argp 'symbol 'word))) 468 | (end (end-of-thing (if argp 'symbol 'word)))) 469 | (save-excursion 470 | (kill-region beg end)))) 471 | 472 | ;; from http://endlessparentheses.com/fill-and-unfill-paragraphs-with-a-single-key.html 473 | (defun sam/fill-or-unfill () 474 | "Like `fill-paragraph', but unfill if used twice." 475 | (interactive) 476 | (let ((fill-column 477 | (if (eq last-command 'sam/fill-or-unfill) 478 | (progn (setq this-command nil) 479 | (point-max)) 480 | fill-column))) 481 | (call-interactively #'fill-paragraph))) 482 | 483 | (defun sam|set-transparency (inc) 484 | "Increase or decrease the selected frame transparency" 485 | (let* ((alpha (frame-parameter (selected-frame) 'alpha)) 486 | (next-alpha (cond ((not alpha) 100) 487 | ((> (- alpha inc) 100) 100) 488 | ((< (- alpha inc) 0) 0) 489 | (t (- alpha inc))))) 490 | (set-frame-parameter (selected-frame) 'alpha next-alpha))) 491 | 492 | ;; from http://emacsredux.com/blog/2013/06/21/eval-and-replace/ 493 | (defun eval-and-replace () 494 | "Replace the preceding sexp with its value." 495 | (interactive) 496 | (backward-kill-sexp) 497 | (condition-case nil 498 | (prin1 (eval (read (current-kill 0))) 499 | (current-buffer)) 500 | (error (message "Invalid expression") 501 | (insert (current-kill 0))))) 502 | 503 | ;; from https://www.emacswiki.org/emacs/ExecuteExternalCommand 504 | (defun shell-command-on-buffer () 505 | "Asks for a command and executes it in inferior shell with current buffer 506 | as input." 507 | (interactive) 508 | (shell-command-on-region 509 | (point-min) (point-max) 510 | (read-shell-command "Shell command on buffer: "))) 511 | 512 | (defalias 'kill-frame #'delete-frame) 513 | 514 | (custom-set-variables '(epg-gpg-program "gpg2")) 515 | 516 | ;;; counsel font 517 | 518 | (defun counsel-font () 519 | "Change font of current frame" 520 | (interactive) 521 | (ivy-read "Chose font :" 522 | (font-family-list) 523 | :caller 'counsel-font 524 | :action (lambda (x) (set-frame-font x)))) 525 | 526 | ;;; counsel accession numbers 527 | 528 | (defun sam--completion-collection (col) 529 | (mapcar (lambda (x) 530 | (concat (propertize (car x) 'font-lock-face '(:foreground "#268bd2")) 531 | " => " 532 | (propertize (cadr x) 'face 'slanted))) 533 | col)) 534 | 535 | (defun sam--completion-collection-out (candidate) 536 | (substring-no-properties candidate 0 (string-match " => " candidate))) 537 | 538 | (defun sam--genome-accession-numbers-action (candidate) 539 | (insert (sam--completion-collection-out candidate))) 540 | 541 | (defun sam|genome-accession-numbers () 542 | (interactive) 543 | (let* ((accessions '(("NC_005966.1" "Acinetobacter baylyi ADP1"))) 544 | (cols (sam--completion-collection accessions))) 545 | (ivy-read "Chose genome ?" cols 546 | :action #'sam--genome-accession-numbers-action))) 547 | 548 | ;;; use-package jump 549 | 550 | (defun use-package-jump--list-calls () 551 | (let ((packages)) 552 | (save-excursion 553 | (goto-char (point-max)) 554 | (while (beginning-of-defun) 555 | (let ((line (buffer-substring (line-beginning-position) (line-end-position)))) 556 | (when (string-match "^(use-package \\([^[:space:]\n]+\\)" line) 557 | (push (cons (match-string-no-properties 1 line) (point)) 558 | packages))))) 559 | packages)) 560 | 561 | (defun use-package-jump () 562 | "Jump to an outer-level `use-package' definition in current buffer." 563 | (interactive) 564 | (let ((packages (use-package-jump--list-calls))) 565 | (goto-char (cdr (assoc (ivy-completing-read "Package: " packages) 566 | packages))))) 567 | 568 | (defun helm--goto-use-package-call (candidate) 569 | (push-mark) 570 | (goto-char candidate)) 571 | 572 | (defun helm-use-package-jump () 573 | "Jump to an outer-level `use-package' definition in current buffer." 574 | (interactive) 575 | (helm 576 | :sources (helm-build-sync-source "Packages" 577 | :candidates (use-package-jump--list-calls) 578 | :fuzzy-match t 579 | :action (helm-make-actions 580 | "Go to use-package call" #'helm--goto-use-package-call)) 581 | :buffer "*helm upj*")) 582 | 583 | ;;;; Hidden mode line mode 584 | 585 | ;; If you want to hide the mode-line in every buffer by default 586 | ;; (add-hook 'after-change-major-mode-hook 'hidden-mode-line-mode) 587 | 588 | (defun sam|indent-region () 589 | "Indent region " 590 | (interactive) 591 | (let ((beg (region-beginning)) 592 | (end (region-end))) 593 | (indent-region beg end))) 594 | 595 | (defun sam|indent-paragraph () 596 | "Indent paragraph at point according to mode" 597 | (interactive) 598 | (save-excursion 599 | (mark-paragraph) 600 | (indent-region (region-beginning) (region-end)))) 601 | 602 | (defun sam|join-to-next-line () 603 | "Join current line to next line." 604 | (interactive) 605 | (join-line 4)) 606 | 607 | 608 | ;;; Compile on save mode 609 | 610 | (defun compile-on-save-start () 611 | (let ((buffer (compilation-find-buffer))) 612 | (unless (get-buffer-process buffer) 613 | (recompile)))) 614 | 615 | (define-minor-mode compile-on-save-mode 616 | "Minor mode to automatically call `recompile' whenever the 617 | current buffer is saved. When there is ongoing compilation, 618 | nothing happens." 619 | :lighter " CoS" 620 | (if compile-on-save-mode 621 | (progn (make-local-variable 'after-save-hook) 622 | (add-hook 'after-save-hook 'compile-on-save-start nil t)) 623 | (kill-local-variable 'after-save-hook))) 624 | 625 | ;;; * Side Window Management 626 | 627 | (defun sam|maximize-window () 628 | "Maximize frame on first use, toggle frame fullscreen on second 629 | consecutive use." 630 | (interactive) 631 | (let* ((second? (eq last-command this-command)) 632 | (fullscreen (frame-parameter nil 'fullscreen)) 633 | (maximized? (eq 'maximized fullscreen)) 634 | (fullscreen? (eq 'fullboth fullscreen))) 635 | (cond ((and second? maximized?) 636 | (toggle-frame-fullscreen)) 637 | (fullscreen? 638 | (toggle-frame-fullscreen)) 639 | (t 640 | (toggle-frame-maximized))))) 641 | 642 | (defun sam|main-window (&optional frame) 643 | "Refocus the main editing window. 644 | 645 | Delete all side windows at first use ; at second consecutive use 646 | it also delete other normal windows currently active in the 647 | frame." 648 | (interactive) 649 | (let* ((frame (window-normalize-frame frame)) 650 | (window--sides-inhibit-check t) 651 | (sw? (window-with-parameter 'window-side nil frame))) 652 | (cond ((and (eq last-command this-command) sw?) 653 | (ignore-errors (window-toggle-side-windows)) 654 | (delete-other-windows)) 655 | (sw? 656 | (window-toggle-side-windows)) 657 | (t 658 | (delete-other-windows))))) 659 | 660 | ;;; Thesis project 661 | 662 | (defun sam|thesis-projects () 663 | "Switch to a data projects in my thesis folder" 664 | (interactive) 665 | (let* ((cmd "find ~/these/data -d 1 -type d") 666 | (dirs (split-string (shell-command-to-string cmd) "\n" t)) 667 | (projects (seq-map #'file-name-nondirectory dirs)) 668 | (candidates (seq-mapn #'cons projects dirs))) 669 | (ivy-read "Chose data folder :" candidates 670 | :action (lambda (_) (find-file (cdr _))) 671 | :caller #'sam|thesis-projects))) 672 | 673 | ;;; Snippet helper 674 | 675 | (defun sam--comment-date () 676 | (let ((time (format-time-string "[%Y-%m-%d %H:%M:%S]"))) 677 | (format "%s %s\n%s\t" comment-start time comment-start))) 678 | 679 | (defun sam--efetch-formats () 680 | (let* ((options '(("fasta" "Fasta Sequence") 681 | ("genbank" "GenBank Resume") 682 | ("gbwithparts" "GenBank with sequence"))) 683 | (col (sam--completion-collection options))) 684 | (sam--completion-collection-out 685 | (ivy-read "Choose format :" col)))) 686 | 687 | (defun sam--export-code () 688 | (let* ((options '(("code" "Code only") 689 | ("results" "Results only") 690 | ("both" "Code and Results") 691 | ("none" "None"))) 692 | (col (sam--completion-collection options))) 693 | (sam--completion-collection-out 694 | (ivy-read "Choose format :" col)))) 695 | 696 | (defun org-enquote! (beg end) 697 | (interactive "r") 698 | (org--wrap "QUOTE" beg end)) 699 | 700 | (defun org-ensrc! (beg end) 701 | (interactive "r") 702 | (org--wrap "SRC" beg end)) 703 | 704 | (defun org--wrap (block-name beg end) 705 | (let ((beg-name (format "#+BEGIN_%s\n" (upcase block-name))) 706 | (end-name (format "#+END_%s\n" (upcase block-name)))) 707 | (save-excursion 708 | (goto-char end) 709 | (if (= end (point-at-bol)) 710 | (insert end-name) 711 | (insert (concat "\n" end-name)))) 712 | (save-excursion 713 | (goto-char beg) 714 | (if (= beg (point-at-bol)) 715 | (insert beg-name) 716 | (insert (concat "\n" beg-name)))))) 717 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . --------------------------------------------------------------------------------