diff --git a/docs/applications.html b/docs/applications.html index 242590f..2c15700 100644 --- a/docs/applications.html +++ b/docs/applications.html @@ -4,7 +4,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +Created: 2020-03-19 jeu. 10:39
+Created: 2020-03-22 dim. 23:04
:ignore:
tagstartblock
when opening org-mode files,
leader key
+
+,m
ctrl-ret
used to execute the src block and go to the next onectrl-shift-ret
used to execute the (matlab) src block in the background and go to the next one
whos
matlab functionhelp
matlab functiontdh-org-babel-execute-matlab-background
tdh-matlab-execute-selected
ctrl-shift-ref
,b
packages.el
+Make movement keys work like they should +
;; 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-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)
+Make horizontal movement cross lines +
; Make horizontal movement cross lines -(setq-default evil-cross-lines t) +(setq-default evil-cross-lines t)
jump-forward
key binding(with-eval-after-load 'better-jumper + (map! + :desc "Jump Forward" + "C-i" #'better-jumper-jump-forward)) ++
-Don’t change the font size for subscripts and superscripts in latex fragments. -This cause the orgmode tables not to be well aligned. -
-(after! org - (setq font-latex-fontify-script nil)) --
(defvar tdh-org-latex-fragment-last nil - "Holds last fragment/environment you were on.") - -(defun tdh-org-in-latex-fragment-p () - "Return the point where the latex fragment begins, if inside -a latex fragment. Else return false" - (let* ((el (org-element-context)) - (el-type (car el))) - (and (or (eq 'latex-fragment el-type) (eq 'latex-environment el-type)) - (org-element-property :begin el)))) - -(defun tdh-org-latex-fragment-toggle () - "Toggle a latex fragment image " - (and (eq 'org-mode major-mode) - (let ((begin (tdh-org-in-latex-fragment-p))) - (cond - ;; were on a fragment and now on a new fragment - ((and - ;; fragment we were on - tdh-org-latex-fragment-last - ;; and are on a fragment now - begin - - ;; but not on the last one this is a little tricky. as you edit the - ;; fragment, it is not equal to the last one. We use the begin - ;; property which is less likely to change for the comparison. - (not (and tdh-org-latex-fragment-last - (= begin - tdh-org-latex-fragment-last)))) - ;; go back to last one and put image back, provided there is still a fragment there - (save-excursion - (goto-char tdh-org-latex-fragment-last) - (when (tdh-org-in-latex-fragment-p) (org-preview-latex-fragment)) - - ;; now remove current image - (goto-char begin) - (let ((ov (loop for ov in (org--list-latex-overlays) - if - (and - (<= (overlay-start ov) (point)) - (>= (overlay-end ov) (point))) - return ov))) - (when ov - (delete-overlay ov))) - ;; and save new fragment - (setq tdh-org-latex-fragment-last begin))) - - ;; were on a fragment and now are not on a fragment - ((and - ;; not on a fragment now - (not begin) - ;; but we were on one - tdh-org-latex-fragment-last) - ;; put image back on, provided that there is still a fragment here. - (save-excursion - (goto-char tdh-org-latex-fragment-last) - (when (tdh-org-in-latex-fragment-p) (org-preview-latex-fragment))) - - ;; unset last fragment - (setq tdh-org-latex-fragment-last nil)) - - ;; were not on a fragment, and now are - ((and - ;; we were not one one - (not tdh-org-latex-fragment-last) - ;; but now we are - begin) - ;; remove image - (save-excursion - (goto-char begin) - (let ((ov (loop for ov in (org--list-latex-overlays) - if - (and - (<= (overlay-start ov) (point)) - (>= (overlay-end ov) (point))) - return ov))) - (when ov - (delete-overlay ov)))) - (setq tdh-org-latex-fragment-last begin)))))) --
attr_latex: :widt
(setq org-agenda-archives-mode t)
;; 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)
+ (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"))
@@ -1506,9 +1435,9 @@ Documentation:
Org Export
-
-Basic
-
+
+Basic
+
(after! org
;; How many levels of headline to export
@@ -1577,7 +1506,7 @@ Documentation:
-TODO HTML Export
+HTML Export
@@ -1805,6 +1734,68 @@ Adapt this from https://github.com/
Org LaTeX
+
+LaTeX Fragments
+
+
+(after! org
+ ;; Highligh latex parts in org mode
+ (setq org-highlight-latex-and-related '(native))
+
+ ;; 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/")
+
+ ;; 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 (0.4 . 0.4)
+ :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 '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)
+
+ ;; 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 (face-background 'fringe)))
+)
+
+
+
+
+
LaTeX Classes
@@ -1963,68 +1954,6 @@ Special Environments
-
-TODO Latex Fragments
-
-
-[ ]
The remove hook does not seems to work
-
-
-http://slumpy.org/blog/2017-02-01-automatic-latex-preview-in-org-mode/
-
-
-
-(after! org
- (map! :map org-mode-map
- ;; Activate Automatic LaTeX fragment
- :n ",ol" '(lambda () (interactive) (add-hook 'post-command-hook 'tdh-org-latex-fragment-toggle t))
- ;; ;; Disable Automatic LaTeX fragment
- :n ",oL" '(lambda () (interactive) (remove-hook 'post-command-hook 'tdh-org-latex-fragment-toggle)))
-
- ;; 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/")
-
- ;; 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 (0.6 . 0.6)
- :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.5 . 0.5)
- :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.7 . 0.7)
- :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)
-)
-
-
-
-
-
TODO Custom Export - Add Page and Label for LaTeX export
@@ -2429,7 +2358,7 @@ Nice Functions:
(map!
:map org-mode-map
(:desc "Insert Link"
- :n "C-c i" #'org-ref-insert-ref-link))
+ :ni "C-c i" #'org-ref-insert-ref-link))
)
@@ -2571,210 +2500,6 @@ Nice Functions:
-
-Custom key bindings
-
-
-
-Insert Link to paper / notes
-
-
-(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/thesis/ressources/pdfs/" nil t)))
- (insert (format "[[papers:%s]]" (file-name-base paper))))
-
-(after! org
- (map! :map org-mode-map :n ",ip" 'tdh-insert-paper-org-link))
-
-
-
-
-(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/thesis/ressources/pdfs/" nil t)))
- (insert (format "[[notes:%s]]" (file-name-base note))))
-
-(after! org
- (map! :map org-mode-map :n ",in" 'tdh-insert-note-org-link))
-
-
-
-
-
-
-Insert Image that is in the figs folder
-
-
-(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)))
-
-(after! org
- (map! :map org-mode-map :n ",if" 'tdh-insert-image-org-link))
-
-
-
-
-
-
-Watch LaTeX file using latexmk
-
-
-(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")
- )
-
-(after! org
- (map! :map org-mode-map
- :n ",ow" 'tdh-latex/watch
- :n ",ok" 'tdh-latex/watch/kill))
-
-
-
-
-
-
-Helm-Bibtex
-
-
-(after! org
- (map! :map org-mode-map
- :n ",ob" 'helm-bibtex
- :n ",of" 'helm-bibtex-favorites
- :n ",or" 'helm-resume))
-
-
-
-
-
-
-Open terminal in current directory
-
-
-(defun tdh-open-terminal-in-workdir ()
- (interactive)
- (call-process-shell-command
- (concat "termite --directory=" default-directory) nil 0))
-
-(after! org
- (map! :map org-mode-map :n ",ot" 'tdh-open-terminal-in-workdir))
-
-
-
-
-
-
-Open ranger in current directory
-
-
-(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 ",oo" 'tdh-open-ranger-in-workdir))
-
-
-
-
-
-
-Export to LaTeX
-
-
-(after! org
- (map! :map org-mode-map :n ",l" 'org-latex-export-to-latex))
-
-
-
-
-
-
-Open pdf externally.
-
-
-(defun tdh-open-org-pdf-externally ()
- (interactive)
- (call-process "zathura" nil 0 nil (concat (file-name-sans-extension (buffer-file-name)) ".pdf"))
- )
-
-(after! org
- (map! :map org-mode-map :n ",vp" 'tdh-open-org-pdf-externally))
-
-
-
-
-
-
-Open HTML externally.
-
-
-(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 :n ",vh" 'tdh-open-org-html-externally))
-
-
-
-
-
-
-Take Screenshot and insert a link
-
-
-- Ask for a name
screenshot_name
-- use
maim -s figs/screenshot_name.png
to take a screenshot with selection
-
-Then insert the following to the buffer
-
-
-#+name: sreenshot_name
-[[file:figs/screenshot_name.png]]
-
-
-
-
-
-Then it would be nice to automatically prefix the CUSTOM_ID
property (until the first _
).
-
-
-
-(defun tdh-insert-screenshot-org-link ()
-"Capture screenshot and insert the resulting file.
-The screenshot tool is determined by `org-download-screenshot-method'."
- (interactive)
- (setq filename (concat "./figs/" (read-string "Enter file name:") ".png"))
- (shell-command (concat "maim -s " filename))
- (insert (format "[[file:%s]]" filename))
- )
-
-(after! org
- (map! :map org-mode-map :n ",is" 'tdh-insert-screenshot-org-link))
-
-
-
-
-
-
Automatically run startblock
when opening org-mode files
@@ -2965,6 +2690,219 @@ Then it would be nice to automatically prefix the CUSTOM_ID
propert
+
+
+Custom Keybindings - ,
leader key
+
+
+
+Insert Elements ,i
+
+
+Insert Link to 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/thesis/ressources/pdfs/" nil t)))
+ (insert (format "[[papers:%s]]" (file-name-base paper))))
+
+
+
+
+Insert Link to notes
+
+
+(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/thesis/ressources/pdfs/" nil t)))
+ (insert (format "[[notes:%s]]" (file-name-base note))))
+
+
+
+
+Insert Image that is in the figs folder
+
+
+(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)))
+
+
+
+
+Take Screenshot and insert a link:
+
+
+- Ask for a name
screenshot_name
+- use
maim -s figs/screenshot_name.png
to take a screenshot with selection
+- Then insert the following to the buffer
+
+
+
+(defun tdh-insert-screenshot-org-link ()
+"Capture screenshot and insert the resulting file.
+The screenshot tool is determined by `org-download-screenshot-method'."
+ (interactive)
+ (setq filename (concat "./figs/" (read-string "Enter file name:") ".png"))
+ (shell-command (concat "maim -s " filename))
+ (insert (format "[[file:%s]]" filename))
+ )
+
+
+
+
+Map Keys
+
+
+(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 "s" 'tdh-insert-screenshot-org-link)))
+
+
+
+
+
+
+LaTeX ,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-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)))
+
+
+
+
+
+
+Org LaTeX Automatic fragment
+
+
+(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))
+
+
+
+
+(after! org
+ (map! :map org-mode-map
+ (:prefix (",l" . "LaTeX")
+ :n "f" 'tdh-automatic-latex-fragment-activate
+ :n "F" 'tdh-automatic-latex-fragment-deactivate)))
+
+
+
+
+
+
+Bibtex ,n
+
+
+(after! org
+ (map! :map org-mode-map
+ (:prefix (",b" . "BibTeX")
+ :n "b" 'helm-bibtex
+ :n "f" 'helm-bibtex-favorites
+ :n "r" 'helm-resume)))
+
+
+
+
+
+
+Open ranger in current directory ,o
+
+
+(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))
+
+
+
+
+
+
+View in External programs ,v
+
+
+Open PDF output with zathura
+
+
+(defun tdh-open-org-pdf-externally ()
+ (interactive)
+ (call-process "zathura" nil 0 nil (concat (file-name-sans-extension (buffer-file-name)) ".pdf"))
+ )
+
+
+
+
+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"))
+ )
+
+
+
+
+(after! org
+ (map! :map org-mode-map
+ (:prefix (",v" . "View")
+ :n "p" 'tdh-open-org-pdf-externally
+ :n "h" 'tdh-open-org-html-externally)))
+
+
+
+
+
@@ -3013,6 +2951,41 @@ Use the current window for C-c ’ source editing
(add-hook 'org-mode-hook #'tdh-org-prettify-symbols)
+
+
+ (after! org
+ (set-face-attribute 'org-block nil :background (face-background 'fringe))
+ (set-face-attribute 'org-block-begin-line nil :background (face-background 'fringe))
+ (set-face-attribute 'org-block-end-line nil :background (face-background 'fringe))
+)
+
+
+
+
+If required, it is possible to set custom colors for different source blocks
+
+
+;; (after! org
+;; (setq org-src-block-faces
+;; '(("emacs-lisp" (:background (face-background 'org-block)))
+;; ("matlab" (:background (face-background 'fringe)))))
+;; )
+
+
+
+
+
+
+Indentation
+
+
+(after! org
+ (setq org-edit-src-content-indentation 2
+ org-src-tab-acts-natively nil
+ org-src-preserve-indentation nil)
+ )
+
+
@@ -3032,65 +3005,6 @@ Add all named source blocks to org-babel-library-of-babel
.
-
-Special Shortcuts
-
-
-
-
-Remap ctrl-ret
to execute the source block and go to the next source block
-when inside a source block. Otherwise, keep the normal behavior for ctrl-ent.
-
-
-
-(defun tdh-ctrl-ret ()
- (interactive)
- (defun in-src-block-p ()
- "Returns t when the point is inside a source code block"
- (string= "src" (org-in-block-p '("src"))))
-
- (defun in-src-block-function ()
- "Function to do when inside the src block"
- (progn
- (org-babel-execute-src-block)
- (org-babel-next-src-block)))
-
- (if (in-src-block-p)
- (in-src-block-function)
- (+org--insert-item 'below)))
-
-(map! :after evil-org
- :map evil-org-mode-map
- :n "<C-return>" #'tdh-ctrl-ret)
-
-
-
-
-(defun tdh-ctrl-shit-ret ()
- (interactive)
- (defun in-src-block-p ()
- "Returns t when the point is inside a source code block"
- (string= "src" (org-in-block-p '("src"))))
-
- (if (in-src-block-p)
- (tdh-org-babel-execute-goto-next)
- (+org/insert-item-above)))
-
-(map! :after evil-org
- :map evil-org-mode-map
- :n "<C-S-return>" #'tdh-ctrl-shit-ret)
-
-
-
-
-Remap C-c C-c
:
-https://emacs.stackexchange.com/questions/22430/rebind-org-babel-execute-src-block-maybe-to-c-c-c-c/22530#22530
-
-
-
-
Org-Babel Matlab
@@ -3113,16 +3027,14 @@ Remap C-c C-c
:
)
-
-
+Default options for Matlab code +
(after! org
(setq org-babel-default-header-args:matlab
- '((:results . "none")
+ '((:results . "none")
(:session . "*MATLAB*")
(:comments . "org")
(:exports . "both")
@@ -3138,40 +3050,12 @@ Remap C-c C-c
:
;; (after! org -;; (require 'color) -;; (set-face-attribute 'org-block nil :background (color-darken-name (face-attribute 'default :background) 3)) -;; ) --
(after! org - (setq org-edit-src-content-indentation 2 - org-src-tab-acts-natively nil - org-src-preserve-indentation nil) - ) --
whos
matlab function,m
+whos
matlab function
+
(defun tdh-matlab-whos (&optional start end)
"Get what is in the Matlab workspace"
@@ -3182,40 +3066,25 @@ Remap C-c C-c
:
(process-send-string "*MATLAB*" (concat "whosEmacs" "\n"))))
help
matlab function
+help
matlab function
+
(defun tdh-matlab-help (start end) -"Get help on the selected function" - (interactive "r") - (let ((regionp (buffer-substring start end))) - (process-send-string "*MATLAB*" (concat "help " regionp "\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"))) + )
(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*" regionp))) --
+Specify a Matlab command to run +
(defun tdh-matlab-run-command ()
"Prompt user to enter a matlab command"
@@ -3223,14 +3092,101 @@ Remap C-c C-c
:
(process-send-string "*MATLAB*" (concat (read-string "Matlab Command: ") "\n")))
+Specify a Matlab command to run and show output in mini-buffer +
+(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"))) ++
+Org-Babel Tangle File and Execute with Matlab +
+(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))))) ++
+Map Functions +
+(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-ret
used to execute the src block and go to the next one
+Remap ctrl-ret
to execute the source block and go to the next source block
+when inside a source block. Otherwise, keep the normal behavior for ctrl-ret
.
+
(defun tdh-org-babel-execute (&optional arg info params) +(defun tdh-ctrl-ret () + (interactive) + (defun in-src-block-p () + "Returns t when the point is inside a source code block" + (string= "src" (org-in-block-p '("src")))) + + (if (in-src-block-p) + (progn + (org-babel-execute-src-block) + (org-babel-next-src-block)) + (+org--insert-item 'below))) ++
(map! :after evil-org + :map evil-org-mode-map + :n "<C-return>" #'tdh-ctrl-ret) ++
ctrl-shift-ret
used to execute the (matlab) src block in the background and go to the next onetdh-org-babel-execute-matlab-background
(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 @@ -3284,7 +3240,6 @@ RemapC-c C-c
: d)))) (cmd (intern (concat "org-babel-execute:" lang))) result) - ;; (message "%s" body) (process-send-string "*MATLAB*" (concat body "\n")) result)) ))) @@ -3295,23 +3250,73 @@ RemapC-c C-c
:
tdh-matlab-execute-selected
(defun tdh-org-babel-execute-goto-next (&optional arg info params) - (interactive) - (tdh-org-babel-execute arg info params) - (org-babel-next-src-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"))))
ctrl-shift-ref
+This function: +
+matlab
+matlab
block, it first check if a region if selected, if so it just runs the selected region.
+if no region is selected, it runs all the code blocks and goes to the next block(defun tdh-ctrl-shift-ret () + (interactive) + (defun in-src-block-p () + "Returns t when the point is inside a source code block" + (string= "src" (org-in-block-p '("src")))) + + (if (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)) + ) + ) + ) ++
(map! :after evil-org + :map evil-org-mode-map + :n "<C-S-return>" #'tdh-ctrl-shift-ret) ++
,b
+Org-Babel Tangle Sub-tree +
(defun tdh-org-babel-tangle-subtree ()
"Tangle the current subtree"
@@ -3321,21 +3326,12 @@ Remap C-c C-c
:
(org-babel-tangle)
(widen))
)
-
-(after! org
- (map! :map org-mode-map :n ",bT" 'tdh-org-babel-tangle-subtree))
-Actually this tangle the file and then go to the file. Maybe I would like to ignore the tangling phase. +Org-Tangle and Org-Babel Jump to Tangle File
-(defun tdh-org-babel-jump-to-tangle-file () "Jump to tangle file for the source block at point." @@ -3350,41 +3346,27 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign (if (file-readable-p file) (find-file file) (error "Cannot open tangle file %S" file))))) - - (after! org - (map! :map org-mode-map :n ",bF" 'tdh-org-babel-jump-to-tangle-file))
+Map Functions +
(defun tdh-org-babel-execute-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) - (process-send-string "*MATLAB*" (concat "run " file "\n")) - (error "Cannot open tangle file %S" file))))) +(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)))
(with-eval-after-load 'font-latex + (set-face-attribute 'font-latex-math-face nil :foreground (face-foreground 'org-meta-line)) +) ++
(use-package! pdf-tools :config - (add-hook 'pdf-view-mode-hook (lambda() (linum-mode -1))) + (add-hook 'pdf-view-mode-hook (lambda() (linum-mode -1))) )
Created: 2020-03-19 jeu. 10:46
+Created: 2020-03-22 dim. 23:03
Created: 2020-03-01 dim. 22:50
+Created: 2020-03-22 dim. 23:04
IMAPAccount gmail Host imap.gmail.com @@ -469,9 +491,9 @@ Sync Pull
IMAPAccount esrf Host imaps.esrf.fr @@ -686,9 +708,9 @@ tls_certcheck off
account gmail
host smtp.gmail.com
@@ -702,9 +724,9 @@ passwordeval "pass email/dehaeze.thomas@gmail.com"
account esrf
host smtps.esrf.fr
@@ -765,12 +787,20 @@ passwordeval "pass email/tdehaeze@uliege.be"
-http://www.djcbsoftware.nl/code/mu/
-http://www.djcbsoftware.nl/code/mu/cheatsheet.html
+Mu
(github) it used as a “maildir indexer/searcher”.
+Useful commands are described in the Cheat-sheet.
+For instance, to find mails with pdf
attachments:
+
mu find 'mime:application/pdf' ++
bind generic Q exit @@ -1245,9 +1275,9 @@ bind index,pager N search-opposite
bind attach l view-attach @@ -1307,13 +1337,8 @@ Attach multiple files using ranger
-https://unix.stackexchange.com/questions/108485/send-email-written-in-markdown-using-mutt/424162 -https://github.com/Roguelazer/muttdown -
-Write html emails using markdown
@@ -1340,9 +1365,9 @@ bind browser q exitEnter Command
@@ -1364,9 +1389,9 @@ macro index M "<save-message>?<toggle-mailboxebind index,pager \Cp sidebar-prev
bind index,pager \Cn sidebar-next
@@ -1529,9 +1554,9 @@ color index brightcolor000 color001 "~v~(~D)"
color sidebar_indicator color000 color021 # Mailbox is open color sidebar_highlight color000 color003 # Mailbox is highlighted @@ -1554,9 +1579,9 @@ color header brightcolor004 color000 "^(Subject)"
# Color if the attachment is autoviewed color attach_headers brightgreen default "Autoview" @@ -1702,9 +1727,9 @@ macro index,pager gm "<change-folder>+gmail/InboxGmail
--Configuration
-++Configuration
+-set from = "dehaeze.thomas@gmail.com" set sendmail = "msmtp -a gmail" @@ -1728,9 +1753,9 @@ macro index,pager D \-Signature
-++Signature
+Thomas Dehaeze@@ -1750,9 +1775,9 @@ This empty code block is used to add a new line after signatureESRF
--Configuration
-++Configuration
+-set from = "thomas.dehaeze@esrf.fr" set sendmail = "msmtp -a esrf" @@ -1776,9 +1801,9 @@ macro index,pager D \-Signature
-++Signature
+Thomas Dehaeze@@ -1798,9 +1823,9 @@ This empty code block is used to add a new line after signatureULG
--Configuration
-++Configuration
+-set from = "thomas.dehaeze@doct.uliege.be" set sendmail = "msmtp -a ulg" @@ -1824,9 +1849,9 @@ macro index,pager D \-Signature
-++Signature
+Thomas Dehaeze@@ -1846,9 +1871,9 @@ This empty code block is used to add a new line after signatureULIEGE
--Configuration
-++Configuration
+-set from = "tdehaeze@uliege.be" set sendmail = "msmtp -a uliege" @@ -1872,9 +1897,9 @@ macro index,pager D \-Signature
-++Signature
+-Thomas Dehaeze@@ -2010,9 +2035,9 @@ hdr_order from: to: cc: date: subject: #-Sidebar
-++-Sidebar
+General Config
@@ -2120,9 +2145,9 @@ named-mailboxes " Trash" =uliege/Trash-Attachments
-++@@ -728,7 +740,6 @@Attachments
+Attachment View Options
@@ -2321,7 +2346,7 @@ text/rtf; libreoffice --nologo --writer '%s'; codiff --git a/docs/polybar.html b/docs/polybar.html index 38440e0..b286a85 100644 --- a/docs/polybar.html +++ b/docs/polybar.html @@ -4,7 +4,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2020-03-19 jeu. 10:38
+Created: 2020-03-22 dim. 23:03
Polybar Configuration @@ -201,28 +201,50 @@ @@ -263,7 +285,7 @@- NordVPN
@@ -285,12 +307,6 @@- Toggle Automatic Lock Screen
-- Weather - -
- Network
- Screenshot
- Scripts @@ -374,7 +390,7 @@ modules-left = i3 bspwm xwindow modules-center = -modules-right = pulseaudio xbacklight redshift packages nordvpn lockscreen dunst unread_mail cpu battery temperature date +modules-right = pulseaudio xbacklight redshift nordvpn lockscreen dunst packages unread_mail cpu battery temperature date wm-restack = i3 @@ -695,27 +711,23 @@
[module/temperature] type = internal/temperature - -interval = 5 +interval = 2 thermal-zone = 0 warn-temperature = 70 hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input - -format = %{A1:$TERMINAL -e "watch sensors" &:}<ramp> <label>%{A} -format-underline = ${colors.bg} +units = false +format = %{A1:$TERMINAL --class="Floating" -e "watch sensors" &:}<ramp> <label>%{A} format-warn = <ramp> <label-warn> +label = %temperature-c%°C +label-warn = %temperature-c%°C +label-warn-foreground = ${colors.fg} format-warn-underline = ${colors.red} - -label = %temperature-c% -label-warn = %temperature-c% -label-warn-foreground = ${colors.red} - ramp-0 = ramp-1 = ramp-2 = ramp-3 = ramp-4 = -ramp-foreground = ${color.fg} +ramp-foreground = ${colors.fg}[module/unread_mail] type = custom/script -label-font = 2 format-underline = ${colors.bg} click-left = ~/.config/polybar/scripts/mail-open.sh format = <label> @@ -742,12 +753,12 @@Unread Mail Scripts
-@@ -772,7 +783,6 @@mails=$(du -a ~/.mail/*/Inbox/new/* 2>/dev/null | sed -n '$=') +mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l` -if [[ -z "$mails" ]]; then - echo "" +if [ "$mail_nb" -eq "0" ]; then + echo ""; else - echo "%{F#859900}%{F-}" + echo "%{F#859900} $mail_nb%{F-}"; fi[module/redshift] type = custom/script -label-font = 2 format-underline = ${colors.bg} click-left = ~/.config/polybar/scripts/redshift-toggle.sh format = <label> @@ -828,11 +838,8 @@-TODO Nordvpn Status script
+Nordvpn Status script
-+ +-
- -
[ ]
Should check if there is a tmpfile, if there is not, run nordvpn status and create the tmpfile accordindly-tmpfile="/tmp/vpnstatus"; @@ -885,11 +892,12 @@Packages Status script
-@@ -1016,152 +1024,6 @@packagenb=`yay -Qu 2> /dev/null | wc -l`; -if [ "$packagenb" -eq "0" ]; then +package_nb=`yay -Qu 2> /dev/null | wc -l`; + +if [ "$package_nb" -eq "0" ]; then echo ""; else - echo "%{F#859900}%{F-}"; + echo "%{F#859900} $package_nb%{F-}"; fi--Weather
--- --https://github.com/x70b1/polybar-scripts/tree/master/polybar-scripts/openweathermap-fullfeatured -
- ---[module/weather] -type = custom/script - -exec = ~/.config/polybar/scripts/weather-status.sh -click-left = ~/.config/polybar/scripts/weather-open.sh - -interval = 600 -label-font = 3 ---- -Script to retrieve the weather
-----get_icon() { - case $1 in - 01d) icon="";; - 01n) icon="";; - 02d) icon="";; - 02n) icon="";; - 03*) icon="";; - 04*) icon="";; - 09d) icon="";; - 09n) icon="";; - 10d) icon="";; - 10n) icon="";; - 11d) icon="";; - 11n) icon="";; - 13d) icon="";; - 13n) icon="";; - 50d) icon="";; - 50n) icon="";; - *) icon=""; - esac - - echo $icon -} - -get_duration() { - - osname=$(uname -s) - - case $osname in - *BSD) date -r "$1" -u +%H:%M;; - *) date --date="@$1" -u +%H:%M;; - esac - -} - -KEY="a705adc4ce0e271801051b9460ecb1cd" -CITY="" -UNITS="metric" -SYMBOL="°" - -API="https://api.openweathermap.org/data/2.5" - -if [ -n "$CITY" ]; then - if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then - CITY_PARAM="id=$CITY" - else - CITY_PARAM="q=$CITY" - fi - - current=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS") - forecast=$(curl -sf "$API/forecast?appid=$KEY&$CITY_PARAM&units=$UNITS&cnt=1") -else - location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue) - - if [ -n "$location" ]; then - location_lat="$(echo "$location" | jq '.location.lat')" - location_lon="$(echo "$location" | jq '.location.lng')" - - current=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS") - forecast=$(curl -sf "$API/forecast?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS&cnt=1") - fi -fi - -if [ -n "$current" ] && [ -n "$forecast" ]; then - current_temp=$(echo "$current" | jq ".main.temp" | cut -d "." -f 1) - current_icon=$(echo "$current" | jq -r ".weather[0].icon") - - forecast_temp=$(echo "$forecast" | jq ".list[].main.temp" | cut -d "." -f 1) - forecast_icon=$(echo "$forecast" | jq -r ".list[].weather[0].icon") - - - if [ "$current_temp" -gt "$forecast_temp" ]; then - trend="" # - elif [ "$forecast_temp" -gt "$current_temp" ]; then - trend="" # - else - trend="" # - fi - - - sun_rise=$(echo "$current" | jq ".sys.sunrise") - sun_set=$(echo "$current" | jq ".sys.sunset") - now=$(date +%s) - - if [ "$sun_rise" -gt "$now" ]; then - daytime=" $(get_duration "$((sun_rise-now))")" - elif [ "$sun_set" -gt "$now" ]; then - daytime=" $(get_duration "$((sun_set-now))")" - else - daytime=" $(get_duration "$((sun_rise-now))")" - fi - - echo "$(get_icon "$current_icon") $current_temp$SYMBOL $trend $(get_icon "$forecast_icon") $forecast_temp$SYMBOL $daytime" -fi ----TODO Open Weather Webpage
----
- -- -
[ ]
Find a way to open a web page with detailed forecast with the current location--# location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue) - -# if [ -n "$location" ]; then -# location_lat="$(echo "$location" | jq '.location.lat')" -# location_lon="$(echo "$location" | jq '.location.lng')" -# else - -# fi -$BROWSER https://www.yahoo.com/news/weather/france/grenoble/grenoble-593720 --Network
@@ -1256,7 +1118,7 @@ polybar top >>/tmp/polybar.logdiff --git a/docs/qutebrowser.html b/docs/qutebrowser.html index 9eb439f..7a78214 100644 --- a/docs/qutebrowser.html +++ b/docs/qutebrowser.html @@ -4,7 +4,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2020-03-19 jeu. 10:39
+Created: 2020-03-22 dim. 23:03
Qutebrowser Configuration @@ -201,28 +201,50 @@ @@ -254,10 +276,10 @@@@ -311,7 +333,7 @@
- Create a new password
- Cast Youtube to Chromecast
-- Add url to refile.org
- Passwordfillrc
- Org-Capture
- Add Url to Buku using Rofi
+- Add Url to Buku without asking for information
Editor
@@ -604,7 +626,7 @@ Create a Password for the current website-c.editor.command = ['/usr/bin/termite', '-e', 'nvim {}'] +c.editor.command = ['/usr/bin/termite', '--class="Floating"', '-e', 'nvim {}']-Use Pass to fill password and username (configuration is done in
~/.config/qutebrowser/password_fill_rc
). +Use Pass to fill password and username (configuration is done in~/.config/qutebrowser/password_fill_rc
)config.bind(',p', 'spawn --userscript password_fill') @@ -612,7 +634,7 @@ Use Pass to fill password and username (configuration is done in~/.config
-Open Youtube video using MPV +Open Youtube video using
mpv
config.bind(',m', 'spawn --detach mpv --force-window yes {url}') @@ -630,24 +652,16 @@ config.bind(',C', 'hint-Add url to refile.org +Add page to Bookmarks using
buku
-- -config.bind(',r', 'spawn --userscript ~/.config/qutebrowser/userscripts/add-to-orgmode-refile.sh') ---Add page to Bookmarks -
--config.bind(',b', 'spawn buku -a {url}') +config.bind(',b', 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-add.sh') config.bind(',B', 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-rofi.sh')-Open bookmark using buku +Open bookmark using
buku
-config.bind(',o', 'spawn ~/bin/bukurun') @@ -713,21 +727,6 @@ pass insert --multiline " -Add url to refile.org
----Add the date and time of add to properties. -
---echo "* TODO $QUTE_TITLE" >> ~/Dropbox/org/refile.org -echo "$QUTE_URL" >> ~/Dropbox/org/refile.org -echo "message-info 'Added to refile.org'" >> "$QUTE_FIFO" --+Passwordfillrc
@@ -784,7 +783,17 @@ Add the date and time of add to properties.+title=$(echo "$QUTE_TITLE" | rofi -p "Title" -dmenu -lines 1) tags=$(buku -t --nc --np | sed -e 's/\s*[[:digit:]]*\.\s*\(.*\)\s*([[:digit:]]*)\s*/\1/' -e '/^\s*$/d' | sort | uniq | rofi -p "Tags" -dmenu) -buku --add "$QUTE_URL" --tag "$tags" --title "$title" +buku --add "$QUTE_URL" --tag "$tags" --title "$title" && dunstify "Buku" "📑 Bookmark Added" +++@@ -587,7 +609,7 @@ mopidy --config ~/.config/mopidy/mopidy.conf >/dev/nullAdd Url to Buku without asking for information
++@@ -793,7 +802,7 @@ buku --add "+buku --add $QUTE_URL --title "$QUTE_TITLE" && dunstify "Buku" "📑 Bookmark Added"diff --git a/docs/scripts.html b/docs/scripts.html index fdeae77..90f7543 100644 --- a/docs/scripts.html +++ b/docs/scripts.html @@ -4,7 +4,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + -Created: 2020-03-19 jeu. 10:38
+Created: 2020-03-22 dim. 23:03
Scripts @@ -201,28 +201,50 @@ @@ -407,7 +429,7 @@ xclip -h 2>/dev/null ||else echo "$chosen" | tr -d '\n' | xsel -ib - notify-send "'$chosen' copied to clipboard." & + dunstify "'$chosen' copied to clipboard." & fiCreated: 2020-03-19 jeu. 10:38
+Created: 2020-03-22 dim. 23:03
-