https://github.com/bozenne/emacs-config

My configuration for running emacs

https://github.com/bozenne/emacs-config

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    3 of 5 committers (60.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.8%) to scientific vocabulary

Keywords from Contributors

generalized-pairwise-comparisons non-parametric inference latent-variable-models
Last synced: 10 months ago · JSON representation

Repository

My configuration for running emacs

Basic Info
  • Host: GitHub
  • Owner: bozenne
  • Language: Emacs Lisp
  • Default Branch: master
  • Size: 4.68 MB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created almost 9 years ago · Last pushed over 1 year ago
Metadata Files
Readme

README.org

#+Title: My configuration for emacs
#+LaTeX_CLASS: org-article
#+LaTeX_HEADER:\author{Brice Ozeene}
#+OPTIONS: toc:t

* Installation

** Emacs
The official installation guide for emacs can be found at
https://www.gnu.org/software/emacs/download.html.

Note: windows user may find convenient to first install MSYS2
(https://www.msys2.org/) to have a linux-like interface, e.g. use
=pacman -S mingw-w64-x86_64-emacs= to install emacs.
  
** External dependencies

*Linux*: normally emacs should take care of installing all
dependencies (otherwise you can do it yourself using
=list-packages=). However you will need to install =git= yourself,
e.g. using:
#+BEGIN_SRC shell :export code :eval ever
sudo apt update
sudo apt install git
#+END_SRC

as well as latex:
#+BEGIN_SRC shell :export code :eval ever
sudo apt-get install texlive-full
sudo apt-get install latexmk
#+END_SRC
and a pdf viewer like okular (https://okular.kde.org/) or sumatraPDF (https://www.sumatrapdfreader.org/free-pdf-reader).


*Windows*: you will need to install several additional software:
- miktex (https://miktex.org/) for latex
- latexmk via miktex (to automatically regenerate latex files)
- hunspell (https://sourceforge.net/projects/ezwinports/files/hunspell-1.3.2-3-w32-bin.zip/download) for spell checking
- perl (https://strawberryperl.com/): it is used by latexmk as well as some R packages
- git (https://gitforwindows.org/): it is used by magit. 
  
* Link emacs to the proposed configuration

** Basic version

Download all files and put them in a directory called *emacs-config*.

Place this directory in the folder containing the =.emacs= file (=~/.= when doing C-x C-f).

Copy the following code at the begining of the =.emacs= file:
#+BEGIN_SRC emacs-lisp :export code :eval ever
;;; load automatic config
(package-initialize)
(setq user-full-name "my name")
(setq user-mail-adress "my.email@adress.com")
(setq path-emacs-config "~/emacs-config")
(setq path-emacs-snippet (concat path-emacs-config "/snippets"))

(load-file (expand-file-name "step01-load-packages.el" path-emacs-config))
(load-file (expand-file-name "step02-general-settings.el" path-emacs-config)) 
;;(load-file (expand-file-name "step03-email.el" path-emacs-config))
(load-file (expand-file-name "step04a-ess.el" path-emacs-config)) 
(load-file (expand-file-name "step04b-orgmode.el" path-emacs-config))
(load-file (expand-file-name "step04c-other-software.el" path-emacs-config))
(load-file (expand-file-name "step05-org-class.el" path-emacs-config))
(load-file (expand-file-name "step06-org-templates.el" path-emacs-config))
(load-file (expand-file-name "step07-header.el" path-emacs-config))
(load-file (expand-file-name "step08-folding.el" path-emacs-config))
(load-file (expand-file-name "step09-spellChecking.el" path-emacs-config))

(load-file (expand-file-name "FCT-dired.el" path-emacs-config))
(load-file (expand-file-name "FCT-editing.el" path-emacs-config))
(load-file (expand-file-name "FCT-file-management.el" path-emacs-config))
(load-file (expand-file-name "FCT-ess.el" path-emacs-config))
(load-file (expand-file-name "FCT-tex.el" path-emacs-config))
(load-file (expand-file-name "FCT-python.el" path-emacs-config))
(load-file (expand-file-name "FCT-org.el" path-emacs-config))
(load-file (expand-file-name "FCT-switch-to-OS-explorer.el" path-emacs-config))
(load-file (expand-file-name "FCT-superman.el" path-emacs-config))

(load-file (expand-file-name "step10-shorcuts.el" path-emacs-config))
#+END_SRC
In the first line, replace ="my name"= by your name.
In the second line, replace ="my.email@adress.com"= by your email adress.
In the third line, check that ="~/emacs-config"= is where you have put emacs-config.

** Customization

Set the font size to 120 by adding the following line
#+BEGIN_SRC emacs-lisp :export code :eval ever
;;; Font size
(set-face-attribute 'default nil :height 120)
#+END_SRC

Display the file =~/todo.org= when starting emacs instead of the
default emacs startup screen:
#+BEGIN_SRC emacs-lisp :export code :eval ever
;;; File at startup
(setq inhibit-startup-screen t) ;; dismiss startup screen
(find-file "~/todo.org")
#+END_SRC

Remove the tool bar:
#+BEGIN_SRC emacs-lisp :export code :eval ever
;;; remove tool bar
(tool-bar-mode -1)
#+END_SRC

Transfert to the agenda elements in =~/todo.org=:
#+BEGIN_SRC emacs-lisp :export code :eval ever
;;; Agenda
(setq org-agenda-files (list "~/todo.org")
#+END_SRC

** Modifications for Windows

Add to the =.emacs= file something like:
#+BEGIN_SRC emacs-lisp :export code :eval ever
;;; modification for windows

;;;; shell
;; https://www.gnu.org/software/emacs/manual/html_node/efaq-w32/Using-shell.html
(setq explicit-shell-file-name "c:/cygwin64/bin/bash")
(setq TeX-shell "c:/cygwin64/bin/bash")
(setq org-export-allow-bind-keywords t)

;; FROM: https://www.emacswiki.org/emacs/NTEmacsWithCygwin
(let* ((cygwin-root "c:/cygwin64")
       (cygwin-bin (concat cygwin-root "/bin")))
  (when (and (eq 'windows-nt system-type)
             (file-readable-p cygwin-root))

    (setq exec-path (cons cygwin-bin exec-path))
    (setenv "PATH" (concat cygwin-bin ";" (getenv "PATH")))

    ;; By default use the Windows HOME.
    ;; Otherwise, uncomment below to set a HOME
    ;;      (setenv "HOME" (concat cygwin-root "/home/eric"))

    ;; NT-emacs assumes a Windows shell. Change to bash.
    (setq shell-file-name "bash")
    (setenv "SHELL" shell-file-name) 
    (setq explicit-shell-file-name shell-file-name) 

    ;; This removes unsightly ^M characters that would otherwise
    ;; appear in the output of java applications.
    (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)))

;;;; path to external dependencies
(setq org-export-allow-bind-keywords t)

(setq TeX-view-program-list '(("SumatraPDF" "C://Users//hpl802//AppData//Local//SumatraPDF//SumatraPDF.exe %o")))
(setq TeX-view-program-selection '((output-pdf "SumatraPDF")
           			(output-dvi "Yap")))
(put 'overwrite-mode 'disabled nil)

;;;; update path variable
(setenv "PATH"
 	(concat
 	 "C:\\unison" ";"
 	 "C:\\hunspell" ";"
     "C:\\strawberry\\perl\\bin" ";"
 	 "C:\\Program Files\\SymatraPDF" ";" 	 
 	 "C:\\Program Files\\PuTTY" ";"
 	 "C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\" ";"
 	 (getenv "PATH")		;
 	 )
 	)

;;;; R software
(setq-default inferior-R-program-name "C:\\Program Files\\R\\R-4.1.1\\bin\\x64\\Rterm.exe")

;;;; spell checker
(setq ispell-program-name "hunspell")
(setq ispell-local-dictionary "en_GB")
;; (ispell-find-hunspell-dictionaries)
#+END_SRC



** [Optional] Emails

*WARNING*: before trying anything, save all important emails outside the
mailbox in case that the synchronisation does not work properly.
#+BEGIN_SRC emacs-lisp :export code :eval ever
;;; send email
#+END_SRC

**** Receiving
Install offlineimap using =sudo apt-get install offlineimap= in the
shell.

Then create a file =~/.offlineimaprc= to indicate from which adress
email should be imported:
#+BEGIN_SRC emacs-lisp :export code :eval ever
[general]
accounts = Gmail
maxsyncaccounts = 3
pythonfile = ~/.offlineimap.py

[Account Gmail]
localrepository = localGmail
remoterepository = remoteGmail
autorefresh = 10

[Repository localGmail]
type = Maildir
localfolders = ~/Maildir/Gmail

[Repository remoteGmail]
type = Gmail
remoteuser = myadress@gmail.com
remotepasseval = get_password_emacs("imap.gmail.com", "myadress.com", "993")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
auth_mechanisms = PLAIN
folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail', '[Gmail]/Starred', '[Gmail]/Important']
realdelete = no
#+END_SRC

For the password, create a file =.offlineimap.py= containing:
#+BEGIN_SRC python :export code :eval ever
#!/usr/bin/python
import re, os

def get_password_emacs(machine, login, port):
    s = "machine %s login %s port %s password ([^ ]*)\n" % (machine, login, port)
    p = re.compile(s)
    authinfo = os.popen("gpg --quiet --passphrase anotherPassword --decrypt ~/.authinfo.gpg").read()#
#    authinfo = os.popen("gpg --quiet --no-tty --decrypt ~/.authinfo.gpg").read()
    return p.search(authinfo).group(1)
#+END_SRC
and a file =~/.authinfo.gpg= containing:
#+BEGIN_SRC emacs-lisp :export code :eval ever
machine imap.gmail.com login myadress@gmail.com port 993 password myGmailPassword
machine smtp.gmail.com login myadress@gmail.com port 587 password myGmailPassword
#+END_SRC

Then run =offlineimap=.

Then install mu using in the shell:
- =git clone https://github.com/djcb/mu.git=
- =sudo apt-get install libtool=
- =cd mu=
- =mu/$ autoreconf -i && ./configure && make=
Normally =mu index= should run and import emails.

Finally add to the =~/.emacs=:
#+BEGIN_SRC emacs-lisp :export code :eval ever
;;;; receive email
;; location of the mails
(setq mu4e-maildir (expand-file-name "~/Maildir"))

;; mail box
(setq mu4e-account-alist
      '(("Gmail"
         ;; Under each account, set the account-specific variables you want.
         (mu4e-sent-messages-behavior delete)
         (mu4e-sent-folder "/Gmail/[Gmail].Sent Mail")
         (mu4e-drafts-folder "/Gmail/[Gmail].Drafts")
         (mu4e-trash-folder "/Gmail/[Gmail].Trash")
         (user-mail-address "myadress@gmail.com")
         (user-full-name "My Name"))
       	)
      )

;; setup some handy shortcuts
(setq mu4e-maildir-shortcuts
      '(("/Gmail/INBOX" . ?i)
	("/Gmail/ProjectA" . ?a))
)

;; signature
(setq
 mu4e-compose-signature
 (concat
  "My Name \n"
  "myadress@gmail.com\n")
 )
#+END_SRC

**** Sending
Create a file =~/.authinfo.gpg= to indicate from which adress emails
can be sent:
#+BEGIN_SRC emacs-lisp :export code :eval ever
machine imap.gmail.com login myadress@gmail.com port 993 password myGmailPassword
machine smtp.gmail.com login myadress@gmail.com port 587 password myGmailPassword
#+END_SRC
and add in the =.emacs=:
#+BEGIN_SRC emacs-lisp :export code :eval ever
;;;; send email
(require 'smtpmail)

(setq message-send-mail-function 'smtpmail-send-it
     starttls-use-gnutls t
     smtpmail-starttls-credentials
     '(("smtp.gmail.com" 587 nil nil))
     smtpmail-auth-credentials
     (expand-file-name "~/.authinfo.gpg")
     smtpmail-default-smtp-server "smtp.gmail.com"
     smtpmail-smtp-server "smtp.gmail.com"
     smtpmail-smtp-service 587
     smtpmail-debug-info t)
#+END_SRC

* Key binding
See the file [[https://github.com/bozenne/emacs-config/blob/master/extendedCommands.org][extendedCommands.org]]

* Credit

A major part of configuration comes from [[https://github.com/tagteam/emacs-genome][emacs-genome]] (thanks
thomas!!!). In particular all the functions contained in the file
=FCT-superman.el= are directly copied from emacs-genome.

# https://github.com/alhassy/ElispCheatSheet/blob/master/CheatSheet.pdf

Owner

  • Name: Ozenne
  • Login: bozenne
  • Kind: user
  • Location: Copenhagen

I'm a bio-statistician; you will find on my Github R packages implementing statistical developments, code related to articles, and setting for emacs.

GitHub Events

Total
  • Push event: 1
Last Year
  • Push event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 170
  • Total Committers: 5
  • Avg Commits per committer: 34.0
  • Development Distribution Score (DDS): 0.553
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Brice Maxime Hugues Ozenne h****2@s****k 76
Brice Ozenne b****e@o****r 74
Brice Maxime Hugues Ozenne h****2@k****k 9
bozenne b****z@s****k 8
Brice Ozenne b****e@b****e 3
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels