0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 22:47:56 +00:00

v5.7.2 of org-index

This commit is contained in:
Marc Ihm 2017-11-07 20:49:58 +01:00
parent 28ebfa6d77
commit 8f3077d14a

View file

@ -3,7 +3,7 @@
;; Copyright (C) 2011-2017 Free Software Foundation, Inc. ;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
;; Author: Marc Ihm <org-index@2484.de> ;; Author: Marc Ihm <org-index@2484.de>
;; Version: 5.7.1 ;; Version: 5.7.2
;; Keywords: outlines index ;; Keywords: outlines index
;; This file is not part of GNU Emacs. ;; This file is not part of GNU Emacs.
@ -92,11 +92,12 @@
(require 'org-table) (require 'org-table)
(require 'org-id) (require 'org-id)
(require 'org-inlinetask)
(require 'cl-lib) (require 'cl-lib)
(require 'widget) (require 'widget)
;; Version of this package ;; Version of this package
(defvar org-index-version "5.7.1" "Version of `org-index', format is major.minor.bugfix, where \"major\" are incompatible changes and \"minor\" are new features.") (defvar org-index-version "5.7.2" "Version of `org-index', format is major.minor.bugfix, where \"major\" are incompatible changes and \"minor\" are new features.")
;; customizable options ;; customizable options
(defgroup org-index nil (defgroup org-index nil
@ -320,7 +321,7 @@ for its index table.
To start building up your index, use subcommands 'add', 'ref' and To start building up your index, use subcommands 'add', 'ref' and
'yank' to create entries and use 'occur' to find them. 'yank' to create entries and use 'occur' to find them.
This is version 5.7.1 of org-index.el. This is version 5.7.2 of org-index.el.
The function `org-index' is the only interactive function of this The function `org-index' is the only interactive function of this
@ -688,7 +689,7 @@ interactive calls."
;; move up until we find a node in index ;; move up until we find a node in index
(save-excursion (save-excursion
(outline-back-to-heading) (org-with-limited-levels (org-back-to-heading))
(while (not done) (while (not done)
(if id (if id
(setq info (org-index--on 'id id (setq info (org-index--on 'id id
@ -1052,14 +1053,12 @@ Optional argument KEYS-VALUES specifies content of new line."
(message (concat (org-index--goto-focus) " (again).")))) (message (concat (org-index--goto-focus) " (again)."))))
(define-key map (vector ?h) (define-key map (vector ?h)
(lambda () (interactive) (lambda () (interactive)
(org-back-to-heading) (org-with-limited-levels (org-back-to-heading))
(recenter 1) (recenter 1)
(message "On heading."))) (message "On heading.")))
(define-key map (vector ?b) (define-key map (vector ?b)
(lambda () (interactive) (lambda () (interactive)
(or (and (org-goto-first-child) (org-index--end-of-focused-node)
(forward-line -1))
(org-end-of-subtree))
(recenter -1) (recenter -1)
(message "At bottom."))) (message "At bottom.")))
(define-key map (vector ?d) (define-key map (vector ?d)
@ -1083,9 +1082,7 @@ Optional argument KEYS-VALUES specifies content of new line."
(when org-index-goto-bottom-after-focus (when org-index-goto-bottom-after-focus
(setq bottom-clause "bottom of ") (setq bottom-clause "bottom of ")
(setq heading-is-clause (format ", heading is '%s'" (propertize (org-get-heading t t t t) 'face 'org-todo))) (setq heading-is-clause (format ", heading is '%s'" (propertize (org-get-heading t t t t) 'face 'org-todo)))
(or (and (org-goto-first-child) (org-index--end-of-focused-node))
(forward-line -1))
(org-end-of-subtree)))
(org-index--unfold-buffer) (org-index--unfold-buffer)
(if org-index-goto-bottom-after-focus (recenter -1))) (if org-index-goto-bottom-after-focus (recenter -1)))
@ -1119,6 +1116,25 @@ Optional argument KEYS-VALUES specifies content of new line."
"No nodes in focus, use set-focus")) "No nodes in focus, use set-focus"))
(defun org-index--end-of-focused-node ()
"Goto end of focused nodes, ignoring inline-tasks but stopping at first child."
(let (level next (pos (point)))
(when (ignore-errors (org-with-limited-levels (org-back-to-heading)))
(setq level (outline-level))
(forward-char 1)
(if (and (org-with-limited-levels (re-search-forward org-outline-regexp-bol nil t))
(> (outline-level) level))
(progn ; landed on child node
(goto-char (match-beginning 0))
(forward-line -1))
(goto-char pos) ; landed on next sibling or end of buffer
(org-with-limited-levels
(org-end-of-subtree nil t)
(when (org-at-heading-p)
(forward-line -1))))
(beginning-of-line))))
(defun org-index--more-focus-commands () (defun org-index--more-focus-commands ()
"More commands for handling focused nodes." "More commands for handling focused nodes."
(let (id text more-text char prompt ids-up-to-top) (let (id text more-text char prompt ids-up-to-top)
@ -1211,7 +1227,7 @@ Optional argument KEYS-VALUES specifies content of new line."
(let (ancestors id level start-level) (let (ancestors id level start-level)
(save-excursion (save-excursion
(ignore-errors (ignore-errors
(outline-back-to-heading) (org-with-limited-levels (org-back-to-heading))
(setq id (org-id-get)) (setq id (org-id-get))
(if id (setq ancestors (cons id ancestors))) (if id (setq ancestors (cons id ancestors)))
(setq start-level (org-outline-level)) (setq start-level (org-outline-level))
@ -2370,7 +2386,7 @@ CREATE-REF and TAG-WITH-REF if given."
(org-index--save-positions) (org-index--save-positions)
(unless (or org-index--within-index-node (unless (or org-index--within-index-node
org-index--within-occur) org-index--within-occur)
(org-back-to-heading)) (org-with-limited-levels (org-back-to-heading)))
;; try to do the same things from within index and from outside ;; try to do the same things from within index and from outside
(if org-index--within-index-node (if org-index--within-index-node
@ -2587,7 +2603,7 @@ Optional argument DEFAULTS gives default values."
(org-index--save-positions) (org-index--save-positions)
(unless (or org-index--within-index-node (unless (or org-index--within-index-node
org-index--within-occur) org-index--within-occur)
(org-back-to-heading)) (org-with-limited-levels (org-back-to-heading)))
;; Collect information: What should be deleted ? ;; Collect information: What should be deleted ?
(if (or org-index--within-occur (if (or org-index--within-occur