diff --git a/docs/binaries-private.html b/docs/binaries-private.html index d6d585b..52a8470 100644 --- a/docs/binaries-private.html +++ b/docs/binaries-private.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +Created: 2021-01-01 ven. 20:08
+Created: 2021-01-08 ven. 01:33
diff --git a/docs/calendar.html b/docs/calendar.html index 07c9971..ee734cb 100644 --- a/docs/calendar.html +++ b/docs/calendar.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - +Created: 2021-01-01 ven. 20:08
+Created: 2021-01-08 ven. 01:32
Created: 2021-01-01 ven. 20:08
+Created: 2021-01-08 ven. 01:32
startblock
when opening org-mode files-\(a\) -
+yay -Ss aspell aspell-fr aspell-en +yay -Ss aspell aspell-fr aspell-en
@@ -585,45 +566,45 @@ After that, restart Emacs with spc q r
.
(setq doom-font (font-spec :family "Hack Nerd Font Mono" :size 12 :weight 'semi-light) - doom-variable-pitch-font (font-spec :family "Hack Nerd Font Mono") - doom-unicode-font (font-spec :family "Hack Nerd Font Mono" :size 12) - doom-big-font (font-spec :family "Hack Nerd Font Mono" :size 19)) +(setq doom-font (font-spec :family "Hack Nerd Font Mono" :size 12 :weight 'semi-light) + doom-variable-pitch-font (font-spec :family "Hack Nerd Font Mono") + doom-unicode-font (font-spec :family "Hack Nerd Font Mono" :size 12) + doom-big-font (font-spec :family "Hack Nerd Font Mono" :size 19))
(setq doom-theme 'leuven) +(setq doom-theme 'leuven)
(setq display-line-numbers-type t) +(setq display-line-numbers-type t)
(use-package doom-modeline - :hook (after-init . doom-modeline-mode) - :custom - (doom-modeline-height 25) - (doom-modeline-bar-width 1) - (doom-modeline-icon t) - (doom-modeline-major-mode-icon t) - (doom-modeline-major-mode-color-icon t) - (doom-modeline-buffer-file-name-style 'truncate-upto-project) - (doom-modeline-buffer-state-icon t) - (doom-modeline-buffer-modification-icon t) - (doom-modeline-minor-modes nil) - (doom-modeline-enable-word-count nil) - (doom-modeline-buffer-encoding t) - (doom-modeline-indent-info nil) - (doom-modeline-checker-simple-format t) - (doom-modeline-vcs-max-length 12) - (doom-modeline-env-version t) - (doom-modeline-irc-stylize 'identity) - (doom-modeline-github-timer nil) - (doom-modeline-gnus-timer nil)) +(use-package doom-modeline + :hook (after-init . doom-modeline-mode) + :custom + (doom-modeline-height 25) + (doom-modeline-bar-width 1) + (doom-modeline-icon t) + (doom-modeline-major-mode-icon t) + (doom-modeline-major-mode-color-icon t) + (doom-modeline-buffer-file-name-style 'truncate-upto-project) + (doom-modeline-buffer-state-icon t) + (doom-modeline-buffer-modification-icon t) + (doom-modeline-minor-modes nil) + (doom-modeline-enable-word-count nil) + (doom-modeline-buffer-encoding t) + (doom-modeline-indent-info nil) + (doom-modeline-checker-simple-format t) + (doom-modeline-vcs-max-length 12) + (doom-modeline-env-version t) + (doom-modeline-irc-stylize 'identity) + (doom-modeline-github-timer nil) + (doom-modeline-gnus-timer nil))
spc q r
.
(after! evil - (map! :m "-" #'dired-jump)) +(after! evil + (map! :m "-" #'dired-jump))
spc q r
.
Make movement keys work like they should
(define-key evil-normal-state-map (kbd "<remap> <evil-next-line>") 'evil-next-visual-line) - (define-key evil-normal-state-map (kbd "<remap> <evil-previous-line>") 'evil-previous-visual-line) - (define-key evil-motion-state-map (kbd "<remap> <evil-next-line>") 'evil-next-visual-line) - (define-key evil-motion-state-map (kbd "<remap> <evil-previous-line>") 'evil-previous-visual-line) +(define-key evil-normal-state-map (kbd "<remap> <evil-next-line>") 'evil-next-visual-line) +(define-key evil-normal-state-map (kbd "<remap> <evil-previous-line>") 'evil-previous-visual-line) +(define-key evil-motion-state-map (kbd "<remap> <evil-next-line>") 'evil-next-visual-line) +(define-key evil-motion-state-map (kbd "<remap> <evil-previous-line>") 'evil-previous-visual-line)
(setq-default evil-cross-lines t) +(setq-default evil-cross-lines t)
;; this macro was copied from here: https://stackoverflow.com/a/22418983/4921402 - (defmacro define-and-bind-quoted-text-object (name key start-regex end-regex) - (let ((inner-name (make-symbol (concat "evil-inner-" name))) - (outer-name (make-symbol (concat "evil-a-" name)))) - `(progn - (evil-define-text-object ,inner-name (count &optional beg end type) - (evil-select-paren ,start-regex ,end-regex beg end type count nil)) - (evil-define-text-object ,outer-name (count &optional beg end type) - (evil-select-paren ,start-regex ,end-regex beg end type count t)) - (define-key evil-inner-text-objects-map ,key #',inner-name) - (define-key evil-outer-text-objects-map ,key #',outer-name)))) +;; this macro was copied from here: https://stackoverflow.com/a/22418983/4921402 +(defmacro define-and-bind-quoted-text-object (name key start-regex end-regex) + (let ((inner-name (make-symbol (concat "evil-inner-" name))) + (outer-name (make-symbol (concat "evil-a-" name)))) + `(progn + (evil-define-text-object ,inner-name (count &optional beg end type) + (evil-select-paren ,start-regex ,end-regex beg end type count nil)) + (evil-define-text-object ,outer-name (count &optional beg end type) + (evil-select-paren ,start-regex ,end-regex beg end type count t)) + (define-key evil-inner-text-objects-map ,key #',inner-name) + (define-key evil-outer-text-objects-map ,key #',outer-name)))) - ;; Add dollar as a surround object - (define-and-bind-quoted-text-object "dollar" "$" "\\$" "\\$") +;; Add dollar as a surround object +(define-and-bind-quoted-text-object "dollar" "$" "\\$" "\\$")
(global-visual-line-mode nil) +(global-visual-line-mode nil)
(auto-fill-mode -1) - (remove-hook 'text-mode-hook #'turn-on-auto-fill) - (after! org - ;; turn off auto-fill for org-mode - (add-hook 'org-mode-hook 'turn-off-auto-fill)) - (after! auctex - (add-hook 'latex-mode-hook 'turn-off-auto-fill)) +(auto-fill-mode -1) +(remove-hook 'text-mode-hook #'turn-on-auto-fill) +(after! org + ;; turn off auto-fill for org-mode + (add-hook 'org-mode-hook 'turn-off-auto-fill)) +(after! auctex + (add-hook 'latex-mode-hook 'turn-off-auto-fill))
(defun tdh-matlab-work () - "Setup Matlab Work Windows" - (interactive) - (delete-other-windows) - (evil-window-vsplit) - (evil-window-right 1) - (switch-to-buffer "*MATLAB*") - (evil-window-left 1) - ) +(defun tdh-matlab-work () + "Setup Matlab Work Windows" + (interactive) + (delete-other-windows) + (evil-window-vsplit) + (evil-window-right 1) + (switch-to-buffer "*MATLAB*") + (evil-window-left 1) + )
(setq alert-default-style 'libnotify) +(setq alert-default-style 'libnotify)
(setq create-lockfiles nil) +(setq create-lockfiles nil)
(global-hl-line-mode -1) - (after! org - (add-hook 'org-mode-hook - (lambda() - (hl-line-mode -1) - (global-hl-line-mode -1)) - 't - )) +(global-hl-line-mode -1) +(after! org + (add-hook 'org-mode-hook + (lambda() + (hl-line-mode -1) + (global-hl-line-mode -1)) + 't + ))
jump-forward
key binding(with-eval-after-load 'better-jumper - (map! - :desc "Jump Forward" - "C-i" #'better-jumper-jump-forward)) +(with-eval-after-load 'better-jumper + (map! + :desc "Jump Forward" + "C-i" #'better-jumper-jump-forward))
(setenv "GIT_ASKPASS" "git-gui--askpass") +(setenv "GIT_ASKPASS" "git-gui--askpass") - (after! magit - (setq magit-diff-refine-hunk 'all) - (setq magit-repository-directories `(("~/Cloud/thesis/matlab/" . 1) - ("~/Cloud/thesis/papers/" . 1))) - (setq magit-repolist-columns '(("Name" 25 magit-repolist-column-ident nil) - ("Status" 7 magit-repolist-column-flag) - ("B<U" 3 magit-repolist-column-unpulled-from-upstream - ((:right-align t) - (:help-echo "Upstream changes not in branch"))) - ("B>U" 3 magit-repolist-column-unpushed-to-upstream - ((:right-align t) - (:help-echo "Local changes not in upstream"))) - ("Path" 99 magit-repolist-column-path nil))) - ) +(after! magit + (setq magit-diff-refine-hunk 'all) + (setq magit-repository-directories `(("~/Cloud/thesis/matlab/" . 1) + ("~/Cloud/thesis/papers/" . 1))) + (setq magit-repolist-columns '(("Name" 25 magit-repolist-column-ident nil) + ("Status" 7 magit-repolist-column-flag) + ("B<U" 3 magit-repolist-column-unpulled-from-upstream + ((:right-align t) + (:help-echo "Upstream changes not in branch"))) + ("B>U" 3 magit-repolist-column-unpushed-to-upstream + ((:right-align t) + (:help-echo "Local changes not in upstream"))) + ("Path" 99 magit-repolist-column-path nil))) + )
C-c C-e
Writable Dired mode, when changes are done C-c C-c
.
-This works also with C-x C-q
C-c C-e
Writable Dired mode, when changes are done C-c C-c
.
+This works also with C-x C-q
+
C-c C-r
use rsync
to copy file in the background+
Create a directoryC-x C-q
(use-package! pdf-tools - :config - (add-hook 'pdf-view-mode-hook (lambda() (linum-mode -1))) - ) +(use-package! pdf-tools + :config + (add-hook 'pdf-view-mode-hook (lambda() (linum-mode -1))) + )
C-x C-q
(push "~/.config/doom/snippets" yas-snippet-dirs) - (yas-global-mode 1) +(push "~/.config/doom/snippets" yas-snippet-dirs) +(yas-global-mode 1)
C-x C-q
(defun tdh-export-everything-to-hugo () - "Export all the .org files in the specified directory to markdown using Hugo" - (interactive) - (setq org-files (directory-files (read-directory-name "Directory:" "/home/thomas/Cloud/brain/") t "org$" t)) +(defun tdh-export-everything-to-hugo () + "Export all the .org files in the specified directory to markdown using Hugo" + (interactive) + (setq org-files (directory-files (read-directory-name "Directory:" "/home/thomas/Cloud/brain/") t "org$" t)) - (while org-files - (setq current-org-file (car org-files)) - (message "Exporting %s" current-org-file) - (find-file current-org-file) - (org-hugo-export-to-md) - (setq org-files (cdr org-files)))) + (while org-files + (setq current-org-file (car org-files)) + (message "Exporting %s" current-org-file) + (find-file current-org-file) + (org-hugo-export-to-md) + (setq org-files (cdr org-files))))
C-x C-q
(setq auto-save-default t) +(setq auto-save-default t)
C-x C-q
(setq org-directory "~/Cloud/org/") - (after! org - (setq org-directory "~/Cloud/org/") +(setq org-directory "~/Cloud/org/") +(after! org + (setq org-directory "~/Cloud/org/") - ;; Replace the content marker, “⋯”, with a nice unicode arrow. - (setq org-ellipsis " ⤵") + ;; Replace the content marker, “⋯”, with a nice unicode arrow. + (setq org-ellipsis " ⤵") - (setq org-default-notes-file "~/Cloud/org/refile.org") + (setq org-default-notes-file "~/Cloud/org/refile.org") - ;; Avoid accidentally editing folded regions, say by adding text after an Org “⋯”. - (setq org-catch-invisible-edits 'show) + ;; Avoid accidentally editing folded regions, say by adding text after an Org “⋯”. + (setq org-catch-invisible-edits 'show) - ;; The following setting hides blank lines between headings which keeps folded view nice and compact. - (setq org-cycle-separator-lines 0) + ;; The following setting hides blank lines between headings which keeps folded view nice and compact. + (setq org-cycle-separator-lines 0) - ;; Indent according to the outline structure - (setq org-startup-indented t) - (setq org-startup-folded t) + ;; Indent according to the outline structure + (setq org-startup-indented t) + (setq org-startup-folded t) - ;; Record the information of when the task was marked as DONE - (setq org-log-done 'time) + ;; Record the information of when the task was marked as DONE + (setq org-log-done 'time) - ;; begining of line on heading behavior - (setq org-special-ctrl-a/e nil) - ) + ;; begining of line on heading behavior + (setq org-special-ctrl-a/e nil) +)
C-x C-q
TAB was changed to toggle only the visibility state of the current subtree, rather than cycle through it recursively. This can be reversed with:
(after! evil-org - (remove-hook 'org-tab-first-hook #'+org-cycle-only-current-subtree-h)) +(after! evil-org + (remove-hook 'org-tab-first-hook #'+org-cycle-only-current-subtree-h))
attr_latex: :width \linewidth
for instance.
(after! org - (setq org-image-actual-width t)) +(after! org + (setq org-image-actual-width t))
(after! org - (setq org-link-abbrev-alist - '(("bib" . "~/Cloud/brain/biblio/references.bib::%s") - ("notes" . "~/Cloud/brain/%s.org") - ("papers" . "~/Cloud/pdfs/%s.pdf"))) - ) +(after! org + (setq org-link-abbrev-alist + '(("bib" . "~/Cloud/brain/biblio/references.bib::%s") + ("notes" . "~/Cloud/brain/%s.org") + ("papers" . "~/Cloud/pdfs/%s.pdf"))) + )
(defun tdh/pdf-link (filename) - (start-process "" nil "zathura" (concat "~/Cloud/pdfs/" filename ".pdf")) - "") +(defun tdh/pdf-link (filename) + (start-process "" nil "zathura" (concat "~/Cloud/pdfs/" filename ".pdf")) + "") - (after! org - (org-link-set-parameters "pdf" :follow #'tdh/pdf-link) - ) +(after! org + (org-link-set-parameters "pdf" :follow #'tdh/pdf-link) + )
attr_latex: :widt
Org Tagging
- (after! org
- ;; Align Tags and flush right
- (setq org-tags-column -78)
- ;; Tags with fast selection keys
- (setq org-tag-alist (quote (("@home" . ?h)
- ("@work" . ?w)
- ("@christophe" . ?c)
- ("@veijo" . ?v))))
- )
+(after! org
+ ;; Align Tags and flush right
+ (setq org-tags-column -78)
+ ;; Tags with fast selection keys
+ (setq org-tag-alist (quote (("@home" . ?h)
+ ("@work" . ?w)
+ ("@christophe" . ?c)
+ ("@veijo" . ?v))))
+ )
@@ -1010,9 +995,9 @@ Display the real size of images and not the one set with attr_latex: :widt
Org Refile
- (after! org
- (setq org-refile-targets '((org-agenda-files . (:maxlevel . 6))))
- )
+(after! org
+ (setq org-refile-targets '((org-agenda-files . (:maxlevel . 6))))
+ )
@@ -1022,33 +1007,33 @@ Display the real size of images and not the one set with attr_latex: :widt
Org TODO
- (after! org
- ;; Tags with fast selection keys
- (setq org-todo-keywords '(
- (sequence "TODO(t)" "NEXT(n)" "MAIL(m)" "|" "DONE(d)")
- (sequence "READ(r)" "BKMK(b)" "EXER(x)" "|" "DONE(d)")
- (sequence "WAIT(w@/!)" "SDAY(s)" "|" "CANC(c@/!)")
- (sequence "QUES(q)" "|" "ANSW(a)")
- (sequence "EXAM(e)" "IDEA(i)" "|")
- ))
+(after! org
+ ;; Tags with fast selection keys
+ (setq org-todo-keywords '(
+ (sequence "TODO(t)" "NEXT(n)" "MAIL(m)" "|" "DONE(d)")
+ (sequence "READ(r)" "BKMK(b)" "EXER(x)" "|" "DONE(d)")
+ (sequence "WAIT(w@/!)" "SDAY(s)" "|" "CANC(c@/!)")
+ (sequence "QUES(q)" "|" "ANSW(a)")
+ (sequence "EXAM(e)" "IDEA(i)" "|")
+ ))
- ;; Display of the keywords
- (setq org-todo-keyword-faces
- '(("TODO" . (:foreground "#cc241d" :weight bold)) ;; red
- ("EXER" . (:foreground "#cc241d" :weight bold)) ;; red
- ("NEXT" . (:foreground "#cc241d" :weight bold)) ;; red
- ("MAIL" . (:foreground "#cc241d" :weight bold)) ;; red
- ("READ" . (:foreground "#cc241d" :weight bold)) ;; red
- ("ANSW" . (:foreground "#689d6a" :weight bold)) ;; aqua
- ("DONE" . (:foreground "#689d6a" :weight bold)) ;; aqua
- ("WAIT" . (:foreground "#d65d0e" :weight bold)) ;; orange
- ("QUES" . (:foreground "#d79921" :weight bold)) ;; yellow
- ("CANC" . (:foreground "#a89984" :weight bold)) ;; grey
- ("SDAY" . (:foreground "#98971a" :weight bold)) ;; green
- ("BKMK" . (:foreground "#98971a" :weight bold)) ;; green
- ("IDEA" . (:foreground "#98971a" :weight bold)) ;; green
- ("EXAM" . (:foreground "#98971a" :weight bold)))) ;; green
- )
+ ;; Display of the keywords
+ (setq org-todo-keyword-faces
+ '(("TODO" . (:foreground "#cc241d" :weight bold)) ;; red
+ ("EXER" . (:foreground "#cc241d" :weight bold)) ;; red
+ ("NEXT" . (:foreground "#cc241d" :weight bold)) ;; red
+ ("MAIL" . (:foreground "#cc241d" :weight bold)) ;; red
+ ("READ" . (:foreground "#cc241d" :weight bold)) ;; red
+ ("ANSW" . (:foreground "#689d6a" :weight bold)) ;; aqua
+ ("DONE" . (:foreground "#689d6a" :weight bold)) ;; aqua
+ ("WAIT" . (:foreground "#d65d0e" :weight bold)) ;; orange
+ ("QUES" . (:foreground "#d79921" :weight bold)) ;; yellow
+ ("CANC" . (:foreground "#a89984" :weight bold)) ;; grey
+ ("SDAY" . (:foreground "#98971a" :weight bold)) ;; green
+ ("BKMK" . (:foreground "#98971a" :weight bold)) ;; green
+ ("IDEA" . (:foreground "#98971a" :weight bold)) ;; green
+ ("EXAM" . (:foreground "#98971a" :weight bold)))) ;; green
+ )
@@ -1063,50 +1048,50 @@ Archive subtrees under the same hierarchy as original in the archive files
- (after! org
- (defadvice org-archive-subtree (around fix-hierarchy activate)
- (let* ((fix-archive-p (and (not current-prefix-arg)
- (not (use-region-p))))
- (location (org-archive--compute-location org-archive-location))
- (afile (car location))
- (offset (if (= 0 (length (cdr location)))
- 1
- (1+ (string-match "[^*]" (cdr location)))))
- (buffer (or (find-buffer-visiting afile) (find-file-noselect afile))))
- ad-do-it
- (when fix-archive-p
- (with-current-buffer buffer
- (goto-char (point-max))
- (while (> (org-current-level) offset) (org-up-heading-safe))
- (let* ((olpath (org-entry-get (point) "ARCHIVE_OLPATH"))
- (path (and olpath (split-string olpath "/")))
- (level offset)
- tree-text)
- (when olpath
- (org-mark-subtree)
- (setq tree-text (buffer-substring (region-beginning) (region-end)))
- (let (this-command) (org-cut-subtree))
- (goto-char (point-min))
- (save-restriction
- (widen)
- (-each path
- (lambda (heading)
- (if (re-search-forward
- (rx-to-string
- `(: bol (repeat ,level "*") (1+ " ") ,heading)) nil t)
- (org-narrow-to-subtree)
- (goto-char (point-max))
- (unless (looking-at "^")
- (insert "\n"))
- (insert (make-string level ?*)
- " "
- heading
- "\n"))
- (cl-incf level)))
- (widen)
- (org-end-of-subtree t t)
- (org-paste-subtree level tree-text))))))))
- )
+(after! org
+ (defadvice org-archive-subtree (around fix-hierarchy activate)
+ (let* ((fix-archive-p (and (not current-prefix-arg)
+ (not (use-region-p))))
+ (location (org-archive--compute-location org-archive-location))
+ (afile (car location))
+ (offset (if (= 0 (length (cdr location)))
+ 1
+ (1+ (string-match "[^*]" (cdr location)))))
+ (buffer (or (find-buffer-visiting afile) (find-file-noselect afile))))
+ ad-do-it
+ (when fix-archive-p
+ (with-current-buffer buffer
+ (goto-char (point-max))
+ (while (> (org-current-level) offset) (org-up-heading-safe))
+ (let* ((olpath (org-entry-get (point) "ARCHIVE_OLPATH"))
+ (path (and olpath (split-string olpath "/")))
+ (level offset)
+ tree-text)
+ (when olpath
+ (org-mark-subtree)
+ (setq tree-text (buffer-substring (region-beginning) (region-end)))
+ (let (this-command) (org-cut-subtree))
+ (goto-char (point-min))
+ (save-restriction
+ (widen)
+ (-each path
+ (lambda (heading)
+ (if (re-search-forward
+ (rx-to-string
+ `(: bol (repeat ,level "*") (1+ " ") ,heading)) nil t)
+ (org-narrow-to-subtree)
+ (goto-char (point-max))
+ (unless (looking-at "^")
+ (insert "\n"))
+ (insert (make-string level ?*)
+ " "
+ heading
+ "\n"))
+ (cl-incf level)))
+ (widen)
+ (org-end-of-subtree t t)
+ (org-paste-subtree level tree-text))))))))
+ )
(after! org - ;; File to save todo items - (setq org-agenda-files (list "~/Cloud/org/")) +(after! org + ;; File to save todo items + (setq org-agenda-files (list "~/Cloud/org/")) - ;; Include archived files - (setq org-agenda-archives-mode nil) + ;; Include archived files + (setq org-agenda-archives-mode nil) - ;; Set priority range from A to C with default A - (setq org-highest-priority ?A) - (setq org-lowest-priority ?C) - (setq org-default-priority ?C) + ;; Set priority range from A to C with default A + (setq org-highest-priority ?A) + (setq org-lowest-priority ?C) + (setq org-default-priority ?C) - ;; Set colours for priorities - (setq org-priority-faces '((?A . (:foreground "#FB4934")) - (?B . (:foreground "#FABD2F")) - (?C . (:foreground "#98971A")))) + ;; Set colours for priorities + (setq org-priority-faces '((?A . (:foreground "#FB4934")) + (?B . (:foreground "#FABD2F")) + (?C . (:foreground "#98971A")))) - ;; Open agenda in current window - (setq org-agenda-window-setup 'current-window) + ;; Open agenda in current window + (setq org-agenda-window-setup 'current-window) - ;; Set default first day of agenda - (setq org-agenda-start-day nil) - (setq org-agenda-start-on-weekday 1) - (setq org-agenda-span 7) + ;; Set default first day of agenda + (setq org-agenda-start-day nil) + (setq org-agenda-start-on-weekday 1) + (setq org-agenda-span 7) - (setq org-agenda-prefix-format - '((agenda . " %?-12t% s") - (todo . "") ;; Don't show the filename for reading agenda - (tags . " %-12:c") - (search . " %-12:c")) - ) - ) + (setq org-agenda-prefix-format + '((agenda . " %?-12t% s") + (todo . "") ;; Don't show the filename for reading agenda + (tags . " %-12:c") + (search . " %-12:c")) + ) + )
(after! org-agenda - (defun tdh-org-agenda-skip-scheduled () - (org-agenda-skip-entry-if 'scheduled 'deadline 'regexp "\n]+>")) +(after! org-agenda + (defun tdh-org-agenda-skip-scheduled () + (org-agenda-skip-entry-if 'scheduled 'deadline 'regexp "\n]+>")) - (setq org-agenda-custom-commands - '(("w" "Work" - ((org-ql-block '(and (tags "@work") - (todo "TODO") - (priority "A")) - ((org-ql-block-header "Important TODOs"))) - (org-ql-block '(and (tags "@work") - (todo "TODO") - (priority "B")) - ((org-ql-block-header "TODOs"))) - (org-ql-block '(and (tags "@work") - (todo "TODO") - (priority "C")) - ((org-ql-block-header "Not important TODOs"))))) - ("h" "Home" - ((org-ql-block '(and (tags "@home") - (todo "TODO") - (priority "A")) - ((org-ql-block-header "Things to do"))) - (org-ql-block '(and (tags "@home") - (todo "TODO") - (priority "B")) - ((org-ql-block-header "Things to do"))) - (org-ql-block '(and (tags "@home") - (todo "TODO") - (priority "C")) - ((org-ql-block-header "Things to do"))))) - ("q" "Questions to ask" - ((org-ql-block '(and (todo "QUES") - (tags "@christophe")) - ((org-ql-block-header "Questions to Christophe"))) - (org-ql-block '(and (todo "QUES") - (tags "@veijo")) - ((org-ql-block-header "Questions to Veijo"))) - (org-ql-block '(and (todo "QUES") - (not (tags "@veijo" "@christophe"))) - ((org-ql-block-header "Other Questions"))))) - ("R" "Already read Articles and Books" - ((org-ql-block '(and (todo "DONE") - (level 1) - (tags "article" "inproceedings" "techreport" "inbook")) - ((org-ql-block-header "Articles"))) - (org-ql-block '(and (todo "DONE") - (level 1) - (tags "book")) - ((org-ql-block-header "Books"))) - (org-ql-block '(and (todo "DONE") - (level 1) - (tags "phdthesis")) - ((org-ql-block-header "Phd Thesis"))) - (org-ql-block '(and (todo "DONE") - (level 1) - (not (tags "article" "inproceedings" "techreport" "inbook" "book" "phdthesis"))) - ((org-ql-block-header "Other Things")))) - ((org-agenda-files '("~/Cloud/brain/")))) - ("r" "Articles and Books to read" - ((org-ql-block '(and (todo "READ") - (level 1) - (tags "article" "inproceedings" "techreport" "inbook")) - ((org-ql-block-header "Article to Read"))) - (org-ql-block '(and (todo "READ") - (level 1) - (tags "book")) - ((org-ql-block-header "Books to Read"))) - (org-ql-block '(and (todo "READ") - (level 1) - (tags "phdthesis")) - ((org-ql-block-header "Phd Thesis to Read"))) - (org-ql-block '(and (todo "READ") - (level 1) - (not (tags "article" "inproceedings" "techreport" "inbook" "book" "phdthesis"))) - ((org-ql-block-header "Other Things to Read")))) - ((org-agenda-files '("~/Cloud/brain/"))))) - ) - ) + (setq org-agenda-custom-commands + '(("w" "Work" + ((org-ql-block '(and (tags "@work") + (todo "TODO") + (priority "A")) + ((org-ql-block-header "Important TODOs"))) + (org-ql-block '(and (tags "@work") + (todo "TODO") + (priority "B")) + ((org-ql-block-header "TODOs"))) + (org-ql-block '(and (tags "@work") + (todo "TODO") + (priority "C")) + ((org-ql-block-header "Not important TODOs"))))) + ("h" "Home" + ((org-ql-block '(and (tags "@home") + (todo "TODO") + (priority "A")) + ((org-ql-block-header "Things to do"))) + (org-ql-block '(and (tags "@home") + (todo "TODO") + (priority "B")) + ((org-ql-block-header "Things to do"))) + (org-ql-block '(and (tags "@home") + (todo "TODO") + (priority "C")) + ((org-ql-block-header "Things to do"))))) + ("q" "Questions to ask" + ((org-ql-block '(and (todo "QUES") + (tags "@christophe")) + ((org-ql-block-header "Questions to Christophe"))) + (org-ql-block '(and (todo "QUES") + (tags "@veijo")) + ((org-ql-block-header "Questions to Veijo"))) + (org-ql-block '(and (todo "QUES") + (not (tags "@veijo" "@christophe"))) + ((org-ql-block-header "Other Questions"))))) + ("R" "Already read Articles and Books" + ((org-ql-block '(and (todo "DONE") + (level 1) + (tags "article" "inproceedings" "techreport" "inbook")) + ((org-ql-block-header "Articles"))) + (org-ql-block '(and (todo "DONE") + (level 1) + (tags "book")) + ((org-ql-block-header "Books"))) + (org-ql-block '(and (todo "DONE") + (level 1) + (tags "phdthesis")) + ((org-ql-block-header "Phd Thesis"))) + (org-ql-block '(and (todo "DONE") + (level 1) + (not (tags "article" "inproceedings" "techreport" "inbook" "book" "phdthesis"))) + ((org-ql-block-header "Other Things")))) + ((org-agenda-files '("~/Cloud/brain/")))) + ("r" "Articles and Books to read" + ((org-ql-block '(and (todo "READ") + (level 1) + (tags "article" "inproceedings" "techreport" "inbook")) + ((org-ql-block-header "Article to Read"))) + (org-ql-block '(and (todo "READ") + (level 1) + (tags "book")) + ((org-ql-block-header "Books to Read"))) + (org-ql-block '(and (todo "READ") + (level 1) + (tags "phdthesis")) + ((org-ql-block-header "Phd Thesis to Read"))) + (org-ql-block '(and (todo "READ") + (level 1) + (not (tags "article" "inproceedings" "techreport" "inbook" "book" "phdthesis"))) + ((org-ql-block-header "Other Things to Read")))) + ((org-agenda-files '("~/Cloud/brain/"))))) + ) + )
(use-package! org-fancy-priorities ; priority icons - :hook (org-mode . org-fancy-priorities-mode) - :config (setq org-fancy-priorities-list '("■" "■" "■"))) +(use-package! org-fancy-priorities ; priority icons + :hook (org-mode . org-fancy-priorities-mode) + :config (setq org-fancy-priorities-list '("■" "■" "■")))
(after! org-agenda - (setq appt-message-warning-time 5) - (defun tdh-org-agenda-to-appt () - (interactive) - (setq appt-time-msg-list nil) - (org-agenda-to-appt)) +(after! org-agenda + (setq appt-message-warning-time 5) + (defun tdh-org-agenda-to-appt () + (interactive) + (setq appt-time-msg-list nil) + (org-agenda-to-appt)) - (tdh-org-agenda-to-appt) - ; Display appointments as a window manager notification - (setq appt-disp-window-function 'tdh-appt-display) - (setq appt-delete-window-function (lambda () t)) + (tdh-org-agenda-to-appt) + ; Display appointments as a window manager notification + (setq appt-disp-window-function 'tdh-appt-display) + (setq appt-delete-window-function (lambda () t)) - (setq tdh-appt-notification-app (concat (getenv "HOME") "/bin/appt-notification")) - (defun tdh-appt-display (min-to-app new-time msg) - (if (atom min-to-app) - (start-process "tdh-appt-notification-app" nil tdh-appt-notification-app min-to-app msg) - (dolist (i (number-sequence 0 (1- (length min-to-app)))) - (start-process "tdh-appt-notification-app" nil tdh-appt-notification-app (nth i min-to-app) (nth i msg))))) - ) + (setq tdh-appt-notification-app (concat (getenv "HOME") "/bin/appt-notification")) + (defun tdh-appt-display (min-to-app new-time msg) + (if (atom min-to-app) + (start-process "tdh-appt-notification-app" nil tdh-appt-notification-app min-to-app msg) + (dolist (i (number-sequence 0 (1- (length min-to-app)))) + (start-process "tdh-appt-notification-app" nil tdh-appt-notification-app (nth i min-to-app) (nth i msg))))) + )
TIME="$1"TODO - MSG="$2" +TIME="$1"TODO +MSG="$2" - dunstify --replace=85401 "Event in $TIME minutes" "$MSG" +dunstify --replace=85401 "Event in $TIME minutes" "$MSG"
(after! org - (require 'org-tempo) - (setq org-structure-template-alist - '(("c" . "center") - ("C" . "comment") - ("mm" . "src matlab") - ("mf" . "src matlab :exports none") - ("mv" . "src matlab :results value replace :exports none :tangle no") - ("l" . "src emacs-lisp") - ("q" . "quote") - ("s" . "src") - ("ba" . "answer") - ("bd" . "definition") - ("be" . "exampl") - ("bx" . "exercice") - ("bq" . "question") - ("bs" . "summary") - ("bS" . "seealso") - ("bh" . "hint") - ("bn" . "note") - ("bi" . "important") - ("bc" . "caution") - ("bw" . "warning") - )) - ) +(after! org + (require 'org-tempo) + (setq org-structure-template-alist + '(("c" . "center") + ("C" . "comment") + ("mm" . "src matlab") + ("mf" . "src matlab :exports none") + ("mv" . "src matlab :results value replace :exports none :tangle no") + ("l" . "src emacs-lisp") + ("q" . "quote") + ("s" . "src") + ("ba" . "answer") + ("bd" . "definition") + ("be" . "exampl") + ("bx" . "exercice") + ("bq" . "question") + ("bs" . "summary") + ("bS" . "seealso") + ("bh" . "hint") + ("bn" . "note") + ("bi" . "important") + ("bc" . "caution") + ("bw" . "warning") + )) +)
(after! org - (setq org-capture-templates - (quote (("t" ; key - "Todo" ; name - entry ; type - (file+headline "~/Cloud/org/work-notebook.org" "Inbox") ; target - "** TODO %?\n%U\n" ; template - ) - ("M" ; key - "Meeting" ; name - entry ; type - (file+headline "~/Cloud/org/work-notebook.org" "Meetings") ; target - "** %?\n%(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n" ; template - ) - ("m" ; key - "Mail" ; name - entry ; type - (file+headline "~/Cloud/org/work-notebook.org" "Mails") ; target - "** TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n" ; template - ) - ("r" ; key - "Reference" ; name - entry ; type - (file+headline "~/Cloud/org/inbox-ereader.org" "Things to Read") ; target - "** TODO [#B] %?\n" ; template - ) - ("pm" - "Org-Protocol Mail" - entry - (file+headline "~/Cloud/org/work-notebook.org" "Mails") - "* MAIL %:description [[message:%:link][link]]\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n\n" - :immediate-finish t - ) - ("pu" - "Org-Protocol Url" - entry - (file+headline "~/Cloud/org/work-notebook.org" "Inbox") - "* [[%:link][%:description]]\nCaptured On: %U\n\n" - :immediate-finish t - ) - ("pt" - "Org-Protocol text" - entry - (file+headline "~/Cloud/org/work-notebook.org" "Inbox") - "* %:description\nSource: %:link\nCaptured On: %U\n\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n" - :immediate-finish t - ) - ))) - ) +(after! org + (setq org-capture-templates + (quote (("t" ; key + "Todo" ; name + entry ; type + (file+headline "~/Cloud/org/work-notebook.org" "Inbox") ; target + "** TODO %?\n%U\n" ; template + ) + ("M" ; key + "Meeting" ; name + entry ; type + (file+headline "~/Cloud/org/work-notebook.org" "Meetings") ; target + "** %?\n%(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n" ; template + ) + ("m" ; key + "Mail" ; name + entry ; type + (file+headline "~/Cloud/org/work-notebook.org" "Mails") ; target + "** TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n" ; template + ) + ("r" ; key + "Reference" ; name + entry ; type + (file+headline "~/Cloud/org/inbox-ereader.org" "Things to Read") ; target + "** TODO [#B] %?\n" ; template + ) + ("pm" + "Org-Protocol Mail" + entry + (file+headline "~/Cloud/org/work-notebook.org" "Mails") + "* MAIL %:description [[message:%:link][link]]\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n\n" + :immediate-finish t + ) + ("pu" + "Org-Protocol Url" + entry + (file+headline "~/Cloud/org/work-notebook.org" "Inbox") + "* [[%:link][%:description]]\nCaptured On: %U\n\n" + :immediate-finish t + ) + ("pt" + "Org-Protocol text" + entry + (file+headline "~/Cloud/org/work-notebook.org" "Inbox") + "* %:description\nSource: %:link\nCaptured On: %U\n\n#+begin_quote\n%i\n#+end_quote\n\n" + :immediate-finish t + ) + ))) + )
(after! org - ;; How many levels of headline to export - (setq org-export-headline-levels 4) +(after! org + ;; How many levels of headline to export + (setq org-export-headline-levels 4) - ;; Authorize BIND to set local variables - (setq org-export-allow-bind-keywords t) + ;; Authorize BIND to set local variables + (setq org-export-allow-bind-keywords t) - ;; Use doc instead of odt - (setq org-odt-preferred-output-format "doc") - ) + ;; Use doc instead of odt + (setq org-odt-preferred-output-format "doc") + )
(after! org - (setq org-export-with-author t) - (setq org-export-with-creator nil) - (setq org-export-with-date t) - (setq org-export-with-toc t) - (setq org-export-with-drawers nil) - (setq org-export-with-sub-superscripts nil) - (setq org-export-with-todo-keywords nil) - ) +(after! org + (setq org-export-with-author t) + (setq org-export-with-creator nil) + (setq org-export-with-date t) + (setq org-export-with-toc t) + (setq org-export-with-drawers nil) + (setq org-export-with-sub-superscripts nil) + (setq org-export-with-todo-keywords nil) + )
:ignore:
tag:
;; Used to not export headings with :ignore: tag - (after! org - (require 'ox-extra) - (ox-extras-activate '(ignore-headlines))) +;; Used to not export headings with :ignore: tag +(after! org + (require 'ox-extra) + (ox-extras-activate '(ignore-headlines)))
:ignore:
tag:
(after! org - (setq org-html-head "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">") - (setq org-html-head-extra "") +(after! org + (setq org-html-head "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">") + (setq org-html-head-extra "") - (setq org-html-head-include-default-style nil) - (setq org-html-head-include-scripts nil) + (setq org-html-head-include-default-style nil) + (setq org-html-head-include-scripts nil) - (setq org-html-viewport nil) + (setq org-html-viewport nil) - (setq org-html-html5-fancy t) - (setq org-html-doctype "xhtml-strict") + (setq org-html-html5-fancy t) + (setq org-html-doctype "xhtml-strict") - (setq org-html-wrap-src-lines nil) + (setq org-html-wrap-src-lines nil) - ;; Export with css class instead of inline css - (setq org-html-htmlize-output-type 'css) - ) + ;; Export with css class instead of inline css + (setq org-html-htmlize-output-type 'css) + )
:ignore:
tag:
(after! org - (setq org-html-mathjax-template - "<script> - MathJax = { - svg: { - scale: %SCALE, - fontCache: \"global\" - }, - tex: { - tags: \"%AUTONUMBER\", - multlineWidth: \"%MULTLINEWIDTH\", - tagSide: \"%TAGSIDE\", - macros: {bm: [\"\\\\boldsymbol{#1}\",1],}, - tagIndent: \"%TAGINDENT\" - } - }; - </script> - <script id=\"MathJax-script\" async - src=\"%PATH\"></script>") +(after! org + (setq org-html-mathjax-template + "<script> + MathJax = { + svg: { + scale: %SCALE, + fontCache: \"global\" + }, + tex: { + tags: \"%AUTONUMBER\", + multlineWidth: \"%MULTLINEWIDTH\", + tagSide: \"%TAGSIDE\", + macros: {bm: [\"\\\\boldsymbol{#1}\",1],}, + tagIndent: \"%TAGINDENT\" + } + }; + </script> + <script id=\"MathJax-script\" async + src=\"%PATH\"></script>") - (setq org-html-mathjax-options - '((path "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js" ) - (scale "1") - (autonumber "ams") - (tagindent ".8em") - (tagside "right"))) - ) + (setq org-html-mathjax-options + '((path "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js" ) + (scale "1") + (autonumber "ams") + (tagindent ".8em") + (tagside "right"))) + )
:ignore:
tag:
video
link(defun org-video-link-export (path desc backend) - (let ((ext (file-name-extension path))) - (cond - ((eq 'html backend) - (format "<video preload='metadata' controls='controls'><source type='video/%s' src='%s' /></video>" ext path)) - ;; fall-through case for everything else - (t - path)))) +(defun org-video-link-export (path desc backend) + (let ((ext (file-name-extension path))) + (cond + ((eq 'html backend) + (format "<video preload='metadata' controls='controls'><source type='video/%s' src='%s' /></video>" ext path)) + ;; fall-through case for everything else + (t + path)))) - (after! org - (org-link-set-parameters "video" :export 'org-video-link-export) +(after! org + (org-link-set-parameters "video" :export 'org-video-link-export) - (org-export-string-as "video:xxx.mp4" 'html t) - ) + (org-export-string-as "video:xxx.mp4" 'html t) + )
(define-minor-mode unpackaged/org-export-html-with-useful-ids-mode - "Attempt to export Org as HTML with useful link IDs. - Instead of random IDs like \"#orga1b2c3\", use heading titles, - made unique when necessary." - :global t - (if unpackaged/org-export-html-with-useful-ids-mode - (advice-add #'org-export-get-reference :override #'unpackaged/org-export-get-reference) - (advice-remove #'org-export-get-reference #'unpackaged/org-export-get-reference))) +(define-minor-mode unpackaged/org-export-html-with-useful-ids-mode + "Attempt to export Org as HTML with useful link IDs. +Instead of random IDs like \"#orga1b2c3\", use heading titles, +made unique when necessary." + :global t + (if unpackaged/org-export-html-with-useful-ids-mode + (advice-add #'org-export-get-reference :override #'unpackaged/org-export-get-reference) + (advice-remove #'org-export-get-reference #'unpackaged/org-export-get-reference))) - (defun unpackaged/org-export-get-reference (datum info) - "Like `org-export-get-reference', except uses heading titles instead of random numbers." - (let ((cache (plist-get info :internal-references))) - (or (car (rassq datum cache)) - (let* ((crossrefs (plist-get info :crossrefs)) - (cells (org-export-search-cells datum)) - ;; Preserve any pre-existing association between - ;; a search cell and a reference, i.e., when some - ;; previously published document referenced a location - ;; within current file (see - ;; `org-publish-resolve-external-link'). - ;; - ;; However, there is no guarantee that search cells are - ;; unique, e.g., there might be duplicate custom ID or - ;; two headings with the same title in the file. - ;; - ;; As a consequence, before re-using any reference to - ;; an element or object, we check that it doesn't refer - ;; to a previous element or object. - (new (or (cl-some - (lambda (cell) - (let ((stored (cdr (assoc cell crossrefs)))) - (when stored - (let ((old (org-export-format-reference stored))) - (and (not (assoc old cache)) stored))))) - cells) - (when (org-element-property :raw-value datum) - ;; Heading with a title - (unpackaged/org-export-new-named-reference datum cache)) - (when (member (car datum) '(src-block table example fixed-width property-drawer)) - ;; Nameable elements - (unpackaged/org-export-new-named-reference datum cache)) - ;; NOTE: This probably breaks some Org Export - ;; feature, but if it does what I need, fine. - (org-export-format-reference - (org-export-new-reference cache)))) - (reference-string new)) - ;; Cache contains both data already associated to - ;; a reference and in-use internal references, so as to make - ;; unique references. - (dolist (cell cells) (push (cons cell new) cache)) - ;; Retain a direct association between reference string and - ;; DATUM since (1) not every object or element can be given - ;; a search cell (2) it permits quick lookup. - (push (cons reference-string datum) cache) - (plist-put info :internal-references cache) - reference-string)))) +(defun unpackaged/org-export-get-reference (datum info) + "Like `org-export-get-reference', except uses heading titles instead of random numbers." + (let ((cache (plist-get info :internal-references))) + (or (car (rassq datum cache)) + (let* ((crossrefs (plist-get info :crossrefs)) + (cells (org-export-search-cells datum)) + ;; Preserve any pre-existing association between + ;; a search cell and a reference, i.e., when some + ;; previously published document referenced a location + ;; within current file (see + ;; `org-publish-resolve-external-link'). + ;; + ;; However, there is no guarantee that search cells are + ;; unique, e.g., there might be duplicate custom ID or + ;; two headings with the same title in the file. + ;; + ;; As a consequence, before re-using any reference to + ;; an element or object, we check that it doesn't refer + ;; to a previous element or object. + (new (or (cl-some + (lambda (cell) + (let ((stored (cdr (assoc cell crossrefs)))) + (when stored + (let ((old (org-export-format-reference stored))) + (and (not (assoc old cache)) stored))))) + cells) + (when (org-element-property :raw-value datum) + ;; Heading with a title + (unpackaged/org-export-new-named-reference datum cache)) + (when (member (car datum) '(src-block table example fixed-width property-drawer)) + ;; Nameable elements + (unpackaged/org-export-new-named-reference datum cache)) + ;; NOTE: This probably breaks some Org Export + ;; feature, but if it does what I need, fine. + (org-export-format-reference + (org-export-new-reference cache)))) + (reference-string new)) + ;; Cache contains both data already associated to + ;; a reference and in-use internal references, so as to make + ;; unique references. + (dolist (cell cells) (push (cons cell new) cache)) + ;; Retain a direct association between reference string and + ;; DATUM since (1) not every object or element can be given + ;; a search cell (2) it permits quick lookup. + (push (cons reference-string datum) cache) + (plist-put info :internal-references cache) + reference-string)))) - (defun unpackaged/org-export-new-named-reference (datum cache) - "Return new reference for DATUM that is unique in CACHE." - (cl-macrolet ((inc-suffixf (place) - `(progn - (string-match (rx bos - (minimal-match (group (1+ anything))) - (optional "--" (group (1+ digit))) - eos) - ,place) - ;; HACK: `s1' instead of a gensym. - (-let* (((s1 suffix) (list (match-string 1 ,place) - (match-string 2 ,place))) - (suffix (if suffix - (string-to-number suffix) - 0))) - (setf ,place (format "%s--%s" s1 (cl-incf suffix))))))) - (let* ((headline-p (eq (car datum) 'headline)) - (title (if headline-p - (org-element-property :raw-value datum) - (or (org-element-property :name datum) - (concat (org-element-property :raw-value - (org-element-property :parent - (org-element-property :parent datum))))))) - ;; get ascii-only form of title without needing percent-encoding - (ref (concat (org-reference-contraction (substring-no-properties title)) - (unless (or headline-p (org-element-property :name datum)) - (concat "," - (pcase (car datum) - ('src-block "code") - ('example "example") - ('fixed-width "mono") - ('property-drawer "properties") - (_ (symbol-name (car datum)))) - "--1")))) - (parent (when headline-p (org-element-property :parent datum)))) - (while (--any (equal ref (car it)) - cache) - ;; Title not unique: make it so. - (if parent - ;; Append ancestor title. - (setf title (concat (org-element-property :raw-value parent) - "--" title) - ;; get ascii-only form of title without needing percent-encoding - ref (org-reference-contraction (substring-no-properties title)) - parent (when headline-p (org-element-property :parent parent))) - ;; No more ancestors: add and increment a number. - (inc-suffixf ref))) - ref))) +(defun unpackaged/org-export-new-named-reference (datum cache) + "Return new reference for DATUM that is unique in CACHE." + (cl-macrolet ((inc-suffixf (place) + `(progn + (string-match (rx bos + (minimal-match (group (1+ anything))) + (optional "--" (group (1+ digit))) + eos) + ,place) + ;; HACK: `s1' instead of a gensym. + (-let* (((s1 suffix) (list (match-string 1 ,place) + (match-string 2 ,place))) + (suffix (if suffix + (string-to-number suffix) + 0))) + (setf ,place (format "%s--%s" s1 (cl-incf suffix))))))) + (let* ((headline-p (eq (car datum) 'headline)) + (title (if headline-p + (org-element-property :raw-value datum) + (or (org-element-property :name datum) + (concat (org-element-property :raw-value + (org-element-property :parent + (org-element-property :parent datum))))))) + ;; get ascii-only form of title without needing percent-encoding + (ref (concat (org-reference-contraction (substring-no-properties title)) + (unless (or headline-p (org-element-property :name datum)) + (concat "," + (pcase (car datum) + ('src-block "code") + ('example "example") + ('fixed-width "mono") + ('property-drawer "properties") + (_ (symbol-name (car datum)))) + "--1")))) + (parent (when headline-p (org-element-property :parent datum)))) + (while (--any (equal ref (car it)) + cache) + ;; Title not unique: make it so. + (if parent + ;; Append ancestor title. + (setf title (concat (org-element-property :raw-value parent) + "--" title) + ;; get ascii-only form of title without needing percent-encoding + ref (org-reference-contraction (substring-no-properties title)) + parent (when headline-p (org-element-property :parent parent))) + ;; No more ancestors: add and increment a number. + (inc-suffixf ref))) + ref))) - (add-hook 'org-load-hook #'unpackaged/org-export-html-with-useful-ids-mode) +(add-hook 'org-load-hook #'unpackaged/org-export-html-with-useful-ids-mode)
(defun my/org-drawer-format (name contents) - "Export to HTML the drawers named with prefix ‘fold_’, ignoring case. +(defun my/org-drawer-format (name contents) + "Export to HTML the drawers named with prefix ‘fold_’, ignoring case. - The resulting drawer is a ‘code-details’ and so appears folded; - the user clicks it to see the information therein. - Henceforth, these are called ‘fold drawers’. +The resulting drawer is a ‘code-details’ and so appears folded; +the user clicks it to see the information therein. +Henceforth, these are called ‘fold drawers’. - Drawers without such a prefix may be nonetheless exported if their - body contains ‘:export: t’ ---this switch does not appear in the output. - Thus, we are biased to generally not exporting non-fold drawers. +Drawers without such a prefix may be nonetheless exported if their +body contains ‘:export: t’ ---this switch does not appear in the output. +Thus, we are biased to generally not exporting non-fold drawers. - One may suspend export of fold drawers by having ‘:export: nil’ - in their body definition. +One may suspend export of fold drawers by having ‘:export: nil’ +in their body definition. - Fold drawers naturally come with a title. - Either it is specfied in the drawer body by ‘:title: ⋯’, - or otherwise the drawer's name is used with all underscores replaced - by spaces. - " - (let* ((contents′ (replace-regexp-in-string ":export:.*\n?" "" contents)) - (fold? (s-prefix? "fold_" name 'ignore-case)) - (export? (string-match ":export:\s+t" contents)) - (not-export? (string-match ":export:\s+nil" contents)) - (title′ (and (string-match ":title:\\(.*\\)\n" contents) - (match-string 1 contents)))) +Fold drawers naturally come with a title. +Either it is specfied in the drawer body by ‘:title: ⋯’, +or otherwise the drawer's name is used with all underscores replaced +by spaces. +" + (let* ((contents′ (replace-regexp-in-string ":export:.*\n?" "" contents)) + (fold? (s-prefix? "fold_" name 'ignore-case)) + (export? (string-match ":export:\s+t" contents)) + (not-export? (string-match ":export:\s+nil" contents)) + (title′ (and (string-match ":title:\\(.*\\)\n" contents) + (match-string 1 contents)))) - ;; Ensure we have a title. - (unless title′ (setq title′ (s-join " " (cdr (s-split "_" name))))) + ;; Ensure we have a title. + (unless title′ (setq title′ (s-join " " (cdr (s-split "_" name))))) - ;; Output - (cond - ((and export? (not fold?)) contents′) - (not-export? nil) - (fold? - (thread-last contents′ - (replace-regexp-in-string ":title:.*\n" "") - (format "<details class=\"code-details\"> <summary> <strong> - <font face=\"Courier\" size=\"3\" color=\"green\"> %s - </font> </strong> </summary> %s </details>" title′)))))) + ;; Output + (cond + ((and export? (not fold?)) contents′) + (not-export? nil) + (fold? + (thread-last contents′ + (replace-regexp-in-string ":title:.*\n" "") + (format "<details class=\"code-details\"> <summary> <strong> + <font face=\"Courier\" size=\"3\" color=\"green\"> %s + </font> </strong> </summary> %s </details>" title′)))))) - (setq org-html-format-drawer-function 'my/org-drawer-format) +(setq org-html-format-drawer-function 'my/org-drawer-format)
(after! org - ;; Highligh latex parts in org mode - (setq org-highlight-latex-and-related '(latex script entities)) +(after! org + ;; Highligh latex parts in org mode + (setq org-highlight-latex-and-related '(latex script entities)) - ;; Use F9 to globally generate all the latex fragments - (map! :map org-mode-map - :n "<f9>" - (lambda () (interactive) (org-preview-latex-fragment 16))) + ;; Use F9 to globally generate all the latex fragments + (map! :map org-mode-map + :n "<f9>" + (lambda () (interactive) (org-preview-latex-fragment 16))) - ;; Put all the preview images in some directory - (setq org-preview-latex-image-directory "~/.ltximg/") + ;; Put all the preview images in some directory + (setq org-preview-latex-image-directory "~/.ltximg/") - ;; Define backends to preview LaTeX fragments - (setq org-preview-latex-process-alist '((imagemagick - :programs ("pdflatex" "convert") - :description "pdf > png" - :message "you need to install the programs: pdflatex and imagemagick." - :image-input-type "pdf" - :image-output-type "png" - :image-size-adjust (1.0 . 1.0) - :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f") - :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")) - (dvipng - :programs ("latex" "dvipng") - :description "dvi > png" - :message "you need to install the programs: latex and dvipng." - :image-input-type "dvi" - :image-output-type "png" - :image-size-adjust (0.4 . 0.4) - :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") - :image-converter ("dvipng -D %D -T tight -o %O %f")) - (dvisvgm - :programs ("pdflatex" "dvisvgm") - :description "dvi > svg" - :message "you need to install the programs: latex and dvisvgm." - :image-input-type "dvi" - :image-output-type "svg" - :image-size-adjust (0.6 . 0.6) - :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") - :image-converter ("dvisvgm %f -n -b min -c %S -o %O")) - )) + ;; Define backends to preview LaTeX fragments + (setq org-preview-latex-process-alist '((imagemagick + :programs ("pdflatex" "convert") + :description "pdf > png" + :message "you need to install the programs: pdflatex and imagemagick." + :image-input-type "pdf" + :image-output-type "png" + :image-size-adjust (1.0 . 1.0) + :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f") + :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")) + (dvipng + :programs ("latex" "dvipng") + :description "dvi > png" + :message "you need to install the programs: latex and dvipng." + :image-input-type "dvi" + :image-output-type "png" + :image-size-adjust (0.4 . 0.4) + :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") + :image-converter ("dvipng -D %D -T tight -o %O %f")) + (dvisvgm + :programs ("pdflatex" "dvisvgm") + :description "dvi > svg" + :message "you need to install the programs: latex and dvisvgm." + :image-input-type "dvi" + :image-output-type "svg" + :image-size-adjust (0.6 . 0.6) + :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") + :image-converter ("dvisvgm %f -n -b min -c %S -o %O")) + )) - ;; Use imagemagick/dvisvgm to generate png from pdf - (setq org-preview-latex-default-process 'dvipng) + ;; Use imagemagick/dvisvgm to generate png from pdf + (setq org-preview-latex-default-process 'dvisvgm) - ;; Don't change the font size for subscripts and superscripts in latex fragments. - ;; This cause the orgmode tables not to be well aligned. - (setq font-latex-fontify-script nil) + ;; Don't change the font size for subscripts and superscripts in latex fragments. + ;; This cause the orgmode tables not to be well aligned. + (setq font-latex-fontify-script nil) - ;; Colors of latex fragments - (setq org-format-latex-options (plist-put org-format-latex-options :foreground 'default)) - (setq org-format-latex-options (plist-put org-format-latex-options :background 'default)) - ) + ;; Colors of latex fragments + (setq org-format-latex-options (plist-put org-format-latex-options :foreground 'default)) + (setq org-format-latex-options (plist-put org-format-latex-options :background 'default)) + )
(after! org - ;; Custom classes to use when exporting to latex - (add-to-list 'org-latex-classes - '("beamer" - ,(concat "\\documentclass[presentation]{beamer}\n" - "[DEFAULT-PACKAGES]" - "[PACKAGES]" - "[EXTRA]\n") - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) - (add-to-list 'org-latex-classes - '("clean-cheatsheet" - "\\documentclass{clean-cheatsheet}" - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) - ) - (add-to-list 'org-latex-classes - '("clean-beamer" - "\\documentclass{clean-beamer}" - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) - ) - (add-to-list 'org-latex-classes - '("cleanreport" - "\\documentclass{cleanreport}" - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) - ) - (add-to-list 'org-latex-classes - '("scrartcl" - "\\documentclass{scrartcl}" - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) - ) - (add-to-list 'org-latex-classes - '("scrreprt" - "\\documentclass[a4paper, 10pt, DIV=12, parskip=full]{scrreprt}" - ("\\chapter{%s}" . "\\chapter*{%s}") - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) - ) - (add-to-list 'org-latex-classes - '("biblioreport" - "\\documentclass{biblioreport}" - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) - ) - (add-to-list 'org-latex-classes - '("moderncv" - "\\documentclass{moderncv}" - ("\\section{%s}" . "\\section*{%s}") - ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}") - ("\\paragraph{%s}" . "\\paragraph*{%s}") - ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) - ) +(after! org +;; Custom classes to use when exporting to latex +(add-to-list 'org-latex-classes + '("beamer" + ,(concat "\\documentclass[presentation]{beamer}\n" + "[DEFAULT-PACKAGES]" + "[PACKAGES]" + "[EXTRA]\n") + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) +(add-to-list 'org-latex-classes + '("clean-cheatsheet" + "\\documentclass{clean-cheatsheet}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + ) +(add-to-list 'org-latex-classes + '("clean-beamer" + "\\documentclass{clean-beamer}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + ) +(add-to-list 'org-latex-classes + '("cleanreport" + "\\documentclass{cleanreport}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + ) +(add-to-list 'org-latex-classes + '("scrartcl" + "\\documentclass{scrartcl}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + ) +(add-to-list 'org-latex-classes + '("scrreprt" + "\\documentclass[a4paper, 10pt, DIV=12, parskip=full]{scrreprt}" + ("\\chapter{%s}" . "\\chapter*{%s}") + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + ) +(add-to-list 'org-latex-classes + '("biblioreport" + "\\documentclass{biblioreport}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + ) +(add-to-list 'org-latex-classes + '("moderncv" + "\\documentclass{moderncv}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + ) - ) +)
;; (use-package! ox-latex-subfigure - ;; :after org - ;; :config (require 'ox-latex-subfigure)) +;; (use-package! ox-latex-subfigure +;; :after org +;; :config (require 'ox-latex-subfigure))
(use-package! ox-latex-subfigure - :load-path "~/.config/doom/packages/ox-latex-subfigure/" - :config (require 'ox-latex-subfigure)) +(use-package! ox-latex-subfigure + :load-path "~/.config/doom/packages/ox-latex-subfigure/" + :config (require 'ox-latex-subfigure))
(after! org - (defun tdh-get-headline-string-element (headline backend info) - (let ((prop-point (next-property-change 0 headline))) - (if prop-point (plist-get (text-properties-at prop-point headline) :parent)))) +(after! org + (defun tdh-get-headline-string-element (headline backend info) + (let ((prop-point (next-property-change 0 headline))) + (if prop-point (plist-get (text-properties-at prop-point headline) :parent)))) - (defun tdh-ensure-latex-clearpage (headline backend info) - (when (org-export-derived-backend-p backend 'latex) - (let ((elmnt (tdh-get-headline-string-element headline backend info))) - (when (and elmnt (org-element-property :CLEARPAGE elmnt)) - (concat "\\clearpage\n" headline))))) + (defun tdh-ensure-latex-clearpage (headline backend info) + (when (org-export-derived-backend-p backend 'latex) + (let ((elmnt (tdh-get-headline-string-element headline backend info))) + (when (and elmnt (org-element-property :CLEARPAGE elmnt)) + (concat "\\clearpage\n" headline))))) - (add-to-list 'org-export-filter-headline-functions - 'tdh-ensure-latex-clearpage) - ) + (add-to-list 'org-export-filter-headline-functions + 'tdh-ensure-latex-clearpage) + )
(after! org - (setq org-latex-default-packages-alist - '(("AUTO" "inputenc" t ("pdflatex")) ;; for basic font and character selection - ("T1" "fontenc" t ("pdflatex")) ;; for basic font and character selection - ("" "graphicx" t) ;; for including images - ("" "grffile" t) ;; allow periods and spaces in graphics file names - ("" "longtable" nil) ;; For multipage tables - ("" "wrapfig" nil) ;; for figure placement - ("" "rotating" nil) ;; for sideways figures and tables - ("normalem" "ulem" t) ;; for underline and strike-through - ("" "amsmath" t) ;; for subscript and superscript and math environments - ("" "textcomp" t) ;; for various symbols - ("" "amssymb" t) ;; for various symbols - ("" "capt-of" nil) ;; for captions outside of floats - ("" "hyperref" nil)) ;; for cross references - ) - ) +(after! org + (setq org-latex-default-packages-alist + '(("AUTO" "inputenc" t ("pdflatex")) ;; for basic font and character selection + ("T1" "fontenc" t ("pdflatex")) ;; for basic font and character selection + ("" "graphicx" t) ;; for including images + ("" "grffile" t) ;; allow periods and spaces in graphics file names + ("" "longtable" nil) ;; For multipage tables + ("" "wrapfig" nil) ;; for figure placement + ("" "rotating" nil) ;; for sideways figures and tables + ("normalem" "ulem" t) ;; for underline and strike-through + ("" "amsmath" t) ;; for subscript and superscript and math environments + ("" "textcomp" t) ;; for various symbols + ("" "amssymb" t) ;; for various symbols + ("" "capt-of" nil) ;; for captions outside of floats + ("" "hyperref" nil)) ;; for cross references + ) + )
(after! org - (add-to-list 'org-latex-packages-alist '("" "siunitx" t)) - (add-to-list 'org-latex-packages-alist '("" "array" t)) - (add-to-list 'org-latex-packages-alist '("" "tabularx" t)) - (add-to-list 'org-latex-packages-alist '("" "booktabs" t)) - (add-to-list 'org-latex-packages-alist '("" "bm" t)) - (add-to-list 'org-latex-packages-alist '("most" "tcolorbox" t)) - ) +(after! org + (add-to-list 'org-latex-packages-alist '("" "siunitx" t)) + (add-to-list 'org-latex-packages-alist '("" "array" t)) + (add-to-list 'org-latex-packages-alist '("" "tabularx" t)) + (add-to-list 'org-latex-packages-alist '("" "booktabs" t)) + (add-to-list 'org-latex-packages-alist '("" "bm" t)) + (add-to-list 'org-latex-packages-alist '("most" "tcolorbox" t)) + )
(after! org - ;; Setup default option for image size when exporting to LaTeX - (setq org-latex-image-default-scale "") - (setq org-latex-image-default-width "") - (setq org-latex-image-default-height "") - (setq org-latex-image-default-option "scale=1") +(after! org + ;; Setup default option for image size when exporting to LaTeX + (setq org-latex-image-default-scale "") + (setq org-latex-image-default-width "") + (setq org-latex-image-default-height "") + (setq org-latex-image-default-option "scale=1") - ;; Use define labels instead of automatic generated ones - (setq org-latex-prefer-user-labels t) + ;; Use define labels instead of automatic generated ones + (setq org-latex-prefer-user-labels t) - ;; Captions above the table - (setq org-latex-caption-above '(table)) + ;; Captions above the table + (setq org-latex-caption-above '(table)) - ;; Settings to export code with `minted' instead of `verbatim'. - (setq org-latex-listings 'minted) + ;; Settings to export code with `minted' instead of `verbatim'. + (setq org-latex-listings 'minted) - ;; Set the following as images - (setq org-latex-inline-image-rules '(("file" . "\\.\\(pdf\\|jpeg\\|jpg\\|png\\|ps\\|eps\\|tikz\\|pgf\\|svg\\|gif\\)\\'"))) + ;; Set the following as images + (setq org-latex-inline-image-rules '(("file" . "\\.\\(pdf\\|jpeg\\|jpg\\|png\\|ps\\|eps\\|tikz\\|pgf\\|svg\\|gif\\)\\'"))) - ;; Command used when exporting to pdf - (setq org-latex-pdf-process - '("latexmk -cd -pdflatex=\"pdflatex -synctex=1 -shell-escape -interaction nonstopmode -output-directory %o\" -pdf -bibtex -f %f")) - ) + ;; Command used when exporting to pdf + (setq org-latex-pdf-process + '("latexmk -cd -pdflatex=\"pdflatex -synctex=1 -shell-escape -interaction nonstopmode -output-directory %o\" -pdf -bibtex -f %f")) + )
(after! org - (defun tdh-my-beamer-bold (contents backend info) - (when (eq backend 'beamer) - (replace-regexp-in-string - (concat "\\`\\\\" "[A-Za-z0-9]+") ;; If not, orgmode is crazy... - "\\\\textbf" - contents))) +(after! org + (defun tdh-my-beamer-bold (contents backend info) + (when (eq backend 'beamer) + (replace-regexp-in-string + (concat "\\`\\\\" "[A-Za-z0-9]+") ;; If not, orgmode is crazy... + "\\\\textbf" + contents))) - (add-to-list 'org-export-filter-bold-functions 'tdh-my-beamer-bold) - ) + (add-to-list 'org-export-filter-bold-functions 'tdh-my-beamer-bold) + )
[ ]
Make some comment those special environments(after! org - (add-to-list 'org-beamer-environments-extra - '("cbox" ;; Name of environment - "m" ;; Selection key - "\\onslide%a{\\begin{cbox}[%h]%O" - "\\end{cbox}}\\vspace{0.5em}")) - (add-to-list 'org-beamer-environments-extra - '("csubbox" ;; Name of environment - "M" ;; Selection key - "\\onslide%a{\\tcbsubtitle{%h}" - "}")) - ) +(after! org + (add-to-list 'org-beamer-environments-extra + '("cbox" ;; Name of environment + "m" ;; Selection key + "\\onslide%a{\\begin{cbox}[%h]%O" + "\\end{cbox}}\\vspace{0.5em}")) + (add-to-list 'org-beamer-environments-extra + '("csubbox" ;; Name of environment + "M" ;; Selection key + "\\onslide%a{\\tcbsubtitle{%h}" + "}")) + )
(defcustom tdh-org-property-mapping - '((latex ("CUSTOM_PAGE" . tdh-insert-org-page-latex) - ("CUSTOM_LABEL" . tdh-insert-org-label-latex))) - "List of mappings from org property to arbitrary strings. - Each element is a list: - (BACKEND (PROPERTY1 . FUNCTION1) (PROPERTY2 . FUNCTION2) ...) - FUNCTION are functions which get called with a single - argument (the value of PROPERTY) and are responsible for doing - whatever should be done." - :type '(repeat (cons symbol (repeat (cons string string))))) +(defcustom tdh-org-property-mapping + '((latex ("CUSTOM_PAGE" . tdh-insert-org-page-latex) + ("CUSTOM_LABEL" . tdh-insert-org-label-latex))) + "List of mappings from org property to arbitrary strings. +Each element is a list: + (BACKEND (PROPERTY1 . FUNCTION1) (PROPERTY2 . FUNCTION2) ...) +FUNCTION are functions which get called with a single +argument (the value of PROPERTY) and are responsible for doing +whatever should be done." + :type '(repeat (cons symbol (repeat (cons string string)))))
(defun tdh-replace-org-property (backend) - "Convert org properties using `tdh-org-property-mapping'. - Lookup BACKEND in `tdh-org-property-mapping' for a list of - (PROPERTY REPLACEMENT). For each healine being exported, if it has a - PROPERTY listed insert a string immediately after the healine given by - (format REPLACEMENT PROPERTY-VALUE)" - (let ((map (cdr (assoc backend tdh-org-property-mapping))) - value replacement) - (when map - (org-map-entries - (lambda () - (dolist (it map) - (save-excursion - (when (setq value (org-entry-get (point) (car it))) - (funcall (cdr it) value))))))))) +(defun tdh-replace-org-property (backend) + "Convert org properties using `tdh-org-property-mapping'. +Lookup BACKEND in `tdh-org-property-mapping' for a list of +(PROPERTY REPLACEMENT). For each healine being exported, if it has a +PROPERTY listed insert a string immediately after the healine given by + (format REPLACEMENT PROPERTY-VALUE)" + (let ((map (cdr (assoc backend tdh-org-property-mapping))) + value replacement) + (when map + (org-map-entries + (lambda () + (dolist (it map) + (save-excursion + (when (setq value (org-entry-get (point) (car it))) + (funcall (cdr it) value))))))))) - (add-hook 'org-export-before-processing-hook #'tdh-replace-org-property) +(add-hook 'org-export-before-processing-hook #'tdh-replace-org-property)
(defun tdh-insert-org-label-latex (label) - "Insert \"\\\\label{LABEL}\\n\" after the :PROPERTY: drawer." - (search-forward-regexp org-property-end-re) - (forward-char 1) - (insert (format "\\label{%s}\n" label))) - (defun tdh-insert-org-page-latex (page) - "Insert \"\\\\page{PAGE}\\n\" after the :PROPERTY: drawer." - (search-forward-regexp org-property-end-re) - (forward-char 1) - (insert (format "\\page{%s}\n" page))) +(defun tdh-insert-org-label-latex (label) + "Insert \"\\\\label{LABEL}\\n\" after the :PROPERTY: drawer." + (search-forward-regexp org-property-end-re) + (forward-char 1) + (insert (format "\\label{%s}\n" label))) +(defun tdh-insert-org-page-latex (page) + "Insert \"\\\\page{PAGE}\\n\" after the :PROPERTY: drawer." + (search-forward-regexp org-property-end-re) + (forward-char 1) + (insert (format "\\page{%s}\n" page)))
(after! org - (defun tdh-org-renumber-environment (orig-func &rest args) - "A function to inject numbers in LaTeX fragment previews." - (let ((results '()) - (counter -1) - (numberp)) +(after! org + (defun tdh-org-renumber-environment (orig-func &rest args) + "A function to inject numbers in LaTeX fragment previews." + (let ((results '()) + (counter -1) + (numberp)) - (setq results (loop for (begin . env) in - (org-element-map (org-element-parse-buffer) 'latex-environment - (lambda (env) - (cons - (org-element-property :begin env) - (org-element-property :value env)))) - collect - (cond - ((and (string-match "\\\\begin{equation}" env) - (not (string-match "\\\\tag{" env))) - (incf counter) - (cons begin counter)) - ((string-match "\\\\begin{align}" env) - (prog2 - (incf counter) - (cons begin counter) - (with-temp-buffer - (insert env) - (goto-char (point-min)) - ;; \\ is used for a new line. Each one leads to a number - (incf counter (count-matches "\\\\$")) - ;; unless there are nonumbers. - (goto-char (point-min)) - (decf counter (count-matches "\\nonumber"))))) - (t - (cons begin nil))))) + (setq results (loop for (begin . env) in + (org-element-map (org-element-parse-buffer) 'latex-environment + (lambda (env) + (cons + (org-element-property :begin env) + (org-element-property :value env)))) + collect + (cond + ((and (string-match "\\\\begin{equation}" env) + (not (string-match "\\\\tag{" env))) + (incf counter) + (cons begin counter)) + ((string-match "\\\\begin{align}" env) + (prog2 + (incf counter) + (cons begin counter) + (with-temp-buffer + (insert env) + (goto-char (point-min)) + ;; \\ is used for a new line. Each one leads to a number + (incf counter (count-matches "\\\\$")) + ;; unless there are nonumbers. + (goto-char (point-min)) + (decf counter (count-matches "\\nonumber"))))) + (t + (cons begin nil))))) - (when (setq numberp (cdr (assoc (point) results))) - (setf (car args) - (concat - (format "\\setcounter{equation}{%s}\n" numberp) - (car args))))) + (when (setq numberp (cdr (assoc (point) results))) + (setf (car args) + (concat + (format "\\setcounter{equation}{%s}\n" numberp) + (car args))))) - (apply orig-func args)) + (apply orig-func args)) - (advice-add 'org-create-formula-image :around #'tdh-org-renumber-environment) - ) + (advice-add 'org-create-formula-image :around #'tdh-org-renumber-environment) + )
(after! org - (add-to-list 'org-src-lang-modes '("latex-macros" . latex)) +(after! org + (add-to-list 'org-src-lang-modes '("latex-macros" . latex)) - (defvar org-babel-default-header-args:latex-macros - '((:results . "raw") - (:exports . "results"))) + (defvar org-babel-default-header-args:latex-macros + '((:results . "raw") + (:exports . "results"))) - (defun prefix-all-lines (pre body) - (with-temp-buffer - (insert body) - (string-insert-rectangle (point-min) (point-max) pre) - (buffer-string))) + (defun prefix-all-lines (pre body) + (with-temp-buffer + (insert body) + (string-insert-rectangle (point-min) (point-max) pre) + (buffer-string))) - (defun org-babel-execute:latex-macros (body _params) - (concat - "\n#+begin_export html\n<div style=\"display: none\"> \\(\n" - body - "\n\\)</div>\n#+end_export\n")) - ) + (defun org-babel-execute:latex-macros (body _params) + (concat + "\n#+begin_export html\n<div style=\"display: none\"> \\(\n" + body + "\n\\)</div>\n#+end_export\n")) + )
(setq org-publish-project-alist - '(("config" - :base-directory "~/.config/literate-dotfiles/" - :publishing-directory "~/.config/literate-dotfiles/docs/" - :recursive nil - :publishing-function org-html-publish-to-html - :auto-sitemap nil - :section-numbers nil - :table-of-contents nil) - ("stewart-simscape" - :base-directory "~/Cloud/thesis/matlab/stewart-simscape/org/" - :base-extension "org" - :publishing-directory "~/Cloud/thesis/matlab/stewart-simscape/docs/" - :author "Dehaeze Thomas" - :email "dehaeze.thomas@gmail.com/" - :recursive nil - :publishing-function org-html-publish-to-html - :auto-preamble t - :auto-sitemap nil - :html-link-up "index.html" - :html-link-home "index.html" - :with-todo-keywords nil - :html-wrap-src-lines nil - :table-of-contents nil) - ("nass-simscape" - :base-directory "~/Cloud/thesis/matlab/nass-simscape/org/" - :base-extension "org" - :publishing-directory "~/Cloud/thesis/matlab/nass-simscape/docs/" - :author "Dehaeze Thomas" - :email "dehaeze.thomas@gmail.com/" - :recursive nil - :publishing-function org-html-publish-to-html - :auto-preamble t - :auto-sitemap nil - :html-link-up "index.html" - :html-link-home "index.html" - :with-todo-keywords nil - :html-wrap-src-lines nil - :table-of-contents nil) - ("tikz-maker" - :base-directory "~/Cloud/tikz/org/" - :base-extension "org" - :publishing-directory "~/Cloud/tikz/docs/" - :author "Dehaeze Thomas" - :email "dehaeze.thomas@gmail.com/" - :recursive nil - :publishing-function org-html-publish-to-html - :auto-preamble t - :auto-sitemap nil - :html-link-up "index.html" - :html-link-home "index.html" - :with-todo-keywords nil - :html-wrap-src-lines nil - :table-of-contents nil))) +(setq org-publish-project-alist + '(("config" + :base-directory "~/.config/literate-dotfiles/" + :publishing-directory "~/.config/literate-dotfiles/docs/" + :recursive nil + :publishing-function org-html-publish-to-html + :auto-sitemap nil + :section-numbers nil + :table-of-contents nil) + ("stewart-simscape" + :base-directory "~/Cloud/thesis/matlab/stewart-simscape/org/" + :base-extension "org" + :publishing-directory "~/Cloud/thesis/matlab/stewart-simscape/docs/" + :author "Dehaeze Thomas" + :email "dehaeze.thomas@gmail.com/" + :recursive nil + :publishing-function org-html-publish-to-html + :auto-preamble t + :auto-sitemap nil + :html-link-up "index.html" + :html-link-home "index.html" + :with-todo-keywords nil + :html-wrap-src-lines nil + :table-of-contents nil) + ("nass-simscape" + :base-directory "~/Cloud/thesis/matlab/nass-simscape/org/" + :base-extension "org" + :publishing-directory "~/Cloud/thesis/matlab/nass-simscape/docs/" + :author "Dehaeze Thomas" + :email "dehaeze.thomas@gmail.com/" + :recursive nil + :publishing-function org-html-publish-to-html + :auto-preamble t + :auto-sitemap nil + :html-link-up "index.html" + :html-link-home "index.html" + :with-todo-keywords nil + :html-wrap-src-lines nil + :table-of-contents nil) + ("tikz-maker" + :base-directory "~/Cloud/tikz/org/" + :base-extension "org" + :publishing-directory "~/Cloud/tikz/docs/" + :author "Dehaeze Thomas" + :email "dehaeze.thomas@gmail.com/" + :recursive nil + :publishing-function org-html-publish-to-html + :auto-preamble t + :auto-sitemap nil + :html-link-up "index.html" + :html-link-home "index.html" + :with-todo-keywords nil + :html-wrap-src-lines nil + :table-of-contents nil)))
startblock
when opening org-mode files(after! org - (defun tdh-eval-startblock () - (if (member "startblock" (org-babel-src-block-names)) - (save-excursion - (org-babel-goto-named-src-block "startblock") - (org-babel-execute-src-block)) - nil - ) - ) +(after! org + (defun tdh-eval-startblock () + (if (member "startblock" (org-babel-src-block-names)) + (save-excursion + (org-babel-goto-named-src-block "startblock") + (org-babel-execute-src-block)) + nil + ) + ) - (add-hook 'org-mode-hook 'tdh-eval-startblock) - ) + (add-hook 'org-mode-hook 'tdh-eval-startblock) + ) ++
(defun org-syntax-convert-case-to-lower () + "Convert all #+keywords to #+keywords." + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((count 0) + (case-fold-search nil)) + (while (re-search-forward "#\\+[A-Z_]+" nil t) + (replace-match (downcase (match-string 0)) t) + (setq count (1+ count))) + (message "Replaced %d occurances" count))))
;; required libraries - (require 'dash) - ;; (require 'swiper) - (require 's) +;; required libraries +(require 'dash) +;; (require 'swiper) +(require 's) - ;; start directory - (defvar tdh-image-dir (expand-file-name "/home/thomas/Pictures")) +;; start directory +(defvar tdh-image-dir (expand-file-name "/home/thomas/Pictures")) - (defun tdh-insert-conference-image () - "Insert image from conference directory, rename and add link in current file. +(defun tdh-insert-conference-image () + "Insert image from conference directory, rename and add link in current file. - The file is taken from a start directory set by `tdh-image-dir' and moved to the current directory, renamed and embedded at the point as an org-mode link. The user is presented with a list of files in the start directory, from which to select the file to move, sorted by most recent first." - (interactive) - (let (file-list target-dir file-list-sorted start-file start-file-full file-ext end-file end-file-base end-file-full file-number) - ;; Clean directories from list but keep times - (setq file-list - (-remove (lambda (x) (nth 1 x)) - (directory-files-and-attributes tdh-image-dir))) +The file is taken from a start directory set by `tdh-image-dir' and moved to the current directory, renamed and embedded at the point as an org-mode link. The user is presented with a list of files in the start directory, from which to select the file to move, sorted by most recent first." + (interactive) + (let (file-list target-dir file-list-sorted start-file start-file-full file-ext end-file end-file-base end-file-full file-number) + ;; Clean directories from list but keep times + (setq file-list + (-remove (lambda (x) (nth 1 x)) + (directory-files-and-attributes tdh-image-dir))) - ;; Get target directory - (setq target-dir (file-name-directory (buffer-file-name))) + ;; Get target directory + (setq target-dir (file-name-directory (buffer-file-name))) - ;; Sort list by most recent - (setq file-list-sorted - (mapcar #'car - (sort file-list - #'(lambda (x y) (time-less-p (nth 6 y) (nth 6 x)))))) + ;; Sort list by most recent + (setq file-list-sorted + (mapcar #'car + (sort file-list + #'(lambda (x y) (time-less-p (nth 6 y) (nth 6 x)))))) - ;; Use ivy to select start-file - (setq start-file (ivy-read - (concat "Move selected file to " target-dir ":") - file-list-sorted - :re-builder #'ivy--regex - :sort nil - :initial-input nil)) + ;; Use ivy to select start-file + (setq start-file (ivy-read + (concat "Move selected file to " target-dir ":") + file-list-sorted + :re-builder #'ivy--regex + :sort nil + :initial-input nil)) - ;; add full path to start file and end-file - (setq start-file-full - (expand-file-name start-file tdh-image-dir)) + ;; add full path to start file and end-file + (setq start-file-full + (expand-file-name start-file tdh-image-dir)) - ;; final file name including path - (setq end-file-full - (expand-file-name start-file target-dir)) + ;; final file name including path + (setq end-file-full + (expand-file-name start-file target-dir)) - ;; rename file - (rename-file start-file-full end-file-full) - (message "moved %s to %s" start-file-full start-file) + ;; rename file + (rename-file start-file-full end-file-full) + (message "moved %s to %s" start-file-full start-file) - ;; insert link - (insert (org-make-link-string (format "file:%s" start-file))) + ;; insert link + (insert (org-make-link-string (format "file:%s" start-file))) - ;; display image - (org-display-inline-images t t))) + ;; display image + (org-display-inline-images t t)))
(after! org - (defun tdh-render-org-table-at-point () - (interactive) - (save-excursion - (beginning-of-line) - ;; removes the overlay is already there - (if (overlays-at (point)) - (delete-overlay (car (overlays-at (point)))) +(after! org + (defun tdh-render-org-table-at-point () + (interactive) + (save-excursion + (beginning-of-line) + ;; removes the overlay is already there + (if (overlays-at (point)) + (delete-overlay (car (overlays-at (point)))) - (let* ((element-type (org-element-type (org-element-at-point)))) - (if (and (not (eq element-type 'table)) - (not (eq element-type 'table-row))) - (error "not at an org table") + (let* ((element-type (org-element-type (org-element-at-point)))) + (if (and (not (eq element-type 'table)) + (not (eq element-type 'table-row))) + (error "not at an org table") - (while (not (eq 'table (org-element-type (org-element-at-point)))) - (forward-line -1)) - (tdh-render-org-table (org-element-at-point)) - ))))) + (while (not (eq 'table (org-element-type (org-element-at-point)))) + (forward-line -1)) + (tdh-render-org-table (org-element-at-point)) + ))))) - (defun tdh-render-org-table (table) - (interactive) - (let* ((begin (org-element-property :begin table)) - (end (let ((pos (org-element-property :end table))) - (goto-char pos) - (beginning-of-line) - ;; skip possible space after table - (while (not (looking-at " *[|#]")) - (setq pos (point)) - (forward-line -1)) - pos)) - (tabletxt (buffer-substring-no-properties begin end)) - (img (with-temp-buffer - (insert tabletxt) - (mark-whole-buffer) - (org-latex-convert-region-to-latex) - (org-latex-preview) - (goto-char (point-min)) - (overlay-get (car (overlays-at (point))) 'display))) - (overlay (make-overlay begin end))) - (overlay-put overlay 'display img) - (forward-line -1)) - ) + (defun tdh-render-org-table (table) + (interactive) + (let* ((begin (org-element-property :begin table)) + (end (let ((pos (org-element-property :end table))) + (goto-char pos) + (beginning-of-line) + ;; skip possible space after table + (while (not (looking-at " *[|#]")) + (setq pos (point)) + (forward-line -1)) + pos)) + (tabletxt (buffer-substring-no-properties begin end)) + (img (with-temp-buffer + (insert tabletxt) + (mark-whole-buffer) + (org-latex-convert-region-to-latex) + (org-latex-preview) + (goto-char (point-min)) + (overlay-get (car (overlays-at (point))) 'display))) + (overlay (make-overlay begin end))) + (overlay-put overlay 'display img) + (forward-line -1)) + ) - (defun tdh-render-org-tables-in-buffer () - (save-excursion - (org-element-map (org-element-parse-buffer) 'table 'tdh-render-org-table))) + (defun tdh-render-org-tables-in-buffer () + (save-excursion + (org-element-map (org-element-parse-buffer) 'table 'tdh-render-org-table))) - ;; Use F9 to globally generate tables - (map! :map org-mode-map :n "<f8>" (lambda () (interactive) (tdh-render-org-table-at-point))) - ) + ;; Use F9 to globally generate tables + (map! :map org-mode-map :n "<f8>" (lambda () (interactive) (tdh-render-org-table-at-point))) + )
(after! org - (require 'org-special-block-extras) - ) +(after! org + (require 'org-special-block-extras) + )
(after! org - (require 'org-inlinetask) - ) +(after! org + (require 'org-inlinetask) + )
(after! org - (setq yt-iframe-format - ;; You may want to change your width and height. - (concat "<div class=\"yt\"><iframe width=\"100%%\"" - " height=\"100%%\"" - " src=\"https://www.youtube.com/embed/%s\"" - " frameborder=\"0\"" - " allowfullscreen>%s</iframe></div>")) +(after! org + (setq yt-iframe-format + ;; You may want to change your width and height. + (concat "<div class=\"yt\"><iframe width=\"100%%\"" + " height=\"100%%\"" + " src=\"https://www.youtube.com/embed/%s\"" + " frameborder=\"0\"" + " allowfullscreen>%s</iframe></div>")) - (org-add-link-type - "yt" - (lambda (handle) - (browse-url - (concat "https://www.youtube.com/embed/" - handle))) - (lambda (path desc backend) - (cl-case backend - (html (format yt-iframe-format - path (or desc ""))) - (md (format "{{< youtube %s >}}" - path)) - (latex (format "\\href{%s}{%s}" - (concat "https://www.youtube.com/embed/" - path) (or desc "video")))))) - ) + (org-add-link-type + "yt" + (lambda (handle) + (browse-url + (concat "https://www.youtube.com/embed/" + handle))) + (lambda (path desc backend) + (cl-case backend + (html (format yt-iframe-format + path (or desc ""))) + (md (format "{{< youtube %s >}}" + path)) + (latex (format "\\href{%s}{%s}" + (concat "https://www.youtube.com/embed/" + path) (or desc "video")))))) + )
(use-package! org-gcal - :after org - :init - :config - (setq org-gcal-client-id "396102378658-dcmbcmrnthbe925519otsjbd921otq0v.apps.googleusercontent.com" - org-gcal-client-secret "4M5PWrbhQjwYEMXGK85lDYX9" - org-gcal-file-alist '(("dehaeze.thomas@gmail.com" . "~/Cloud/org/gcal.org") - ("8kjmhe2ar0abnm054ill1fb0gc@group.calendar.google.com" . "~/Cloud/org/gcal_phd.org"))) - ;; Automatic fetch of the new events - ;; (add-hook 'org-agenda-mode-hook (lambda () (org-gcal-fetch) )) - ) +(use-package! org-gcal + :after org + :init + :config + (setq org-gcal-client-id "396102378658-dcmbcmrnthbe925519otsjbd921otq0v.apps.googleusercontent.com" + org-gcal-client-secret "4M5PWrbhQjwYEMXGK85lDYX9" + org-gcal-file-alist '(("dehaeze.thomas@gmail.com" . "~/Cloud/org/gcal.org") + ("8kjmhe2ar0abnm054ill1fb0gc@group.calendar.google.com" . "~/Cloud/org/gcal_phd.org"))) + ;; Automatic fetch of the new events + ;; (add-hook 'org-agenda-mode-hook (lambda () (org-gcal-fetch) )) + )
(use-package! citeproc-org - :ensure t :after ox-hugo :config (citeproc-org-setup)) @@ -2504,15 +2508,15 @@ Special EnvironmentsOrg Wild Notifier
@@ -2522,16 +2526,16 @@ Special Environments-(use-package! org-wild-notifier - :after org - :init - (setq alert-default-style 'libnotify) - :config - (setq org-wild-notifier-alert-time '(10 5)) - (setq org-wild-notifier-notification-title "Org Agenda") - (org-wild-notifier-mode) - ) +(use-package! org-wild-notifier + :after org + :init + (setq alert-default-style 'libnotify) + :config + (setq org-wild-notifier-alert-time '(10 5)) + (setq org-wild-notifier-notification-title "Org Agenda") + (org-wild-notifier-mode) +)Orch
@@ -2573,39 +2577,39 @@ Special Environments-(use-package! web-server - :init - :config - ) +(use-package! web-server + :init + :config +)-(add-to-list 'load-path "~/.config/doom/packages/orch/") - (autoload 'orch-toggle "orch" nil t) +(add-to-list 'load-path "~/.config/doom/packages/orch/") +(autoload 'orch-toggle "orch" nil t)-(after! org - (map! :map org-mode-map - (:desc "Org Agenda" - :ni "C-c a" 'org-agenda) - (:desc "Archive" - :n "C-c A" 'org-archive-subtree) - (:desc "Org Capture" - :ni "C-c c" 'org-capture) - (:desc "Store Link" - :ni "C-c l" 'org-store-link) - (:desc "Narrow Subtree" - :ni "C-c n" 'org-toggle-narrow-to-subtree) - (:desc "Org Noter" - :ni "C-c N" 'org-noter) - (:desc "Align Block" - :ni "C-c =" 'tdh-align-src-block) - (:desc "Insert Reference" - :ni "C-c r" 'org-ref-insert-ref-link) - (:desc "Insert Image" - :ni "C-c i" 'tdh-insert-image-org-link) - (:desc "Insert Image SXIV" - :ni "C-c I" 'tdh-insert-image-org-link-sxiv) - (:desc "Link to next Figure" - :ni "C-c f" 'tdh-insert-link-to-next-figure) - (:desc "Link to previous Figure" - :ni "C-c F" 'tdh-insert-link-to-previous-figure) - (:desc "Insert Screenshot" - :ni "C-c s" 'tdh-insert-screenshot-org-link) - (:desc "Find Roam" - :ni "C-c r" 'orb-find-non-ref-file) - (:desc "Insert Roam" - :ni "C-c R" 'orb-insert-non-ref) - )) +(after! org + (map! :map org-mode-map + (:desc "Org Agenda" + :ni "C-c a" 'org-agenda) + (:desc "Archive" + :n "C-c A" 'org-archive-subtree) + (:desc "Org Capture" + :ni "C-c c" 'org-capture) + (:desc "Store Link" + :ni "C-c l" 'org-store-link) + (:desc "Narrow Subtree" + :ni "C-c n" 'org-toggle-narrow-to-subtree) + (:desc "Org Noter" + :ni "C-c N" 'org-noter) + (:desc "Align Block" + :ni "C-c =" 'tdh-align-src-block) + (:desc "Insert Reference" + :ni "C-c r" 'org-ref-insert-ref-link) + (:desc "Insert Image" + :ni "C-c i" 'tdh-insert-image-org-link) + (:desc "Insert Image SXIV" + :ni "C-c I" 'tdh-insert-image-org-link-sxiv) + (:desc "Link to next Figure" + :ni "C-c f" 'tdh-insert-link-to-next-figure) + (:desc "Link to previous Figure" + :ni "C-c F" 'tdh-insert-link-to-previous-figure) + (:desc "Insert Screenshot" + :ni "C-c s" 'tdh-insert-screenshot-org-link) + (:desc "Find Roam" + :ni "C-c r" 'orb-find-non-ref-file) + (:desc "Insert Roam" + :ni "C-c R" 'orb-insert-non-ref) + ))
(defun tdh-insert-paper-org-link (paper) - "Insert an org link to some paper, choosing the file with completion" - (interactive - (list (read-file-name "Paper: " "~/Cloud/pdfs/" nil t))) - (insert (format "[[papers:%s]]" (file-name-base paper)))) +(defun tdh-insert-paper-org-link (paper) + "Insert an org link to some paper, choosing the file with completion" + (interactive + (list (read-file-name "Paper: " "~/Cloud/pdfs/" nil t))) + (insert (format "[[papers:%s]]" (file-name-base paper))))
(defun tdh-insert-note-org-link (note) - "Insert an org link to some note, choosing the file with completion" - (interactive - (list (read-file-name "Note: " "~/Cloud/pdfs/" nil t))) - (insert (format "[[notes:%s]]" (file-name-base note)))) +(defun tdh-insert-note-org-link (note) + "Insert an org link to some note, choosing the file with completion" + (interactive + (list (read-file-name "Note: " "~/Cloud/pdfs/" nil t))) + (insert (format "[[notes:%s]]" (file-name-base note))))
(defun tdh-insert-image-org-link (img) - "Insert an org image link, choosing the file with completion - and starting from `my-default-image-directory'." - (interactive - (list (file-relative-name (read-file-name "Image: " (concat default-directory "figs/")) default-directory))) - (insert (format "[[file:%s]]" img))) +(defun tdh-insert-image-org-link (img) + "Insert an org image link, choosing the file with completion +and starting from `my-default-image-directory'." + (interactive + (list (file-relative-name (read-file-name "Image: " (concat default-directory "figs/")) default-directory))) + (insert (format "[[file:%s]]" img)))
figs
folder using SXIV
(defun tdh-insert-image-org-link-sxiv () - "Insert an org image link, choosing the file with completion - and starting from `my-default-image-directory'." - (interactive) - (setq img (shell-command-to-string "ls figs/*.{jpg,jpeg,bmp,png,gif} 2> /dev/null | sxiv -i -t -o | tail -1 | tr -d '\n'")) - (unless (equal "" img) - (insert (format "[[file:%s]]" img))) - ) +(defun tdh-insert-image-org-link-sxiv () + "Insert an org image link, choosing the file with completion +and starting from `my-default-image-directory'." + (interactive) + (setq img (shell-command-to-string "ls figs/*.{jpg,jpeg,bmp,png,gif} 2> /dev/null | sxiv -i -t -o | tail -1 | tr -d '\n'")) + (unless (equal "" img) + (insert (format "[[file:%s]]" img))) + )
figs
folder using SXIV
Copy picture from phone folder using SXIV and insert it
(defun tdh-insert-phone-picture () - (interactive) - (setq img (shell-command-to-string "~/.config/doom/bin/copy-phone-picture.sh")) - (unless (equal "" img) - (insert (format "[[file:%s]]" img))) - ) +(defun tdh-insert-phone-picture () + (interactive) + (setq img (shell-command-to-string "~/.config/doom/bin/copy-phone-picture.sh")) + (unless (equal "" img) + (insert (format "[[file:%s]]" img))) + )
if [ -z "$1" ]; then - oldpath=$(ls -t ~/Cloud/photos/phone/*.jpg | sxiv -i -t -o | tail -1); - else - oldpath=$(ls -t $1 | sxiv -i -t -o | tail -1); - fi +if [ -z "$1" ]; then + oldpath=$(ls -t ~/Cloud/photos/phone/*.jpg | sxiv -i -t -o | tail -1); +else + oldpath=$(ls -t $1 | sxiv -i -t -o | tail -1); +fi - if [ -n "$oldpath" ]; then - newfilename=$(basename $oldpath .jpg | rofi -i -dmenu -p "Filename") - if [ -n "$newfilename" ]; then - cp $oldpath "figs/$newfilename.jpg" - printf "figs/$newfilename.jpg" - fi - fi +if [ -n "$oldpath" ]; then + newfilename=$(basename $oldpath .jpg | rofi -i -dmenu -p "Filename") + if [ -n "$newfilename" ]; then + cp $oldpath "figs/$newfilename.jpg" + printf "figs/$newfilename.jpg" + fi +fi
(defun tdh-insert-screenshot-org-link () - "Capture screenshot and insert the resulting file. - The screenshot tool is determined by `org-download-screenshot-method'." - (interactive) - (if (string-match "_" (file-name-base buffer-file-name)) - (setq filename (read-string "Enter file name:" (car (split-string (file-name-base buffer-file-name) "_")))) - (setq filename (read-string "Enter file name:"))) - (setq filepath (concat "./figs/" filename ".png")) - (shell-command (concat "maim -u -s " filepath)) - (insert (format "#+name: fig:%s\n#+caption:\n[[file:%s]]" filename filepath)) - (search-backward "caption") - (end-of-line) - ) +(defun tdh-insert-screenshot-org-link () + "Capture screenshot and insert the resulting file. +The screenshot tool is determined by `org-download-screenshot-method'." + (interactive) + (if (string-match "_" (file-name-base buffer-file-name)) + (setq filename (read-string "Enter file name:" (car (split-string (file-name-base buffer-file-name) "_")))) + (setq filename (read-string "Enter file name:"))) + (setq filepath (concat "./figs/" filename ".png")) + (shell-command (concat "maim -u -s " filepath)) + (insert (format "#+name: fig:%s\n#+caption:\n[[file:%s]]" filename filepath)) + (search-backward "caption") + (end-of-line) + )
(defun tdh-insert-link-to-next-figure () - (interactive) - (save-excursion - (re-search-forward "^#\\+name:\s*\\(fig:.*\\)" nil t 1)) - (insert (concat "[[" (match-string 1) "]]")) - ) +(defun tdh-insert-link-to-next-figure () + (interactive) + (save-excursion + (re-search-forward "^#\\+name:\s*\\(fig:.*\\)" nil t 1)) + (insert (concat "[[" (match-string 1) "]]")) + )
(defun tdh-insert-link-to-previous-figure () - (interactive) - (save-excursion - (re-search-backward "^#\\+name:\s*\\(fig:.*\\)" nil t 1)) - (insert (concat "[[" (match-string 1) "]]")) - ) +(defun tdh-insert-link-to-previous-figure () + (interactive) + (save-excursion + (re-search-backward "^#\\+name:\s*\\(fig:.*\\)" nil t 1)) + (insert (concat "[[" (match-string 1) "]]")) + )
(after! org - (map! :map org-mode-map - (:prefix (",i" . "Insert") - :n "p" 'tdh-insert-paper-org-link - :n "n" 'tdh-insert-note-org-link - :n "f" 'tdh-insert-image-org-link - :n "F" 'tdh-insert-image-org-link-sxiv - :n "i" 'tdh-insert-phone-picture - :n "l" 'tdh-insert-link-to-next-figure - :n "L" 'tdh-insert-link-to-previous-figure - :n "s" 'tdh-insert-screenshot-org-link))) +(after! org + (map! :map org-mode-map + (:prefix (",i" . "Insert") + :n "p" 'tdh-insert-paper-org-link + :n "n" 'tdh-insert-note-org-link + :n "f" 'tdh-insert-image-org-link + :n "F" 'tdh-insert-image-org-link-sxiv + :n "i" 'tdh-insert-phone-picture + :n "l" 'tdh-insert-link-to-next-figure + :n "L" 'tdh-insert-link-to-previous-figure + :n "s" 'tdh-insert-screenshot-org-link)))
,l
(defun tdh-latex-watch () - "Watch LaTeX file using latexmk" - (interactive) - (start-process-shell-command "latexmk-watch" "*latexmk-watch-output*" - "latexmk" (format "-pdflatex=\"xelatex -synctex=1 -shell-escape -interaction nonstopmode -output-directory='%s'\" -pdf -pvc -bibtex -f %s.tex" - (file-name-directory buffer-file-name) - (file-name-base buffer-file-name)))) +(defun tdh-latex-watch () + "Watch LaTeX file using latexmk" + (interactive) + (start-process-shell-command "latexmk-watch" "*latexmk-watch-output*" + "latexmk" (format "-pdflatex=\"xelatex -synctex=1 -shell-escape -interaction nonstopmode -output-directory='%s'\" -pdf -pvc -bibtex -f %s.tex" + (file-name-directory buffer-file-name) + (file-name-base buffer-file-name))))
(defun tdh-latex-watch-kill () - "Kill the currently running TeX job." - (interactive) - (delete-process "latexmk-watch") - ) +(defun tdh-latex-watch-kill () + "Kill the currently running TeX job." + (interactive) + (delete-process "latexmk-watch") + )
(after! org - (map! :map org-mode-map - (:prefix (",l" . "LaTeX") - :n "w" 'tdh-latex-watch - :n "k" 'tdh-latex-watch-kill - :n "l" 'org-latex-export-to-latex))) +(after! org + (map! :map org-mode-map + (:prefix (",l" . "LaTeX") + :n "w" 'tdh-latex-watch + :n "k" 'tdh-latex-watch-kill + :n "l" 'org-latex-export-to-latex)))
(use-package! org-fragtog - :after org - :config - (add-hook 'org-mode-hook 'org-fragtog-mode) - ) +(use-package! org-fragtog + :after org + :config + (add-hook 'org-mode-hook 'org-fragtog-mode) +)
(defun tdh-automatic-latex-fragment-activate () - (interactive) - (add-hook 'org-mode-hook 'org-fragtog-mode)) +(defun tdh-automatic-latex-fragment-activate () + (interactive) + (add-hook 'org-mode-hook 'org-fragtog-mode)) - (defun tdh-automatic-latex-fragment-deactivate () - (interactive) - (remove-hook 'org-mode-hook 'org-fragtog-mode)) +(defun tdh-automatic-latex-fragment-deactivate () + (interactive) + (remove-hook 'org-mode-hook 'org-fragtog-mode))
(after! org - (map! :map org-mode-map - (:prefix (",l" . "LaTeX") - :n "f" 'tdh-automatic-latex-fragment-activate - :n "F" 'tdh-automatic-latex-fragment-deactivate))) +(after! org + (map! :map org-mode-map + (:prefix (",l" . "LaTeX") + :n "f" 'tdh-automatic-latex-fragment-activate + :n "F" 'tdh-automatic-latex-fragment-deactivate)))
,r
(after! org - (map! :map org-mode-map - (:prefix (",r" . "References") - :n "b" 'helm-bibtex - :n "B" 'helm-bibtex-with-local-bibliography - :n "f" 'tdh-helm-bibtex-favorites - :n "r" 'helm-resume))) +(after! org + (map! :map org-mode-map + (:prefix (",r" . "References") + :n "b" 'helm-bibtex + :n "B" 'helm-bibtex-with-local-bibliography + :n "f" 'tdh-helm-bibtex-favorites + :n "r" 'helm-resume)))
,o
(defun tdh-open-ranger-in-workdir () - (interactive) - (call-process-shell-command - (concat "termite --directory=" default-directory " --exec=ranger") nil 0)) +(defun tdh-open-ranger-in-workdir () + (interactive) + (call-process-shell-command + (concat "termite --directory=" default-directory " --exec=ranger") nil 0))
(after! org - (map! :map org-mode-map - :n ",o" 'tdh-open-ranger-in-workdir)) +(after! org + (map! :map org-mode-map + :n ",o" 'tdh-open-ranger-in-workdir))
zathura
(defun tdh-open-org-pdf-externally () - (interactive) - (call-process "zathura" nil 0 nil (concat (file-name-sans-extension (buffer-file-name)) ".pdf")) - ) +(defun tdh-open-org-pdf-externally () + (interactive) + (call-process "zathura" nil 0 nil (concat (file-name-sans-extension (buffer-file-name)) ".pdf")) + )
zathura
Open HTML output externally
(defun tdh-open-org-html-externally () - (interactive) - (call-process "xdg-open" nil 0 nil (concat (file-name-sans-extension (buffer-file-name)) ".html")) - ) +(defun tdh-open-org-html-externally () + (interactive) + (call-process "xdg-open" nil 0 nil (concat (file-name-sans-extension (buffer-file-name)) ".html")) + )
(after! org - (map! :map org-mode-map - (:prefix (",v" . "View") - :n "p" 'tdh-open-org-pdf-externally - :n "h" 'tdh-open-org-html-externally))) +(after! org + (map! :map org-mode-map + (:prefix (",v" . "View") + :n "p" 'tdh-open-org-pdf-externally + :n "h" 'tdh-open-org-html-externally)))
(defun tdh-org-confirm-babel-evaluate (lang body) - (not (member lang '("emacs-lisp" "latex" "matlab" "sh" "latex-macros" "python")))) +(defun tdh-org-confirm-babel-evaluate (lang body) + (not (member lang '("emacs-lisp" "latex" "matlab" "sh" "latex-macros" "python")))) - (after! org - (setq org-confirm-babel-evaluate 'tdh-org-confirm-babel-evaluate)) +(after! org + (setq org-confirm-babel-evaluate 'tdh-org-confirm-babel-evaluate))
(after! org - (setq org-babel-default-header-args '((:eval . "no-export")))) +(after! org + (setq org-babel-default-header-args '((:eval . "no-export"))))
(after! org - (setq org-src-window-setup 'current-window)) +(after! org + (setq org-src-window-setup 'current-window))
(defun tdh-org-prettify-symbols () - (mapc (apply-partially 'add-to-list 'prettify-symbols-alist) - (cl-reduce 'append - (mapcar (lambda (x) (list x (cons (upcase (car x)) (cdr x)))) - `(("#+begin_src" . ?✎) - ("#+end_src" . ?□) - ("#+begin_quote" . ?«) - ("#+end_quote" . ?»))))) - (turn-on-prettify-symbols-mode)) - (add-hook 'org-mode-hook #'tdh-org-prettify-symbols) +(defun tdh-org-prettify-symbols () + (mapc (apply-partially 'add-to-list 'prettify-symbols-alist) + (cl-reduce 'append + (mapcar (lambda (x) (list x (cons (upcase (car x)) (cdr x)))) + `(("#+begin_src" . ?✎) + ("#+end_src" . ?□) + ("#+begin_quote" . ?«) + ("#+end_quote" . ?»))))) + (turn-on-prettify-symbols-mode)) +(add-hook 'org-mode-hook #'tdh-org-prettify-symbols)
(after! org - (setq org-edit-src-content-indentation 2 - org-src-tab-acts-natively nil - org-src-preserve-indentation nil) - ) +(after! org + ;; Don't change indentation when toggling + (setq org-src-preserve-indentation t) + )
org-babel-library-of-babel
(
(after! org - (org-babel-lob-ingest "~/.config/literate-dotfiles/emacs-library-babel.org")) +(after! org + (org-babel-lob-ingest "~/.config/literate-dotfiles/emacs-library-babel.org"))
org-babel-library-of-babel
(Org-Babel Matlab
(after! org - (setq org-babel-matlab-shell-command "/home/thomas/.local/bin/matlab -softwareopengl -nodesktop -nosplash") - ) +(after! org + (setq org-babel-matlab-shell-command "/home/thomas/.local/bin/matlab -softwareopengl -nodesktop -nosplash") + )
org-babel-library-of-babel
(
(after! org - (setq org-babel-default-header-args:matlab - '((:results . "none") - (:session . "*MATLAB*") - (:comments . "org") - (:exports . "both") - (:cache . "no") - (:noweb . "no") - (:hlines . "no") - (:tangle . "yes") - (:mkdir . "yes") - (:eval . "no-export"))) - ) +(after! org + (setq org-babel-default-header-args:matlab + '((:results . "none") + (:session . "*MATLAB*") + (:comments . "org") + (:exports . "both") + (:cache . "no") + (:noweb . "no") + (:hlines . "no") + (:tangle . "yes") + (:mkdir . "yes") + (:eval . "no-export"))) + )
(after! org - (defun org-babel-octave-evaluate-session - (session body result-type &optional matlabp) - "Evaluate BODY in SESSION." - (let* ((tmp-file (org-babel-temp-file (if matlabp "matlab-" "octave-"))) - (wait-file (org-babel-temp-file "matlab-emacs-link-wait-signal-")) - (full-body - (pcase result-type - (`output - (mapconcat +(after! org + (defun org-babel-octave-evaluate-session + (session body result-type &optional matlabp) + "Evaluate BODY in SESSION." + (let* ((tmp-file (org-babel-temp-file (if matlabp "matlab-" "octave-"))) + (wait-file (org-babel-temp-file "matlab-emacs-link-wait-signal-")) + (full-body + (pcase result-type + (`output + (mapconcat + #'org-babel-chomp + (list (if matlabp + (multi-replace-regexp-in-string + '(("%.*$" . "") ;Remove comments + (";\\s-*\n+" . "; ") ;Concatenate lines + ("\\(\\.\\)\\{3\\}\\s-*\n+" . " ") ;Handle continuations + (",*\\s-*\n+" . ", ")) ;Concatenate lines + body) + body) + org-babel-octave-eoe-indicator) "\n")) + (`value + (if (and matlabp org-babel-matlab-with-emacs-link) + (concat + (format org-babel-matlab-emacs-link-wrapper-method + body + (org-babel-process-file-name tmp-file 'noquote) + (org-babel-process-file-name tmp-file 'noquote) wait-file) "\n") + (mapconcat #'org-babel-chomp - (list (if matlabp - (multi-replace-regexp-in-string - '(("%.*$" . "") ;Remove comments - (";\\s-*\n+" . "; ") ;Concatenate lines - ("\\(\\.\\)\\{3\\}\\s-*\n+" . " ") ;Handle continuations - (",*\\s-*\n+" . ", ")) ;Concatenate lines - body) - body) - org-babel-octave-eoe-indicator) "\n")) - (`value - (if (and matlabp org-babel-matlab-with-emacs-link) - (concat - (format org-babel-matlab-emacs-link-wrapper-method - body - (org-babel-process-file-name tmp-file 'noquote) - (org-babel-process-file-name tmp-file 'noquote) wait-file) "\n") - (mapconcat - #'org-babel-chomp - (list (format org-babel-octave-wrapper-method - body - (org-babel-process-file-name tmp-file 'noquote) - (org-babel-process-file-name tmp-file 'noquote)) - org-babel-octave-eoe-indicator) "\n"))))) - (raw (if (and matlabp org-babel-matlab-with-emacs-link) - (save-window-excursion - (with-temp-buffer - (insert full-body) - (write-region "" 'ignored wait-file nil nil nil 'excl) - (matlab-shell-run-region (point-min) (point-max)) - (message "Waiting for Matlab Emacs Link") - (while (file-exists-p wait-file) (sit-for 0.01)) - "")) ;; matlab-shell-run-region doesn't seem to - ;; make *matlab* buffer contents easily - ;; available, so :results output currently - ;; won't work - (org-babel-comint-with-output - (session - (if matlabp - org-babel-octave-eoe-indicator - org-babel-octave-eoe-output) - t full-body) - (insert full-body) (comint-send-input nil t)))) results) - (pcase result-type - (`value - (org-babel-octave-import-elisp-from-file tmp-file)) - (`output - (setq results - (if matlabp - (cdr (reverse (delete "" (mapcar #'org-strip-quotes - (mapcar #'org-trim (remove-car-upto-newline raw)))))) - (cdr (member org-babel-octave-eoe-output - (reverse (mapcar #'org-strip-quotes - (mapcar #'org-trim raw))))))) - (mapconcat #'identity (reverse results) "\n"))))) + (list (format org-babel-octave-wrapper-method + body + (org-babel-process-file-name tmp-file 'noquote) + (org-babel-process-file-name tmp-file 'noquote)) + org-babel-octave-eoe-indicator) "\n"))))) + (raw (if (and matlabp org-babel-matlab-with-emacs-link) + (save-window-excursion + (with-temp-buffer + (insert full-body) + (write-region "" 'ignored wait-file nil nil nil 'excl) + (matlab-shell-run-region (point-min) (point-max)) + (message "Waiting for Matlab Emacs Link") + (while (file-exists-p wait-file) (sit-for 0.01)) + "")) ;; matlab-shell-run-region doesn't seem to + ;; make *matlab* buffer contents easily + ;; available, so :results output currently + ;; won't work + (org-babel-comint-with-output + (session + (if matlabp + org-babel-octave-eoe-indicator + org-babel-octave-eoe-output) + t full-body) + (insert full-body) (comint-send-input nil t)))) results) + (pcase result-type + (`value + (org-babel-octave-import-elisp-from-file tmp-file)) + (`output + (setq results + (if matlabp + (cdr (reverse (delete "" (mapcar #'org-strip-quotes + (mapcar #'org-trim (remove-car-upto-newline raw)))))) + (cdr (member org-babel-octave-eoe-output + (reverse (mapcar #'org-strip-quotes + (mapcar #'org-trim raw))))))) + (mapconcat #'identity (reverse results) "\n"))))) - (defun remove-car-upto-newline (raw) - "Truncate each string in a list of strings up to the first newline" - (cons (mapconcat #'identity - (cdr (split-string-and-unquote (car raw) "\n")) - "\n") (cdr raw))) + (defun remove-car-upto-newline (raw) + "Truncate each string in a list of strings up to the first newline" + (cons (mapconcat #'identity + (cdr (split-string-and-unquote (car raw) "\n")) + "\n") (cdr raw))) - (defun multi-replace-regexp-in-string (replacements-list string &optional rest) - (interactive) - "Replace multiple regexps in a string. Order matters." - (if (null replacements-list) - string - (let ((regex (caar replacements-list)) - (replacement (cdar replacements-list))) - (multi-replace-regexp-in-string (cdr replacements-list) - (replace-regexp-in-string regex replacement - string rest))))) - ) + (defun multi-replace-regexp-in-string (replacements-list string &optional rest) + (interactive) + "Replace multiple regexps in a string. Order matters." + (if (null replacements-list) + string + (let ((regex (caar replacements-list)) + (replacement (cdar replacements-list))) + (multi-replace-regexp-in-string (cdr replacements-list) + (replace-regexp-in-string regex replacement + string rest))))) + )
(defun tdh-matlab-whos (&optional start end) - "Get what is in the Matlab workspace" - (interactive) - (if (use-region-p) - (let ((regionp (buffer-substring (region-beginning) (region-end)))) - (process-send-string "*MATLAB*" (concat "whosEmacs " regionp "\n"))) - (process-send-string "*MATLAB*" (concat "whosEmacs" "\n")))) +-(defun tdh-matlab-whos (&optional start end) +"Get what is in the Matlab workspace" + (interactive) + (if (use-region-p) + (let ((regionp (buffer-substring (region-beginning) (region-end)))) + (process-send-string "*MATLAB*" (concat "whosEmacs " regionp "\n"))) + (process-send-string "*MATLAB*" (concat "whosEmacs" "\n"))))@@ -3144,14 +3147,14 @@ Better format the output results for Matlab ( -(defun tdh-matlab-help (&optional start end) - "Get help on the selected function" - (interactive) - (if (use-region-p) - (let ((regionp (buffer-substring (region-beginning) (region-end)))) - (process-send-string "*MATLAB*" (concat "help " regionp "\n"))) - (process-send-string "*MATLAB*" (concat "help " (read-string "Matlab help:") "\n"))) - ) +(defun tdh-matlab-help (&optional start end) + "Get help on the selected function" + (interactive) + (if (use-region-p) + (let ((regionp (buffer-substring (region-beginning) (region-end)))) + (process-send-string "*MATLAB*" (concat "help " regionp "\n"))) + (process-send-string "*MATLAB*" (concat "help " (read-string "Matlab help:") "\n"))) + )@@ -3160,9 +3163,9 @@ Specify a Matlab command to run@@ -3170,10 +3173,10 @@ Specify a Matlab command to run Specify a Matlab command to run and show output in mini-buffer(defun tdh-matlab-run-command () - "Prompt user to enter a matlab command" - (interactive) - (process-send-string "*MATLAB*" (concat (read-string "Matlab Command: ") "\n"))) +"Prompt user to enter a matlab command" +(interactive) +(process-send-string "*MATLAB*" (concat (read-string "Matlab Command: ") "\n")))-@@ -3182,18 +3185,18 @@ Org-Babel Tangle File and Execute with Matlab(defun tdh-matlab-run-command-show-output () - "Prompt user to enter a matlab command" - (interactive) - (process-send-string "*MATLAB*" (concat "evalEmacs('" (read-string "Matlab Command: ") "')\n"))) +(defun tdh-matlab-run-command-show-output () + "Prompt user to enter a matlab command" + (interactive) + (process-send-string "*MATLAB*" (concat "evalEmacs('" (read-string "Matlab Command: ") "')\n")))@@ -3201,14 +3204,14 @@ Org-Babel Tangle File and Execute with Matlab Map Functions(defun tdh-matlab-tangle-and-execute () - "Jump to tangle file for the source block at point." - (interactive) - (let (file org-babel-pre-tangle-hook org-babel-post-tangle-hook) - (cl-letf (((symbol-function 'write-region) (lambda (start end filename &rest _ignore) - (setq file filename))) - ((symbol-function 'delete-file) #'ignore)) - (org-babel-tangle '(4))) - (when file - (setq file (expand-file-name file)) - (if (file-readable-p file) - (process-send-string "*MATLAB*" (concat "run " file "\n")) - (error "Cannot open tangle file %S" file))))) +"Jump to tangle file for the source block at point." +(interactive) +(let (file org-babel-pre-tangle-hook org-babel-post-tangle-hook) + (cl-letf (((symbol-function 'write-region) (lambda (start end filename &rest _ignore) + (setq file filename))) + ((symbol-function 'delete-file) #'ignore)) + (org-babel-tangle '(4))) + (when file + (setq file (expand-file-name file)) + (if (file-readable-p file) + (process-send-string "*MATLAB*" (concat "run " file "\n")) + (error "Cannot open tangle file %S" file)))))-@@ -3227,24 +3230,24 @@ when inside a source block. Otherwise, keep the normal behavior for(after! org - (map! :map org-mode-map - (:prefix (",m" . "Matlab") - :n "e" 'tdh-matlab-run-command - :n "E" 'tdh-matlab-run-command-show-output - :n "T" 'tdh-matlab-tangle-and-execute - :nv "h" 'tdh-matlab-help - :nv "w" 'tdh-matlab-whos))) +(after! org + (map! :map org-mode-map + (:prefix (",m" . "Matlab") + :n "e" 'tdh-matlab-run-command + :n "E" 'tdh-matlab-run-command-show-output + :n "T" 'tdh-matlab-tangle-and-execute + :nv "h" 'tdh-matlab-help + :nv "w" 'tdh-matlab-whos)))ctrl-r
-(defun tdh-ctrl-ret () - (interactive) - (defun tdh-in-src-block-p () - "Returns t when the point is inside a source code block" - (string= "src" (org-in-block-p '("src")))) +(defun tdh-ctrl-ret () + (interactive) + (defun tdh-in-src-block-p () + "Returns t when the point is inside a source code block" + (string= "src" (org-in-block-p '("src")))) - (if (tdh-in-src-block-p) - (progn - (org-babel-execute-src-block) - (org-babel-next-src-block)) - (+org--insert-item 'below))) + (if (tdh-in-src-block-p) + (progn + (org-babel-execute-src-block) + (org-babel-next-src-block)) + (+org--insert-item 'below)))-@@ -3258,65 +3261,65 @@ when inside a source block. Otherwise, keep the normal behavior for(map! :after evil-org - :map evil-org-mode-map - :n "<C-return>" #'tdh-ctrl-ret) +(map! :after evil-org + :map evil-org-mode-map + :n "<C-return>" #'tdh-ctrl-ret)ctrl-r
tdh-org-babel-execute-matlab-background
@@ -3326,11 +3329,11 @@ when inside a source block. Otherwise, keep the normal behavior for-(defun tdh-org-babel-execute-matlab-background (&optional arg info params) - (interactive) - (let* ((org-babel-current-src-block-location - (or org-babel-current-src-block-location - (nth 5 info) - (org-babel-where-is-src-block-head))) - (info (if info (copy-tree info) (org-babel-get-src-block-info)))) - ;; Merge PARAMS with INFO before considering source block - ;; evaluation since both could disagree. - (cl-callf org-babel-merge-params (nth 2 info) params) - (when (org-babel-check-evaluate info) - (cl-callf org-babel-process-params (nth 2 info)) - (let* ((params (nth 2 info)) - (cache (let ((c (cdr (assq :cache params)))) - (and (not arg) c (string= "yes" c)))) - (new-hash (and cache (org-babel-sha1-hash info :eval))) - (old-hash (and cache (org-babel-current-result-hash))) - (current-cache (and new-hash (equal new-hash old-hash)))) - (cond - (current-cache - (save-excursion ;Return cached result. - (goto-char (org-babel-where-is-src-block-result nil info)) - (forward-line) - (skip-chars-forward " \t") - (let ((result (org-babel-read-result))) - (message (replace-regexp-in-string "%" "%%" (format "%S" result))) - result))) - ((org-babel-confirm-evaluate info) - (let* ((lang (nth 0 info)) - (result-params (cdr (assq :result-params params))) - ;; Expand noweb references in BODY and remove any - ;; coderef. - (body - (let ((coderef (nth 6 info)) - (expand - (if (org-babel-noweb-p params :eval) - (org-babel-expand-noweb-references info) - (nth 1 info)))) - (if (not coderef) expand - (replace-regexp-in-string - (org-src-coderef-regexp coderef) "" expand nil nil 1)))) - (dir (cdr (assq :dir params))) - (mkdirp (cdr (assq :mkdirp params))) - (default-directory - (cond - ((not dir) default-directory) - ((member mkdirp '("no" "nil" nil)) - (file-name-as-directory (expand-file-name dir))) - (t - (let ((d (file-name-as-directory (expand-file-name dir)))) - (make-directory d 'parents) - d)))) - (cmd (intern (concat "org-babel-execute:" lang))) - result) - (process-send-string "*MATLAB*" (concat body "\n")) - result)) - ))) - ) - ) +(defun tdh-org-babel-execute-matlab-background (&optional arg info params) + (interactive) + (let* ((org-babel-current-src-block-location + (or org-babel-current-src-block-location + (nth 5 info) + (org-babel-where-is-src-block-head))) + (info (if info (copy-tree info) (org-babel-get-src-block-info)))) + ;; Merge PARAMS with INFO before considering source block + ;; evaluation since both could disagree. + (cl-callf org-babel-merge-params (nth 2 info) params) + (when (org-babel-check-evaluate info) + (cl-callf org-babel-process-params (nth 2 info)) + (let* ((params (nth 2 info)) + (cache (let ((c (cdr (assq :cache params)))) + (and (not arg) c (string= "yes" c)))) + (new-hash (and cache (org-babel-sha1-hash info :eval))) + (old-hash (and cache (org-babel-current-result-hash))) + (current-cache (and new-hash (equal new-hash old-hash)))) + (cond + (current-cache + (save-excursion ;Return cached result. + (goto-char (org-babel-where-is-src-block-result nil info)) + (forward-line) + (skip-chars-forward " \t") + (let ((result (org-babel-read-result))) + (message (replace-regexp-in-string "%" "%%" (format "%S" result))) + result))) + ((org-babel-confirm-evaluate info) + (let* ((lang (nth 0 info)) + (result-params (cdr (assq :result-params params))) + ;; Expand noweb references in BODY and remove any + ;; coderef. + (body + (let ((coderef (nth 6 info)) + (expand + (if (org-babel-noweb-p params :eval) + (org-babel-expand-noweb-references info) + (nth 1 info)))) + (if (not coderef) expand + (replace-regexp-in-string + (org-src-coderef-regexp coderef) "" expand nil nil 1)))) + (dir (cdr (assq :dir params))) + (mkdirp (cdr (assq :mkdirp params))) + (default-directory + (cond + ((not dir) default-directory) + ((member mkdirp '("no" "nil" nil)) + (file-name-as-directory (expand-file-name dir))) + (t + (let ((d (file-name-as-directory (expand-file-name dir)))) + (make-directory d 'parents) + d)))) + (cmd (intern (concat "org-babel-execute:" lang))) + result) + (process-send-string "*MATLAB*" (concat body "\n")) + result)) + ))) + ) + )ctrl-r
tdh-matlab-execute-selected
@@ -3353,30 +3356,30 @@ if no region is selected, it runs all the code blocks and goes to the next block-(defun tdh-matlab-execute-selected (start end) - "Execute selected text in the *MATLAB* buffer" - (interactive "r") - (let ((regionp (buffer-substring start end))) - (process-send-string "*MATLAB*" (concat regionp "\n")))) +(defun tdh-matlab-execute-selected (start end) +"Execute selected text in the *MATLAB* buffer" + (interactive "r") + (let ((regionp (buffer-substring start end))) + (process-send-string "*MATLAB*" (concat regionp "\n"))))-(defun tdh-ctrl-shift-ret () - (interactive) - (defun tdh-in-src-block-p () - "Returns t when the point is inside a source code block" - (string= "src" (org-in-block-p '("src")))) +(defun tdh-ctrl-shift-ret () + (interactive) + (defun tdh-in-src-block-p () + "Returns t when the point is inside a source code block" + (string= "src" (org-in-block-p '("src")))) - (if (tdh-in-src-block-p) - (let ((lang (nth 0 (org-babel-get-src-block-info)))) - (if (string= lang "matlab") - (if (region-active-p) - (tdh-matlab-execute-selected (region-beginning) (region-end)) - (progn (tdh-org-babel-execute-matlab-background) - (org-babel-next-src-block))) - (tdh-ctrl-ret)) - ) - ) - ) + (if (tdh-in-src-block-p) + (let ((lang (nth 0 (org-babel-get-src-block-info)))) + (if (string= lang "matlab") + (if (region-active-p) + (tdh-matlab-execute-selected (region-beginning) (region-end)) + (progn (tdh-org-babel-execute-matlab-background) + (org-babel-next-src-block))) + (tdh-ctrl-ret)) + ) + ) + )-@@ -3387,18 +3390,18 @@ if no region is selected, it runs all the code blocks and goes to the next block(map! :after evil-org - :map evil-org-mode-map - :n "<C-S-return>" #'tdh-ctrl-shift-ret) +(map! :after evil-org + :map evil-org-mode-map + :n "<C-S-return>" #'tdh-ctrl-shift-ret)Align Source Blocks
@@ -3411,14 +3414,14 @@ if no region is selected, it runs all the code blocks and goes to the next block Org-Babel Tangle Sub-tree-(defun tdh-align-src-block () - (interactive) - (defun tdh-in-src-block-p () - "Returns t when the point is inside a source code block" - (string= "src" (org-in-block-p '("src")))) +(defun tdh-align-src-block () + (interactive) + (defun tdh-in-src-block-p () + "Returns t when the point is inside a source code block" + (string= "src" (org-in-block-p '("src")))) - (if (tdh-in-src-block-p) - (progn - (org-edit-special) - (evil-indent (point-min) (point-max)) - (org-edit-src-exit)) - (org-table-eval-formula))) + (if (tdh-in-src-block-p) + (progn + (org-edit-special) + (evil-indent (point-min) (point-max)) + (org-edit-src-exit)) + (org-table-eval-formula)))-@@ -3426,19 +3429,19 @@ Org-Babel Tangle Sub-tree Org-Tangle and Org-Babel Jump to Tangle File(defun tdh-org-babel-tangle-subtree () - "Tangle the current subtree" - (interactive) - (progn - (org-narrow-to-subtree) - (org-babel-tangle) - (widen)) - ) +(defun tdh-org-babel-tangle-subtree () + "Tangle the current subtree" + (interactive) + (progn + (org-narrow-to-subtree) + (org-babel-tangle) + (widen)) + )-@@ -3446,11 +3449,11 @@ Org-Tangle and Org-Babel Jump to Tangle File Map Functions(defun tdh-org-babel-jump-to-tangle-file () - "Jump to tangle file for the source block at point." - (interactive) - (let (file org-babel-pre-tangle-hook org-babel-post-tangle-hook) - (cl-letf (((symbol-function 'write-region) (lambda (start end filename &rest _ignore) - (setq file filename))) - ((symbol-function 'delete-file) #'ignore)) - (org-babel-tangle '(4))) - (when file - (setq file (expand-file-name file)) - (if (file-readable-p file) - (find-file file) - (error "Cannot open tangle file %S" file))))) +(defun tdh-org-babel-jump-to-tangle-file () + "Jump to tangle file for the source block at point." + (interactive) + (let (file org-babel-pre-tangle-hook org-babel-post-tangle-hook) + (cl-letf (((symbol-function 'write-region) (lambda (start end filename &rest _ignore) + (setq file filename))) + ((symbol-function 'delete-file) #'ignore)) + (org-babel-tangle '(4))) + (when file + (setq file (expand-file-name file)) + (if (file-readable-p file) + (find-file file) + (error "Cannot open tangle file %S" file)))))-@@ -3487,76 +3490,76 @@ Nice Functions:(after! org - (map! :map org-mode-map - (:prefix (",b" . "Tangle") - :n "F" 'tdh-org-babel-jump-to-tangle-file - :n "T" 'tdh-org-babel-tangle-subtree))) +(after! org + (map! :map org-mode-map + (:prefix (",b" . "Tangle") + :n "F" 'tdh-org-babel-jump-to-tangle-file + :n "T" 'tdh-org-babel-tangle-subtree)))-(use-package! org-ref - :after org - :init - :config - ;; Folder where the notes files are located (or file if just one Note file) - (setq org-ref-notes-directory "~/Cloud/brain") - (setq org-ref-bibliography-notes "~/Cloud/brain") +(use-package! org-ref + :after org + :init + :config + ;; Folder where the notes files are located (or file if just one Note file) + (setq org-ref-notes-directory "~/Cloud/brain") + (setq org-ref-bibliography-notes "~/Cloud/brain") - ;; Bibliography File - (setq reftex-default-bibliography '("~/Cloud/brain/biblio/references.bib")) - (setq org-ref-default-bibliography '("~/Cloud/brain/biblio/references.bib")) + ;; Bibliography File + (setq reftex-default-bibliography '("~/Cloud/brain/biblio/references.bib")) + (setq org-ref-default-bibliography '("~/Cloud/brain/biblio/references.bib")) - ;; Folder where all the pdf are located - (setq org-ref-pdf-directory "~/Cloud/pdfs") + ;; Folder where all the pdf are located + (setq org-ref-pdf-directory "~/Cloud/pdfs") - (setq org-ref-bibliography-entry-format - '(("article" . "%a, %t, %j, v(%n), %p (%y).") - ("book" . "%a, %t, %u (%y).") - ("techreport" . "%a, %t, %i, %u (%y).") - ("phdthesis" . "%a, %t (%y).") - ("proceedings" . "%e, %t in %S, %u (%y).") - ("inproceedings" . "%a, %t, %p, in %b, edited by %e, %u (%y)"))) + (setq org-ref-bibliography-entry-format + '(("article" . "%a, %t, %j, v(%n), %p (%y).") + ("book" . "%a, %t, %u (%y).") + ("techreport" . "%a, %t, %i, %u (%y).") + ("phdthesis" . "%a, %t (%y).") + ("proceedings" . "%e, %t in %S, %u (%y).") + ("inproceedings" . "%a, %t, %p, in %b, edited by %e, %u (%y)"))) - ;; Tell org-ref to let helm-bibtex find notes for it - (setq org-ref-notes-function - (lambda (thekey) - (let ((bibtex-completion-bibliography (org-ref-find-bibliography))) - (bibtex-completion-edit-notes - (list (car (org-ref-get-bibtex-key-and-file thekey))))))) + ;; Tell org-ref to let helm-bibtex find notes for it + (setq org-ref-notes-function + (lambda (thekey) + (let ((bibtex-completion-bibliography (org-ref-find-bibliography))) + (bibtex-completion-edit-notes + (list (car (org-ref-get-bibtex-key-and-file thekey))))))) - ;; Problem with speed: don't display broken links - (setq org-ref-show-broken-links t) - ;; Display information on the citation - (setq org-ref-show-citation-on-enter t) + ;; Problem with speed: don't display broken links + (setq org-ref-show-broken-links t) + ;; Display information on the citation + (setq org-ref-show-citation-on-enter t) - (add-to-list 'org-ref-helm-user-candidates - '("Open pdf in Zathura" . (lambda () (call-process "zathura" nil 0 nil (concat - (file-name-as-directory org-ref-pdf-directory) - (car (org-ref-get-bibtex-key-and-file)) - ".pdf")))) - t) + (add-to-list 'org-ref-helm-user-candidates + '("Open pdf in Zathura" . (lambda () (call-process "zathura" nil 0 nil (concat + (file-name-as-directory org-ref-pdf-directory) + (car (org-ref-get-bibtex-key-and-file)) + ".pdf")))) + t) - (add-to-list 'org-ref-helm-user-candidates - '("Drag and Drop" . (lambda () (call-process "/bin/bash" nil 0 nil "-c" (concat - "dragon-drag-and-drop " - (file-name-as-directory org-ref-pdf-directory) - (car (org-ref-get-bibtex-key-and-file)) - ".pdf")))) - t) + (add-to-list 'org-ref-helm-user-candidates + '("Drag and Drop" . (lambda () (call-process "/bin/bash" nil 0 nil "-c" (concat + "dragon-drag-and-drop " + (file-name-as-directory org-ref-pdf-directory) + (car (org-ref-get-bibtex-key-and-file)) + ".pdf")))) + t) - ;; Let Mathjax deals with equation reference - (defun org-ref-eqref-export (keyword desc format) - (cond - ((eq format 'latex) (format "\\eqref{%s}" keyword)) - ((eq format 'html) (format "\\eqref{%s}" keyword)) - ((eq format 'md) (format "\\eqref{%s}" keyword)))) - ) + ;; Let Mathjax deals with equation reference + (defun org-ref-eqref-export (keyword desc format) + (cond + ((eq format 'latex) (format "\\eqref{%s}" keyword)) + ((eq format 'html) (format "\\eqref{%s}" keyword)) + ((eq format 'md) (format "\\eqref{%s}" keyword)))) + )-@@ -3566,37 +3569,37 @@ Nice Functions:(defun tdh-org-ref-open-pdf-at-point () - "Open the pdf in external program for bibtex key under point if it exists." - (interactive) - (let* ((results (org-ref-get-bibtex-key-and-file)) - (key (car results)) - (pdf-file (funcall org-ref-get-pdf-filename-function key))) - (if (file-exists-p pdf-file) - (call-process "zathura" nil 0 nil pdf-file) - (message "no pdf found for %s" key)))) +(defun tdh-org-ref-open-pdf-at-point () + "Open the pdf in external program for bibtex key under point if it exists." + (interactive) + (let* ((results (org-ref-get-bibtex-key-and-file)) + (key (car results)) + (pdf-file (funcall org-ref-get-pdf-filename-function key))) + (if (file-exists-p pdf-file) + (call-process "zathura" nil 0 nil pdf-file) + (message "no pdf found for %s" key))))Org Noter (link)
@@ -3606,40 +3609,40 @@ Nice Functions:-(use-package! org-noter - :defer t - :after (:any org pdf-view) - :config - (setq org-noter-always-create-frame nil) +(use-package! org-noter + :defer t + :after (:any org pdf-view) + :config + (setq org-noter-always-create-frame nil) - (setq org-noter-kill-frame-at-session-end nil) + (setq org-noter-kill-frame-at-session-end nil) - ;; Fraction of the frame that the document window will occupy when split - (setq org-noter-doc-split-fraction '(0.6 . 0.6)) + ;; Fraction of the frame that the document window will occupy when split + (setq org-noter-doc-split-fraction '(0.6 . 0.6)) - ;; Save the last visited location automatically; when starting a new session, go to that location - (setq org-noter-auto-save-last-location nil) + ;; Save the last visited location automatically; when starting a new session, go to that location + (setq org-noter-auto-save-last-location nil) - ;; Add an empty line between each note's heading and content - (setq org-noter-separate-notes-from-heading t) + ;; Add an empty line between each note's heading and content + (setq org-noter-separate-notes-from-heading t) - ;; List of paths to check (non recursively) when searching for a notes file - (setq org-noter-notes-search-path "~/Cloud/brain") + ;; List of paths to check (non recursively) when searching for a notes file + (setq org-noter-notes-search-path "~/Cloud/brain") - (defun org-noter-init-pdf-view () - (pdf-view-fit-page-to-window) - (pdf-view-auto-slice-minor-mode) - (run-at-time "0.5 sec" nil #'org-noter)) - (add-hook 'pdf-view-mode-hook 'org-noter-init-pdf-view) + (defun org-noter-init-pdf-view () + (pdf-view-fit-page-to-window) + (pdf-view-auto-slice-minor-mode) + (run-at-time "0.5 sec" nil #'org-noter)) + (add-hook 'pdf-view-mode-hook 'org-noter-init-pdf-view) - (map! - :map pdf-view-mode-map - (:desc "Insert Note" - :n "i" #'org-noter-insert-note)) - ) + (map! + :map pdf-view-mode-map + (:desc "Insert Note" + :n "i" #'org-noter-insert-note)) + )Org Roam (link)
@@ -3725,95 +3728,95 @@ Create Org-Roam file from heading (Helm-Bibtex (link)-@@ -3647,31 +3650,31 @@ Nice Functions: Automatic export of backlinks(use-package! org-roam - :custom-face - (org-roam-link ((t (:inherit org-link :foreground "#cc241d")))) - :config - (setq org-roam-directory "~/Cloud/brain/") - (setq org-roam-completion-system 'helm) - (setq org-roam-tag-sources '(prop last-directory)) - (setq org-roam-capture-templates - `(("d" "default" plain (function org-roam--capture-get-point) - "%?" - :file-name "${slug}" - :head ,(concat "#+TITLE: ${title}\n" - "#+SETUPFILE: ./setup/org-setup-file.org\n" - "#+HUGO_SECTION: zettels\n" - "\n" - "- Tags ::\n" - "\n" - "* Bibliography :ignore:\n" - "bibliography:./biblio/references.bib" - ) - :unnarrowed t))) - (setq org-roam-capture-ref-templates - `(("r" "ref" plain (function org-roam--capture-get-point) - "%?" - :file-name "${slug}" - :head ,(concat "#+TITLE: ${title}\n" - "#+SETUPFILE: ./setup/org-setup-file.org\n" - "#+HUGO_SECTION: websites\n" - "#+ROAM_KEY: ${ref}\n" - "\n" - "- Tags ::\n" - ) - :unnarrowed t))) - ) +(use-package! org-roam + :custom-face + (org-roam-link ((t (:inherit org-link :foreground "#cc241d")))) + :config + (setq org-roam-directory "~/Cloud/brain/") + (setq org-roam-completion-system 'helm) + (setq org-roam-tag-sources '(prop last-directory)) + (setq org-roam-capture-templates + `(("d" "default" plain (function org-roam--capture-get-point) + "%?" + :file-name "${slug}" + :head ,(concat "#+title: ${title}\n" + "#+setupfile: ./setup/org-setup-file.org\n" + "#+hugo_section: zettels\n" + "\n" + "- Tags ::\n" + "\n" + "* Bibliography :ignore:\n" + "bibliography:./biblio/references.bib" + ) + :unnarrowed t))) + (setq org-roam-capture-ref-templates + `(("r" "ref" plain (function org-roam--capture-get-point) + "%?" + :file-name "${slug}" + :head ,(concat "#+title: ${title}\n" + "#+setupfile: ./setup/org-setup-file.org\n" + "#+hugo_section: websites\n" + "#+roam_key: ${ref}\n" + "\n" + "- Tags ::\n" + ) + :unnarrowed t))) + )-@@ -3679,43 +3682,43 @@ Automatic export of backlinks Create Org-Roam file from heading (link)(after! (org org-roam) - (defun tdh-org-roam--backlinks-list (file) - (when (org-roam--org-roam-file-p file) - (mapcar #'car (org-roam-db-query [:select :distinct [from] - :from links - :where (= to $s1) - :and from :not :like $s2] file "%private%")))) - (defun tdh-org-export-preprocessor (_backend) - (when-let ((links (tdh-org-roam--backlinks-list (buffer-file-name)))) - (insert "\nBacklinks:\n") - (dolist (link links) - (insert (format "- [[file:%s][%s]]\n" - (file-relative-name link org-roam-directory) - (org-roam--get-title-or-slug link)))))) - (add-hook 'org-export-before-processing-hook #'tdh-org-export-preprocessor) +(after! (org org-roam) + (defun tdh-org-roam--backlinks-list (file) + (when (org-roam--org-roam-file-p file) + (mapcar #'car (org-roam-db-query [:select :distinct [from] + :from links + :where (= to $s1) + :and from :not :like $s2] file "%private%")))) + (defun tdh-org-export-preprocessor (_backend) + (when-let ((links (tdh-org-roam--backlinks-list (buffer-file-name)))) + (insert "\nBacklinks:\n") + (dolist (link links) + (insert (format "- [[file:%s][%s]]\n" + (file-relative-name link org-roam-directory) + (org-roam--get-title-or-slug link)))))) + (add-hook 'org-export-before-processing-hook #'tdh-org-export-preprocessor) - (defun tdh-org-roam-export-all () - "Re-exports all Org-roam files to Hugo markdown." - (interactive) - (dolist (f (org-roam--list-all-files)) - (with-current-buffer (find-file f) - (when (s-contains? "SETUPFILE" (buffer-string)) - (org-hugo-export-wim-to-md))))) - ) + (defun tdh-org-roam-export-all () + "Re-exports all Org-roam files to Hugo markdown." + (interactive) + (dolist (f (org-roam--list-all-files)) + (with-current-buffer (find-file f) + (when (s-contains? "SETUPFILE" (buffer-string)) + (org-hugo-export-wim-to-md))))) + )-(defun tdh/make-roam-filepath (title) - "Make filename from note TITLE." - (concat - org-roam-directory - (org-roam--title-to-slug title) - ".org")) +(defun tdh/make-roam-filepath (title) + "Make filename from note TITLE." + (concat + org-roam-directory + (org-roam--title-to-slug title) + ".org")) - (defun tdh/insert-org-roam-file (file-path title text) - "Insert org roam file in FILE-PATH with TITLE, LINKS, SOURCES, TEXT, QUOTE." - (with-temp-file file-path - (insert - "#+TITLE: " title "\n" - "#+SETUPFILE: ./setup/org-setup-file.org\n" - "#+HUGO_SECTION: zettels\n" - "\n" - "- Tags ::\n" - "\n" - text - "\n" - "\n" - "* Bibliography :ignore:\n" - "bibliography:./biblio/references.bib" - "\n" - ))) +(defun tdh/insert-org-roam-file (file-path title text) + "Insert org roam file in FILE-PATH with TITLE, LINKS, SOURCES, TEXT, QUOTE." + (with-temp-file file-path + (insert + "#+title: " title "\n" + "#+setupfile: ./setup/org-setup-file.org\n" + "#+hugo_section: zettels\n" + "\n" + "- Tags ::\n" + "\n" + text + "\n" + "\n" + "* Bibliography :ignore:\n" + "bibliography:./biblio/references.bib" + "\n" + ))) - (defun tdh/convert-task-to-org-note () - "Convert a task in a `org-roam' note." - (interactive) - (let* ((heading (org-get-heading t t t t)) - (body (org-get-entry)) - (filepath (tdh/make-roam-filepath heading))) - (tdh/insert-org-roam-file - filepath - heading - body) - (find-file filepath))) +(defun tdh/convert-task-to-org-note () + "Convert a task in a `org-roam' note." + (interactive) + (let* ((heading (org-get-heading t t t t)) + (body (org-get-entry)) + (filepath (tdh/make-roam-filepath heading))) + (tdh/insert-org-roam-file + filepath + heading + body) + (find-file filepath)))@@ -3830,10 +3833,10 @@ Open pdf externally Special Commands-(use-package! helm-bibtex - :after-call helm-bibtex - :init - :config - ;; Bibliography file - (setq bibtex-completion-bibliography '("~/Cloud/brain/biblio/references.bib" - "~/Cloud/acoustic/resources/acoustics.bib")) +(use-package! helm-bibtex + :after-call helm-bibtex + :init + :config + ;; Bibliography file + (setq bibtex-completion-bibliography '("~/Cloud/brain/biblio/references.bib" + "~/Cloud/acoustic/resources/acoustics.bib")) - ;; Directory with all the pdfs - (setq bibtex-completion-library-path '("~/Cloud/pdfs/" - "~/Cloud/acoustic/resources/pdfs/")) + ;; Directory with all the pdfs + (setq bibtex-completion-library-path '("~/Cloud/pdfs/" + "~/Cloud/acoustic/resources/pdfs/")) - ;; Directory with notes files - (setq bibtex-completion-notes-path "~/Cloud/brain/") - (setq bibtex-completion-notes-extension ".org") - (setq bibtex-completion-pdf-extension '(".pdf" ".djvu")) + ;; Directory with notes files + (setq bibtex-completion-notes-path "~/Cloud/brain/") + (setq bibtex-completion-notes-extension ".org") + (setq bibtex-completion-pdf-extension '(".pdf" ".djvu")) - (setq bibtex-completion-additional-search-fields '(keywords)) + (setq bibtex-completion-additional-search-fields '(keywords)) - ;; Use "keywords" field when looking for bib entries - (setq helm-bibtex-additional-search-fields '(keywords)) + ;; Use "keywords" field when looking for bib entries + (setq helm-bibtex-additional-search-fields '(keywords)) - (setq helm-bibtex-full-frame nil) + (setq helm-bibtex-full-frame nil) - ;; Display of bibtex entries with helm - (setq bibtex-completion-display-formats - '((t . "${author:36} ${title:*} ${year:4} ${=type=:7} ${=has-note=:1}"))) + ;; Display of bibtex entries with helm + (setq bibtex-completion-display-formats + '((t . "${author:36} ${title:*} ${year:4} ${=type=:7} ${=has-note=:1}"))) - ;; Special symbols for notes and pdf - (setq bibtex-completion-pdf-symbol "⌘") - (setq bibtex-completion-notes-symbol "✎") + ;; Special symbols for notes and pdf + (setq bibtex-completion-pdf-symbol "⌘") + (setq bibtex-completion-notes-symbol "✎") - ;; Template used when creating new Note file - (setq bibtex-completion-notes-template-multiple-files (concat "#+TITLE: ${title}\n" - "#+SETUPFILE: ./setup/org-setup-file.org\n" - "#+HUGO_SECTION: ${=type=}\n" - "#+ROAM_KEY: ${=key=}\n" - "\n" - "- Tags ::\n" - "- Reference :: cite:${=key=}\n" - "- Author(s) :: ${author}\n" - "- Year :: ${year}\n" - "\n" - "* ${author-abbrev} (${year}): ${title} :${=type=}:ignore:\n" - ":PROPERTIES:\n" - ":NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n" - ":END:\n" - "\n" - "* Bibliography :ignore:\n" - "bibliography:./biblio/references.bib" - )) + ;; Template used when creating new Note file + (setq bibtex-completion-notes-template-multiple-files (concat "#+title: ${title}\n" + "#+setupfile: ./setup/org-setup-file.org\n" + "#+hugo_section: ${=type=}\n" + "#+roam_key: ${=key=}\n" + "\n" + "- Tags ::\n" + "- Reference :: cite:${=key=}\n" + "- Author(s) :: ${author}\n" + "- Year :: ${year}\n" + "\n" + "* ${author-abbrev} (${year}): ${title} :${=type=}:ignore:\n" + ":PROPERTIES:\n" + ":NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n" + ":END:\n" + "\n" + "* Bibliography :ignore:\n" + "bibliography:./biblio/references.bib" + )) - ;; Make "Edit notes" the default action - (helm-delete-action-from-source "Edit notes" helm-source-bibtex) - (helm-add-action-to-source "Edit notes" 'helm-bibtex-edit-notes helm-source-bibtex 0) + ;; Make "Edit notes" the default action + (helm-delete-action-from-source "Edit notes" helm-source-bibtex) + (helm-add-action-to-source "Edit notes" 'helm-bibtex-edit-notes helm-source-bibtex 0) - (helm-delete-action-from-source "Open PDF Externally" helm-source-bibtex) - (helm-add-action-to-source "Open PDF Externally" 'tdh-open-pdf-externally helm-source-bibtex 1) + (helm-delete-action-from-source "Open PDF Externally" helm-source-bibtex) + (helm-add-action-to-source "Open PDF Externally" 'tdh-open-pdf-externally helm-source-bibtex 1) - (helm-add-action-to-source "Insert Link to Note" 'tdh-insert-link-to-note helm-source-bibtex 2) + (helm-add-action-to-source "Insert Link to Note" 'tdh-insert-link-to-note helm-source-bibtex 2) - (helm-add-action-to-source "Insert E-Reader Link" 'tdh-insert-link-to-pdf-entry helm-source-bibtex 3) - ) + (helm-add-action-to-source "Insert E-Reader Link" 'tdh-insert-link-to-pdf-entry helm-source-bibtex 3) + )-(defun tdh-insert-link-to-pdf-entry (key) - "Insert a link to a pdf associated with the bibtex entry." - (let* - ((entry (bibtex-completion-get-entry key)) - (title (bibtex-completion-get-value "title" entry))) - (insert (concat "[[file:Download/" key ".pdf][" title "]] (cite:" key ")")) - ) - ) +(defun tdh-insert-link-to-pdf-entry (key) + "Insert a link to a pdf associated with the bibtex entry." + (let* + ((entry (bibtex-completion-get-entry key)) + (title (bibtex-completion-get-value "title" entry))) + (insert (concat "[[file:Download/" key ".pdf][" title "]] (cite:" key ")")) + ) + )-@@ -3821,8 +3824,8 @@ Create Org-Roam file from heading ( -(defun tdh-insert-link-to-note (key) - "Insert a link to a note associated with the bibtex entry." - (if (and bibtex-completion-notes-path - (f-directory? bibtex-completion-notes-path)) - (let* ((path (f-join bibtex-completion-notes-path - (s-concat key bibtex-completion-notes-extension)))) - (if (file-exists-p path) - (insert (concat "[[file:" (file-relative-name path) "][Notes]]")) - (message "No note file associated")) - ))) +(defun tdh-insert-link-to-note (key) + "Insert a link to a note associated with the bibtex entry." + (if (and bibtex-completion-notes-path + (f-directory? bibtex-completion-notes-path)) + (let* ((path (f-join bibtex-completion-notes-path + (s-concat key bibtex-completion-notes-extension)))) + (if (file-exists-p path) + (insert (concat "[[file:" (file-relative-name path) "][Notes]]")) + (message "No note file associated")) + )))(defun tdh-open-pdf-externally (key) - (call-process "zathura" nil 0 nil (nth 0 (-cons-to-list (bibtex-completion-find-pdf key))))) +(defun tdh-open-pdf-externally (key) + (call-process "zathura" nil 0 nil (nth 0 (-cons-to-list (bibtex-completion-find-pdf key)))))-@@ -3841,24 +3844,24 @@ Special Commands List all element of the bibliography without pdf associated(defun tdh-helm-bibtex-favorites (&optional arg) - "Search Favorite BibTeX entries" - (interactive "P") - (helm-bibtex arg nil "favorite ")) +(defun tdh-helm-bibtex-favorites (&optional arg) + "Search Favorite BibTeX entries" + (interactive "P") + (helm-bibtex arg nil "favorite "))-@@ -3868,9 +3871,9 @@ List all element of the bibliography without pdf associated(defun tdh-list-bib-without-pdf-associated () - (interactive) - (bibtex-completion-init) - (setq candidates (bibtex-completion-candidates)) +(defun tdh-list-bib-without-pdf-associated () + (interactive) + (bibtex-completion-init) + (setq candidates (bibtex-completion-candidates)) - (defun canditate-is-pdf-present (candidate) - (bibtex-completion-find-pdf-in-library (cdr (assoc "=key=" candidate))) - ) + (defun canditate-is-pdf-present (candidate) + (bibtex-completion-find-pdf-in-library (cdr (assoc "=key=" candidate))) + ) - (setq candidates-without-pdf (remove-if #'canditate-is-pdf-present candidates)) + (setq candidates-without-pdf (remove-if #'canditate-is-pdf-present candidates)) - (setq candidate-without-pdf-names (mapcar - (lambda (x) (cdr (assoc "title" x))) - candidates-without-pdf)) + (setq candidate-without-pdf-names (mapcar + (lambda (x) (cdr (assoc "title" x))) + candidates-without-pdf)) - (with-output-to-temp-buffer "*bib-without-pdf*" (princ (string-join candidate-without-pdf-names "\n"))) - (switch-to-buffer-other-window "*bib-without-pdf*") - ) + (with-output-to-temp-buffer "*bib-without-pdf*" (princ (string-join candidate-without-pdf-names "\n"))) + (switch-to-buffer-other-window "*bib-without-pdf*") + )Deft
@@ -3889,45 +3892,45 @@ Provides nice functions such as:-(use-package! deft - :custom - (deft-directory "~/Cloud/brain/")) +(use-package! deft + :custom + (deft-directory "~/Cloud/brain/"))-(use-package! org-roam-bibtex - :hook (org-roam-mode . org-roam-bibtex-mode) - :config - (setq orb-preformat-keywords `("=key=" "title" "author" "year" "author-abbrev" "=type=")) +(use-package! org-roam-bibtex + :hook (org-roam-mode . org-roam-bibtex-mode) + :config + (setq orb-preformat-keywords `("=key=" "title" "author" "year" "author-abbrev" "=type=")) - (setq orb-templates - `(("r" "ref" plain (function org-roam-capture--get-point) "" - :file-name "${=key=}" - :head ,(concat "#+TITLE: ${title}\n" - "#+SETUPFILE: ./setup/org-setup-file.org\n" - "#+HUGO_SECTION: ${=type=}\n" - "#+ROAM_KEY: ${ref}\n" - "\n" - "- Tags ::\n" - "- Reference :: ${ref}\n" - "- Author(s) :: ${author}\n" - "- Year :: ${year}\n" - "\n" - "* ${author-abbrev} (${year}): ${title} :${=type=}:ignore:\n" - ":PROPERTIES:\n" - ":NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n" - ":END:\n" - "\n" - "* Bibliography :ignore:\n" - "bibliography:./biblio/references.bib" - ) - :unnarrowed t))) + (setq orb-templates + `(("r" "ref" plain (function org-roam-capture--get-point) "" + :file-name "${=key=}" + :head ,(concat "#+title: ${title}\n" + "#+setupfile: ./setup/org-setup-file.org\n" + "#+hugo_section: ${=type=}\n" + "#+roam_key: ${ref}\n" + "\n" + "- Tags ::\n" + "- Reference :: ${ref}\n" + "- Author(s) :: ${author}\n" + "- Year :: ${year}\n" + "\n" + "* ${author-abbrev} (${year}): ${title} :${=type=}:ignore:\n" + ":PROPERTIES:\n" + ":NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n" + ":END:\n" + "\n" + "* Bibliography :ignore:\n" + "bibliography:./biblio/references.bib" + ) + :unnarrowed t))) - (setq orb-note-actions-user '(("Open with Zathura" . tdh-open-bib-with-zathura))) - ) + (setq orb-note-actions-user '(("Open with Zathura" . tdh-open-bib-with-zathura))) + )-@@ -3937,11 +3940,11 @@ Provides nice functions such as:(defun tdh-open-bib-with-zathura (key) - "Open the pdf corresponding to the reference KEY with Zathura" - (if (listp key) - (setq key (car key))) - (call-process "zathura" nil 0 nil (org-ref-get-pdf-filename key))) +(defun tdh-open-bib-with-zathura (key) + "Open the pdf corresponding to the reference KEY with Zathura" + (if (listp key) + (setq key (car key))) + (call-process "zathura" nil 0 nil (org-ref-get-pdf-filename key)))Citeproc-org (link)
@@ -3957,12 +3960,12 @@ Provides nice functions such as: --(use-package! citeproc-org - :after org - :config - (citeproc-org-setup) - (setq citeproc-org-html-backends '(html))) +(use-package! citeproc-org + :after org + :config + (citeproc-org-setup) + (setq citeproc-org-html-backends '(html)))--Basic Config
-+-+Basic Config
+@@ -3972,9 +3975,9 @@ Provides nice functions such as:-(after! auctex - (setq +latex-viewers '(zathura pdf-tools))) +(after! auctex + (setq +latex-viewers '(zathura pdf-tools)))Bibtex
@@ -3993,10 +3996,10 @@ Provides nice functions such as:-(use-package! bibtex - :config - (bibtex-set-dialect 'BibTeX)) +(use-package! bibtex + :config + (bibtex-set-dialect 'BibTeX))Setup Matlab Mode
@@ -4006,19 +4009,19 @@ Provides nice functions such as:-(setq matlab-shell-command "/home/thomas/.local/bin/matlab") - (setq matlab-shell-command-switches (list "-softwareopengl -nodesktop -nosplash")) - (setq matlab-indent-function t) - (setq mlint-programs '("mlint" "/home/thomas/.local/bin/mlint")) +(setq matlab-shell-command "/home/thomas/.local/bin/matlab") +(setq matlab-shell-command-switches (list "-softwareopengl -nodesktop -nosplash")) +(setq matlab-indent-function t) +(setq mlint-programs '("mlint" "/home/thomas/.local/bin/mlint"))Setup Flycheck to work with
mlint
@@ -4028,8 +4031,8 @@ Provides nice functions such as:-(defvar mlint-executable "/home/thomas/.local/bin/mlint") +(defvar mlint-executable "/home/thomas/.local/bin/mlint") - (flycheck-define-command-checker 'matlab-mlint - "A Matlab checker based on mlint." - :command `(,mlint-executable source) - :error-patterns - '((warning line-start "L " line " (C " (1+ digit) "): " (message) line-end)) - :modes '(matlab-mode)) +(flycheck-define-command-checker 'matlab-mlint + "A Matlab checker based on mlint." + :command `(,mlint-executable source) + :error-patterns + '((warning line-start "L " line " (C " (1+ digit) "): " (message) line-end)) + :modes '(matlab-mode)) - (add-to-list 'flycheck-checkers 'matlab-mlint) +(add-to-list 'flycheck-checkers 'matlab-mlint) - ;; Automatic startup of flycheck for matlab - (add-hook 'matlab-mode-hook 'flycheck-mode) +;; Automatic startup of flycheck for matlab +(add-hook 'matlab-mode-hook 'flycheck-mode)Completion in the Matlab Shell
@@ -4039,18 +4042,18 @@ Provides nice functions such as:-(map! :map matlab-shell-mode-map - :i "<tab>" 'matlab-shell-tab) +(map! :map matlab-shell-mode-map + :i "<tab>" 'matlab-shell-tab)Beautify code
@@ -4060,51 +4063,51 @@ Provides nice functions such as:-(defun tdh-matlab-beautify-buffer () - "Beautify Current Matlab Buffer" - (interactive) - ;; First verifies is the current file is a Matlab file - (if (string= (file-name-extension (buffer-file-name)) "m") - (progn - (save-buffer) - (matlab-shell-run-command (concat "MBeautify.formatFileNoEditor(\"" (buffer-file-name) "\", \"" (buffer-file-name) "\")")) - (revert-buffer :ignore-auto :noconfirm)) - (message "Current buffer is not a matlab file") - ) - ) +(defun tdh-matlab-beautify-buffer () + "Beautify Current Matlab Buffer" + (interactive) + ;; First verifies is the current file is a Matlab file + (if (string= (file-name-extension (buffer-file-name)) "m") + (progn + (save-buffer) + (matlab-shell-run-command (concat "MBeautify.formatFileNoEditor(\"" (buffer-file-name) "\", \"" (buffer-file-name) "\")")) + (revert-buffer :ignore-auto :noconfirm)) + (message "Current buffer is not a matlab file") + ) + )Key Bindings
@@ -4198,14 +4201,14 @@ Send math and source code: This is a helper to help determine which account context I am in based on the folder in my maildir the email (eg. ~/.mail/nine27) is located in.-(defun tdh-matlab-add-breakpoint () - (interactive) - (matlab-shell-run-command (concat "dbstop in " (buffer-name) " at " (number-to-string (line-number-at-pos nil))))) +(defun tdh-matlab-add-breakpoint () + (interactive) + (matlab-shell-run-command (concat "dbstop in " (buffer-name) " at " (number-to-string (line-number-at-pos nil))))) - (defun tdh-matlab-remove-breakpoint () - (interactive) - (matlab-shell-run-command (concat "dbclear in " (buffer-name) " at " (number-to-string (line-number-at-pos nil))))) +(defun tdh-matlab-remove-breakpoint () + (interactive) + (matlab-shell-run-command (concat "dbclear in " (buffer-name) " at " (number-to-string (line-number-at-pos nil))))) - (defun tdh-matlab-list-breakpoints () - (interactive) - (matlab-shell-run-command (concat "dbstatus " (buffer-name)))) +(defun tdh-matlab-list-breakpoints () + (interactive) + (matlab-shell-run-command (concat "dbstatus " (buffer-name)))) - (defun tdh-matlab-clear-breakpoints () - (interactive) - (matlab-shell-run-command (concat "dbclear in " (buffer-name)))) +(defun tdh-matlab-clear-breakpoints () + (interactive) + (matlab-shell-run-command (concat "dbclear in " (buffer-name)))) - (defun tdh-matlab-no-debug-on-error () - (interactive) - (matlab-shell-run-command (concat "dbclear if error"))) +(defun tdh-matlab-no-debug-on-error () + (interactive) + (matlab-shell-run-command (concat "dbclear if error"))) - (defun tdh-matlab-debug-on-error () - (interactive) - (matlab-shell-run-command (concat "dbstop if error"))) +(defun tdh-matlab-debug-on-error () + (interactive) + (matlab-shell-run-command (concat "dbstop if error"))) - (defun tdh-matlab-go-to-file-directory () - (interactive) - (matlab-shell-run-command (concat "cd " (file-name-directory buffer-file-name)))) +(defun tdh-matlab-go-to-file-directory () + (interactive) + (matlab-shell-run-command (concat "cd " (file-name-directory buffer-file-name))))-(map! :map matlab-mode-map - (:prefix ("," . "prefix") - :n "g" 'tdh-matlab-go-to-file-directory - (:prefix ("d" . "Debug") - :n "de" 'tdh-matlab-debug-on-error - :n "dE" 'tdh-matlab-no-debug-on-error - :n "da" 'tdh-matlab-add-breakpoint - :n "dr" 'tdh-matlab-remove-breakpoint - :n "dL" 'tdh-matlab-list-breakpoints - :n "dc" 'tdh-matlab-clear-breakpoints - :n "dl" 'gud-cont - :n "ds" 'gud-step - :n "dn" 'gud-next - :n "dq" 'gud-finish))) +(map! :map matlab-mode-map + (:prefix ("," . "prefix") + :n "g" 'tdh-matlab-go-to-file-directory + (:prefix ("d" . "Debug") + :n "de" 'tdh-matlab-debug-on-error + :n "dE" 'tdh-matlab-no-debug-on-error + :n "da" 'tdh-matlab-add-breakpoint + :n "dr" 'tdh-matlab-remove-breakpoint + :n "dL" 'tdh-matlab-list-breakpoints + :n "dc" 'tdh-matlab-clear-breakpoints + :n "dl" 'gud-cont + :n "ds" 'gud-step + :n "dn" 'gud-next + :n "dq" 'gud-finish)))-@@ -4213,44 +4216,44 @@ This is a helper to help determine which account context I am in based on the fo Choose account label to feed msmtp -a option based on From header in Message buffer; This function must be added to message-send-mail-hook for on-the-fly change of From address before sending message since message-send-mail-hook is processed right before sending message.(defun mu4e-message-maildir-matches (msg rx) - (when rx - (if (listp rx) - ;; If rx is a list, try each one for a match - (or (mu4e-message-maildir-matches msg (car rx)) - (mu4e-message-maildir-matches msg (cdr rx))) - ;; Not a list, check rx - (string-match rx (mu4e-message-field msg :maildir))))) +(defun mu4e-message-maildir-matches (msg rx) + (when rx + (if (listp rx) + ;; If rx is a list, try each one for a match + (or (mu4e-message-maildir-matches msg (car rx)) + (mu4e-message-maildir-matches msg (cdr rx))) + ;; Not a list, check rx + (string-match rx (mu4e-message-field msg :maildir)))))-(defun choose-msmtp-account () - (if (message-mail-p) - (save-excursion - (let* - ((from (save-restriction - (message-narrow-to-headers) - (message-fetch-field "from"))) - (account - (cond - ((string-match "dehaeze.thomas@gmail.com" from) "gmail") - ((string-match "thomas.dehaeze@esrf.fr" from) "esrf")))) - (setq message-sendmail-extra-arguments (list '"-a" account)))))) +(defun choose-msmtp-account () + (if (message-mail-p) + (save-excursion + (let* + ((from (save-restriction + (message-narrow-to-headers) + (message-fetch-field "from"))) + (account + (cond + ((string-match "dehaeze.thomas@gmail.com" from) "gmail") + ((string-match "thomas.dehaeze@esrf.fr" from) "esrf")))) + (setq message-sendmail-extra-arguments (list '"-a" account))))))-Basic Config
-++Basic Config
+@@ -4260,26 +4263,26 @@ Choose account label to feed msmtp -a option based on From header in Message buf-(use-package! mu4e - :config - (setq mail-user-agent 'mu4e-user-agent - mu4e-mu-binary "/usr/bin/mu" - mu4e-maildir "~/.mail" - mu4e-compose-format-flowed t - mu4e-compose-in-new-frame nil - mu4e-view-show-images t - mu4e-html2text-command "w3m -dump -T text/html" - mu4e-use-fancy-chars t - mu4e-headers-include-related t - mu4e-attachment-dir "~/Downloads" - message-kill-buffer-on-exit t - mu4e-compose-signature-auto-include t - mu4e-view-show-images t - mu4e-view-show-addresses t) - ) +(use-package! mu4e + :config + (setq mail-user-agent 'mu4e-user-agent + mu4e-mu-binary "/usr/bin/mu" + mu4e-maildir "~/.mail" + mu4e-compose-format-flowed t + mu4e-compose-in-new-frame nil + mu4e-view-show-images t + mu4e-html2text-command "w3m -dump -T text/html" + mu4e-use-fancy-chars t + mu4e-headers-include-related t + mu4e-attachment-dir "~/Downloads" + message-kill-buffer-on-exit t + mu4e-compose-signature-auto-include t + mu4e-view-show-images t + mu4e-view-show-addresses t) + )Additional config
@@ -4289,17 +4292,17 @@ Choose account label to feed msmtp -a option based on From header in Message buf-(use-package! mu4e - :config - ;; Use imagemagick, if available. - (when (fboundp 'imagemagick-register-types) - (imagemagick-register-types)) +(use-package! mu4e + :config + ;; Use imagemagick, if available. + (when (fboundp 'imagemagick-register-types) + (imagemagick-register-types)) - ;; Sometimes html email is just not readable in a text based client, this lets me open the - ;; email in my browser. - (add-to-list 'mu4e-view-actions '("View in browser" . mu4e-action-view-in-browser) t) + ;; Sometimes html email is just not readable in a text based client, this lets me open the + ;; email in my browser. + (add-to-list 'mu4e-view-actions '("View in browser" . mu4e-action-view-in-browser) t) - ;; Spell checking ftw. - (add-hook 'mu4e-compose-mode-hook 'flyspell-mode) + ;; Spell checking ftw. + (add-hook 'mu4e-compose-mode-hook 'flyspell-mode) - ;; Use Helm to select mailboxes - (setq mu4e-completing-read-function 'completing-read) - ;; Don't ask for a 'context' upon opening mu4e - (setq mu4e-context-policy 'pick-first) - ;; Don't ask to quit... why is this the default? - (setq mu4e-confirm-quit nil) - ) + ;; Use Helm to select mailboxes + (setq mu4e-completing-read-function 'completing-read) + ;; Don't ask for a 'context' upon opening mu4e + (setq mu4e-context-policy 'pick-first) + ;; Don't ask to quit... why is this the default? + (setq mu4e-confirm-quit nil) + )Provide Information
@@ -4309,12 +4312,12 @@ Choose account label to feed msmtp -a option based on From header in Message buf-(use-package! mu4e - :config - (setq mu4e-user-mail-address-list '("dehaeze.thomas@gmail.com" "thomas.dehaeze@esrf.fr") - mu4e-compose-signature "Thomas Dehaeze\n" - user-mail-address "dehaeze.thomas@gmail.com") - ;; Default Folders - (setq mu4e-sent-folder "/gmail/Sent" - mu4e-drafts-folder "/gmail/Drafts" - mu4e-trash-folder "/gmail/Trash" - mu4e-refile-folder "/gmail/Archive") - ) +(use-package! mu4e + :config + (setq mu4e-user-mail-address-list '("dehaeze.thomas@gmail.com" "thomas.dehaeze@esrf.fr") + mu4e-compose-signature "Thomas Dehaeze\n" + user-mail-address "dehaeze.thomas@gmail.com") + ;; Default Folders + (setq mu4e-sent-folder "/gmail/Sent" + mu4e-drafts-folder "/gmail/Drafts" + mu4e-trash-folder "/gmail/Trash" + mu4e-refile-folder "/gmail/Archive") + )Receiving emails using mbsync
@@ -4324,41 +4327,41 @@ Choose account label to feed msmtp -a option based on From header in Message buf-(use-package! mu4e - :config - (setq mu4e-get-mail-command "checkmail" - mu4e-update-interval nil - mu4e-change-filenames-when-moving t) ;; Fix for mbsync - ) +(use-package! mu4e + :config + (setq mu4e-get-mail-command "checkmail" + mu4e-update-interval nil + mu4e-change-filenames-when-moving t) ;; Fix for mbsync + )Contexts
@@ -4368,19 +4371,19 @@ Choose account label to feed msmtp -a option based on From header in Message buf-(use-package! mu4e - :config - (setq mu4e-contexts - `( ,(make-mu4e-context - :name "gmail" - :enter-func (lambda () (mu4e-message "Switch to the gmail context")) - :match-func (lambda (msg) (when msg - (string-prefix-p "/gmail" (mu4e-message-field msg :maildir)))) - :leave-func (lambda () (mu4e-clear-caches)) - :vars '( - (user-mail-address . "dehaeze.thomas@gmail.com") - (user-full-name . "Thomas Dehaeze") - (mu4e-sent-folder . "/gmail/Sent") - (mu4e-trash-folder . "/gmail/Trash") - (mu4e-drafts-folder . "/gmail/Drafts") - (mu4e-refile-folder . "/gmail/Archive") - (mu4e-compose-signature . "Thomas Dehaeze\n") - )) - ,(make-mu4e-context - :name "esrf" - :enter-func (lambda () (mu4e-message "Switch to the esrf context")) - :match-func (lambda (msg) (when msg - (string-prefix-p "/esrf" (mu4e-message-field msg :maildir)))) - :leave-func (lambda () (mu4e-clear-caches)) - :vars '( - (user-mail-address . "thomas.dehaeze@esrf.fr") - (user-full-name . "Thomas Dehaeze") - (mu4e-sent-folder . "/esrf/Sent") - (mu4e-trash-folder . "/esrf/Trash") - (mu4e-drafts-folder . "/esrf/Drafts") - (mu4e-refile-folder . "/esrf/Archive") - (mu4e-compose-signature . "Thomas Dehaeze\n") - )) - )) - ) +(use-package! mu4e + :config + (setq mu4e-contexts + `( ,(make-mu4e-context + :name "gmail" + :enter-func (lambda () (mu4e-message "Switch to the gmail context")) + :match-func (lambda (msg) (when msg + (string-prefix-p "/gmail" (mu4e-message-field msg :maildir)))) + :leave-func (lambda () (mu4e-clear-caches)) + :vars '( + (user-mail-address . "dehaeze.thomas@gmail.com") + (user-full-name . "Thomas Dehaeze") + (mu4e-sent-folder . "/gmail/Sent") + (mu4e-trash-folder . "/gmail/Trash") + (mu4e-drafts-folder . "/gmail/Drafts") + (mu4e-refile-folder . "/gmail/Archive") + (mu4e-compose-signature . "Thomas Dehaeze\n") + )) + ,(make-mu4e-context + :name "esrf" + :enter-func (lambda () (mu4e-message "Switch to the esrf context")) + :match-func (lambda (msg) (when msg + (string-prefix-p "/esrf" (mu4e-message-field msg :maildir)))) + :leave-func (lambda () (mu4e-clear-caches)) + :vars '( + (user-mail-address . "thomas.dehaeze@esrf.fr") + (user-full-name . "Thomas Dehaeze") + (mu4e-sent-folder . "/esrf/Sent") + (mu4e-trash-folder . "/esrf/Trash") + (mu4e-drafts-folder . "/esrf/Drafts") + (mu4e-refile-folder . "/esrf/Archive") + (mu4e-compose-signature . "Thomas Dehaeze\n") + )) + )) + )Sending mails
@@ -4390,16 +4393,16 @@ Choose account label to feed msmtp -a option based on From header in Message buf-(use-package! mu4e - :config - (setq message-send-mail-function 'message-send-mail-with-sendmail - sendmail-program "/usr/bin/msmtp" - user-full-name "Thomas Dehaeze") +(use-package! mu4e + :config + (setq message-send-mail-function 'message-send-mail-with-sendmail + sendmail-program "/usr/bin/msmtp" + user-full-name "Thomas Dehaeze") - ;; This prevents saving the email to the Sent folder since gmail will do this for us on their end. - (setq mu4e-sent-messages-behavior 'delete) + ;; This prevents saving the email to the Sent folder since gmail will do this for us on their end. + (setq mu4e-sent-messages-behavior 'delete) - ;; Use the correct account context when sending mail based on the from header. - (setq message-sendmail-envelope-from 'header) - (add-hook 'message-send-mail-hook 'choose-msmtp-account) - ) + ;; Use the correct account context when sending mail based on the from header. + (setq message-sendmail-envelope-from 'header) + (add-hook 'message-send-mail-hook 'choose-msmtp-account) + )Bookmarks
@@ -4410,102 +4413,102 @@ Choose account label to feed msmtp -a option based on From header in Message buf-(use-package! mu4e - :config - (setq mu4e-bookmarks `(,(make-mu4e-bookmark - :name "All Inboxes" - :query "maildir:/gmail/Inbox OR maildir:/esrf/Inbox" - :key ?i) - ("flag:unread" "Unread messages" ?u) - ("date:today..now" "Today's messages" ?t) - ("date:7d..now" "Last 7 days" ?w))) - ) +(use-package! mu4e + :config + (setq mu4e-bookmarks `(,(make-mu4e-bookmark + :name "All Inboxes" + :query "maildir:/gmail/Inbox OR maildir:/esrf/Inbox" + :key ?i) + ("flag:unread" "Unread messages" ?u) + ("date:today..now" "Today's messages" ?t) + ("date:7d..now" "Last 7 days" ?w))) + )Doom
init.el
@@ -4515,103 +4518,103 @@ Choose account label to feed msmtp -a option based on From header in Message buf-(when noninteractive - (after! undo-tree - (global-undo-tree-mode -1))) +(when noninteractive + (after! undo-tree + (global-undo-tree-mode -1))) - (doom! :completion - company ; the ultimate code completion backend - helm ; the *other* search engine for love and life - ivy ; a search engine for love and life +(doom! :completion + company ; the ultimate code completion backend + helm ; the *other* search engine for love and life + ivy ; a search engine for love and life - :ui - doom ; what makes DOOM look the way it does - deft - hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW - hydra - modeline - ophints ; highlight the region an operation acts on - (popup ; tame sudden yet inevitable temporary windows - +all ; catch all popups that start with an asterix - +defaults) ; default popup rules - unicode ; extended unicode support for various languages - vc-gutter ; vcs diff in the fringe - vi-tilde-fringe ; fringe tildes to mark beyond EOB - workspaces ; tab emulation, persistence & separate workspaces - (emoji +unicode) + :ui + doom ; what makes DOOM look the way it does + deft + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + hydra + modeline + ophints ; highlight the region an operation acts on + (popup ; tame sudden yet inevitable temporary windows + +all ; catch all popups that start with an asterix + +defaults) ; default popup rules + unicode ; extended unicode support for various languages + vc-gutter ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + workspaces ; tab emulation, persistence & separate workspaces + (emoji +unicode) - :editor - (evil +everywhere); come to the dark side, we have cookies - fold ; (nigh) universal code folding - rotate-text ; cycle region at point between text candidates - snippets ; my elves. They type so I don't have to - word-wrap ; soft wrapping with language-aware indent + :editor + (evil +everywhere); come to the dark side, we have cookies + fold ; (nigh) universal code folding + rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + word-wrap ; soft wrapping with language-aware indent - :emacs - (dired +icons) ; making dired pretty [functional] - electric ; smarter, keyword-based electric-indent - (ibuffer +icons) ; interactive buffer management - vc ; version-control and Emacs, sitting in a tree - undo + :emacs + (dired +icons) ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + (ibuffer +icons) ; interactive buffer management + vc ; version-control and Emacs, sitting in a tree + undo - :term - eshell ; a consistent, cross-platform shell (WIP) - vterm + :term + eshell ; a consistent, cross-platform shell (WIP) + vterm - :tools - debugger ; Stepping through code, to help you add bugs - (eval +overlay) ; run code, run (also, repls) - (lookup ; helps you navigate your code and documentation - +docsets) ; ...or in Dash docsets locally - lsp - magit ; a git porcelain for Emacs - docker - ;;pass ; password manager for nerds - pdf ; pdf enhancements - eval - biblio - (lookup +dictionary) + :tools + debugger ; Stepping through code, to help you add bugs + (eval +overlay) ; run code, run (also, repls) + (lookup ; helps you navigate your code and documentation + +docsets) ; ...or in Dash docsets locally + lsp + magit ; a git porcelain for Emacs + docker + ;;pass ; password manager for nerds + pdf ; pdf enhancements + eval + biblio + (lookup +dictionary) - :checkers - syntax ; tasing you for every semicolon you forget - (spell +aspell) ; tasing you for misspelling mispelling + :checkers + syntax ; tasing you for every semicolon you forget + (spell +aspell) ; tasing you for misspelling mispelling - :lang - data ; config/data formats - emacs-lisp ; drown in parentheses - go - (javascript - +lsp) - (latex - +latexmk - +lsp) - ;; markdown ; writing docs for people to ignore - (org ; organize your plain life in plain text - +dragndrop ; drag & drop files/images into org buffers - +hugo ; use Emacs for hugo blogging - +roam ; - +gnuplot - +present) ; using org-mode for presentations - python ; beautiful is better than ugly - (sh ; she sells {ba,z,fi}sh shells on the C xor - +lsp) - (web - +lsp) - yaml + :lang + data ; config/data formats + emacs-lisp ; drown in parentheses + go + (javascript + +lsp) + (latex + +latexmk + +lsp) + ;; markdown ; writing docs for people to ignore + (org ; organize your plain life in plain text + +dragndrop ; drag & drop files/images into org buffers + +hugo ; use Emacs for hugo blogging + +roam ; + +gnuplot + +present) ; using org-mode for presentations + python ; beautiful is better than ugly + (sh ; she sells {ba,z,fi}sh shells on the C xor + +lsp) + (web + +lsp) + yaml - :email - (mu4e +gmail) + :email + (mu4e +gmail) - :app - calendar - ;;(rss +org) ; emacs as an RSS reader - ;;write ; emacs for writers (fiction, notes, papers, etc.) + :app + calendar + ;;(rss +org) ; emacs as an RSS reader + ;;write ; emacs for writers (fiction, notes, papers, etc.) - :config - literate - (default +bindings) - ) + :config + literate + (default +bindings) + )Doom
packages.el
@@ -4619,7 +4622,7 @@ Choose account label to feed msmtp -a option based on From header in Message buf-;; Vimrc - (package! vimrc-mode) +;; Vimrc +(package! vimrc-mode)-;; Automatic toggling of LaTeX fragments - (package! org-fragtog) +;; Automatic toggling of LaTeX fragments +(package! org-fragtog)-;; custom blocks and links for org-mode - (package! org-special-block-extras) +;; custom blocks and links for org-mode +(package! org-special-block-extras)-;; Nice theme - (package! poet-theme) +;; Nice theme +(package! poet-theme)-;; Major mode for SPICE - (package! spice-mode) +;; Major mode for SPICE +(package! spice-mode)-;; Import file to Org-mode - (package! org-pandoc-import - :recipe (:host github - :repo "tecosaur/org-pandoc-import" - :files ("*.el" "filters" "preprocessors"))) +;; Import file to Org-mode +(package! org-pandoc-import + :recipe (:host github + :repo "tecosaur/org-pandoc-import" + :files ("*.el" "filters" "preprocessors")))-;; Renders Org-mode citations in CSL styles - (package! citeproc-org) +;; Renders Org-mode citations in CSL styles +(package! citeproc-org)-;; Org-mode modules for citations, cross-references, bibliographies - (package! org-ref) +;; Org-mode modules for citations, cross-references, bibliographies +(package! org-ref)-;; Alert notifications for org-agenda - (package! org-wild-notifier) +;; Alert notifications for org-agenda +(package! org-wild-notifier)-;; Display Google Calendar in org-calendar - (package! org-gcal) +;; Display Google Calendar in org-calendar +(package! org-gcal)-;; Turn table into subfigure - (package! ox-latex-subfigure - :recipe (:host github :repo "linktohack/ox-latex-subfigure")) +;; Turn table into subfigure +(package! ox-latex-subfigure + :recipe (:host github :repo "linktohack/ox-latex-subfigure"))-;; Major Mode for Matlab - (package! matlab-mode - :recipe (:host github :repo "matlab-mode/mirror")) +;; Major Mode for Matlab +(package! matlab-mode + :recipe (:host github :repo "matlab-mode/mirror"))-;; Org-mode query language - (package! org-ql) +;; Org-mode query language +(package! org-ql)-;; Display Org Mode priorities as custom strings - (package! org-fancy-priorities) +;; Display Org Mode priorities as custom strings +(package! org-fancy-priorities)-;; Web Server - (package! web-server) +;; Web Server +(package! web-server)-;; Don't use this default package in Doom - (package! evil-escape :disable t) +;; Don't use this default package in Doom +(package! evil-escape :disable t)diff --git a/docs/emacs-library-babel.html b/docs/emacs-library-babel.html index 6be7de5..1f7ec5e 100644 --- a/docs/emacs-library-babel.html +++ b/docs/emacs-library-babel.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2021-01-04 lun. 21:32
+Created: 2021-01-08 ven. 01:32
My Own Library of Babel @@ -115,7 +115,7 @@ size_strings = strsplit(figsize, '-');diff --git a/docs/newsboat.html b/docs/newsboat.html index b6fdb4f..9b91755 100644 --- a/docs/newsboat.html +++ b/docs/newsboat.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2021-01-01 ven. 20:08
+Created: 2021-01-08 ven. 01:32
Newsboat Configuration @@ -26,7 +26,7 @@
- Reload configuration
- Basic configuration
-- Queries
+- Queries
- Filters
- Notifications
-Queries
-++Queries
+prepopulate-query-feeds yes@@ -334,9 +333,9 @@ highlight article "\\[image\\ [0-9]+\\]" green d--Queries
-++Queries
+"query:Unread:unread = \"yes\"" "query:Unwatch - Youtube:unread = \"yes\" and tags # \"youtube\"" @@ -352,9 +351,9 @@ highlight article "\\[image\\ [0-9]+\\]" green dNewsfeeds
--Matlab and Control
-++Matlab and Control
+-https://undocumentedmatlab.com/feed/ "~RSS undocumentedmatlab" matlab http://blogs.mathworks.com/seth/feed/ "~RSS Guy on Simulink" matlab control @@ -369,9 +368,9 @@ https://medium.com/feed/@mithi-Audio and Electronics
-++Audio and Electronics
+-http://jipihorn.wordpress.com/feed/ "~RSS Jipihorn's Blog" electronics audio https://quantasylum.com/blogs/news.atom "~RSS QuantAsylum" audio @@ -381,9 +380,9 @@ https://www.scrample.xyz/index.xml-Science
-++Science
+-http://sciencetonnante.wordpress.com/feed/ "~RSS Science étonnante" science https://brushingupscience.com/feed/ "~RSS Brushing Up Science" science @@ -392,9 +391,9 @@ https://brushingupscience.com/feed/-Linux, Emacs and Computer Science
-++Linux, Emacs and Computer Science
+https://yiufung.net/index.xml "~RSS yiufung" emacs https://bzg.fr/index.xml "~RSS bzg" emacs @@ -459,9 +458,9 @@ https://ag91.github.io/rss.xml Youtube--Matlab and Control
-++Matlab and Control
+-https://www.youtube.com/feeds/videos.xml?channel_id=UCm5mt-A4w61lknZ9lCsZtBw "~YT Steve Brunton" youtube control science https://www.youtube.com/feeds/videos.xml?channel_id=UCoUOaSVYkTV6W4uLvxvgiFA "~YT Nathan Kutz" youtube science control @@ -479,9 +478,9 @@ https://ag91.github.io/rss.xml-Audio and Electronics
-++Audio and Electronics
+-https://www.youtube.com/feeds/videos.xml?channel_id=UCI-FgEdZQxBASsm3HNcWKxQ "~YT Red Robbo's Workshop" youtube linux audio https://www.youtube.com/feeds/videos.xml?channel_id=UCtpB66XKjAtFZfZyzmC-_Cg "~YT HexiBase" youtube audio @@ -504,9 +503,9 @@ https://ag91.github.io/rss.xml-@@ -452,40 +452,40 @@ Backup to NASLinux, Emacs and Computer Science
-+@@ -436,11 +436,11 @@ Backup to NAS+@@ -384,11 +384,11 @@ Backup to NASLinux, Emacs and Computer Science
+--https://www.youtube.com/feeds/videos.xml?channel_id=UCNqFXwI5gNcyxt2c1zTQAKw "~YT Yisrael Dov L" youtube emacs https://www.youtube.com/feeds/videos.xml?channel_id=UC2eYFnH61tmytImy1mTYvhA "~YT Luke Smith" youtube linux @@ -575,16 +574,6 @@ https://ag91.github.io/rss.xml--Engineering
-------Interesting - General
@@ -597,15 +586,14 @@ https://ag91.github.io/rss.xml https://www.youtube.com/feeds/videos.xml?channel_id=UCWty1tzwZW_ZNSp5GVGteaA "~YT La statistique expliquée à mon chat" youtube interesting https://www.youtube.com/feeds/videos.xml?channel_id=UCLbgxBMMEo6mAYe87esxGmg "~YT horror humanum est" youtube interesting https://www.youtube.com/feeds/videos.xml?channel_id=UCOuIgj0CYCXCvjWywjDbauw "~YT Chat Sceptique" youtube interesting --Science
-+++Science
+@@ -685,6 +672,7 @@ https://ag91.github.io/rss.xmlhttps://www.youtube.com/feeds/videos.xml?channel_id=UCwgqYNmYaij2_8hq_tOFyZw "~YT Aurelien Barrau" youtube science https://www.youtube.com/feeds/videos.xml?channel_id=UCeR8BYZS7IHYjk_9Mh5JgkA "~YT Scilabus" youtube science @@ -627,7 +615,6 @@ https://ag91.github.io/rss.xml https://www.youtube.com/feeds/videos.xml?channel_id=UCNmLe68qKzdjuEpT_YTDFuA "~YT Etonnarium" youtube science https://www.youtube.com/feeds/videos.xml?channel_id=UCCSN5zJTKjl6UKvPcLzLuiw "~YT Macroscopie" youtube science https://www.youtube.com/feeds/videos.xml?channel_id=UC7DdEm33SyaTDtWYGO2CwdA "~YT Physics Girl" youtube science -@@ -731,7 +718,7 @@ https://ag91.github.io/rss.xmlRandom - Fun - Others
@@ -721,7 +709,6 @@ https://ag91.github.io/rss.xml https://www.youtube.com/feeds/videos.xml?channel_id=UCJZ94qp4dtCw0Q5UQqAkg7w "~YT larsandersen23" youtube random https://www.youtube.com/feeds/videos.xml?channel_id=UCDPK_MTu3uTUFJXRVcTJcEw "~YT Mcfly et Carlito" youtube random https://www.youtube.com/feeds/videos.xml?channel_id=UC2_OG1L8DLTzQ7UrZVOk7OA "~YT Axolot" youtube random -diff --git a/docs/pcmanfm.html b/docs/pcmanfm.html index 07216c8..c8aad33 100644 --- a/docs/pcmanfm.html +++ b/docs/pcmanfm.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2021-01-01 ven. 20:09
+Created: 2021-01-08 ven. 01:33
PCManFM @@ -33,8 +33,8 @@Config
@@ -44,10 +44,10 @@-[config] - bm_open_method=0 +[config] +bm_open_method=0Volume
@@ -57,24 +57,24 @@-[volume] - mount_on_startup=0 - mount_removable=0 - autorun=0 +[volume] +mount_on_startup=0 +mount_removable=0 +autorun=0UI
@@ -82,7 +82,7 @@-[ui] - always_show_tabs=0 - max_tab_chars=32 - win_width=1263 - win_height=690 - splitter_pos=150 - media_in_new_tab=0 - desktop_folder_new_win=0 - change_tab_on_drop=1 - close_on_unmount=1 - focus_previous=0 - side_pane_mode=places - view_mode=icon - show_hidden=0 - sort=mtime;descending; - toolbar=newtab;navigation;home; - show_statusbar=1 - pathbar_mode_buttons=0 +[ui] +always_show_tabs=0 +max_tab_chars=32 +win_width=1263 +win_height=690 +splitter_pos=150 +media_in_new_tab=0 +desktop_folder_new_win=0 +change_tab_on_drop=1 +close_on_unmount=1 +focus_previous=0 +side_pane_mode=places +view_mode=icon +show_hidden=0 +sort=mtime;descending; +toolbar=newtab;navigation;home; +show_statusbar=1 +pathbar_mode_buttons=0diff --git a/docs/ranger.html b/docs/ranger.html index fa8bd85..7437a1f 100644 --- a/docs/ranger.html +++ b/docs/ranger.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2021-01-03 dim. 22:51
+Created: 2021-01-08 ven. 01:33
Ranger @@ -38,7 +38,7 @@Define keys for the browser -
- Basic
+- Basic
- Open Shell in current directory
- Open With
- Filter
@@ -62,7 +62,7 @@Define keys for the console @@ -280,7 +280,7 @@ alias travel scout -aefiklst Extract -@@ -288,7 +288,7 @@ Extract Compressmap ,x shell ~/.config/ranger/scripts/extract.sh %f +map ,x shell ~/.config/ranger/scripts/extract.sh %f-@@ -296,7 +296,7 @@ Compress Get Bibtex from PDFmap ,z shell ~/.config/ranger/scripts/compress.sh %f +map ,z shell ~/.config/ranger/scripts/compress.sh %f-@@ -304,7 +304,7 @@ Get Bibtex from PDF Delete first page of pdfmap ,b shell pdf2bib %f +map ,b shell pdf2bib %f-@@ -312,8 +312,8 @@ Delete first page of pdf Convert images/pdf/…map ,d shell pdf-delete-first-page %f +map ,d shell pdf-delete-first-page %f-@@ -321,7 +321,7 @@ Convert images/pdf/… Magit Statusmap ,cp shell pdf2png %f - map ,cc shell convert-file %f +map ,cp shell pdf2png %f +map ,cc shell convert-file %f-@@ -329,7 +329,7 @@ Magit Status Open SXIV on current directorymap ,gs shell emacsclient -create-frame --alternate-editor="" -n --eval '(magit-status)' +map ,gs shell emacsclient -create-frame --alternate-editor="" -n --eval '(magit-status)'-@@ -337,8 +337,8 @@ Open SXIV on current directory Upload with 0x0 / self hosted Tansfer.shmap ,s shell nohup sxiv -t %d & +map ,s shell nohup sxiv -t %d &-@@ -346,7 +346,7 @@ Upload with 0x0 / self hosted Tansfer.sh Open current folder with PCManFMmap ,t shell upload %f - map ,T shell share %f +map ,t shell upload %f +map ,T shell share %f-@@ -354,7 +354,7 @@ Open current folder with PCManFM Open with Emacsmap ,o shell nohup pcmanfm %d & +map ,o shell nohup pcmanfm %d &-@@ -362,7 +362,7 @@ Open with Emacs Print on Rnicemap ,e shell emacsclient -create-frame --alternate-editor="" -n %f +map ,e shell emacsclient -create-frame --alternate-editor="" -n %f-@@ -370,7 +370,7 @@ Print on Rnice Backup to NASmap ,p shell print-rnice %f & +map ,p shell print-rnice %f &-map ,B shell ~/.config/ranger/scripts/backup-to-nas.sh %s & +map ,B shell ~/.config/ranger/scripts/backup-to-nas.sh %s &Extract Script
@@ -398,11 +398,11 @@ Backup to NAS-if [ $TMUX ]; then - tmux split -v -l 2 atool -x $1 && tmux select-pane -U - else - atool -x $1 - fi +if [ $TMUX ]; then + tmux split -v -l 2 atool -x $1 && tmux select-pane -U +else + atool -x $1 +fiCompress Script
@@ -417,11 +417,11 @@ Backup to NAS-if [ $TMUX ]; then - tmux split -v -l 2 apack ${1%.*}.zip $1 && tmux select-pane -U - else - apack ${1%.*}.zip $1 - fi +if [ $TMUX ]; then + tmux split -v -l 2 apack ${1%.*}.zip $1 && tmux select-pane -U +else + apack ${1%.*}.zip $1 +fi-if [ $TMUX ]; then - tmux split -v -l 2 rsync -a --inplace --info=progress2 --rsh='ssh -p10022' "$@" nas:/volume1/Data/Downloads/Backup/ && tmux select-pane -U - else - rsync -a --info=progress2 --inplace --rsh='ssh -p10022' "$@" nas:/volume1/Data/Downloads/Backup/ - fi +if [ $TMUX ]; then + tmux split -v -l 2 rsync -a --inplace --info=progress2 --rsh='ssh -p10022' "$@" nas:/volume1/Data/Downloads/Backup/ && tmux select-pane -U +else + rsync -a --info=progress2 --inplace --rsh='ssh -p10022' "$@" nas:/volume1/Data/Downloads/Backup/ +fi-if [ $TMUX ]; then - tmux split -v -l 1 rsync -a --info=progress2 "${@:2}" "$1" && tmux select-pane -U - else - rsync -a --info=progress2 "${@:2}" "$1" - fi +if [ $TMUX ]; then + tmux split -v -l 1 rsync -a --info=progress2 "${@:2}" "$1" && tmux select-pane -U +else + rsync -a --info=progress2 "${@:2}" "$1" +fiDefine keys for the browser
--Basic
-++Basic
+@@ -495,8 +495,8 @@ Backup to NAS-map Q quit! - map q eval fm.execute_console("shell tmux detach") if 'TMUX' in os.environ.keys() else fm.execute_console("quit") +map Q quit! +map q eval fm.execute_console("shell tmux detach") if 'TMUX' in os.environ.keys() else fm.execute_console("quit")-map <C-c> abort - map <esc> change_mode normal - map ~ set viewmode! +map <C-c> abort +map <esc> change_mode normal +map ~ set viewmode!-map ? help +map ? help-map : console - map ; console +map : console +map ; console-map ! console shell%space +map ! console shell%space-map @ console -p6 shell %%s +map @ console -p6 shell %%sOpen Shell in current directory
@@ -506,7 +506,7 @@ Backup to NAS-map s shell $SHELL - map S shell nohup $TERMINAL & +map s shell $SHELL +map S shell nohup $TERMINAL &Open With
@@ -516,9 +516,9 @@ Backup to NAS-map O chain draw_possible_programs; console open_with%space +map O chain draw_possible_programs; console open_with%spaceFilter
@@ -528,8 +528,8 @@ Backup to NAS-map f console filter%space - # Reset filter - map F filter +map f console filter%space +# Reset filter +map F filterTagging / Marking
@@ -539,12 +539,12 @@ Backup to NAS-map <Space> mark_files toggle=True - map v mark_files all=True toggle=True +map <Space> mark_files toggle=True +map v mark_files all=True toggle=TrueVIM-like
@@ -554,24 +554,24 @@ Backup to NAS-copymap <UP> k - copymap <DOWN> j - copymap <LEFT> h - copymap <RIGHT> l - copymap <HOME> gg - copymap <END> G +copymap <UP> k +copymap <DOWN> j +copymap <LEFT> h +copymap <RIGHT> l +copymap <HOME> gg +copymap <END> GJumping around
@@ -581,15 +581,15 @@ Backup to NAS-map H history_go -1 - map L history_go 1 +map H history_go -1 +map L history_go 1
-map ] move_parent 1 - map [ move_parent -1 +map ] move_parent 1 +map [ move_parent -1
-map } traverse +map } traverse-map cd console cd%space +map cd console cd%spaceGo to special folders
@@ -599,10 +599,10 @@ Backup to NAS-map gh cd ~/ - map gb cd ~/Cloud/brain - map gm cd ~/Cloud/thesis - map gp cd ~/Pictures - map gP cd ~/Cloud/personal - map gT cd ~/.local/share/Trash/files - map gd cd ~/Downloads - map gc cd ~/Cloud - map gV cd ~/.config/literate-dotfiles +map gh cd ~/ +map gb cd ~/Cloud/brain +map gm cd ~/Cloud/thesis +map gp cd ~/Pictures +map gP cd ~/Cloud/personal +map gT cd ~/.local/share/Trash/files +map gd cd ~/Downloads +map gc cd ~/Cloud +map gV cd ~/.config/literate-dotfilesGet size of folders
@@ -612,12 +612,12 @@ Backup to NAS-# Get size of all folders - map du shell -p du --max-depth=1 -h --apparent-size - # Get size of all folders and sort them - map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh +# Get size of all folders +map du shell -p du --max-depth=1 -h --apparent-size +# Get size of all folders and sort them +map dU shell -p du --max-depth=1 -h --apparent-size | sort -rhYank path of directory/file
@@ -627,7 +627,7 @@ Backup to NAS-# Yank path of current directory/file - map yp shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b - # Yank path of directory - map yd shell -f echo -n %d | xsel -i; xsel -o | xsel -i -b - # Yank filename - map yn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -b +# Yank path of current directory/file +map yp shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b +# Yank path of directory +map yd shell -f echo -n %d | xsel -i; xsel -o | xsel -i -b +# Yank filename +map yn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -bDrag and Drop
@@ -637,10 +637,10 @@ Backup to NAS-map D shell dragon-drag-and-drop -a -x %p +map D shell dragon-drag-and-drop -a -x %pRename files
@@ -650,14 +650,14 @@ Backup to NAS-map a rename_append - map C eval fm.execute_console("bulkrename") if fm.thisdir.marked_items else fm.open_console("rename ") - map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%")) - map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7) +map a rename_append +map C eval fm.execute_console("bulkrename") if fm.thisdir.marked_items else fm.open_console("rename ") +map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%")) +map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)Paste files
@@ -675,9 +675,9 @@ Paste with Rsync-@@ -665,7 +665,7 @@ Backup to NAS Paste with Rsyncmap pp paste - map po paste overwrite=True - map pP paste append=True - map pO paste overwrite=True append=True - map pl paste_symlink relative=False - map pL paste_symlink relative=True - map phl paste_hardlink - map pht paste_hardlinked_subtree +map pp paste +map po paste overwrite=True +map pP paste append=True +map pO paste overwrite=True append=True +map pl paste_symlink relative=False +map pL paste_symlink relative=True +map phl paste_hardlink +map pht paste_hardlinked_subtree-map pr shell ~/.config/ranger/scripts/paste-rsync.sh %d %c +map pr shell ~/.config/ranger/scripts/paste-rsync.sh %d %cDelete and move files
@@ -687,8 +687,8 @@ Paste with Rsync-map dD shell -s trash-put %s - map dd cut - map du uncut +map dD shell -s trash-put %s +map dd cut +map du uncutCopy files
@@ -698,9 +698,9 @@ Paste with Rsync-map yy copy - map yu uncut +map yy copy +map yu uncutSearching
@@ -710,14 +710,14 @@ Paste with Rsync-map / console search%space - map n search_next - map N search_next forward=False +map / console search%space +map n search_next +map N search_next forward=False
Tabs
@@ -727,10 +727,10 @@ Paste with Rsync-map <C-n> tab_new ~ - map <C-w> tab_close +map <C-n> tab_new ~ +map <C-w> tab_close - map <TAB> tab_move 1 - map <S-TAB> tab_move -1 +map <TAB> tab_move 1 +map <S-TAB> tab_move -1 - map gn tab_new ~ - map gt tab_move 1 +map gn tab_new ~ +map gt tab_move 1Settings
@@ -740,13 +740,13 @@ Paste with Rsync-map zh set show_hidden! +map zh set show_hidden! - map zi set preview_images! - map zv set use_preview_script! +map zi set preview_images! +map zv set use_preview_script!Bookmarks
@@ -756,7 +756,7 @@ Paste with Rsync-map `<any> enter_bookmark %any - map '<any> enter_bookmark %any - map m<any> set_bookmark %any - map um<any> unset_bookmark %any +map `<any> enter_bookmark %any +map '<any> enter_bookmark %any +map m<any> set_bookmark %any +map um<any> unset_bookmark %any - map m<bg> draw_bookmarks - copymap m<bg> um<bg> `<bg> '<bg> +map m<bg> draw_bookmarks +copymap m<bg> um<bg> `<bg> '<bg>FZF
@@ -767,9 +767,9 @@ Paste with Rsync-map <C-f> fzf_select +map <C-f> fzf_selectDefine keys for the console
--Basic
-++-Basic
+cmap <tab> eval fm.ui.console.tab() cmap <s-tab> eval fm.ui.console.tab(-1) @@ -820,209 +820,209 @@ copycmap <end> <C-e>Rifle
@@ -1036,9 +1036,9 @@ copycmap <end> <C-e>-# This is the configuration file of "rifle", ranger's file executor/opener. - # Each line consists of conditions and a command. For each line the conditions - # are checked and if they are met, the respective command is run. - # - # Syntax: - # <condition1> , <condition2> , ... = command - # - # The command can contain these environment variables: - # $1-$9 | The n-th selected file - # $@ | All selected files - # - # If you use the special command "ask", rifle will ask you what program to run. - # - # Prefixing a condition with "!" will negate its result. - # These conditions are currently supported: - # match <regexp> | The regexp matches $1 - # ext <regexp> | The regexp matches the extension of $1 - # mime <regexp> | The regexp matches the mime type of $1 - # name <regexp> | The regexp matches the basename of $1 - # path <regexp> | The regexp matches the absolute path of $1 - # has <program> | The program is installed (i.e. located in $PATH) - # env <variable> | The environment variable "variable" is non-empty - # file | $1 is a file - # directory | $1 is a directory - # number <n> | change the number of this command to n - # terminal | stdin, stderr and stdout are connected to a terminal - # X | $DISPLAY is not empty (i.e. Xorg runs) - # - # There are also pseudo-conditions which have a "side effect": - # flag <flags> | Change how the program is run. See below. - # label <label> | Assign a label or name to the command so it can - # | be started with :open_with <label> in ranger - # | or `rifle -p <label>` in the standalone executable. - # else | Always true. - # - # Flags are single characters which slightly transform the command: - # f | Fork the program, make it run in the background. - # | New command = setsid $command >& /dev/null & - # r | Execute the command with root permissions - # | New command = sudo $command - # t | Run the program in a new terminal. If $TERMCMD is not defined, - # | rifle will attempt to extract it from $TERM. - # | New command = $TERMCMD -e $command - # Note: The "New command" serves only as an illustration, the exact - # implementation may differ. - # Note: When using rifle in ranger, there is an additional flag "c" for - # only running the current file even if you have marked multiple files. +# This is the configuration file of "rifle", ranger's file executor/opener. +# Each line consists of conditions and a command. For each line the conditions +# are checked and if they are met, the respective command is run. +# +# Syntax: +# <condition1> , <condition2> , ... = command +# +# The command can contain these environment variables: +# $1-$9 | The n-th selected file +# $@ | All selected files +# +# If you use the special command "ask", rifle will ask you what program to run. +# +# Prefixing a condition with "!" will negate its result. +# These conditions are currently supported: +# match <regexp> | The regexp matches $1 +# ext <regexp> | The regexp matches the extension of $1 +# mime <regexp> | The regexp matches the mime type of $1 +# name <regexp> | The regexp matches the basename of $1 +# path <regexp> | The regexp matches the absolute path of $1 +# has <program> | The program is installed (i.e. located in $PATH) +# env <variable> | The environment variable "variable" is non-empty +# file | $1 is a file +# directory | $1 is a directory +# number <n> | change the number of this command to n +# terminal | stdin, stderr and stdout are connected to a terminal +# X | $DISPLAY is not empty (i.e. Xorg runs) +# +# There are also pseudo-conditions which have a "side effect": +# flag <flags> | Change how the program is run. See below. +# label <label> | Assign a label or name to the command so it can +# | be started with :open_with <label> in ranger +# | or `rifle -p <label>` in the standalone executable. +# else | Always true. +# +# Flags are single characters which slightly transform the command: +# f | Fork the program, make it run in the background. +# | New command = setsid $command >& /dev/null & +# r | Execute the command with root permissions +# | New command = sudo $command +# t | Run the program in a new terminal. If $TERMCMD is not defined, +# | rifle will attempt to extract it from $TERM. +# | New command = $TERMCMD -e $command +# Note: The "New command" serves only as an illustration, the exact +# implementation may differ. +# Note: When using rifle in ranger, there is an additional flag "c" for +# only running the current file even if you have marked multiple files. - #------------------------------------------- - # Websites - #------------------------------------------- - # Rarely installed browsers get higher priority; It is assumed that if you - # install a rare browser, you probably use it. Firefox/konqueror/w3m on the - # other hand are often only installed as fallback browsers. +#------------------------------------------- +# Websites +#------------------------------------------- +# Rarely installed browsers get higher priority; It is assumed that if you +# install a rare browser, you probably use it. Firefox/konqueror/w3m on the +# other hand are often only installed as fallback browsers. - ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@" - ext x?html?, has firefox, X, flag f = firefox -- "$@" - ext x?html?, has elinks, terminal = elinks "$@" - ext x?html?, has links2, terminal = links2 "$@" - ext x?html?, has links, terminal = links "$@" - ext x?html?, has lynx, terminal = lynx -- "$@" - ext x?html?, has w3m, terminal = w3m "$@" +ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@" +ext x?html?, has firefox, X, flag f = firefox -- "$@" +ext x?html?, has elinks, terminal = elinks "$@" +ext x?html?, has links2, terminal = links2 "$@" +ext x?html?, has links, terminal = links "$@" +ext x?html?, has lynx, terminal = lynx -- "$@" +ext x?html?, has w3m, terminal = w3m "$@" - #Spreadsheets for scim - ext sc|csv|sxc|xlsx?|xlt|xlw|gnm|gnumeric, = sc-im -- "$@" +#Spreadsheets for scim +ext sc|csv|sxc|xlsx?|xlt|xlw|gnm|gnumeric, = sc-im -- "$@" - #------------------------------------------- - # Misc - #------------------------------------------- - ext org = emacsclient -c "$1" +#------------------------------------------- +# Misc +#------------------------------------------- +ext org = emacsclient -c "$1" - # Define the "editor" for text files as first action - mime ^text, label editor = $EDITOR -- "$@" - mime ^text, label pager = "$PAGER" -- "$@" - !mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@" - !mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" +# Define the "editor" for text files as first action +mime ^text, label editor = $EDITOR -- "$@" +mime ^text, label pager = "$PAGER" -- "$@" +!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@" +!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" - ext 1 = man "$1" - ext s[wmf]c, has zsnes, X = zsnes "$1" - ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1" - ext nes, has fceux, X = fceux "$1" - ext exe = wine "$1" - name ^[mM]akefile$ = make +ext 1 = man "$1" +ext s[wmf]c, has zsnes, X = zsnes "$1" +ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1" +ext nes, has fceux, X = fceux "$1" +ext exe = wine "$1" +name ^[mM]akefile$ = make - #-------------------------------------------- - # Code - #------------------------------------------- - ext py = python -- "$1" - ext pl = perl -- "$1" - ext rb = ruby -- "$1" - ext js = node -- "$1" - ext sh = sh -- "$1" - ext php = php -- "$1" +#-------------------------------------------- +# Code +#------------------------------------------- +ext py = python -- "$1" +ext pl = perl -- "$1" +ext rb = ruby -- "$1" +ext js = node -- "$1" +ext sh = sh -- "$1" +ext php = php -- "$1" - #-------------------------------------------- - # Video/Audio with a GUI - #------------------------------------------- - mime ^video, has mpv, X, flag f = mpv -- "$@" - mime ^video, has mpv, X, flag f = mpv --fs -- "$@" - mime ^video, has mpv, X, flag f = mpv --loop -- "$@" +#-------------------------------------------- +# Video/Audio with a GUI +#------------------------------------------- +mime ^video, has mpv, X, flag f = mpv -- "$@" +mime ^video, has mpv, X, flag f = mpv --fs -- "$@" +mime ^video, has mpv, X, flag f = mpv --loop -- "$@" - #-------------------------------------------- - # Audio without X - #------------------------------------------- - mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@" - mime ^audio|ogg$ = tag "$@" - mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" +#-------------------------------------------- +# Audio without X +#------------------------------------------- +mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@" +mime ^audio|ogg$ = tag "$@" +mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" - #-------------------------------------------- - # Video without X: - #------------------------------------------- - mime ^video, terminal, !X, has mpv = mpv -- "$@" - mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@" - mime ^video, terminal, !X, has mplayer = mplayer -- "$@" +#-------------------------------------------- +# Video without X: +#------------------------------------------- +mime ^video, terminal, !X, has mpv = mpv -- "$@" +mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@" +mime ^video, terminal, !X, has mplayer = mplayer -- "$@" - #------------------------------------------- - # Documents - #------------------------------------------- - ext pdf, has zathura, X, flag f = zathura -- "$@" - ext pdf, has llpp, X, flag f = llpp "$@" - ext pdf, has mupdf, X, flag f = mupdf "$@" - ext pdf, has mupdf, X, flag f = mupdf -I "$@" - ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@" - ext pdf, has apvlv, X, flag f = apvlv -- "$@" - ext pdf, has xpdf, X, flag f = xpdf -- "$@" - ext pdf, has evince, X, flag f = evince -- "$@" - ext pdf, has atril, X, flag f = atril -- "$@" - ext pdf, has okular, X, flag f = okular -- "$@" - ext pdf, has epdfview, X, flag f = epdfview -- "$@" - ext pdf, has qpdfview, X, flag f = qpdfview "$@" +#------------------------------------------- +# Documents +#------------------------------------------- +ext pdf, has zathura, X, flag f = zathura -- "$@" +ext pdf, has llpp, X, flag f = llpp "$@" +ext pdf, has mupdf, X, flag f = mupdf "$@" +ext pdf, has mupdf, X, flag f = mupdf -I "$@" +ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@" +ext pdf, has apvlv, X, flag f = apvlv -- "$@" +ext pdf, has xpdf, X, flag f = xpdf -- "$@" +ext pdf, has evince, X, flag f = evince -- "$@" +ext pdf, has atril, X, flag f = atril -- "$@" +ext pdf, has okular, X, flag f = okular -- "$@" +ext pdf, has epdfview, X, flag f = epdfview -- "$@" +ext pdf, has qpdfview, X, flag f = qpdfview "$@" - ext epub, has zathura, X, flag f = zathura -- "$@" - ext epub, has mupdf, X, flag f = mupdf "$@" +ext epub, has zathura, X, flag f = zathura -- "$@" +ext epub, has mupdf, X, flag f = mupdf "$@" - ext docx?, has wps, X, flag f = wps "$@" +ext docx?, has wps, X, flag f = wps "$@" - ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER" +ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER" - ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has wpp, X, flag f = wpp "$@" - ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@" - ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@" - ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@" - ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@" - ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@" + ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has wpp, X, flag f = wpp "$@" +ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@" +ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@" +ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@" +ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@" +ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@" - ext djvu, has zathura,X, flag f = zathura -- "$@" - ext djvu, has evince, X, flag f = evince -- "$@" - ext djvu, has atril, X, flag f = atril -- "$@" +ext djvu, has zathura,X, flag f = zathura -- "$@" +ext djvu, has evince, X, flag f = evince -- "$@" +ext djvu, has atril, X, flag f = atril -- "$@" - #------------------------------------------- - # Image Viewing: - #------------------------------------------- - mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" - mime ^image/svg, has display, X, flag f = display -- "$@" - mime ^image/gif, has mpv, X, flag f = mpv --loop -- "$@" - mime ^image/gif, has viewnior, X, flag f = viewnior -- "$@" - mime ^image/gif, has qutebrowser, X, flag f = qutebrowser -- "$@" +#------------------------------------------- +# Image Viewing: +#------------------------------------------- +mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" +mime ^image/svg, has display, X, flag f = display -- "$@" +mime ^image/gif, has mpv, X, flag f = mpv --loop -- "$@" +mime ^image/gif, has viewnior, X, flag f = viewnior -- "$@" +mime ^image/gif, has qutebrowser, X, flag f = qutebrowser -- "$@" - ext xcf, X, flag f = gimp -- "$@" - mime ^image, has sxiv, X, flag f = sxiv -- "$@" - mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom --image-bg black -- "$@" - mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom -- "$@" - mime ^image, has mirage, X, flag f = mirage -- "$@" - mime ^image, has ristretto, X, flag f = ristretto "$@" - mime ^image, has eog, X, flag f = eog -- "$@" - mime ^image, has eom, X, flag f = eom -- "$@" - mime ^image, has gimp, X, flag f = gimp -- "$@" - mime ^image, has pinta, X, flag f = pinta -- "$@" - mime ^image, has mypaint, X, flag f = mypaint -- "$@" - mime ^image, has kolourpaint, X, flag f = kolourpaint -- "$@" +ext xcf, X, flag f = gimp -- "$@" +mime ^image, has sxiv, X, flag f = sxiv -- "$@" +mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom --image-bg black -- "$@" +mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom -- "$@" +mime ^image, has mirage, X, flag f = mirage -- "$@" +mime ^image, has ristretto, X, flag f = ristretto "$@" +mime ^image, has eog, X, flag f = eog -- "$@" +mime ^image, has eom, X, flag f = eom -- "$@" +mime ^image, has gimp, X, flag f = gimp -- "$@" +mime ^image, has pinta, X, flag f = pinta -- "$@" +mime ^image, has mypaint, X, flag f = mypaint -- "$@" +mime ^image, has kolourpaint, X, flag f = kolourpaint -- "$@" - #------------------------------------------- - # Archives - #------------------------------------------- - # This requires atool - ext jar = java -jar "$@" +#------------------------------------------- +# Archives +#------------------------------------------- +# This requires atool +ext jar = java -jar "$@" - ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has als = als -- "$@" | "$PAGER" - ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als = als -- "$@" | "$PAGER" - ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@" - ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@" +ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has als = als -- "$@" | "$PAGER" +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als = als -- "$@" | "$PAGER" +ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@" +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@" - # Fallback: - ext tar|gz, has tar = tar vvtf "$@" | "$PAGER" - ext tar|gz, has tar = tar vvxf "$@" +# Fallback: +ext tar|gz, has tar = tar vvtf "$@" | "$PAGER" +ext tar|gz, has tar = tar vvxf "$@" - #------------------------------------------- - # Misc - #------------------------------------------- - label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1" - label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1" - label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1" - label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1" +#------------------------------------------- +# Misc +#------------------------------------------- +label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1" +label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1" +label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1" +label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1" - # Define the editor for non-text files + pager as last action - !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask - label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@" - label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" +# Define the editor for non-text files + pager as last action + !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask +label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@" +label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" - ext blend, has blender, X, flag f = blender -- "$@" +ext blend, has blender, X, flag f = blender -- "$@" - has dragon-drag-and-drop, X, flag f = dragon-drag-and-drop -a -x "$@" +has dragon-drag-and-drop, X, flag f = dragon-drag-and-drop -a -x "$@"Import
@@ -1048,35 +1048,35 @@ copycmap <end> <C-e>-from ranger.api.commands import * +from ranger.api.commands import * - import os +import osfzf_select
@@ -1085,7 +1085,7 @@ copycmap <end> <C-e>-class fzf_select(Command): - """ - :fzf_select +class fzf_select(Command): + """ + :fzf_select - Find a file using fzf. + Find a file using fzf. - With a prefix argument select only directories. + With a prefix argument select only directories. - See: https://github.com/junegunn/fzf - """ - def execute(self): - import subprocess - import os.path - if self.quantifier: - # match only directories - command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ - -o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m" - else: - # match files and directories - command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ - -o -print 2> /dev/null | sed 1d | cut -b3- | fzf +m" - fzf = self.fm.execute_command(command, universal_newlines=True, stdout=subprocess.PIPE) - stdout, stderr = fzf.communicate() - if fzf.returncode == 0: - fzf_file = os.path.abspath(stdout.rstrip('\n')) - if os.path.isdir(fzf_file): - self.fm.cd(fzf_file) - else: - self.fm.select_file(fzf_file) + See: https://github.com/junegunn/fzf + """ + def execute(self): + import subprocess + import os.path + if self.quantifier: + # match only directories + command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ + -o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m" + else: + # match files and directories + command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ + -o -print 2> /dev/null | sed 1d | cut -b3- | fzf +m" + fzf = self.fm.execute_command(command, universal_newlines=True, stdout=subprocess.PIPE) + stdout, stderr = fzf.communicate() + if fzf.returncode == 0: + fzf_file = os.path.abspath(stdout.rstrip('\n')) + if os.path.isdir(fzf_file): + self.fm.cd(fzf_file) + else: + self.fm.select_file(fzf_file)diff --git a/docs/sxhkd.html b/docs/sxhkd.html index 2b40c92..718e5fe 100644 --- a/docs/sxhkd.html +++ b/docs/sxhkd.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2021-01-03 dim. 22:51
+Created: 2021-01-08 ven. 01:33
Simple X Hotkey Daemon @@ -39,20 +39,20 @@
- BSPWM hotkeys
- Monocle Layout
-- Set the window State
+- Set the window State
- Sticky Window
- Focus and Swap
-- Preselect
-- Resize
+- Preselect
+- Resize
I3 related @@ -301,12 +301,8 @@ super + space ; o super + space ; d $TERMINAL -e "tmux new-session -A -s aria2p aria2p --port 6800 --host http://dl.tdehaeze.xyz --secret $(pass dl.tdehaeze.xyz/tdehaeze | sed -n 1p)" -# Mails with neomutt -super + space ; m - $TERMINAL -e "tmux new-session -A -s neomutt neomutt" - # Run another instance of Neomutt in read-only mode -super + space ; shift + m +super + space ; m $TERMINAL -e "neomutt -R" # Weechat @@ -335,7 +331,7 @@ super + space ; t # Emacs super + space ; e - emacs; + emacsclient -create-frame --alternate-editor="" # Weather super + space ; shift + w @@ -382,9 +378,9 @@ super + c-Set the window State
-++Set the window State
+-# Set the window state to tiled super + t @@ -458,13 +454,13 @@ super + shift + {1-9}-Preselect
-++-Preselect
+# preselect the direction super + ctrl + {h,j,k,l} - bspc node -p {west,south,north,east} +bspc node -p {west,south,north,east} # preselect the ratio # super + ctrl + {1-9} @@ -472,15 +468,15 @@ super + ctrl + {h,j,k,l} # cancel the preselection for the focused node super + ctrl + space - bspc node -p cancel +bspc node -p cancel-Resize
-++Resize
+-# expand a window by moving one of its side outward super + alt + {h,j,k,l} @@ -519,9 +515,9 @@ super + q-Set the window State
-++Set the window State
+-# Set the window to full-screen super + f @@ -588,9 +584,9 @@ super + shift + {1-9}-Preselect
-++-Preselect
+Preselect the direction
@@ -607,9 +603,9 @@ super + ctrl + {j,k,Up,Down}--Resize
-++Resize
+Expand/Shrink a window
@@ -634,7 +630,7 @@ super + alt + ldiff --git a/docs/tmux.html b/docs/tmux.html index f4c547b..5456c6b 100644 --- a/docs/tmux.html +++ b/docs/tmux.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2021-01-01 ven. 20:08
+Created: 2021-01-08 ven. 01:32
Tmux Configuration @@ -337,7 +337,7 @@ set -g @batt_attached_icon "o"diff --git a/docs/vim.html b/docs/vim.html index 9fac6bd..0f00c87 100644 --- a/docs/vim.html +++ b/docs/vim.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2021-01-01 ven. 20:09
+Created: 2021-01-08 ven. 01:33
Vim Config @@ -40,8 +40,8 @@Tmux Syntax Markdown -LaTeX -Matlab +LaTeX +Matlab Org Mode Plug End @@ -74,14 +74,14 @@Filetypes Plugins Config @@ -109,7 +109,7 @@ Bindings @@ -341,9 +341,9 @@ Plug 'nelstrom/vim-markdown-folding'-
- Vim Which Key
+- Vim Which Key
- Direct ones
- Quit
- Files
@@ -125,7 +125,7 @@- Text
- Config
- Insert
-- Save Which Key Configuration
+- Save Which Key Configuration
-LaTeX
-++LaTeX
+-Plug 'lervag/vimtex', { 'for': 'tex' } " A modern vim plugin for editing LaTeX files.@@ -351,9 +351,9 @@ Plug 'nelstrom/vim-markdown-folding'-Matlab
-++Matlab
+Plug 'tdehaeze/matlab-vim', { 'for': 'matlab' } " Edit Matlab M-files in Vim editor Plug 'djoshea/vim-matlab-fold', { 'for': 'matlab' } " Vim code folding for Matlab files @@ -882,9 +882,9 @@ Taken from: Filetypes--Vim Which Key
-++Vim Which Key
+nnoremap <silent> <leader> :WhichKey '<Space>'<cr> @@ -915,9 +915,9 @@ Taken from: -LaTeX
-++LaTeX
+au BufRead,BufNewFile *.tikz set filetype=tex let tex_no_error=1 " used to not highlight underscores @@ -1002,9 +1002,9 @@ Taken from: -Matlab
-++Matlab
+-" Run Section (delimited by %%) au FileType matlab nmap <buffer> <localleader>mm <Plug>SlimeParagraphSend @@ -1049,9 +1049,9 @@ endfunc-Save Which Key Configuration
-++Save Which Key Configuration
+call which_key#register('<Space>', "g:which_key_map")@@ -1417,9 +1417,9 @@ Quit Vim if this is the only remaining bufferBindings
--Vim Which Key
-++Vim Which Key
+-nnoremap <silent> <leader> :WhichKey '<Space>'<cr> @@ -2012,9 +2012,9 @@ endfun-Save Which Key Configuration
-++Save Which Key Configuration
+call which_key#register('<Space>', "g:which_key_map")@@ -2025,7 +2025,7 @@ endfundiff --git a/video.org b/video.org index 4ee8e7d..f7633ad 100644 --- a/video.org +++ b/video.org @@ -25,6 +25,9 @@ slang=fr # Play English audio if available, fall back to French otherwise. alang=en,fr + +# Do not close mpv at the end of video +keep-open=yes #+end_src * =input.conf= - MPV Key Bindings -Created: 2021-01-01 ven. 20:08
+Created: 2021-01-08 ven. 01:33