Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
el-index --- Generic index mode for Emacs

-------------------------------------------------------------------------------
1. About
-------------------------------------------------------------------------------

Displays list of given items. By default you can configure select, delete and
rename actions. Other custom actions may be applied via local keymap

Code was based on bookmark.el which can be found in Emacs distribution

-------------------------------------------------------------------------------
2. Installation
-------------------------------------------------------------------------------

Put `el-index' project into your load path

-------------------------------------------------------------------------------
3. Usage
-------------------------------------------------------------------------------
3.1 Initialization
-------------------------------------------------------------------------------

(require 'el-index/el-index)

Invoke mode by calling `el-index-display' passing buffer name, items list and
list of functions that will take care of: writing item name, selecting, renaming,
deleting and reload index list.
See following example:

(setq sample-items-group1
  '((first . optional)
    (second . optional)
    (third . optional)))

(setq sample-items-group2
  '((first2 . optional)
    (second2 . optional)
    (third2 . optional)))

(setq sample-items
  (list (cons "First Group" sample-items-group1)
    (cons "Second Group" sample-items-group2)))

(setq index-actions
  '((write . (lambda (item)
        (insert (symbol-name (car item)))))
    (select . (lambda (item)
        (message "%S selected" (car item))
        (quit-window)))
    (rename . (lambda (item newname)
        (if (and newname (not (equal newname "")))
          (setcar item (intern newname))
          (message "No new name given"))))
    (delete . (lambda (item)
        (setq sample-items-group1 (delq item sample-items-group1))
        (setq sample-items-group2 (delq item sample-items-group2))))
    (reload . sample-index-display)))

(defun sample-index-display ()
  (el-index-display "Sample index" sample-items index-actions))

(sample-index-display)

-------------------------------------------------------------------------------
3.2 Interaction
-------------------------------------------------------------------------------

Default keyboard bindings:

RET -- Select item.

r -- Rename item (prompts for new name).

d -- Mark item to be deleted, and move down.
C-d -- Mark item to be deleted, and move up.

x -- Delete items marked with `D.

u -- Remove all kinds of marks from current line.

You can add extra bindings with `local-key-set' when mode is loaded.

About

Generic index mode for Emacs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published