diff options
author | Case Duckworth | 2021-08-26 23:30:43 -0500 |
---|---|---|
committer | Case Duckworth | 2021-08-26 23:30:43 -0500 |
commit | e627aec4ded8a98b724a6d0aef4a1e54124eeb20 (patch) | |
tree | 872c0581a389db117b3dcac9b34efe01550fb0fa | |
parent | Add experimental (commented) :after advice for do-auto-fill (diff) | |
download | emacs-e627aec4ded8a98b724a6d0aef4a1e54124eeb20.tar.gz emacs-e627aec4ded8a98b724a6d0aef4a1e54124eeb20.zip |
Add bindings to widen org-buffer on next/previous heading
-rw-r--r-- | init.el | 8 | ||||
-rw-r--r-- | lisp/acdw-org.el | 17 |
2 files changed, 22 insertions, 3 deletions
diff --git a/init.el b/init.el index 079e586..587ffdf 100644 --- a/init.el +++ b/init.el | |||
@@ -1570,8 +1570,8 @@ successive invocations." | |||
1570 | ((string-suffix-p "~" pattern) | 1570 | ((string-suffix-p "~" pattern) |
1571 | `(orderless-flex . ,(substring pattern 0 -1)))))) | 1571 | `(orderless-flex . ,(substring pattern 0 -1)))))) |
1572 | 1572 | ||
1573 | (setup (:straight org) | 1573 | (setup (:straight org |
1574 | (:straight org-contrib) | 1574 | org-contrib) |
1575 | (require 'acdw-org) ; so I don't clutter up init.el | 1575 | (require 'acdw-org) ; so I don't clutter up init.el |
1576 | (:option | 1576 | (:option |
1577 | org-adapt-indentation nil | 1577 | org-adapt-indentation nil |
@@ -1612,7 +1612,9 @@ successive invocations." | |||
1612 | "<S-return>" acdw-org/org-table-copy-down | 1612 | "<S-return>" acdw-org/org-table-copy-down |
1613 | "M-SPC M-SPC" insert-zero-width-space | 1613 | "M-SPC M-SPC" insert-zero-width-space |
1614 | "C-c C-l" org-insert-link-dwim | 1614 | "C-c C-l" org-insert-link-dwim |
1615 | "M-w" acdw/copy-region-plain) | 1615 | "M-w" acdw/copy-region-plain |
1616 | "C-c C-n" acdw/org-next-heading-widen | ||
1617 | "C-c C-p" acdw/org-previous-heading-widen) | ||
1616 | 1618 | ||
1617 | (with-eval-after-load 'org-export | 1619 | (with-eval-after-load 'org-export |
1618 | (add-to-list 'org-export-filter-final-output-functions | 1620 | (add-to-list 'org-export-filter-final-output-functions |
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index 2f798d9..75c5f7a 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el | |||
@@ -367,5 +367,22 @@ instead of the true count." | |||
367 | (call-interactively 'org-insert-link))))) | 367 | (call-interactively 'org-insert-link))))) |
368 | 368 | ||
369 | 369 | ||
370 | ;;; Next and previous heading, with widening | ||
371 | (defun acdw/org-next-heading-widen (arg) | ||
372 | (interactive "p") | ||
373 | (let ((point-target (if (> arg 0) | ||
374 | (point-max) | ||
375 | (point-min)))) | ||
376 | (unless (or (org-next-visible-heading arg) | ||
377 | (/= (point) point-target)) | ||
378 | (when (buffer-narrowed-p) | ||
379 | (widen) | ||
380 | (org-next-visible-heading arg))))) | ||
381 | |||
382 | (defun acdw/org-previous-heading-widen (arg) | ||
383 | (interactive "p") | ||
384 | (acdw/org-next-heading (- arg))) | ||
385 | |||
386 | |||
370 | (provide 'acdw-org) | 387 | (provide 'acdw-org) |
371 | ;; acdw-org.el ends here | 388 | ;; acdw-org.el ends here |