Merge branch 'db/org-backlink-searcher' into master

This commit is contained in:
Daniel - 2020-09-26 16:50:29 +02:00
commit e45d23ce8e
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
2 changed files with 22 additions and 4 deletions

View File

@ -175,7 +175,7 @@
(bind-key "<XF86Back>" #'winner-undo)
(bind-key "<XF86Forward>" #'winner-redo)
(bind-key "<f10>" #'magit-status)
(bind-key "<f11>" #'org-capture)
(bind-key "<f11>" #'db/org-find-links-to-current-item)
(bind-key "<f12>" #'db/helm-shortcuts)
(bind-key "<f1>" #'db/run-or-hide-eshell)
(bind-key "<f2>" #'hydra-feature-shortcuts/body)
@ -183,9 +183,9 @@
(bind-key "<f6>" #'hydra-zoom/body)
(bind-key "<f7>" #'dictcc)
(bind-key "<f8>" #'bm-toggle)
(bind-key "<f9>" #'db/org-add-link-to-other-item)
(bind-key "<C-f8>" #'bm-next)
(bind-key "<C-S-f8>" #'bm-previous)
(bind-key "<f9>" #'db/org-find-links-to-current-item)
(bind-key "C-," #'mc/skip-to-previous-like-this)
(bind-key "C-." #'mc/skip-to-next-like-this)
(bind-key "C-;" #'iedit-mode)
@ -716,7 +716,8 @@
db/org-mark-current-default-task
db/export-diary
db/org-copy-template-for-periodic-task
db/org-find-links-to-current-item))
db/org-find-links-to-current-item
db/org-add-link-to-other-item))
(use-package org
:pin "gnu"

View File

@ -616,7 +616,7 @@ not."
((and id custom-id) (format "{\\[\\[id:%s\\]\\|\\[\\[#%s\\]}" id custom-id))
(id (format "[[id:%s]" id))
(custom-id (format "[[#%s]" custom-id))
(t (user-error "No ID given and not in Org Mode.")))))
(t (user-error "Neither ID nor CUSTOM_ID given")))))
(org-search-view nil query)))
(defun db/org-find-links-to-current-item (arg)
@ -635,6 +635,23 @@ prompt for an item."
(org-with-point-at pom
(list (org-id-get) (org-entry-get nil "CUSTOM_ID"))))))))
(defun db/org-add-link-to-other-item ()
"Interactively query for item and add link to it at point.
Uses `org-id-get-create' to get the ID or CUSTOM_ID propery of
the target headline."
(interactive)
(unless (derived-mode-p 'org-mode)
(user-error "Not in Org Mode"))
(let ((pom (nth 3 (org-refile-get-location nil (get-file-buffer db/org-default-org-file)))))
(if (not pom)
(user-error "Invalid location")
(let (id item)
(save-mark-and-excursion
(org-with-point-at pom
(setq item (org-entry-get nil "ITEM")
id (org-id-get-create)))
(insert (format "[[id:%s][%s]]" id item)))))))
;;; End