Compare commits
2 commits
975f872806
...
ea864e15d2
Author | SHA1 | Date | |
---|---|---|---|
ea864e15d2 | |||
|
b0452ffd6f |
2 changed files with 30 additions and 16 deletions
|
@ -673,6 +673,7 @@
|
|||
:config
|
||||
(global-undo-tree-mode)
|
||||
(setq undo-tree-auto-save-history t)
|
||||
(setq undo-tree-visualizer-timestamps t)
|
||||
(let ((undo-dir (expand-file-name "undo" user-emacs-directory)))
|
||||
(unless (file-exists-p undo-dir)
|
||||
(make-directory undo-dir t))
|
||||
|
|
|
@ -117,24 +117,37 @@ Version 2023-10-18"
|
|||
(fill-region (region-beginning) (region-end) nil)))
|
||||
;; END: undo fill-paragraph
|
||||
|
||||
(defun my/org-insert-src-block (src-code-type)
|
||||
"insert a `SRC-CODE-TYPE' type source code block in org-mode."
|
||||
|
||||
(defun my/org-insert-src-block (src-code-type &optional selected-lines)
|
||||
"Insert a `SRC-CODE-TYPE' type source code block in org-mode.
|
||||
If SELECTED-LINES is non-nil, wrap the selected lines with the source code block."
|
||||
(interactive
|
||||
(let ((src-code-types
|
||||
'("emacs-lisp" "python" "C" "shell" "java" "js" "clojure" "C++" "css"
|
||||
"calc" "asymptote" "dot" "gnuplot" "ledger" "lilypond" "mscgen"
|
||||
"octave" "oz" "plantuml" "R" "sass" "screen" "sql" "awk" "ditaa"
|
||||
"haskell" "latex" "lisp" "matlab" "ocaml" "org" "perl" "ruby"
|
||||
"scheme" "sqlite")))
|
||||
(list (ido-completing-read "Source code type: " src-code-types))))
|
||||
(progn
|
||||
(newline-and-indent)
|
||||
(insert (format "#+BEGIN_SRC %s\n" src-code-type))
|
||||
(newline-and-indent)
|
||||
(insert "#+END_SRC\n")
|
||||
(previous-line 2)
|
||||
(org-edit-src-code))
|
||||
)
|
||||
'("emacs-lisp" "python" "C" "shell" "java" "js" "clojure" "C++" "css"
|
||||
"calc" "asymptote" "dot" "gnuplot" "ledger" "lilypond" "mscgen"
|
||||
"octave" "oz" "plantuml" "R" "sass" "screen" "sql" "awk" "ditaa"
|
||||
"haskell" "latex" "lisp" "matlab" "ocaml" "org" "perl" "ruby"
|
||||
"scheme" "sqlite")))
|
||||
(list (ido-completing-read "Source code type: " src-code-types)
|
||||
current-prefix-arg)))
|
||||
(if selected-lines
|
||||
(let ((beg (region-beginning))
|
||||
(end (region-end)))
|
||||
(save-excursion
|
||||
(goto-char end)
|
||||
(insert "#+END_SRC")
|
||||
(newline)
|
||||
(goto-char beg)
|
||||
(insert (format "#+BEGIN_SRC %s\n" src-code-type))))
|
||||
(progn
|
||||
(newline-and-indent)
|
||||
(insert (format "#+BEGIN_SRC %s\n" src-code-type))
|
||||
(newline-and-indent)
|
||||
(insert "#+END_SRC\n")
|
||||
(previous-line 2)
|
||||
(org-edit-src-code))))
|
||||
|
||||
|
||||
|
||||
(defun my/hide-dos-eol ()
|
||||
"do not show ^M in files containing mixed UNIX and DOS line endings."
|
||||
|
|
Loading…
Reference in a new issue