summary refs log tree commit diff stats
path: root/lisp/+org.el
diff options
context:
space:
mode:
authorCase Duckworth2022-01-18 18:16:01 -0600
committerCase Duckworth2022-01-18 18:16:01 -0600
commit6852a7307a6f3a70d32b44d4971f98a343a64c59 (patch)
treec2044852a492ca622d6489881ff3482ab0476c73 /lisp/+org.el
parentAdd unworking sketch for fluid-width tabs (diff)
downloademacs-6852a7307a6f3a70d32b44d4971f98a343a64c59.tar.gz
emacs-6852a7307a6f3a70d32b44d4971f98a343a64c59.zip
Ahh
Diffstat (limited to 'lisp/+org.el')
-rw-r--r--lisp/+org.el47
1 files changed, 45 insertions, 2 deletions
diff --git a/lisp/+org.el b/lisp/+org.el index 5869622..0f2c625 100644 --- a/lisp/+org.el +++ b/lisp/+org.el
@@ -447,10 +447,53 @@ the deletion might narrow the column."
447(defun +org-open-html (file-path link-string) 447(defun +org-open-html (file-path link-string)
448 "Open FILE-PATH with `browse-url'. 448 "Open FILE-PATH with `browse-url'.
449This function is intended to use with `org-file-apps'. See the 449This function is intended to use with `org-file-apps'. See the
450documentation of that function for a description of the two 450 documentation of that function for a description of the two
451arguments here, FILE-PATH and LINK-STRING." 451 arguments here, FILE-PATH and LINK-STRING."
452 (message "Opening %s (%s)..." file-path link-string) 452 (message "Opening %s (%s)..." file-path link-string)
453 (browse-url file-path)) 453 (browse-url file-path))
454 454
455(defun +org-insert-horizontal-rule (prefix)
456 "Insert a horizontal rule (-----) after the current line.
457With PREFIX, insert before the current line."
458 (interactive "P")
459 (if prefix
460 (move-beginning-of-line nil)
461 (move-end-of-line nil)
462 (forward-line 1))
463 (insert "-----\n"))
464
465;;; Make code snippets in org-mode easier to type
466;; http://mbork.pl/2022-01-17_Making_code_snippets_in_Org-mode_easier_to_type
467
468(defun +org-insert-backtick ()
469 "Insert a backtick using `org-self-insert-command'."
470 (interactive)
471 (setq last-command-event ?`)
472 (call-interactively #'org-self-insert-command))
473
474(defvar-local +org-insert-tilde-language nil
475 "Default language name in the current Org file.
476If nil, `org-insert-tilde' after 2 tildes inserts an \"example\"
477block. If a string, it inserts a \"src\" block with the given
478language name.")
479
480(defun +org-insert-tilde ()
481 "Insert a tilde using `org-self-insert-command'."
482 (interactive)
483 (if (string= (buffer-substring-no-properties (- (point) 3) (point))
484 "\n~~")
485 (progn (delete-char -2)
486 (if +org-insert-tilde-language
487 (insert (format "#+begin_src %s\n#+end_src"
488 +org-insert-tilde-language))
489 (insert "#+begin_example\n#+end_example"))
490 (forward-line -1)
491 (if (string= +org-insert-tilde-language "")
492 (move-end-of-line nil)
493 ;;(org-edit-special) ; Useful really only with splits.
494 ))
495 (setq last-command-event ?~)
496 (call-interactively #'org-self-insert-command)))
497
455(provide '+org) 498(provide '+org)
456;;; +org.el ends here 499;;; +org.el ends here