emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/yaml-mode f297efe 012/124: YAML imenu outline integration


From: ELPA Syncer
Subject: [nongnu] elpa/yaml-mode f297efe 012/124: YAML imenu outline integration
Date: Sun, 29 Aug 2021 11:36:03 -0400 (EDT)

branch: elpa/yaml-mode
commit f297efe0fc81cf0e561d0c61a025a5c91989823a
Author: Tim Harper <timcharper@gmail.com>
Commit: Tim Harper <timcharper@gmail.com>

    YAML imenu outline integration
---
 Changes      |  2 ++
 Makefile     |  2 +-
 yaml-mode.el | 20 ++++++++++++++++++--
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/Changes b/Changes
index 4a2b2a6..ae626f5 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+0.0.5  Mon Dec 21 2009
+        - Provide outline of yaml document via imenu (Tim Harper)
 0.0.4  Mon Apr 20 16:46:13 2009 JST
         - Patch from knagano and mad-p. Fixed font-lock bugs(#4)
         * Move to github.com
diff --git a/Makefile b/Makefile
index b135d1b..57ccbf5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.0.4
+VERSION=0.0.5
 EMACS = emacs
 PREFIX = /usr/local
 INSTALLLIBDIR = $(PREFIX)/share/emacs/site-lisp
diff --git a/yaml-mode.el b/yaml-mode.el
index ac9d9bb..a8534d8 100644
--- a/yaml-mode.el
+++ b/yaml-mode.el
@@ -5,7 +5,7 @@
 ;; Author: Yoshiki Kurihara <kurihara@cpan.org>
 ;;         Marshall T. Vandegrift <llasram@gmail.com>
 ;; Keywords: data yaml
-;; Version: 0.0.4
+;; Version: 0.0.5
 
 ;; This file is not part of Emacs
 
@@ -104,10 +104,16 @@ that key is pressed to begin a block literal."
   :group 'faces
   :group 'yaml)
 
+(defcustom yaml-imenu-generic-expression
+  '((nil  "^\\(:?[a-zA-Z_-]+\\):"          1))
+  "The imenu regex to parse an outline of the yaml file."
+  :type 'string
+  :group 'yaml)
+
 
 ;; Constants
 
-(defconst yaml-mode-version "0.0.4" "Version of `yaml-mode.'")
+(defconst yaml-mode-version "0.0.5" "Version of `yaml-mode.'")
 
 (defconst yaml-blank-line-re "^ *$"
   "Regexp matching a line containing only (valid) whitespace.")
@@ -381,6 +387,16 @@ margin."
     (if (and (not arg) (looking-at yaml-document-delimiter-re))
         (delete-horizontal-space))))
 
+
+(defun yaml-set-imenu-generic-expression ()
+  (make-local-variable 'imenu-generic-expression)
+  (make-local-variable 'imenu-create-index-function)
+  (setq imenu-create-index-function 'imenu-default-create-index-function)
+  (setq imenu-generic-expression yaml-imenu-generic-expression))
+
+(add-hook 'yaml-mode-hook 'yaml-set-imenu-generic-expression)
+
+
 (defun yaml-mode-version ()
   "Diplay version of `yaml-mode'."
   (interactive)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]