lang/org: minor refactor of contrib submodules
This commit is contained in:
parent
c5464f1798
commit
1694641636
5 changed files with 26 additions and 35 deletions
|
@ -2,7 +2,7 @@
|
|||
;;;###if (featurep! +dragndrop)
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-dragndrop-download-dnd (uri action)
|
||||
(defun +org-dragndrop-download-dnd-fn (uri action)
|
||||
"TODO"
|
||||
(if (eq major-mode 'org-mode)
|
||||
(+org-attach/uri uri)
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
(interactive)
|
||||
(unless (derived-mode-p 'org-mode)
|
||||
(error "Not in an org buffer"))
|
||||
(call-interactively 'org-tree-slide-mode)
|
||||
(add-hook 'kill-buffer-hook '+org-present--cleanup-org-tree-slides-mode))
|
||||
(call-interactively #'org-tree-slide-mode)
|
||||
(add-hook 'kill-buffer-hook #'+org-present--cleanup-org-tree-slides-mode))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -88,23 +88,3 @@
|
|||
(let ((overlay (make-overlay beg end)))
|
||||
(push overlay +org-present--overlays)
|
||||
(overlay-put overlay 'invisible '+org-present)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Advice
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-present*narrow-to-subtree (orig-fn &rest args)
|
||||
"Narrow to the target subtree when you start the presentation."
|
||||
(cl-letf (((symbol-function 'org-narrow-to-subtree)
|
||||
(lambda () (save-excursion
|
||||
(save-match-data
|
||||
(org-with-limited-levels
|
||||
(narrow-to-region
|
||||
(progn (org-back-to-heading t)
|
||||
(forward-line 1)
|
||||
(point))
|
||||
(progn (org-end-of-subtree t t)
|
||||
(when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
|
||||
(point)))))))))
|
||||
(apply orig-fn args)))
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
:commands (org-download-dnd org-download-dnd-base64)
|
||||
:init
|
||||
;; HACK We add these manually so that org-download is truly lazy-loaded
|
||||
(nconcq! dnd-protocol-alist
|
||||
'(("^\\(?:https?\\|ftp\\|file\\|nfs\\):" . +org-dragndrop-download-dnd)
|
||||
("^data:" . org-download-dnd-base64)))
|
||||
(pushnew! dnd-protocol-alist
|
||||
'("^\\(?:https?\\|ftp\\|file\\|nfs\\):" . +org-dragndrop-download-dnd-fn)
|
||||
'("^data:" . org-download-dnd-base64))
|
||||
(advice-add #'org-download-enable :override #'ignore)
|
||||
:config
|
||||
(setq org-download-image-dir org-attach-directory
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
;;; lang/org/contrib/journal.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! +journal)
|
||||
|
||||
(use-package! org-journal
|
||||
:defer t
|
||||
:config
|
||||
(map! :map org-journal-search-mode-map
|
||||
:localleader
|
||||
(map! :after org-journal
|
||||
:localleader
|
||||
(:map org-journal-search-mode-map
|
||||
"n" #'org-journal-search-next
|
||||
"p" #'org-journal-search-prev)
|
||||
(map! :map org-journal-mode-map
|
||||
:localleader
|
||||
(:map org-journal-mode-map
|
||||
"n" #'org-journal-open-next-entry
|
||||
"p" #'org-journal-open-previous-entry))
|
||||
|
|
|
@ -36,5 +36,19 @@
|
|||
#'org-display-inline-images)
|
||||
|
||||
(add-hook 'org-tree-slide-mode-hook #'+org-present-init-org-tree-window-h)
|
||||
(advice-add #'org-tree-slide--display-tree-with-narrow
|
||||
:around #'+org-present*narrow-to-subtree))
|
||||
|
||||
(defadvice! +org-present--narrow-to-subtree-a (orig-fn &rest args)
|
||||
"Narrow to the target subtree when you start the presentation."
|
||||
:around #'org-tree-slide--display-tree-with-narrow
|
||||
(cl-letf (((symbol-function #'org-narrow-to-subtree)
|
||||
(lambda () (save-excursion
|
||||
(save-match-data
|
||||
(org-with-limited-levels
|
||||
(narrow-to-region
|
||||
(progn (org-back-to-heading t)
|
||||
(forward-line 1)
|
||||
(point))
|
||||
(progn (org-end-of-subtree t t)
|
||||
(when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
|
||||
(point)))))))))
|
||||
(apply orig-fn args))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue