|
|
|
|
@ -528,18 +528,19 @@ |
|
|
|
|
*** Require |
|
|
|
|
Require the ~org~ package; I also occasionally use org-pomodoro |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(require 'org) |
|
|
|
|
(require 'org-pomodoro) |
|
|
|
|
(require 'org) |
|
|
|
|
(require 'org-pomodoro) |
|
|
|
|
#+END_SRC |
|
|
|
|
*** Hooks |
|
|
|
|
Enable ~auto-fill-mode~ (see |
|
|
|
|
[https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Fill.html]) |
|
|
|
|
honestly I do not see where I would not want to use this. |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(add-hook 'org-mode-hook 'turn-on-auto-fill) |
|
|
|
|
(add-hook 'org-mode-hook 'turn-on-auto-fill) |
|
|
|
|
#+END_SRC |
|
|
|
|
*** Cosmetics |
|
|
|
|
Change the default ellipsis ~...~ to the unicode ellipsis ~…~ |
|
|
|
|
*Does not work properly* |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
; (setq org-ellipsis "…") |
|
|
|
|
#+END_SRC |
|
|
|
|
@ -562,9 +563,9 @@ |
|
|
|
|
Open links with external stuff |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(setq org-file-apps |
|
|
|
|
'((auto-mode . emacs) |
|
|
|
|
("\\.x?html?\\'" . "xdg-open %s") |
|
|
|
|
("\\.pdf\\'" . "xdg-open \"%s\""))) |
|
|
|
|
'((auto-mode . emacs) |
|
|
|
|
("\\.x?html?\\'" . "xdg-open %s") |
|
|
|
|
("\\.pdf\\'" . "xdg-open \"%s\""))) |
|
|
|
|
#+END_SRC |
|
|
|
|
*** Agenda |
|
|
|
|
Set the canonical binding for the agenda |
|
|
|
|
@ -667,7 +668,8 @@ |
|
|
|
|
"* DONE mailto:%?"))) |
|
|
|
|
#+END_SRC |
|
|
|
|
*** Source blocks |
|
|
|
|
Add template for a source block in emacs-lisp. This is useful for writing the emacs init file in literate form |
|
|
|
|
Add template for a source block in emacs-lisp. This is useful for |
|
|
|
|
writing the emacs init file in literate form |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(add-to-list 'org-structure-template-alist |
|
|
|
|
'("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC")) |
|
|
|
|
@ -1147,29 +1149,29 @@ |
|
|
|
|
acts as a visual bell which flashes the current line. It is (arbitrarily) |
|
|
|
|
bound to F15 which is supposed to be triggered by some “illegal” key hit |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(defun flash-hline () |
|
|
|
|
(defun flash-hline () |
|
|
|
|
"Flash the current line to emph some mistake" |
|
|
|
|
(interactive) |
|
|
|
|
(let ((fg (face-foreground 'default)) |
|
|
|
|
(bg (face-background 'hl-line))) |
|
|
|
|
(set-face-background 'hl-line fg) |
|
|
|
|
(run-with-timer |
|
|
|
|
0.1 nil (lambda () |
|
|
|
|
(set-face-background 'hl-line "#303030") )))) |
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "<f15>") 'flash-hline) |
|
|
|
|
(let ((fg (face-foreground 'default)) |
|
|
|
|
(bg (face-background 'hl-line))) |
|
|
|
|
(set-face-background 'hl-line fg) |
|
|
|
|
(run-with-timer |
|
|
|
|
0.1 nil (lambda () |
|
|
|
|
(set-face-background 'hl-line "#303030") )))) |
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "<f15>") 'flash-hline) |
|
|
|
|
#+END_SRC |
|
|
|
|
** unfill-paragraph |
|
|
|
|
This is authored by Stefan Monnier <foo at acm.org>. It is the opposite of |
|
|
|
|
fill-paragraph |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(defun unfill-paragraph (&optional region) |
|
|
|
|
"Takes a multi-line paragraph and makes it into a single line of text." |
|
|
|
|
(interactive (progn (barf-if-buffer-read-only) '(t))) |
|
|
|
|
(let ((fill-column (point-max)) |
|
|
|
|
;; This would override `fill-column' if it's an integer. |
|
|
|
|
(emacs-lisp-docstring-fill-column t)) |
|
|
|
|
(fill-paragraph nil region))) |
|
|
|
|
(defun unfill-paragraph (&optional region) |
|
|
|
|
"Takes a multi-line paragraph and makes it into a single line of text." |
|
|
|
|
(interactive (progn (barf-if-buffer-read-only) '(t))) |
|
|
|
|
(let ((fill-column (point-max)) |
|
|
|
|
;; This would override `fill-column' if it's an integer. |
|
|
|
|
(emacs-lisp-docstring-fill-column t)) |
|
|
|
|
(fill-paragraph nil region))) |
|
|
|
|
#+END_SRC |
|
|
|
|
** kill-word |
|
|
|
|
dwim manage space after kill-word. This has been morally pasted from |
|
|
|
|
@ -1196,13 +1198,13 @@ |
|
|
|
|
(cond ((looking-back "^ *") ; remove extra space at beginning of line |
|
|
|
|
(just-one-space 0) |
|
|
|
|
(indent-according-to-mode)) |
|
|
|
|
((looking-back "\\. *") |
|
|
|
|
(just-one-space 2)) |
|
|
|
|
((or (looking-at " ") |
|
|
|
|
(looking-back " ")) ; adjust space only if it exists |
|
|
|
|
(just-one-space 1)) |
|
|
|
|
(t ; do nothing otherwise, includes case where the point is at EOL |
|
|
|
|
)))) |
|
|
|
|
((looking-back "\\. *") |
|
|
|
|
(just-one-space 2)) |
|
|
|
|
((or (looking-at " ") |
|
|
|
|
(looking-back " ")) ; adjust space only if it exists |
|
|
|
|
(just-one-space 1)) |
|
|
|
|
(t ; do nothing otherwise, includes case where the point is at EOL |
|
|
|
|
)))) |
|
|
|
|
;; Delete extra horizontal white space after `kill-word' and `backward-kill-word' |
|
|
|
|
(advice-add 'kill-word :after #'modi/just-one-space-post-kill-word) |
|
|
|
|
#+END_SRC |
|
|
|
|
@ -1213,27 +1215,27 @@ |
|
|
|
|
Add word count in modeline; useful to prepare those pesky grant |
|
|
|
|
applications |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(require 'word-count) |
|
|
|
|
(require 'word-count) |
|
|
|
|
#+END_SRC |
|
|
|
|
* Main packages |
|
|
|
|
** Magit |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(require 'magit) |
|
|
|
|
(global-set-key (kbd "C-x C-g") 'magit-status) |
|
|
|
|
(magit-add-section-hook 'magit-status-sections-hook |
|
|
|
|
#'magit-insert-submodules |
|
|
|
|
#'magit-insert-unpushed-to-pushremote |
|
|
|
|
:append) |
|
|
|
|
#+END_SRC |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(require 'magit) |
|
|
|
|
(global-set-key (kbd "C-x C-g") 'magit-status) |
|
|
|
|
(magit-add-section-hook 'magit-status-sections-hook |
|
|
|
|
#'magit-insert-submodules |
|
|
|
|
#'magit-insert-unpushed-to-pushremote |
|
|
|
|
:append) |
|
|
|
|
#+END_SRC |
|
|
|
|
*** magit-todos |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(require 'magit-todos) |
|
|
|
|
(require 'magit-todos) |
|
|
|
|
#+END_SRC |
|
|
|
|
** smart-tab |
|
|
|
|
This package is a gem: it allows to make tab work dwim |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(require 'smart-tab) |
|
|
|
|
(global-smart-tab-mode 1) |
|
|
|
|
(require 'smart-tab) |
|
|
|
|
(global-smart-tab-mode 1) |
|
|
|
|
#+END_SRC |
|
|
|
|
** Outshine |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
@ -1241,7 +1243,8 @@ |
|
|
|
|
(add-hook 'outline-minor-mode-hook 'outshine-hook-function) |
|
|
|
|
(setq outshine-use-speed-commands t) |
|
|
|
|
(defvar outline-minor-mode-prefix "\M-#") |
|
|
|
|
(eval-after-load 'outshine '(define-key outline-minor-mode-map (kbd "C-M-i") nil)) |
|
|
|
|
(eval-after-load 'outshine |
|
|
|
|
'(define-key outline-minor-mode-map (kbd "C-M-i") nil)) |
|
|
|
|
;; (add-hook 'sh-mode-hook 'outline-minor-mode) |
|
|
|
|
#+END_SRC |
|
|
|
|
** helm |
|
|
|
|
@ -1299,8 +1302,8 @@ |
|
|
|
|
This is an excellent package, although I do not use it that much |
|
|
|
|
I should find a better binding |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(require 'expand-region) |
|
|
|
|
(global-set-key (kbd "C-=") 'er/expand-region) |
|
|
|
|
(require 'expand-region) |
|
|
|
|
(global-set-key (kbd "C-=") 'er/expand-region) |
|
|
|
|
#+END_SRC |
|
|
|
|
** Atomic chrome |
|
|
|
|
This is commented out as it is incompatible with the |
|
|
|
|
@ -1312,7 +1315,7 @@ |
|
|
|
|
** ERC |
|
|
|
|
Enable ~erc dcc~ files transfer |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(require 'erc-dcc) |
|
|
|
|
(require 'erc-dcc) |
|
|
|
|
#+END_SRC |
|
|
|
|
** TODO Phase out Package.el |
|
|
|
|
Load package.el |
|
|
|
|
@ -1327,15 +1330,15 @@ |
|
|
|
|
Save session files to the ~sessions~ directory so that they do not litter |
|
|
|
|
the ~.emacs.d~ base directory. |
|
|
|
|
#+BEGIN_SRC emacs-lisp |
|
|
|
|
(defun emacs-session-filename (session-id) |
|
|
|
|
"Construct a filename to save the session in based on SESSION-ID. |
|
|
|
|
If the directory ~/.emacs.d exists, we make a filename in there, otherwise |
|
|
|
|
a file in the home directory." |
|
|
|
|
(let ((basename (concat "sessions/session." session-id)) |
|
|
|
|
(emacs-dir user-emacs-directory)) |
|
|
|
|
(expand-file-name (if (file-directory-p emacs-dir) |
|
|
|
|
(concat emacs-dir basename) |
|
|
|
|
(concat "~/.emacs-" basename))))) |
|
|
|
|
(defun emacs-session-filename (session-id) |
|
|
|
|
"Construct a filename to save the session in based on SESSION-ID. |
|
|
|
|
If the directory ~/.emacs.d exists, we make a filename in there, otherwise |
|
|
|
|
a file in the home directory." |
|
|
|
|
(let ((basename (concat "sessions/session." session-id)) |
|
|
|
|
(emacs-dir user-emacs-directory)) |
|
|
|
|
(expand-file-name (if (file-directory-p emacs-dir) |
|
|
|
|
(concat emacs-dir basename) |
|
|
|
|
(concat "~/.emacs-" basename))))) |
|
|
|
|
#+END_SRC |
|
|
|
|
|
|
|
|
|
* Finale |
|
|
|
|
|