summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorU-IHM-NOTEBOOK\Olli <marc@ihm.name>2017-10-10 20:28:03 +0200
committerU-IHM-NOTEBOOK\Olli <marc@ihm.name>2017-10-10 20:28:03 +0200
commit4d828ba4c69744da7dc05c5e4827f7b586d9cc53 (patch)
tree5bf3c101ce61738dfe94aea50affd109f30b1994
parent0b83168465563a3c02a017a04de92bd6bb05bc16 (diff)
downloadorg-mode-4d828ba4c69744da7dc05c5e4827f7b586d9cc53.tar.gz
org-index.el version 5.6.2
-rw-r--r--contrib/lisp/org-index.el165
1 files changed, 70 insertions, 95 deletions
diff --git a/contrib/lisp/org-index.el b/contrib/lisp/org-index.el
index 03d5d87..1d37060 100644
--- a/contrib/lisp/org-index.el
+++ b/contrib/lisp/org-index.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
;; Author: Marc Ihm <org-index@2484.de>
-;; Version: 5.6.1
+;; Version: 5.6.2
;; Keywords: outlines index
;; This file is not part of GNU Emacs.
@@ -51,13 +51,11 @@
;;
;; - Place this file in a directory of your load-path,
;; e.g. org-mode/contrib/lisp.
-;;
;; - Add these lines to your .emacs:
;;
;; (require 'org-index)
;;
;; - Restart your Emacs to make this effective.
-;;
;; - Invoke `org-index'; on first run it will assist in creating your
;; index table.
;;
@@ -68,7 +66,6 @@
;; Further information:
;;
;; - Watch the screencast at http://2484.de/org-index.html.
-;;
;; - See the documentation of `org-index', which can also be read by
;; invoking `org-index' and choosing the command help or '?'.
;;
@@ -76,81 +73,20 @@
;; Updates:
;;
;; The latest published version of this file can always be found at:
-;;
;; http://orgmode.org/w/?p=org-mode.git;a=blob_plain;f=contrib/lisp/org-index.el;hb=HEAD
-;;
;; Development version under:
-;;
;; https://github.com/marcIhm/org-index
+;;
+;;
;;; Change Log:
-;; [2017-09-25 Mo] Version 5.6.1
-;; - Quick repeat for goto-focus
-;; - Bugfixes
+;;
+;; - See the command 'news' for recent changes, or
+;; - https://github.com/marcIhm/org-index/ChangeLog.org for older news
+;; - https://github.com/marcIhm/org-index/commits/master for a complete list of changes
;;
-;; [2017-09-03 So] Version 5.5.0
-;; - Standard case-folding in occur
-;; - Better handling of nested focus nodes
-;; - Bugfixes
;;
-;; [2015-12-29 Tu] to [2017-06-06 Tu] Version 5.0.2 to 5.4.2
-;; - New commands yank, column and edit
-;; - New command focus
-;; - New column tags
-;; - All columns are now required
-;; - References are now optional
-;; - Subcommand enter has been renamed to index
-;; - Subcommands kill and edit can be invoked from an occur buffer
-;; - Added link to screencast
-;; - Occur accepts a numeric argument as a day span
-;; - Speed improvements
-;; - Many Bugfixes
-;;
-;; [2015-02-26 Th] to [2015-08-20 Th] Version 4.0.0 to 4.3.0
-;; - Configuration is done now via standard customize
-;; - New sorting strategy 'mixed'
-;; - Removed command "leave"; rather go back with org-mark-ring-goto
-;; - Renamed column "link" to "id"
-;; - Added maintainance options to find duplicate rows, to check ids,
-;; update index or remove property org-index-ref from nodes
-;; - Shortened version history
-;; - Reference numbers for subcommands can be passed as a prefix argument
-;;
-;; [2014-12-08 Mo] to [2015-01-31 Sa] Version 3.0.0 to 3.2.0:
-;; - Complete sorting of index only occurs in idle-timer
-;; - New command "maintain" with some subcommands
-;; - Rewrote command "occur" with overlays in an indirect buffer
-;; - Command "add" updates index, if node is already present
-;; - New commands "add" and "delete" to easily add and remove
-;; the current node to or from your index.
-;; - New command "example" to create an example index.
-;; - Several new flags that are explained within index node.
-;; - Removed commands "reuse", "missing", "put", "goto",
-;; "update", "link", "fill", "unhighlight"
-;; - New function `org-index-default-keybindings'
-;;
-;; [2012-12-07 Fr] to [2014-04-26 Sa] Version 2.0.0 to 2.4.3:
-;; - New functions org-index-new-line and org-index-get-line
-;; offer access to org-index from other lisp programs
-;; - Regression tests with ert
-;; - Renamed from "org-favtable" to "org-index"
-;; - Added an assistant to set up the index table
-;; - occur is now incremental, searching as you type
-;; - Integrated with org-mark-ring-goto
-;; - Added full support for ids
-;; - Renamed the package from "org-reftable" to "org-favtable"
-;; - Additional columns are required (e.g. "link"). Error messages will
-;; guide you
-;; - Ask user explicitly, which command to invoke
-;; - Renamed the package from "org-refer-by-number" to "org-reftable"
-;;
-;; [2011-12-10 Sa] to [2012-09-22 Sa] Version Version 1.2.0 to 1.5.0:
-;; - New command "sort" to sort a buffer or region by reference number
-;; - New commands "highlight" and "unhighlight" to mark references
-;; - New command "head" to find a headline with a reference number
-;; - New commands occur and multi-occur
-;; - Started this Change Log
;;; Code:
@@ -160,7 +96,7 @@
(require 'widget)
;; Version of this package
-(defvar org-index-version "5.6.0" "Version of `org-index', format is major.minor.bugfix, where \"major\" are incompatible changes and \"minor\" are new features.")
+(defvar org-index-version "5.6.2" "Version of `org-index', format is major.minor.bugfix, where \"major\" are incompatible changes and \"minor\" are new features.")
;; customizable options
(defgroup org-index nil
@@ -314,6 +250,7 @@ those pieces."
(defvar org-index--context-occur nil "Position and line used for occur in edit buffer.")
(defvar org-index--context-node nil "Buffer and position for node in edit buffer.")
(defvar org-index--short-help-buffer-name "*org-index commands*" "Name of buffer to display short help.")
+(defvar org-index--news-buffer-name "*org-index news*" "Name of buffer to display news.")
(defvar org-index--display-short-help nil "True, if short help should be displayed.")
(defvar org-index--short-help-displayed nil "True, if short help message has been displayed.")
(defvar org-index--prefix-arg nil "True, if prefix argument has been received during input.")
@@ -324,7 +261,7 @@ those pieces."
(defvar org-index--last-command nil "Subcommand, that hast been excecuted last.")
;; static information for this program package
-(defconst org-index--commands '(occur add kill head ping index ref yank column edit help short-help focus example sort find-ref highlight maintain) "List of commands available.")
+(defconst org-index--commands '(occur add kill head ping index ref yank column edit help short-help news focus example sort find-ref highlight maintain) "List of commands available.")
(defconst org-index--valid-headings '(ref id created last-accessed count keywords category level yank tags) "All valid headings.")
(defconst org-index--occur-buffer-name "*org-index-occur*" "Name of occur buffer.")
(defconst org-index--edit-buffer-name "*org-index-edit*" "Name of edit buffer.")
@@ -377,7 +314,7 @@ for its index table.
To start building up your index, use subcommands 'add', 'ref' and
'yank' to create entries and use 'occur' to find them.
-This is version 5.6.0 of org-index.el.
+This is version 5.6.2 of org-index.el.
The function `org-index' is the only interactive function of this
@@ -439,6 +376,8 @@ of subcommands to choose from:
I.e. from the complete help, show only the first line for each
subcommand.
+ news: [n] Show news for the current point release.
+
example: Create an example index, that will not be saved.
May serve as an example.
@@ -528,11 +467,13 @@ interactive calls."
;; read command; if requested display help in read-loop
(setq org-index--display-short-help (eq command 'short-help))
(setq command (org-index--read-command))
- (setq org-index--last-command org-index--this-command)
- (setq org-index--this-command command)
(if org-index--prefix-arg (setq arg (or arg '(4))))
(setq org-index--display-short-help nil))
+ (setq org-index--last-command org-index--this-command)
+ (setq org-index--this-command command)
+
+
;;
;; Get search string, if required; process possible sources one after
;; another (lisp argument, prefix argument, user input).
@@ -629,6 +570,24 @@ interactive calls."
(org-index--display-short-help))
+ ((eq command 'news)
+ (with-current-buffer-window
+ org-index--news-buffer-name nil nil
+ (insert (format "News for Version %s of org-index:\n"
+ (progn
+ (string-match "\\([0-9]+\\.[0-9]+\\)\\." org-index-version)
+ (match-string 1 org-index-version))))
+ (insert "
+ - Quick repeat with delete-option for goto-focus
+ - Moved Changelog to its own file
+ - New command 'news'
+ - Bugfixes
+")
+ (insert "\nSee https://github.com/marcIhm/org-index/ChangeLog.org for older news.\n")
+ (org-mode))
+ (shrink-window-if-larger-than-buffer (get-buffer-window org-index--news-buffer-name)))
+
+
((eq command 'find-ref)
;; Construct list of all org-buffers
@@ -1014,10 +973,8 @@ Optional argument KEYS-VALUES specifies content of new line."
(princ "Short help; shortcuts in []; capital letter acts like C-u.\n")
(princ (org-index--get-short-help-text)))
(with-current-buffer org-index--short-help-buffer-name
- (let ((inhibit-read-only t)
- win)
- (setq win (get-buffer-window))
- (shrink-window-if-larger-than-buffer win)
+ (let ((inhibit-read-only t))
+ (shrink-window-if-larger-than-buffer (get-buffer-window))
(goto-char (point-min))
(end-of-line)
(goto-char (point-min)))))
@@ -1091,9 +1048,16 @@ Optional argument KEYS-VALUES specifies content of new line."
(define-key map (vector ?f)
(lambda () (interactive)
(setq this-command last-command)
+ (setq org-index--this-command org-index--last-command)
(message (concat (org-index--goto-focus) "."))))
+ (define-key map (vector ?d)
+ (lambda () (interactive)
+ (setq this-command last-command)
+ (org-index--delete-from-focus)
+ (org-index--persist-focused-nodes)
+ (message (concat "Current node has been removed from list of focused nodes, " (org-index--goto-focus) "."))))
map) t)
- (setq repeat-clause ", type 'f' to repeat")
+ (setq repeat-clause "; type 'f' to repeat or 'd' to delete this node from list")
(if (member target-id (org-index--ids-up-to-top))
(setq explain "Staying below current")
@@ -1175,24 +1139,35 @@ Optional argument KEYS-VALUES specifies content of new line."
"Current node has been appended to list of focused nodes%s (%d node%s in focus)")
((eq char ?d)
- (setq id (org-id-get))
- (if (and id (member id org-index--ids-focused-nodes))
- (progn
- (setq org-index--id-last-goto-focus
- (or (car-safe (cdr-safe (member id (reverse (append org-index--ids-focused-nodes
- org-index--ids-focused-nodes)))))
- org-index--id-last-goto-focus))
- (setq org-index--ids-focused-nodes (delete id org-index--ids-focused-nodes))
- (setq org-index--id-last-goto-focus nil)
- "Current node has been removed from list of focused nodes%s (%d node%s in focus)")
- "Current node has not been in list of focused nodes%s (%d node%s in focus)"))))
-
- (with-current-buffer org-index--buffer
- (org-entry-put org-index--point "ids-focused-nodes" (string-join org-index--ids-focused-nodes " ")))
+ (org-index--delete-from-focus))))
+
+ (org-index--persist-focused-nodes)
(format text (or more-text "") (length org-index--ids-focused-nodes) (if (cdr org-index--ids-focused-nodes) "s" ""))))
+(defun org-index--persist-focused-nodes ()
+ "Write list of focused nodes to property."
+ (with-current-buffer org-index--buffer
+ (org-entry-put org-index--point "ids-focused-nodes" (string-join org-index--ids-focused-nodes " "))))
+
+
+(defun org-index--delete-from-focus ()
+ "Delete current node from list of focused nodes"
+ (let (id)
+ (setq id (org-id-get))
+ (if (and id (member id org-index--ids-focused-nodes))
+ (progn
+ (setq org-index--id-last-goto-focus
+ (or (car-safe (cdr-safe (member id (reverse (append org-index--ids-focused-nodes
+ org-index--ids-focused-nodes)))))
+ org-index--id-last-goto-focus))
+ (setq org-index--ids-focused-nodes (delete id org-index--ids-focused-nodes))
+ (setq org-index--id-last-goto-focus nil)
+ "Current node has been removed from list of focused nodes%s (%d node%s in focus)")
+ "Current node has not been in list of focused nodes%s (%d node%s in focus)")))
+
+
(defun org-index--ids-up-to-top ()
"Get list of all ids from current node up to top level."
(when (string= major-mode "org-mode")