update packages
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
|
||||
;; Author: Erik Sjöstrand <sjostrand.erik@gmail.com>
|
||||
;; URL: http://github.com/Kungsgeten/org-brain
|
||||
;; Package-Version: 20201106.2123
|
||||
;; Package-Commit: 6e3d8618b0749742335289c32dea0b92966cf9c2
|
||||
;; Package-Version: 20201214.822
|
||||
;; Package-Commit: 2f36f303e96e384e17d156e0d6489211808d4a36
|
||||
;; Keywords: outlines hypermedia
|
||||
;; Package-Requires: ((emacs "25.1") (org "9.2"))
|
||||
;; Version: 0.94
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
;;;; Custom vars
|
||||
|
||||
(defcustom org-brain-path (expand-file-name "brain" org-directory)
|
||||
(defcustom org-brain-path (file-truename (expand-file-name "brain" org-directory))
|
||||
"The root directory of your org-brain.
|
||||
|
||||
`org-mode' files placed in this directory, or its subdirectories,
|
||||
@@ -98,7 +98,7 @@ Setting this variable to t will create the following backlink in B:
|
||||
"org-brain-suggest-stored-link-as-resource isn't needed because of `org-insert-link-global'."
|
||||
"0.6")
|
||||
|
||||
(defcustom org-brain-data-file (expand-file-name ".org-brain-data.el" org-brain-path)
|
||||
(defcustom org-brain-data-file (file-truename (expand-file-name ".org-brain-data.el" org-brain-path))
|
||||
"Where org-brain data is saved."
|
||||
:group 'org-brain
|
||||
:type '(directory))
|
||||
@@ -592,7 +592,7 @@ Run `org-brain-new-entry-hook' if a new ID is created."
|
||||
(if (file-equal-p directory org-brain-path)
|
||||
(message "Current brain already is %s, no switch" directory)
|
||||
(setq org-brain-path directory)
|
||||
(setq org-brain-data-file (expand-file-name ".org-brain-data.el" org-brain-path))
|
||||
(setq org-brain-data-file (file-truename (expand-file-name ".org-brain-data.el" org-brain-path)))
|
||||
(unless (file-exists-p org-brain-data-file)
|
||||
(org-brain-save-data))
|
||||
(setq org-brain-pins nil)
|
||||
@@ -604,7 +604,7 @@ Run `org-brain-new-entry-hook' if a new ID is created."
|
||||
(defun org-brain-maybe-switch-brain ()
|
||||
"Switch brain to `default-directory' if a file named \".org-brain-data.el\" exists there."
|
||||
(when (and (not (file-equal-p default-directory org-brain-path))
|
||||
(file-exists-p (expand-file-name ".org-brain-data.el" default-directory)))
|
||||
(file-exists-p (file-truename (expand-file-name ".org-brain-data.el" default-directory))))
|
||||
(org-brain-switch-brain default-directory)))
|
||||
|
||||
(defun org-brain-filep (entry)
|
||||
@@ -630,8 +630,8 @@ Run `org-brain-new-entry-hook' if a new ID is created."
|
||||
(defun org-brain-path-entry-name (path)
|
||||
"Get PATH as an org-brain entry name."
|
||||
(string-remove-suffix (concat "." org-brain-files-extension)
|
||||
(file-relative-name (expand-file-name path)
|
||||
(expand-file-name org-brain-path))))
|
||||
(file-relative-name (file-truename path)
|
||||
(file-truename org-brain-path))))
|
||||
|
||||
(defun org-brain-entry-path (entry &optional check-title)
|
||||
"Get path of org-brain ENTRY.
|
||||
@@ -648,8 +648,8 @@ If CHECK-TITLE is non-nil, consider that ENTRY might be a file entry title."
|
||||
(org-brain-files t)))))
|
||||
entry)
|
||||
(car entry))))
|
||||
(expand-file-name (org-link-unescape (format "%s.%s" name org-brain-files-extension))
|
||||
org-brain-path)))
|
||||
(file-truename (expand-file-name (org-link-unescape (format "%s.%s" name org-brain-files-extension))
|
||||
org-brain-path))))
|
||||
|
||||
(defun org-brain-files (&optional relative)
|
||||
"Get all org files (recursively) in `org-brain-path'.
|
||||
@@ -807,8 +807,8 @@ If ENTRY is file, then the identifier is the relative file name."
|
||||
"Get current org-brain entry.
|
||||
CREATE-ID asks to create an ID öif there isn't one already."
|
||||
(cond ((eq major-mode 'org-mode)
|
||||
(unless (string-prefix-p (expand-file-name org-brain-path)
|
||||
(expand-file-name (buffer-file-name)))
|
||||
(unless (string-prefix-p (file-truename org-brain-path)
|
||||
(file-truename (buffer-file-name)))
|
||||
(error "Not in a brain file"))
|
||||
(if org-brain-scan-for-header-entries
|
||||
(if (ignore-errors (org-get-heading))
|
||||
@@ -1270,7 +1270,7 @@ The car is the raw-link and the cdr is the description."
|
||||
(mapcar (lambda (attachment)
|
||||
(cons (format "file:%s"
|
||||
(org-link-escape
|
||||
(expand-file-name attachment attach-dir)))
|
||||
(file-truename (expand-file-name attachment attach-dir))))
|
||||
attachment))
|
||||
(org-attach-file-list attach-dir)))))))))
|
||||
|
||||
@@ -1928,9 +1928,15 @@ If NOCONFIRM is nil, ask if we really want to delete."
|
||||
(org-with-point-at (org-brain-entry-marker entry)
|
||||
(org-mark-subtree)
|
||||
(delete-region (region-beginning) (region-end))))))
|
||||
(delete entry org-brain--vis-history)
|
||||
(setq org-brain--vis-history (delete entry org-brain--vis-history))
|
||||
(org-save-all-org-buffers)
|
||||
(org-brain--revert-if-visualizing t))
|
||||
(if (equal entry org-brain--vis-entry)
|
||||
(when-let ((brain-buffer (get-buffer "*org-brain*")))
|
||||
(if (ignore-errors (org-brain-visualize-back))
|
||||
(message "Deleted visualized entry, going back in history.")
|
||||
(kill-buffer brain-buffer)
|
||||
(message "Deleted visualized entry. No history, hence killing org-brain buffer.")))
|
||||
(org-brain--revert-if-visualizing t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-brain-insert-relationships (entry &optional recursive)
|
||||
@@ -1983,7 +1989,7 @@ Remove external relationships from ENTRY, in order to clean up the brain."
|
||||
(org-brain--remove-relationships entry t)
|
||||
(org-with-point-at (org-brain-entry-marker entry)
|
||||
(org-archive-subtree-default))
|
||||
(delete entry org-brain--vis-history)
|
||||
(setq org-brain--vis-history (delete entry org-brain--vis-history))
|
||||
(org-save-all-org-buffers)
|
||||
(org-brain--revert-if-visualizing))
|
||||
|
||||
@@ -2265,8 +2271,8 @@ Only works if in an `org-mode' buffer inside `org-brain-path'.
|
||||
Suitable for use with `before-save-hook'."
|
||||
(interactive)
|
||||
(and (eq major-mode 'org-mode)
|
||||
(string-prefix-p (expand-file-name org-brain-path)
|
||||
(expand-file-name (buffer-file-name)))
|
||||
(string-prefix-p (file-truename org-brain-path)
|
||||
(file-truename (buffer-file-name)))
|
||||
(org-map-entries #'org-brain-get-id t 'file)))
|
||||
|
||||
;;;###autoload
|
||||
@@ -3392,17 +3398,26 @@ ENTRY should be a string; an id in the case of an headline entry."
|
||||
"Select" 'helm-brain--select
|
||||
"Unselect" 'helm-brain--unselect))
|
||||
|
||||
(defun helm-brain--source ()
|
||||
(helm-build-sync-source "Brain"
|
||||
:candidates (org-brain--all-targets)
|
||||
:action 'helm-brain--actions))
|
||||
(defvar helm-brain--source
|
||||
(helm-make-source "Brain" 'helm-source-sync
|
||||
:candidates #'org-brain--all-targets
|
||||
:action 'helm-brain--actions))
|
||||
|
||||
(defvar helm-brain--fallback-source
|
||||
(helm-make-source "New entry" 'helm-source-dummy
|
||||
:action (helm-make-actions
|
||||
"Visualize" (lambda (x)
|
||||
(org-brain-visualize (org-brain-get-entry-from-title x)))
|
||||
"Add children" 'helm-brain--add-children
|
||||
"Add parents" 'helm-brain--add-parents
|
||||
"Add friends" 'helm-brain--add-friends)))
|
||||
|
||||
(defun helm-brain ()
|
||||
"Use `helm' to choose among your org-brain entries.
|
||||
Provides actions for visualizing, adding/removing relations, etc.
|
||||
Supports selecting multiple entries at once."
|
||||
(interactive)
|
||||
(helm :sources (helm-brain--source))))
|
||||
(helm :sources '(helm-brain--source helm-brain--fallback-source))))
|
||||
|
||||
;;;; Ivy integration
|
||||
|
||||
@@ -3414,10 +3429,12 @@ Provides actions for visualizing, adding/removing relations, etc."
|
||||
(let ((targets (org-brain--all-targets)))
|
||||
(ivy-read "Org-brain: "
|
||||
targets
|
||||
:require-match t
|
||||
:action (lambda (x)
|
||||
(org-brain-visualize (or (org-brain-entry-from-id (cdr x))
|
||||
(cdr x))))
|
||||
(org-brain-visualize
|
||||
(if (stringp x)
|
||||
(org-brain-get-entry-from-title x)
|
||||
(or (org-brain-entry-from-id (cdr x))
|
||||
(cdr x)))))
|
||||
:preselect (ignore-errors
|
||||
(org-brain-entry-name
|
||||
(org-brain-entry-at-pt)))
|
||||
|
||||
Reference in New Issue
Block a user