about summary refs log tree commit diff stats
path: root/lisp
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
parentAdd unworking sketch for fluid-width tabs (diff)
downloademacs-6852a7307a6f3a70d32b44d4971f98a343a64c59.tar.gz
emacs-6852a7307a6f3a70d32b44d4971f98a343a64c59.zip
Ahh
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+org.el47
-rw-r--r--lisp/acdw.el2
2 files changed, 46 insertions, 3 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
diff --git a/lisp/acdw.el b/lisp/acdw.el index 17741ab..28ea108 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -128,7 +128,7 @@ I keep forgetting how they differ."
128 128
129(defmacro +defvar (var value &rest _) 129(defmacro +defvar (var value &rest _)
130 "Quick way to `setq' a variable from a `defvar' form." 130 "Quick way to `setq' a variable from a `defvar' form."
131 (declare (doc-string 3)) 131 (declare (doc-string 3) (indent 2))
132 `(setq ,var ,value)) 132 `(setq ,var ,value))
133 133
134(defmacro +with-message (message &rest body) 134(defmacro +with-message (message &rest body)