add org-auto-expand melpa module
This commit is contained in:
parent
98dfba796f
commit
0df4e6ddba
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,58 @@
|
||||||
|
;;; org-auto-expand-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*-
|
||||||
|
;; Generated by the `loaddefs-generate' function.
|
||||||
|
|
||||||
|
;; This file is part of GNU Emacs.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; Generated autoloads from org-auto-expand.el
|
||||||
|
|
||||||
|
(defvar org-auto-expand-mode nil "\
|
||||||
|
Non-nil if Org-Auto-Expand mode is enabled.
|
||||||
|
See the `org-auto-expand-mode' command
|
||||||
|
for a description of this minor mode.
|
||||||
|
Setting this variable directly does not take effect;
|
||||||
|
either customize it (see the info node `Easy Customization')
|
||||||
|
or call the function `org-auto-expand-mode'.")
|
||||||
|
(custom-autoload 'org-auto-expand-mode "org-auto-expand" nil)
|
||||||
|
(autoload 'org-auto-expand-mode "org-auto-expand" "\
|
||||||
|
Automatically expand certain headings when `org-mode' is activated.
|
||||||
|
|
||||||
|
This is a global minor mode. If called interactively, toggle the
|
||||||
|
`Org-Auto-Expand mode' mode. If the prefix argument is positive,
|
||||||
|
enable the mode, and if it is zero or negative, disable the mode.
|
||||||
|
|
||||||
|
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
|
||||||
|
the mode if ARG is nil, omitted, or is a positive number.
|
||||||
|
Disable the mode if ARG is a negative number.
|
||||||
|
|
||||||
|
To check whether the minor mode is enabled in the current buffer,
|
||||||
|
evaluate `(default-value \\='org-auto-expand-mode)'.
|
||||||
|
|
||||||
|
The mode's hook is called both when the mode is enabled and when
|
||||||
|
it is disabled.
|
||||||
|
|
||||||
|
(fn &optional ARG)" t)
|
||||||
|
(autoload 'org-auto-expand "org-auto-expand" "\
|
||||||
|
Set current buffer's outline visibility accordingly.
|
||||||
|
If `org-startup-folded' is non-nil, call
|
||||||
|
`org-set-startup-visibility' first." t)
|
||||||
|
(register-definition-prefixes "org-auto-expand" '("org-auto-expand-"))
|
||||||
|
|
||||||
|
;;; End of scraped data
|
||||||
|
|
||||||
|
(provide 'org-auto-expand-autoloads)
|
||||||
|
|
||||||
|
;; Local Variables:
|
||||||
|
;; version-control: never
|
||||||
|
;; no-byte-compile: t
|
||||||
|
;; no-update-autoloads: t
|
||||||
|
;; no-native-compile: t
|
||||||
|
;; coding: utf-8-emacs-unix
|
||||||
|
;; End:
|
||||||
|
|
||||||
|
;;; org-auto-expand-autoloads.el ends here
|
15
org/elpa/org-auto-expand-20231006.854/org-auto-expand-pkg.el
Normal file
15
org/elpa/org-auto-expand-20231006.854/org-auto-expand-pkg.el
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
(define-package "org-auto-expand" "20231006.854" "Automatically expand certain headings"
|
||||||
|
'((emacs "26.1")
|
||||||
|
(org "9.6"))
|
||||||
|
:commit "86e3b24e894ab377ea005b1a574e77daace0451d" :authors
|
||||||
|
'(("Adam Porter" . "adam@alphapapa.net"))
|
||||||
|
:maintainers
|
||||||
|
'(("Adam Porter" . "adam@alphapapa.net"))
|
||||||
|
:maintainer
|
||||||
|
'("Adam Porter" . "adam@alphapapa.net")
|
||||||
|
:keywords
|
||||||
|
'("convenience" "outlines" "org")
|
||||||
|
:url "https://github.com/alphapapa/org-auto-expand")
|
||||||
|
;; Local Variables:
|
||||||
|
;; no-byte-compile: t
|
||||||
|
;; End:
|
157
org/elpa/org-auto-expand-20231006.854/org-auto-expand.el
Normal file
157
org/elpa/org-auto-expand-20231006.854/org-auto-expand.el
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
;;; org-auto-expand.el --- Automatically expand certain headings -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2019-2023 Adam Porter
|
||||||
|
|
||||||
|
;; Author: Adam Porter <adam@alphapapa.net>
|
||||||
|
;; URL: https://github.com/alphapapa/org-auto-expand
|
||||||
|
;; Version: 0.2-pre
|
||||||
|
;; Package-Requires: ((emacs "26.1") (org "9.6"))
|
||||||
|
;; Keywords: convenience, outlines, org
|
||||||
|
|
||||||
|
;;; License:
|
||||||
|
|
||||||
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; This package automatically expands certain headings in an Org file
|
||||||
|
;; depending on properties set, making it easy to always get the same
|
||||||
|
;; initial view when finding a file.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
;;;; Requirements
|
||||||
|
|
||||||
|
(require 'cl-lib)
|
||||||
|
(require 'org)
|
||||||
|
(require 'subr-x)
|
||||||
|
|
||||||
|
;;;; Customization
|
||||||
|
|
||||||
|
(defgroup org-auto-expand nil
|
||||||
|
"Automatically expand certain nodes upon finding an Org file."
|
||||||
|
:group 'org
|
||||||
|
:link '(url-link "https://github.com/alphapapa/org-auto-expand"))
|
||||||
|
|
||||||
|
(defcustom org-auto-expand-property "auto-expand"
|
||||||
|
"Name of property holding auto-expand setting."
|
||||||
|
:type 'string)
|
||||||
|
|
||||||
|
(defvar-local org-auto-expand-nodes nil
|
||||||
|
"List defining how to expand outline nodes.
|
||||||
|
Should be set in a file- or dir-local variable.
|
||||||
|
|
||||||
|
Each element should be an alist, the key of which should be an
|
||||||
|
outline-path string, and the value of which corresponds to the
|
||||||
|
WHAT argument to the function `org-auto-expand-node'.")
|
||||||
|
|
||||||
|
;;;; Mode
|
||||||
|
|
||||||
|
;; We use a variable watcher to work around the fact that file-local variables
|
||||||
|
;; are not yet bound until after all of the local variables have been processed,
|
||||||
|
;; because that prevents them from being available in functions called by `eval'
|
||||||
|
;; lines, like `org-auto-expand'. This seems both messy and elegant.
|
||||||
|
|
||||||
|
;; TODO: Figure out if there's an alternative to a variable watcher (or just remove this and use the properties).
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(define-minor-mode org-auto-expand-mode
|
||||||
|
"Automatically expand certain headings when `org-mode' is activated."
|
||||||
|
:global t
|
||||||
|
(if org-auto-expand-mode
|
||||||
|
(progn
|
||||||
|
(add-hook 'org-mode-hook #'org-auto-expand)
|
||||||
|
(add-variable-watcher 'org-auto-expand-nodes #'org-auto-expand-watcher))
|
||||||
|
(remove-hook 'org-mode-hook #'org-auto-expand)
|
||||||
|
(remove-variable-watcher 'org-auto-expand-nodes #'org-auto-expand-watcher)))
|
||||||
|
|
||||||
|
(defun org-auto-expand-watcher (_symbol newval operation where)
|
||||||
|
"Call `org-auto-expand'.
|
||||||
|
When OPERATION is `set', call `org-auto-expand' in buffer WHERE
|
||||||
|
with `org-auto-expand-nodes' bound to NEWVAL."
|
||||||
|
(when (and newval where (eq operation 'set))
|
||||||
|
(with-current-buffer where
|
||||||
|
(let ((org-auto-expand-nodes newval))
|
||||||
|
(org-auto-expand)))))
|
||||||
|
|
||||||
|
;;;; Commands
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun org-auto-expand ()
|
||||||
|
"Set current buffer's outline visibility accordingly.
|
||||||
|
If `org-startup-folded' is non-nil, call
|
||||||
|
`org-set-startup-visibility' first."
|
||||||
|
(interactive)
|
||||||
|
(unless (derived-mode-p 'org-mode)
|
||||||
|
(user-error "Not an Org buffer: %s" (current-buffer)))
|
||||||
|
(let ((re (org-re-property org-auto-expand-property)))
|
||||||
|
;; Do nothing unless we're going to do something.
|
||||||
|
(when (or org-auto-expand-nodes
|
||||||
|
(org-with-wide-buffer
|
||||||
|
(goto-char (point-min))
|
||||||
|
(re-search-forward re nil t)))
|
||||||
|
(when org-startup-folded
|
||||||
|
(org-cycle-set-startup-visibility))
|
||||||
|
(when org-auto-expand-nodes
|
||||||
|
(cl-loop for (olp . how) in org-auto-expand-nodes
|
||||||
|
do (when-let ((pos (org-find-olp olp 'this-buffer)))
|
||||||
|
(org-with-point-at pos
|
||||||
|
(org-auto-expand-node how)))))
|
||||||
|
(org-with-wide-buffer
|
||||||
|
(goto-char (point-min))
|
||||||
|
(while (re-search-forward re nil t)
|
||||||
|
(save-excursion
|
||||||
|
(org-back-to-heading 'invisible-ok)
|
||||||
|
(org-auto-expand-node)))))))
|
||||||
|
|
||||||
|
;;;; Functions
|
||||||
|
|
||||||
|
(cl-defun org-auto-expand-node (&optional (what (org-entry-get (point) org-auto-expand-property)))
|
||||||
|
"Set current node's what according to WHAT.
|
||||||
|
If WHAT is nil, use value of `org-auto-expand-property' at node.
|
||||||
|
|
||||||
|
WHAT may be a string, or it may be a list of the following,
|
||||||
|
meaning to:
|
||||||
|
|
||||||
|
- `heading': Show just the heading.
|
||||||
|
- `body': Show the heading and its body, but not its children.
|
||||||
|
- `children': Show the heading's children, but not its body.
|
||||||
|
- A number N: Show child headings N levels deep.
|
||||||
|
- A symbol that `org-show-context' accepts as an argument.
|
||||||
|
|
||||||
|
If WHAT is a string, it is split on spaces and should be a list
|
||||||
|
of the choices above."
|
||||||
|
(setf what (cl-typecase what
|
||||||
|
(string (cl-loop for it in (split-string what nil 'omit-nulls (rx (1+ space)))
|
||||||
|
collect (if (> (string-to-number it) 0)
|
||||||
|
(string-to-number it)
|
||||||
|
(intern it))))
|
||||||
|
(list what)
|
||||||
|
(number (list what))
|
||||||
|
(symbol (list what))))
|
||||||
|
(dolist (thing what)
|
||||||
|
(pcase thing
|
||||||
|
('heading (org-fold-show-context 'minimal))
|
||||||
|
((or 'body)
|
||||||
|
(org-fold-show-context 'minimal)
|
||||||
|
(org-cycle))
|
||||||
|
('children (org-fold-show-children 1))
|
||||||
|
((pred numberp) (org-fold-show-children thing))
|
||||||
|
(else (org-fold-show-context else)))))
|
||||||
|
|
||||||
|
;;;; Footer
|
||||||
|
|
||||||
|
(provide 'org-auto-expand)
|
||||||
|
|
||||||
|
;;; org-auto-expand.el ends here
|
|
@ -72,7 +72,7 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; additional packages
|
; additional packages
|
||||||
(add-to-list 'package-selected-packages
|
(add-to-list 'package-selected-packages
|
||||||
'(ox-pandoc ox-hugo org-super-agenda org-alert burnt-toast alert)
|
'(org-auto-expand ox-pandoc ox-hugo org-super-agenda org-alert burnt-toast alert)
|
||||||
)
|
)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -251,7 +251,11 @@
|
||||||
'(custom-safe-themes
|
'(custom-safe-themes
|
||||||
'("dde643b0efb339c0de5645a2bc2e8b4176976d5298065b8e6ca45bc4ddf188b7" "bfc0b9c3de0382e452a878a1fb4726e1302bf9da20e69d6ec1cd1d5d82f61e3d" default))
|
'("dde643b0efb339c0de5645a2bc2e8b4176976d5298065b8e6ca45bc4ddf188b7" "bfc0b9c3de0382e452a878a1fb4726e1302bf9da20e69d6ec1cd1d5d82f61e3d" default))
|
||||||
'(safe-local-variable-values
|
'(safe-local-variable-values
|
||||||
'((eval setq org-html-postamble nil)
|
'((eval org-auto-expand)
|
||||||
|
(org-auto-expand-nodes
|
||||||
|
(("To Do")
|
||||||
|
body 1))
|
||||||
|
(eval setq org-html-postamble nil)
|
||||||
(eval setq org-export-html-postamble-format nil)
|
(eval setq org-export-html-postamble-format nil)
|
||||||
(eval add-hook 'after-save-hook 'org-pandoc-export-to-latex-pdf t t)
|
(eval add-hook 'after-save-hook 'org-pandoc-export-to-latex-pdf t t)
|
||||||
(eval add-hook 'after-save-hook 'org-pandoc-export-to-docx t t)
|
(eval add-hook 'after-save-hook 'org-pandoc-export-to-docx t t)
|
||||||
|
|
Reference in a new issue