From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ralph Amissah Newsgroups: gmane.emacs.devel Subject: Re: Ambrose Kofi Laing & Ralph Neelante Amissah [Emacs] sisu-mode.el - a major-mode for highlighting a structured text Date: Sun, 21 Feb 2016 02:04:43 -0500 Message-ID: <20160221070443.GA4007@niu> References: <20160218221933.GA32234@niu> <20160219061802.GA29619@niu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" X-Trace: ger.gmane.org 1456069614 27738 80.91.229.3 (21 Feb 2016 15:46:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Feb 2016 15:46:54 +0000 (UTC) Cc: Kevin Ryde , Ambrose Kofi Laing , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 21 16:46:46 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aXWDd-0006fV-AP for ged-emacs-devel@m.gmane.org; Sun, 21 Feb 2016 16:46:45 +0100 Original-Received: from localhost ([::1]:41979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXWDc-0004td-NJ for ged-emacs-devel@m.gmane.org; Sun, 21 Feb 2016 10:46:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXO4Z-0000yF-Ne for emacs-devel@gnu.org; Sun, 21 Feb 2016 02:04:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXO4V-0003eU-JP for emacs-devel@gnu.org; Sun, 21 Feb 2016 02:04:51 -0500 Original-Received: from mail-qk0-x235.google.com ([2607:f8b0:400d:c09::235]:34591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXO4V-0003eJ-B5 for emacs-devel@gnu.org; Sun, 21 Feb 2016 02:04:47 -0500 Original-Received: by mail-qk0-x235.google.com with SMTP id x1so45922780qkc.1 for ; Sat, 20 Feb 2016 23:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=oqi10PEXNOgt5RXyL+/MxVUtIlAnVLTDr68IXH8onUc=; b=aLNG00IFgWt18ritLteX8POF9P/5cSkFoEX2VGgMQbfp06Cspy+VQrRADaS6YyvdpR bJXIyXQHT7fbP8tmzHgwUNCg8izcFPGboPjynww9/7MmHHbK5gDM5gPm+uueWrn9etSa H1VS8EEXT2Wmt/hCeoT+MRa9Mx4gKC4sNJjVLLnsA9TtMcx9DVWolbYk7vufQRBTjYJx wq4kpBvTrmPPNIceGMGdSScvwUaHDDo0Uvt1Io8i6snTMjKat3mmqEZJIL1f6+0apbeR 86JJyNz8XgrwUb947W61NSlutgFawinCzmnG+YKGWOQA8MWu+ESE3/fDTyL/E5uA/xAb 2/sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=oqi10PEXNOgt5RXyL+/MxVUtIlAnVLTDr68IXH8onUc=; b=kzpUcY/2BoMtFqzf/ske4gfQW66BPB8y8sVZr7/TSRYYlgMmMc2bUUM46v+Ov4H7XP yOgEPfDG+HOuj3uAjZl9HYunAZ/nsS3HHjzIGc5Cp+uGBq6i2o0gW/pDglp4hmBU5q49 M0uPbFVDAay7fkNPvFTmVbIhWN6RtZT+8I3jU+D0b85HCzIIL+ZXkwYQWQ1NGAmLyB5B Qw4R9o5nB+r2IQs7xnf73z5DX/eFU1qT+isniwBqezbttNSCq4FhbqtCKQARzovtKMTx rv2+nHB/dqAyWTwC/XaY1wz50ACnB+LdtItRAKKYC++lNSBmKvauvWw6D0aBcOiH4vMX A/AQ== X-Gm-Message-State: AG10YOQn/PSv8QHH0fULz/7AgFJY0qmmN3IdhIqT9S6YtcwCRzXDP7mbCsYmMLQqDYN9zQ== X-Received: by 10.55.192.89 with SMTP id o86mr3897094qki.31.1456038286621; Sat, 20 Feb 2016 23:04:46 -0800 (PST) Original-Received: from niu (pool-72-79-53-224.nwrknj.east.verizon.net. [72.79.53.224]) by smtp.gmail.com with ESMTPSA id x79sm8008636qka.37.2016.02.20.23.04.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Feb 2016 23:04:45 -0800 (PST) Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::235 X-Mailman-Approved-At: Sun, 21 Feb 2016 10:46:18 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:200381 Archived-At: --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Stefan, thank you for your work. Find attached a new diff against the original Gnu sisu-mode.el I hope I have understood what needed to be done. Sorry if there are further things to address. I am glad to try; also please feel free to make changes you think necessary before applying it. In the unlikely event that I have reason to think otherwise, I can send you a subsequent request. On Fri, Feb 19, 2016 at 01:42:19PM -0500, Stefan Monnier wrote: > > Please find attached sisu-mode.diff for sisu-mode.el > > Thanks. I was about to apply it, but I think it's not quite right. > it's a bit hard to see what the patch does because it includes a lot of > whitespace changes, but even after accounting for those, there are some > changes which I don't think really want to install. See below. > > Stefan > > > -;;; sisu-mode.el --- Major mode for SiSU markup text > > +;;; sisu-mode.el --- a major-mode for highlighting a hierarchy structured text. > > Why did you remove SiSU from the description? > [ Not opposed to it, but rather curious. ] > +;;; sisu-mode.el --- Major mode for SiSU markup text thanks, corrected (not sure when or why it happened and have not gone back to try find out, reverted) > > -;; Copyright (C) 2011 Free Software Foundation, Inc. > > +;; Copyright (C): Free Software Foundation, Inc. (FSF) (GNU EMACS) > > We want to keep all the years of publication in this line. > +;; Copyright (C) 2011, 2016 Free Software Foundation, Inc. > > -;; Author: Ambrose Kofi Laing (& Ralph Amissah) > > -;; Keywords: text, processes, tools > > -;; Version: 3.0.3 > > +;; Author: Ralph Amissah & Ambrose Kofi Laing > > +;; Keywords: text, syntax, processes, tools > > +;; Version: 7.1.7 2015-12-26 Ralph Amissah, > > The Version: pseudo-header should be of the form AA.BB.CC.DD... only. > +;; Author: Ralph Amissah & Ambrose Kofi Laing +;; Keywords: text, syntax, processes, tools +;; Version: 7.1.8 > > +;; URL: [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=data/sisu/conf/editor-syntax-etc/emacs/sisu-mode.el;hb=HEAD] > > Better than a link to the file would be a link to some "sisu-mode > project" web-page with further information than what's in this file. > +;; URL: 'http://www.sisudoc.org' or should it follow the original format: ;; Home URL: SiSU: http://www.sisudoc.org > > ;; License: GPLv3 > > This is redundant. > removed added +;; with contributions from Kevin Ryde and Stefan Monnier > > + (cons "^group\{\\|^\}group" 'general-font-lock-red2) > ^ ^ > These two backslashes do not do anything. > several such escapes removed > > +;; enables outlining for sisu > > +(add-hook 'sisu-mode-hook > > + '(lambda () > > + (outline-minor-mode))) > > Please don't quote your lambdas. > Also (lambda () (outline-minor-mode)) is just a round-about way to say > #'outline-minor-mode. got as far as this +;; enables outlining for sisu +(add-hook 'sisu-mode-hook + 'outline-minor-mode) + > Finally, it's generally preferred to put such code directly in the > sisu-mode function and leave the sisu-mode-hook nil by default. > I did not get this quite > > +;(define-key evil-normal-state-map (kbd ",0") (lambda() (interactive) (show-all))) > > Single-semicolon comments are traditionally indented to comment-column > (e.g. column 40 or so), so you should probably use ";;" instead here. > used ;; > > -;;;###autoload > > +;; Sisu & Autoload: > > (define-derived-mode sisu-mode text-mode "SiSU" > > This ";;;###autoload" comment is the magic cookie used to auto-generate > sisu-mode-autoloads.el, so you don't want to remove it. > reinstated > > - "Major mode for editing SiSU files. > > -SiSU (http://www.sisudoc.org/) is a document structuring and > > -publishing framework. This major mode handles SiSU markup." > > + "Major mode for editing SiSU files." > > + (interactive) > > `define-derived-mode` already declares the function as interactive. > removed (interactive) also modified the description to match what is in use elsewhere "Major mode for editing SiSU files. +SiSU document structuring, publishing in multiple formats and search. +URL `http://www.sisudoc.org/' this description may be a bit terse, and I have no problem with some modification, or with the removed repetition of "This major mode handles SiSU markup" > > (run-hooks 'sisu-mode-hook)) > > And `define-derived-mode` also automatically runs sisu-mode-hook for > you, so you don't need this either. > > > -;;;###autoload (add-to-list 'auto-mode-alist '("\\.sisu\\'" . sisu-mode)) > > +;; ##autoload > > +(add-to-list 'auto-mode-alist '("\\.sst\\'" . sisu-mode)) > > +(add-to-list 'auto-mode-alist '("\\.ssm\\'" . sisu-mode)) > > +(add-to-list 'auto-mode-alist '("\\.ssi\\'" . sisu-mode)) > > I think you want to use something like > > ;;;###autoload > (add-to-list 'auto-mode-alist '("\\.ss[itm]\\'" . sisu-mode)) > > or > > ;;;###autoload > (add-to-list 'auto-mode-alist '("\\.sst\\'" . sisu-mode)) > ;;;###autoload > (add-to-list 'auto-mode-alist '("\\.ssm\\'" . sisu-mode)) > ;;;###autoload > (add-to-list 'auto-mode-alist '("\\.ssi\\'" . sisu-mode)) > thanks +;;;###autoload (add-to-list 'auto-mode-alist '("\\.ss[imt]\\'" . sisu-mode)) > > +;; 2011-07-12 Chong Yidong > > +;; > > +;; Fix version numbers of sisu-mode, register-list, and windresize. > > +;; > > +;; 2011-07-08 Chong Yidong > > +;; > > +;; sisu-mode.el: Add .sisu to auto-mode-alist using autoload cookie. > > +;; Minor doc fixes. > > +;; > > +;; 2011-07-06 Stefan Monnier > > +;; > > +;; * sisu-mode.el (sisu-mode): Autoload. > > +;; > > +;; 2011-07-04 Stefan Monnier > > +;; > > +;; Add sisu-mode.el. Update all.el licence. > > This gets auto-added (from the Git log) when generating the ELPA > package, so we don't need it. > > ok, removed > Stefan I did a diff against the original file and put a few things back (e.g. the triple curly braces). Please let me know if there is more that needs to be done. Thanks again, Ralph P.S. SiSU markup samples, for SiSU git contains some sample files http://git.sisudoc.org/gitweb/?p=doc/sisu-markup-samples.git;a=summary in particular here: http://git.sisudoc.org/gitweb/?p=doc/sisu-markup-samples.git;a=tree;f=data/samples/current/en;hb=HEAD P.P.S quick note to Kevin, thanks, (feel free to review the file) --C7zPtVaVf+AK4Oqc Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="sisu-mode-7.1.8.diff" --- sisu-mode.el 2016-02-20 23:27:42.226633771 -0500 +++ sisu-mode-7.1.8.el 2016-02-21 01:16:40.236406813 -0500 @@ -2,15 +2,15 @@ ;; Copyright (C) 2011 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 , (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 "^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 "
" '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 - "^\\(\\@\\(" - "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.") + ;;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 "
" '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 + "^\\(\\@\\(" + "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) + +;; 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,8 +466,9 @@ ;;;###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) @@ -350,6 +479,9 @@ (make-local-variable 'paragraph-ignore-fill-prefix) (setq paragraph-ignore-fill-prefix t) + (set (make-local-variable 'outline-regexp) + "^\\(\\([1-4]\\|:?[A-D]\\)\\~\\|\\@[a-z]+:\\( \\|$\\)\\)") + (make-local-variable 'require-final-newline) (setq require-final-newline t) @@ -362,7 +494,7 @@ )) (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) --C7zPtVaVf+AK4Oqc--