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

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

[elpa] master 7dece2c: * packages/sisu-mode/sisu-mode.el: Update to 7.1.


From: Stefan Monnier
Subject: [elpa] master 7dece2c: * packages/sisu-mode/sisu-mode.el: Update to 7.1.8
Date: Sun, 21 Feb 2016 15:50:33 +0000

branch: master
commit 7dece2c1976b6e38e371ddebc74420a5c537c9ec
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * packages/sisu-mode/sisu-mode.el: Update to 7.1.8
    
    (sisu-font-lock-keywords): Reindent and improve.
    (sisu-mode): Add outline-regexp.  Don't run sisu-mode-hook since
    define-derived-mode already does it for us.
    (sisu-mode-hook): Add outline-minor-mode to its default.
    (auto-mode-alist): Use .ss[imt] extensions rather than .sisu.
---
 packages/sisu-mode/sisu-mode.el |  540 ++++++++++++++++++++++++---------------
 1 files changed, 335 insertions(+), 205 deletions(-)

diff --git a/packages/sisu-mode/sisu-mode.el b/packages/sisu-mode/sisu-mode.el
index 9d287f1..3a6aefd 100644
--- a/packages/sisu-mode/sisu-mode.el
+++ b/packages/sisu-mode/sisu-mode.el
@@ -1,16 +1,16 @@
 ;;; sisu-mode.el --- Major mode for SiSU markup text
 
-;; Copyright (C) 2011  Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2016  Free Software Foundation, Inc.
 
-;; Author: Ambrose Kofi Laing (& Ralph Amissah)
-;; Keywords: text, processes, tools
-;; Version: 3.0.3
-;; License: GPLv3
-;; Home URL: SiSU:   http://www.jus.uio.no/sisu
+;; Author: Ralph Amissah & Ambrose Kofi Laing
+;; Keywords: text, syntax, processes, tools
+;; Version:   7.1.8
+;; URL: http://www.sisudoc.org/
 ;; originally looked at (based on) doc-mode, with kind permission of the author
 ;;   Author: SUN, Tong <address@hidden>, (c)2001-6, all right reserved
 ;;   Version: $Date: 2006/01/19 03:13:41 $ $Revision: 1.14 $
 ;;   Home URL: http://xpt.sourceforge.net/
+;; with contributions from Kevin Ryde and Stefan Monnier
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -136,200 +136,328 @@
 (defconst sisu-font-lock-keywords
   (eval-when-compile
     (list
+      ;;grouped text ---------
+      ;(cons "^```[ ]code\\(.\\|\n\\)+?\n```\n"      'general-font-lock-red2)
+      (cons "^```[ ]+code.*?$\\|^```$"  'general-font-lock-red2)
+      (cons "^```[ ]+table.*?$\\|^```$" 'general-font-lock-red2)
+      (cons "^```[ ]+group$\\|^```$"    'general-font-lock-red2)
+      (cons "^```[ ]+block$\\|^```$"    'general-font-lock-red2)
+      (cons "^```[ ]+poem$\\|^```$"     'general-font-lock-red2)
+      (cons "^```[ ]+alt$\\|^```$"      'general-font-lock-red2)
+      ;;grouped text ---------
+      (cons "^group{\\|^}group"       'general-font-lock-red2)
+      (cons "^block{\\|^}block"       'general-font-lock-red2)
+      (cons "^code{\\|^}code"         'general-font-lock-red2)
+      (cons "^poem{\\|^}poem"         'general-font-lock-red2)
+      (cons "^alt{\\|^}alt"           'general-font-lock-red2)
+      (cons "^table{.+\\|^}table"     'general-font-lock-red2)
+      (cons "^{table[^}]+}"           'general-font-lock-red2)
+
+      (list
+        (concat
+          "^\`\\{3\\}[ ]+code.*?$"
+          "\\(.\\|\n\\)+?"
+          "\`\\{3\\}$"
+        )
+        '(1 general-font-lock-red2 t)
+        '(2 nil t)
+        '(3 general-font-lock-red2 t)
+      )
+      (list
+        (concat
+          "^\`\\{3\\}[ ]+table.*?$"
+          "\\(.\\|\n\\)+?"
+          "\`\\{3\\}$"
+        )
+        '(1 general-font-lock-red2 t)
+        '(2 nil t)
+        '(3 general-font-lock-red2 t)
+      )
+      (list
+        (concat
+          "^\`\\{3\\}[ ]+\\(group\\|block\\|alt\\|poem\\)$"
+          "\\(.\\|\n\\)+?"
+          "^\`\\{3\\}$"
+        )
+        '(1 general-font-lock-red2 t)
+        '(2 nil t)
+        '(3 general-font-lock-red2 t)
+      )
+
+      ;; footnote/endnote ----
+      ;(cons "\~{.+?}\~"  'general-font-lock-green1)
+      (cons "\~{\\*\\*\\|\~{\\*\\|\~{\\|}\~"   'general-font-lock-red2)
+      (cons "\~\\[\\+\\|\~\\[\\*\\|\~\\[\\|\\]\~"  'general-font-lock-red2)
+      (cons "\~\\^ \\|^\\^\~ " 'general-font-lock-red2)
+      (list
+        (concat
+          "\\(\*\~\\)"
+          "\\([^ \r\t\n]+\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-blue2 t)
+      )
+
+      ;; emphasis (can be program configured to be bold italics or underscore)
+      (list
+        (concat
+          "\\([*]{\\)"
+          "\\([^}]+\\)"
+          "\\(}[*]\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-red1 t)
+      )
+
+      ;; bold ----------------
+      (list
+        (concat
+          "\\([!]{\\)"
+          "\\([^}]+\\)"
+          "\\(}[!]\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-red1 t)
+      )
+      (cons "\\*[^ ]+\\*"               'general-font-lock-red1)
+      (cons "^!_ .+"                    'general-font-lock-red1)
+
+      ;; italics -------------
+      (list
+        (concat
+          "\\([/]{\\)"
+          "\\([^}]+\\)"
+          "\\(}[/]\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-blue1 t)
+        '(3 general-font-lock-red1 t)
+      )
+
+      ;; underscore ----------
+      (list
+        (concat
+          "\\([_]{\\)"
+          "\\([^}]+\\)"
+          "\\(\}[_]\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-red1 t)
+      )
+
+      ;; monospace -----------
+      (list
+        (concat
+          "\\([#]{\\)"
+          "\\([^}]+\\)"
+          "\\(}[#]\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-red1 t)
+      )
+
+      ;; citation ------------
+      (list
+        (concat
+          "\\([\"]{\\)"
+          "\\([^}]+\\)"
+          "\\(}[\"]\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-red1 t)
+      )
+
+      ;; inserted text -------
+      (list
+        (concat
+          "\\([\+]{\\)"
+          "\\([^}]+\\)"
+          "\\(}[\+]\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-red1 t)
+      )
+
+      ;; strike through ------
+      (list
+        (concat
+          "\\(\\-{\\)"
+          "\\([^}]+\\)"
+          "\\(}\\-\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-red1 t)
+      )
+
+      ;; superscript ---------
+      (list
+        (concat
+          "\\(\\^{\\)"
+          "\\([^}]+\\)"
+          "\\(}\\^\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-red1 t)
+      )
+
+      ;; subscript -----------
+      (list
+        (concat
+          "\\([,]{\\)"
+          "\\([^}]+\\)"
+          "\\(}[,]\\)"
+        )
+        '(1 general-font-lock-red1 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-red1 t)
+      )
+
+      ;; numbered list
+      (cons "^# \\|^_# "                'general-font-lock-red1)
+
+      ;; bullet text
+      (cons "^_\\*[1-9] \\|^_\\* "      'general-font-lock-red1)
+
+      ;; indented text
+      (cons "^_[1-9] "                  'general-font-lock-red1)
+      (cons "^_[1-9]! "                 'general-font-lock-red1)
+
+      ;; hanging indented text [proposed enable when implemented]
+      (cons "^__[1-9] "                'general-font-lock-red1)
+      (cons "^_[0-9]_[0-9] "           'general-font-lock-red1)
+      (cons "^__[1-9]! "               'general-font-lock-red1)
+      (cons "^_[0-9]_[0-9]! "          'general-font-lock-red1)
+
+      ;; url
+      (cons "\\(^\\|[ ]\\)http:[/][/][^ \t\n\r<]+" 'general-font-lock-blue2)
+
+      ;; Comment Lines
+      (cons "^% .*"                     'general-font-lock-blue1)
+
+      ;; page break
+      (cons "^\\(-\\\\\\\\-\\|=\\\\\\\\=\\|-\\.\\.-\\)" 
'general-font-lock-red2)
+
+      ;; line break
+      (cons " \\\\\\\\ "                'general-font-lock-red1)
+
+      ;; line break (depreciated)
+      (cons "<br>"                      'general-font-lock-red1)
+
+      ;; Section titles
+      (list "^\\(\\([1-4]\\|:?[A-D]\\)\\~\\)\\(.*\\)"
+        '(1 sisu-title-1 t)
+        '(3 sisu-title-2 t)
+      )
+
+      ;; hyper-links
+      (list
+        (concat
+          "\\({~^\\|{\\)"
+          "\\([^}{]+\\)"
+          "\\(}http:[/][/][^ \r\n\t<]+\\)"
+        )
+        '(1 general-font-lock-blue2 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-blue2 t)
+      )
+
+      ;; book index
+      (list
+        (concat
+          "^\\(\={\\)"
+          "\\([^}{]+\\)"
+          "\\(}\\)$"
+        )
+        '(1 general-font-lock-green1 t)
+        '(2 nil t)
+        '(3 general-font-lock-green1 t)
+      )
+
+      ;(cons "^\={.+}"                 'general-font-lock-green1)
+
+      ;; numbers
+      (cons "\\<[.0-9]+\\>"             'general-font-lock-green2)
+
+      ;; bullets sisu_normal (nearly copied regexp)
+      (cons "^_\\([1-9*]\\|[1-9]\\*\\) " 'general-font-lock-blue2)
+
+      ;; image links
+      (list
+        (concat
+          "\\({\\)"
+          "\\([^}{]+\\)"
+          "\\(}image\\)"
+        )
+        '(1 general-font-lock-blue2 t)
+        '(2 general-font-lock-red1 t)
+        '(3 general-font-lock-blue2 t)
+      )
+
+      ;; insert file links
+      (list
+        (concat
+          "\\(<< \\)"
+          "\\([^ \r\t\n]+\\.ss\\)"
+          "\\(i\\|t\\)"
+        )
+        '(1 general-font-lock-blue2 t)
+        '(2 general-font-lock-blue2 t)
+        '(3 general-font-lock-blue2 t)
+      )
+
+      ;; raw keywords
+      (list
+        (concat
+          "^\\(address@hidden("
+          "creator\\|"
+          "title\\|"
+          "date\\|"
+          "rights\\|"
+          "publisher\\|"
+          "classify\\|"
+          "identifier\\|"
+          "original\\|"
+          "notes\\|"
+          "links\\|"
+          "make\\|"
+          "\\):\\)\\(.*\\)"
+        )
+        '(1 sisu-title-2 keep)
+        '(3 sisu-title-3 keep)
+      )
+    )
+  )
+  "Default expressions to highlight in AsciiSisu mode."
+)
+
+;; enables outlining for sisu
+(add-hook 'sisu-mode-hook
+         'outline-minor-mode)
+
+;;; outline mode "folding" if available
+;;; TODO make sure linum (line numbering) is off, else performance penalty, 
sucks bigtime
+;;(define-key evil-normal-state-map (kbd ",0") (lambda() (interactive) 
(show-all)))
+;;(define-key evil-normal-state-map (kbd ",-") (lambda() (interactive) 
(hide-body)))
+;;(define-key evil-normal-state-map (kbd ",+") (lambda() (interactive) 
(show-subtree)))
+;;(define-key evil-normal-state-map (kbd ",=") (lambda() (interactive) 
(show-subtree)))
+;;
+;;(define-key evil-normal-state-map ",0"   'show-all)
+;;(define-key evil-normal-state-map ",-"   'hide-body)
+;;(define-key evil-normal-state-map ",+"   'show-subtree)
+;;(define-key evil-normal-state-map ",="   'show-subtree)
 
-     ;;grouped text
-     (cons "^group\{\\|^\}group"       'general-font-lock-red2)
-     (cons "^block\{\\|^\}block"       'general-font-lock-red2)
-     (cons "^code\{\\|^\}code"         'general-font-lock-red2)
-     (cons "^poem\{\\|^\}poem"         'general-font-lock-red2)
-     (cons "^alt\{\\|^\}alt"           'general-font-lock-red2)
-     (cons "^table\{.+\\|^\}table"     'general-font-lock-red2)
-     (cons "^\{table[^}]+\}"           'general-font-lock-red2)
-
-     ;; footnote/endnote
-       ;(cons "\~\{.+?\}\~"  'general-font-lock-green1)
-     (cons "\~\{\\*\\*\\|\~\{\\*\\|\~\{\\|\}\~"   'general-font-lock-red2)
-     (cons "\~\\[\\+\\|\~\\[\\*\\|\~\\[\\|\\]\~"  'general-font-lock-red2)
-
-     (cons "\~\\^ \\|^\\^\~ " 'general-font-lock-red2)
-
-     (list (concat
-      "\\(\*\~\\)"
-      "\\([^ \r\t\n]+\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-blue2 t))
-
-     ;; emphasis (can be program configured to be bold italics or underscore)
-     (list (concat
-      "\\([*]\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}[*]\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-red1 t)
-     '(3 general-font-lock-red1 t))
-
-     ;; bold
-     (list (concat
-      "\\([!]\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}[!]\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-red1 t)
-     '(3 general-font-lock-red1 t))
-     (cons "\\*[^ ]+\\*"               'general-font-lock-red1)
-     (cons "^!_ .+"                    'general-font-lock-red1)
-
-     ;;; italics
-     (list (concat
-      "\\([/]\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}[/]\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-blue1 t)
-           '(3 general-font-lock-red1 t))
-
-     ;; underscore
-     (list (concat
-      "\\([_]\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}[_]\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-red1 t)
-           '(3 general-font-lock-red1 t))
-
-     ;; monospace
-     (list (concat
-      "\\([#]\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}[#]\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-red1 t)
-           '(3 general-font-lock-red1 t))
-
-     ;; citation
-     (list (concat
-      "\\([\"]\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}[\"]\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-red1 t)
-           '(3 general-font-lock-red1 t))
-
-     ;; inserted text
-     (list (concat
-      "\\([\+]\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}[\+]\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-red1 t)
-           '(3 general-font-lock-red1 t))
-
-     ;; strike through
-     (list (concat
-      "\\(\\-\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}\\-\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-red1 t)
-           '(3 general-font-lock-red1 t))
-
-     ;; superscript
-     (list (concat
-      "\\(\\^\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}\\^\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-red1 t)
-           '(3 general-font-lock-red1 t))
-
-     ;; subscript
-     (list (concat
-      "\\([,]\{\\)"
-      "\\([^\}]+\\)"
-      "\\(\}[,]\\)")
-     '(1 general-font-lock-red1 t)
-     '(2 general-font-lock-red1 t)
-           '(3 general-font-lock-red1 t))
-
-     ;;numbered list
-     (cons "^# \\|^_# "                'general-font-lock-red1)
-
-     ;;bullet text
-     (cons "^_\\*[1-9] \\|^_\\* "      'general-font-lock-red1)
-
-     ;;indented text
-     (cons "^_[1-9] "                  'general-font-lock-red1)
-
-     ;;url
-     (cons "\\(^\\|[ ]\\)http:[/][/][^ \t\n\r<]+" 'general-font-lock-blue2)
-
-;; \\|\$
-
-     ;; Comment Lines
-     (cons "^% .*"                     'general-font-lock-blue1)
-     ;; line break
-     (cons "<br>"                      'general-font-lock-red1)
-
-     ;; Section titles
-     (list "^\\(\\([1-8]\\|:?[A-C]\\)\\~\\)\\(.*\\)"
-     '(1 sisu-title-1 t)
-     '(3 sisu-title-2 t))
-
-     ;; hyper-links
-     (list (concat
-      "\\(\{~^\\|\{\\)"
-      "\\([^\}\{]+\\)"
-      "\\(\}http:[/][/][^ \r\n\t<]+\\)")
-     '(1 general-font-lock-blue2 t)
-     '(2 general-font-lock-red1 t)
-     '(3 general-font-lock-blue2 t))
-
-     ;; book index
-     (cons "^\=\{.+\}"                 'general-font-lock-green1)
-
-     ;; numbers
-     (cons "\\<[.0-9]+\\>"             'general-font-lock-green2)
-
-     ;; bullets sisu_normal (nearly copied regexp)
-     (cons "^_\\([1-9*]\\|[1-9]\\*\\) " 'general-font-lock-blue2)
-
-     ;; image links
-     (list (concat
-      "\\(\{\\)"
-      "\\([^\}\{]+\\)"
-      "\\(\}image\\)")
-     '(1 general-font-lock-blue2 t)
-     '(2 general-font-lock-red1 t)
-           '(3 general-font-lock-blue2 t))
-
-     ;; insert file links
-     (list (concat
-      "\\(<< \\)"
-      "\\([^ \r\t\n]+\\.ss\\)"
-      "\\(i\\|t\\)")
-     '(1 general-font-lock-blue2 t)
-     '(2 general-font-lock-blue2 t)
-           '(3 general-font-lock-blue2 t))
-
-     ;; raw keywords
-     (list (concat
-      "^\\(address@hidden("
-      "title\\|"
-      "creator\\|"
-      "date\\|"
-      "publisher\\|"
-      "rights\\|"
-      "classify\\|"
-      "original\\|"
-      "notes\\|"
-      "links\\|"
-      "make\\|"
-      "\\):\\)\\(.*\\)")
-     '(1 sisu-title-2 keep)
-     '(3 sisu-title-3 keep))
-
-     ))
- "Default expressions to highlight in AsciiSisu mode.")
+;; C-c @ C-a show all
+;; C-c @ C-t show only the headings
+;; C-c @ C-s show subtree at cursor location
+;; C-c @ C-d hide subtree at cursor location
 
 ;;}}}
 
@@ -338,10 +466,10 @@
 ;;;###autoload
 (define-derived-mode sisu-mode text-mode "SiSU"
   "Major mode for editing SiSU files.
-SiSU (http://www.sisudoc.org/) is a document structuring and
-publishing framework.  This major mode handles SiSU markup."
+SiSU document structuring, publishing in multiple formats and search.
+URL `http://www.sisudoc.org/'"
   (modify-syntax-entry ?\'  ".")
-  ;(flyspell-mode nil)
+  ;;(flyspell-mode nil)
 
   (make-local-variable 'paragraph-start)
   (setq paragraph-start (concat "$\\|>" page-delimiter))
@@ -350,6 +478,9 @@ publishing framework.  This major mode handles SiSU markup."
   (make-local-variable 'paragraph-ignore-fill-prefix)
   (setq paragraph-ignore-fill-prefix t)
 
+  (set (make-local-variable 'outline-regexp)
+    "^\\(\\([1-4]\\|:?[A-D]\\)\\~\\|address@hidden:\\( \\|$\\)\\)")
+
   (make-local-variable 'require-final-newline)
   (setq require-final-newline t)
 
@@ -359,10 +490,9 @@ publishing framework.  This major mode handles SiSU 
markup."
     nil        ; KEYWORDS-ONLY: no
     nil        ; CASE-FOLD: no
     ((?_ . "w"))      ; SYNTAX-ALIST
-    ))
-  (run-hooks 'sisu-mode-hook))
+    )))
 
-;;;###autoload (add-to-list 'auto-mode-alist '("\\.sisu\\'" . sisu-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.ss[imt]\\'" . sisu-mode))
 
 (provide 'sisu-mode)
 



reply via email to

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