Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Multiple Emacs Flavor Setup
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pierre Balaye
Multiple Emacs Flavor Setup
Compare Revisions
b34d80c56fc826427ed5e68810ab566c84baef92...670e3c616b60674ed59214214eb8573776c2ddac
Source
670e3c616b60674ed59214214eb8573776c2ddac
Select Git revision
...
Target
b34d80c56fc826427ed5e68810ab566c84baef92
Select Git revision
Compare
Commits (2)
Minor typo
· 3b90cc58
Pierre Balaye
authored
May 18, 2020
3b90cc58
smartparens layer defined
· 670e3c61
Pierre Balaye
authored
May 19, 2020
670e3c61
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
308 additions
and
27 deletions
+308
-27
01-create-dirs.sh
01-create-dirs.sh
+1
-0
configs/spacemacs-default/dot-layers.el
configs/spacemacs-default/dot-layers.el
+1
-1
configs/spacemacs-default/dot-user-config.el
configs/spacemacs-default/dot-user-config.el
+228
-16
configs/spacemacs-minimal/init.el
configs/spacemacs-minimal/init.el
+63
-6
configs/spacemacs-test/dot-layers.el
configs/spacemacs-test/dot-layers.el
+8
-2
configs/spacemacs-test/dot-user-config.el
configs/spacemacs-test/dot-user-config.el
+7
-2
No files found.
01-create-dirs.sh
View file @
670e3c61
...
...
@@ -5,4 +5,5 @@ mefs_indent_message "Directory tree creation..."
mkdir
-p
$mefs_EMACSDIR
/sources
mkdir
-p
$mefs_EMACSDIR
/flavors/
ln
-sf
$mefs_THISREPODIR
/configs
$mefs_EMACSDIR
/
ln
-sf
$mefs_THISREPODIR
/layers
$mefs_EMACSDIR
/
configs/spacemacs-default/dot-layers.el
View file @
670e3c61
...
...
@@ -21,7 +21,7 @@
;; csv
;; -------- Applications
;;
org
org
;; gnus
;; fasd
lsp
...
...
configs/spacemacs-default/dot-user-config.el
View file @
670e3c61
(
defun
dotspacemacs/user-config-specific
()
(
defun
ulys/config/org/babel
()
;; FIXME julia bug - hack I have opened issue #13597
(
setq
inferior-julia-program-name
"julia"
)
(
custom-set-variables
'
(
org-babel-load-languages
(
quote
((
emacs-lisp
.
t
)
(
R
.
t
)
(
latex
.
t
)
(
shell
.
t
)
(
ditaa
.
t
)
(
julia
.
t
)
(
python
.
t
)
(
sql
.
t
)
)))
'
(
org-confirm-babel-evaluate
nil
)))
(
ulys/config/org
)
(
ulys/config/ess
)
)
; ESS config
(
defun
ulys/config/ess
()
(
ulys/conf/ess-devtools-save-silentely
)
(
add-hook
'ess-mode-hook
(
lambda
()
(
define-key
ess-mode-map
(
kbd
";"
)
'ess-insert-assign
)
(
define-key
ess-mode-map
(
kbd
"C-;"
)
'ulys/conf/ess-insert-magrittr-pipe
)
(
define-key
ess-mode-map
(
kbd
"C-:"
)
'ulys/conf/ess-insert-right-assign-operator
)
(
define-key
ess-mode-map
(
kbd
"C-x C-j"
)
'ess-eval-line-invisibly-and-step
)
(
define-key
ess-mode-map
(
kbd
"C-`"
)
'ulys/conf/ess-backquote-from-dollar
)
(
define-key
ess-mode-map
(
kbd
"C-~"
)
'ulys/conf/ess-backquote-delete-df$
)
)))
(
defun
ulys/conf/ess-insert-magrittr-pipe
()
"Insert magrittr pipe at i.e. \"%>%\"."
(
interactive
)
(
insert
"\n %>% "
))
(
defun
ulys/conf/ess-insert-right-assign-operator
()
"Insert \"->\"."
(
interactive
)
(
insert
" -> "
))
(
defun
ulys/conf/ess-devtools-save-silentely
()
(
setq
ess-save-silently
t
))
(
defun
ulys/conf/ess-backquote-from-dollar
()
"Surround with backquotes form last $ till point."
(
interactive
)
(
insert
"`"
)
(
setq
initial-position
(
point
))
(
evil-find-char-to-backward
1
(
string-to-char
"$"
))
(
insert
"`"
)
(
goto-char
(
+
1
initial-position
)))
(
defun
ulys/conf/ess-backquote-delete-df$
()
(
interactive
)
(
ulys/conf/ess-backquote-from-dollar
)
(
evil-find-char-to-backward
1
(
string-to-char
"$"
))
(
setq
dollar-position
(
point
))
(
evil-backward-WORD-begin
)
(
evil-sp-delete
(
point
)
dollar-position
)
(
evil-find-char
1
(
string-to-char
"`"
))
(
evil-forward-char
)
)
;; Org config
(
defun
ulys/config/org
()
(
ulys/config/org/misc
)
(
ulys/config/org/babel
)
(
ulys/config/org-calendar
)
;; (ulys/config/org-minted)
;; (ulys/config/org-odt-export-latexml)
;; (ulys/config/org-capture)
;; (ulys/config/org-file-apps)
)
(
defun
ulys/config/org/misc
()
(
setq
org-list-allow-alphabetical
t
)
(
setq
org-hide-emphasis-markers
t
)
;; <sTAB => src block
(
require
'org-tempo
)
)
(
defun
ulys/config/org/babel
()
(
setq
org-src-window-setup
'current-window
)
;; FIXME julia bug - hack - have opened issue #13597
(
setq
inferior-julia-program-name
"julia"
)
(
custom-set-variables
'
(
org-babel-load-languages
(
quote
((
emacs-lisp
.
t
)
(
R
.
t
)
(
latex
.
t
)
(
shell
.
t
)
(
ditaa
.
t
)
(
julia
.
t
)
(
python
.
t
)
(
sql
.
t
)
)))
'
(
org-confirm-babel-evaluate
nil
)))
(
defun
ulys/org-insert-csv-as-table
(
filename
)
"Insert a csv file into the current buffer at point, and convert it to an org table."
(
interactive
(
list
(
ido-read-file-name
"csv file: "
)))
(
let*
((
start
(
point
))
(
end
(
+
start
(
nth
1
(
insert-file-contents
filename
)))))
(
org-table-convert-region
start
end
)))
(
defun
ulys/config/org-capture
()
(
setq
org-default-notes-file
"~/Nextcloud/org/tasks.org"
)
(
setq
org-capture-templates
'
((
"t"
"Thesis-related Task"
entry
(
file
"~/Nextcloud/org/thesis.org"
)
"** TODO %?"
:empty-lines
1
)
(
"u"
"Teaching-related Task"
entry
(
file
"~/Nextcloud/org/teaching.org"
)
"** TODO %?"
:empty-lines
1
)
(
"h"
"Hospital-related Task"
entry
(
file
"~/Nextcloud/org/hospital.org"
)
"** TODO %?"
:empty-lines
1
))))
(
defun
ulys/config/org-file-apps
()
(
defun
ulys/org-pdf-app
(
file-path
link-without-schema
)
"Open pdf file using pdf-tools and go to the specified page."
(
let*
((
page
(
if
(
not
(
string-match
"\\.pdf::\\([0-9]+\\)\\'"
link-without-schema
))
1
(
string-to-number
(
match-string
1
link-without-schema
)))))
(
find-file-other-window
file-path
)
(
pdf-view-goto-page
page
)))
(
setq
org-file-apps
'
((
auto-mode
.
emacs
)
(
"\\.x?html?\\'"
.
"firefox %s"
)
(
"\\.pdf\\(::[0-9]+\\)?\\'"
.
whatacold/org-pdf-app
)
(
"\\.gif\\'"
.
"eog \"%s\""
)
(
"\\.mp4\\'"
.
"vlc \"%s\""
)
(
"\\.mkv"
.
"vlc \"%s\""
))))
(
defun
ulys/config/org-calendar
()
(
setq
calendar-week-start-day
1
))
(
defun
ulys/org//capture-helper-capture-with-yank-method
(
method
arg
)
;; helper 1/2
(
defun
wrap-into-results-example
(
capture
)
(
concat
"#+RESULTS:\n"
"#+ATTR_LATEX: :options frame=lines\n"
"#+BEGIN_SRC R :eval no :tangle no\n"
capture
"\n#+END_SRC\n"
))
;; helper 2/2
(
defun
choose-process
(
arg
)
(
if
(
or
arg
;; user asks for selection
(
not
(
boundp
'R-process-target
))
;; target not set
;; or target is not set to an active process:
(
not
(
process-live-p
(
get-buffer-process
R-process-target
))))
(
setq
R-process-target
(
completing-read
"Choose R process: "
(
seq-map
(
lambda
(
el
)
(
buffer-name
(
process-buffer
el
)))
(
process-list
))))))
;; main
(
choose-process
arg
)
(
insert
(
wrap-into-results-example
(
funcall
method
R-process-target
))))
(
defun
ulys/org/tibble-capture
(
arg
)
"Let the user choose a R process, then kill last tibble output
in the process and insert it in current buffer in a org
#+RESULTS: format."
(
interactive
"P"
)
;; helper 1/3
(
defun
extract-nrows-from-tibble-first-line
(
line
)
"Extract the number N in the pattern: # A tibble N x M"
(
let*
((
line-without-commas
(
replace-regexp-in-string
","
""
line
))
(
x-position
(
string-match
" x"
line-without-commas
))
(
nrow-start-at
(
length
"# A tibble "
)))
(
string-to-number
(
substring
line-without-commas
nrow-start-at
x-position
))))
;; helper 3/3
(
defun
yank-last-tibble-from-buffer
(
buffer
)
(
interactive
)
(
save-current-buffer
(
set-buffer
buffer
)
(
search-backward
"tibble"
)
(
beginning-of-line
)
(
let*
((
tibble-beg
(
point
))
(
nrow
(
extract-nrows-from-tibble-first-line
(
thing-at-point
'line
t
)))
(
tibble-end
(
progn
(
message
"nrow: %d"
nrow
)
(
re-search-forward
(
concat
"^"
(
number-to-string
(
min
10
nrow
))))
(
while
(
search-forward
"#"
nil
t
))
;; t means no error
(
end-of-line
)
(
point
))))
(
buffer-substring
tibble-beg
tibble-end
))))
;; main
(
ulys/org//capture-helper-capture-with-yank-method
'yank-last-tibble-from-buffer
arg
))
(
defun
ulys/org/glimpse-capture
(
arg
)
"Let the user choose a R process, then kill last glimpse output
in the process and insert it in current buffer in a org
#+RESULTS: format."
(
interactive
"P"
)
;; helper 1
(
defun
extract-nb-vars-from-glimpse-second-line
(
line
)
"Extract the number N in the pattern: Variables: N"
(
let
((
nb-vars-start-at
(
length
"Varialbes: "
))
(
nb-vars-end-at
(
length
line
)))
(
string-to-number
(
substring
line
nb-vars-start-at
nb-vars-end-at
))))
;; helper 2
(
defun
suppress_$_in_front_of_lines
(
lines
)
(
replace-regexp-in-string
"^\$ "
""
lines
))
;; helper 3
(
defun
yank-last-glimpse-from-buffer
(
buffer
)
(
interactive
)
(
save-current-buffer
(
set-buffer
buffer
)
(
search-backward
"Observations: "
)
(
beginning-of-line
)
(
let*
((
glimpse-beg
(
point
))
(
nrow
(
progn
(
forward-line
)
(
extract-nb-vars-from-glimpse-second-line
(
thing-at-point
'line
t
))))
(
glimpse-end
(
progn
(
forward-line
nrow
)
(
end-of-line
)
(
point
))))
(
suppress_$_in_front_of_lines
(
buffer-substring
glimpse-beg
glimpse-end
)
))))
;; main
(
ulys/org//capture-helper-capture-with-yank-method
'yank-last-glimpse-from-buffer
arg
))
(
defun
ulys/config/org-minted
()
(
setq
org-latex-listings
'minted
org-latex-packages-alist
'
((
""
"minted"
))
org-latex-pdf-process
'
(
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
)))
(
defun
ulys/config/org-odt-export-latexml
()
(
setq
org-latex-to-mathml-convert-command
"latexmlmath \"%i\" --presentationmathml=%o"
))
configs/spacemacs-minimal/init.el
View file @
670e3c61
...
...
@@ -2,7 +2,7 @@
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
;; Determine config directory
;; Determine
specific
config directory
(
setq
config-emacs-directory
(
replace-regexp-in-string
"flavors"
"configs"
user-emacs-directory
))
(
defun
load-config-file
(
filename
)
...
...
@@ -41,6 +41,7 @@ This function should only modify configuration layer settings."
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
dotspacemacs-configuration-layer-path
'
()
;; List of additional packages that will be installed without being
;; wrapped in a layer. If you need some configuration for these
;; packages, then consider creating a layer. You can also put the
...
...
@@ -48,7 +49,8 @@ This function should only modify configuration layer settings."
;; To use a local version of a package, use the `:location' property:
;; '(your-package :location "~/path/to/your-package/")
;; Also include the dependencies as they will not be resolved automatically.
dotspacemacs-additional-packages
'
()
dotspacemacs-additional-packages
'
(
)
;; A list of packages that cannot be updated.
dotspacemacs-frozen-packages
'
()
...
...
@@ -75,6 +77,8 @@ This function should only modify configuration layer settings."
helm-no-header
t
)
emacs-lisp
git
org
smartparens
)
)
...
...
@@ -274,11 +278,11 @@ It should only modify the values of Spacemacs settings."
;; If non-nil then the last auto saved layouts are resumed automatically upon
;; start. (default nil)
dotspacemacs-auto-resume-layouts
nil
dotspacemacs-auto-resume-layouts
t
;; If non-nil, auto-generate layout name when creating new layouts. Only has
;; effect when using the "jump to layout by number" commands. (default nil)
dotspacemacs-auto-generate-layout-names
nil
dotspacemacs-auto-generate-layout-names
t
;; Size (in MB) above which spacemacs will prompt to open the large file
;; literally to avoid performance issues. Opening a file literally means that
...
...
@@ -505,6 +509,8 @@ If you are unsure, try setting them in `dotspacemacs/user-config' first."
;; --------------------------------------------------
;; ------ Configuration common to all versions ------
;; --------------------------------------------------
(
message
(
concat
user-emacs-directory
"../../layers/"
))
;; (setq-default dotspacemacs-configuration-layer-path '(concat user-emacs-directory "../../layers/"))
;; --------------------------------------------------
...
...
@@ -541,8 +547,10 @@ before packages are loaded."
;; --------------------------------------------------
;; ------ Configuration common to all versions ------
;; --------------------------------------------------
(
setq
undo-tree-auto-save-history
t
)
(
setq
hybrid-style-enable-hjkl-bindings
t
)
(
ulys/conf/general
)
(
ulys/conf/dired
)
(
ulys/conf/kbd
)
;; --------------------------------------------------
;; ----- Configuration specific to this version -----
...
...
@@ -551,5 +559,54 @@ before packages are loaded."
(
dotspacemacs/user-config-specific
)
)
; general config
(
defun
ulys/conf/general
()
(
setq
undo-tree-auto-save-history
t
)
(
setq
vc-follow-symlinks
t
)
;; To edit .spacemacs without to be prompted each time
(
setq
hybrid-style-enable-hjkl-bindings
t
)
(
spacemacs/toggle-centered-point-globally-on
)
;; add time in powerline
(
display-time-mode
1
)
;; New frame will open fullscreen
(
add-to-list
'default-frame-alist
'
(
fullscreen
.
fullboth
))
)
; dired config
(
defun
ulys/conf/dired
()
;; helpers
(
defun
ulys/dired-open-current-dir
()
(
interactive
)
(
spacemacs/dired
"."
))
(
defun
ulys/conf/dired/kbd/C-hjkl
()
(
evil-define-key
'
(
normal
)
dired-mode-map
(
kbd
"C-h"
)
'dired-up-directory
)
(
evil-define-key
'
(
normal
)
dired-mode-map
(
kbd
"C-j"
)
'evil-next-line
)
(
evil-define-key
'
(
normal
)
dired-mode-map
(
kbd
"C-k"
)
'evil-previous-line
)
(
evil-define-key
'
(
normal
)
dired-mode-map
(
kbd
"C-l"
)
'dired-find-alternate-file
))
;; Auto-refresh dired on file change
(
add-hook
'dired-mode-hook
'auto-revert-mode
)
(
spacemacs/set-leader-keys
"ad"
'ulys/dired-open-current-dir
)
;; (hide .~undo-tree~ files)
(
setq
dired-omit-verbose
nil
)
(
add-hook
'dired-mode-hook
(
lambda
()
(
dired-omit-mode
)))
(
ulys/conf/dired/kbd/C-hjkl
))
; kbd config
(
defun
ulys/conf/kbd
()
;; --- others
;; C-h to delete buffer and C-S-h for help
(
global-set-key
(
kbd
"C-h"
)
'spacemacs/kill-this-buffer
)
;; Simulates vim increment and decrement number
(
define-key
evil-normal-state-map
(
kbd
"C-a C-a"
)
'evil-numbers/inc-at-pt
)
(
define-key
evil-normal-state-map
(
kbd
"C-x C-x"
)
'evil-numbers/dec-at-pt
)
)
;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
configs/spacemacs-test/dot-layers.el
View file @
670e3c61
...
...
@@ -21,7 +21,7 @@
;; csv
;; -------- Applications
;;
org
org
;; gnus
;; fasd
lsp
...
...
@@ -50,5 +50,11 @@
;; -------
;; theming
))
)
dotspacemacs-additional-packages
(
append
dotspacemacs-additional-packages
'
(
)
)
)
)
configs/spacemacs-test/dot-user-config.el
View file @
670e3c61
(
defun
dotspacemacs/user-config-specific
()
(
defun
ulys/config/org/babel
()
;; FIXME julia bug - hack I have opened issue #13597
(
setq
inferior-julia-program-name
"julia"
)
;; FIXME julia bug - hack I have opened issue #13597
(
setq
inferior-julia-program-name
"julia"
)
(
custom-set-variables
'
(
org-babel-load-languages
(
quote
((
emacs-lisp
.
t
)
...
...
@@ -15,5 +16,9 @@
(
sql
.
t
)
)))
'
(
org-confirm-babel-evaluate
nil
)))
(
ulys/config/org/babel
)
(
require
'org-tempo
)
)